1 2( function($) { 3 4 $( function() { 5 6 7 function ajaxContentAdded() { 8 $('.mfp-wrap').prepend( $('.mfp-close').get(0) ); 9 $(window).trigger( 'onPopupWindowLoaded', ['ajax', this.content] ); 10 } 11 12 13 function destroy_editors( content ) { 14 if( !content ) { 15 return; 16 } 17 content.find('.wp-editor-wrap').each( function() { 18 var editor_id = $(this).attr('id').slice( 3, -5 ); 19 if( tinyMCE.get( editor_id ) ) { 20 tinyMCE.get( editor_id ).destroy(); 21 } 22 }); 23 } 24 25 function open() { 26 27 $('.mfp-wrap').prepend( $('.mfp-close').get(0) ); 28 29 if( 'inline' === this.currItem.type ) { 30 $(window).trigger( 'onPopupWindowLoaded', [ 'inline', this.content ] ); 31 } 32 33 } 34 35 function close() { 36 destroy_editors( this.content ); 37 } 38 39 Window.destroy_editors = destroy_editors; 40 41 // Fix select2 with magnificPopup 42 $.magnificPopup.instance._onFocusIn = function(e) { 43 // Do nothing if target element is select2 input 44 if( $(e.target).hasClass('select2-search__field') ) { 45 return true; 46 } 47 // Else call parent method 48 $.magnificPopup.proto._onFocusIn.call(this,e); 49 }; 50 51 /** 52 * Trigger once close button is pressed from poopup 53 */ 54 $('body').on('click', '.wpas_win_close_btn', function() { 55 $.magnificPopup.close(); 56 }); 57 /** 58 * Trigger once open window button is pressed 59 */ 60 //$('body').delegate( '.mfp_window, .wpas_win_link ', 'click', function( e) { 61 $('body').on( 'click', '.mfp_window, .wpas_win_link ', function( e) { 62 e.preventDefault(); 63 64 65 var type = $(this).data('win_type') || 'inline'; 66 var src = $(this).data('win_src') || $(this).attr('href'); 67 68 var mainClass = $(this).data('window_class'); 69 70 if( !( type && src ) ) { 71 return; 72 } 73 74 var settings = { 75 items : { type : type, src : src }, 76 closeOnBgClick : false, 77 callbacks: { 78 parseAjax: function(mfpResponse) { 79 mfpResponse.data = $(mfpResponse.data).removeClass('mfp-hide') 80 }, 81 82 ajaxContentAdded: ajaxContentAdded, 83 open: open, 84 close : close 85 } 86 }; 87 88 if( 'ajax' === type ) { 89 90 settings.items.src = ajaxurl; 91 92 var ajax_data = $(this).data('ajax_params'); 93 94 settings.ajax = {}; 95 settings.ajax.settings = { 96 method : 'POST', 97 data : ajax_data 98 } 99 } 100 101 settings.mainClass = mainClass; 102 103 $.magnificPopup.open( settings ); 104 105 $('.mfp-content .wpas_mfp_window_wrapper .wpas_msg').hide(); 106 107 }); 108 }) 109 110 111})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.