jQuery(document).on('ready',function() { "use strict"; jQuery( 'body' ).on( 'click', '.blogever-promotion-media-upload', function(e){ e.preventDefault(); jQuery('.widget-control-save').removeAttr("disabled"); jQuery('.widget-control-save').val(""+ blogever_builder_object.blogever_builder_text +""); var send_attachment_bkp = wp.media.editor.send.attachment; wp.media.editor.send.attachment = function(props, attachment) { jQuery('.blogever-promotion-bgurl').val(attachment.url); wp.media.editor.send.attachment = send_attachment_bkp; } wp.media.editor.open(); return false; }); jQuery( 'body' ).on( 'click', '.blogever-rp-media-upload1', function(e){ e.preventDefault(); jQuery('.widget-control-save').removeAttr("disabled"); jQuery('.widget-control-save').val(""+ blogever_builder_object.blogever_builder_text +""); var send_attachment_bkp = wp.media.editor.send.attachment; wp.media.editor.send.attachment = function(props, attachment) { jQuery('.blogever-rp-bgurl1').val(attachment.url); wp.media.editor.send.attachment = send_attachment_bkp; } wp.media.editor.open(); return false; }); jQuery( 'body' ).on( 'click', '.blogever-rp-media-upload2', function(e){ e.preventDefault(); jQuery('.widget-control-save').removeAttr("disabled"); jQuery('.widget-control-save').val(""+ blogever_builder_object.blogever_builder_text +""); var send_attachment_bkp = wp.media.editor.send.attachment; wp.media.editor.send.attachment = function(props, attachment) { jQuery('.blogever-rp-bgurl2').val(attachment.url); wp.media.editor.send.attachment = send_attachment_bkp; } wp.media.editor.open(); return false; }); });