Advertisement
Guest User

Untitled

a guest
Oct 5th, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var WPIS_Configuration = {
  2.     init : function() {
  3.         this.files();
  4.     },
  5.  
  6.     files : function() {
  7.         if ( $( '.wpis_upload_image_button' ).length > 0 ) {
  8.             window.formfield = '';
  9.  
  10.             $('.wpis_upload_image_button').on('click', function(e) {
  11.                 e.preventDefault();
  12.                 window.formfield = $(this).parent().prev();
  13.                 window.tbframe_interval = setInterval(function() {
  14.                     jQuery('#TB_iframeContent').contents().find('.savesend .button').val(wpis_vars.use_this_file).end().find('#insert-gallery, .wp-post-thumbnail').hide();
  15.                 }, 2000);
  16.             if (wpis_vars.post_id != null ) {
  17.                 var post_id = 'post_id=' + wpis_vars.post_id + '&';
  18.             }
  19.                 tb_show(wpis_vars.add_new_download, 'media-upload.php?' + post_id +'TB_iframe=true');
  20.             });
  21.  
  22.             window.original_send_to_editor = window.send_to_editor;
  23.             window.send_to_editor = function (html) {
  24.                 if (window.formfield) {
  25.                     imgurl = $('a', '<div>' + html + '</div>').attr('href');
  26.                     window.formfield.val(imgurl);
  27.                     window.clearInterval(window.tbframe_interval);
  28.                     tb_remove();
  29.                 } else {
  30.                     window.original_send_to_editor(html);
  31.                 }
  32.                 window.formfield = '';
  33.                 window.imagefield = false;
  34.             }
  35.         }
  36.     }
  37.  
  38.     WPIS_Configuration.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement