Advertisement
Guest User

JS

a guest
Sep 27th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready(function() {
  2. var formfield;
  3. jQuery('.upload_image_button').click(function() {
  4. jQuery('html').addClass('Image');
  5. formfield = jQuery(this).prev().attr('name');
  6. tb_show('', 'media-upload.php?type=image&TB_iframe=true');
  7. return false;
  8. });
  9. window.original_send_to_editor = window.send_to_editor;
  10. window.send_to_editor = function(html){
  11. if (formfield) {
  12. fileurl = jQuery('img',html).attr('src');
  13. jQuery('#'+formfield).val(fileurl);
  14. tb_remove();
  15. jQuery('html').removeClass('Image');
  16. } else {
  17. window.original_send_to_editor(html);
  18. }
  19. };
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement