1jQuery(function ($) { 2 3 var jsModalOpen = function() { 4 var startWindowScroll = 0; 5 $('.js-modal-open').magnificPopup({ 6 fixedContentPos: true, 7 fixedBgPos: true, 8 overflowY: 'auto', 9 mainClass: 'c-modal-wrapper', 10 showCloseBtn: false, 11 removalDelay: 100, 12 type: 'inline', 13 callbacks: { 14 beforeOpen: function() { 15 startWindowScroll = $(window).scrollTop(); 16 }, 17 open: function(){ 18 if ( $('.mfp-content').height() < $(window).height() ){ 19 $('body').on('touchmove', function (e) { 20 e.preventDefault(); 21 }); 22 } 23 }, 24 close: function() { 25 $(window).scrollTop(startWindowScroll); 26 $('body').off('touchmove'); 27 } 28 } 29 }); 30 }; 31 32 $('#load_more_news').click(function () { 33 var button = $(this); 34 var data = { 35 'action': 'loadmore', 36 'query': posts_ln, 37 'page': current_page_ln 38 }; 39 $.ajax({ 40 url: ajaxurl_ln, // AJAX handler 41 data: data, 42 type: 'POST', 43 beforeSend: function (xhr) { 44 button.text('Loading...'); // change the button text, you can also add a preloader image 45 button.attr('disabled', 'disabled'); 46 }, 47 success: function (data) { 48 if (data) { 49 button.text('Load more latest news'); 50 $('#latest_news_container').append(data); // insert new posts 51 button.removeAttr('disabled'); 52 current_page_ln++; 53 54 if (current_page_ln == max_page_ln) 55 button.remove(); // if last page, remove the button 56 57 // you can also fire the "post-load" event here if you use a plugin that requires it 58 // $( document.body ).trigger( 'post-load' ); 59 60 jsModalOpen(); 61 62 } else { 63 button.remove(); // if no data, remove the button as well 64 } 65 } 66 }); 67 }); 68 69 $('#load_more_archive').click(function () { 70 var button = $(this); 71 var data = { 72 'action': 'loadmore', 73 'query': posts_ar, 74 'page': current_page_ar 75 }; 76 $.ajax({ 77 url: ajaxurl_ar, // AJAX handler 78 data: data, 79 type: 'POST', 80 beforeSend: function (xhr) { 81 button.text('Loading...'); // change the button text, you can also add a preloader image 82 button.attr('disabled', 'disabled'); 83 }, 84 success: function (data) { 85 if (data) { 86 button.text('Load more'); 87 $('#archive_container').append(data); // insert new posts 88 button.removeAttr('disabled'); 89 current_page_ar++; 90 91 if (current_page_ar == max_page_ar) 92 button.remove(); // if last page, remove the button 93 94 // you can also fire the "post-load" event here if you use a plugin that requires it 95 // $( document.body ).trigger( 'post-load' ); 96 97 jsModalOpen(); 98 99 } else { 100 button.remove(); // if no data, remove the button as well 101 } 102 } 103 }); 104 }); 105 106 var $postsWrapper = $( '.js-post-items' ); 107 var $wrapper = $( '.js-post-items-wrapper' ); 108 109 $($wrapper).on( 'click', '#load_more_search_archive', function () { 110 var $button = $(this); 111 112 let doingAjax = false; 113 114 if ( ! doingAjax ) { 115 $.ajax({ 116 url: $button.attr( 'data-url' ), 117 method: 'get', 118 beforeSend: function () { 119 doingAjax = true; 120 $button.text('Loading...'); // change the button text, you can also add a preloader image 121 $button.attr('disabled', 'disabled'); 122 }, 123 success: function (data) { 124 const $container = $( $.parseHTML( data ) ); 125 const $posts = $container.find( '.js-post-item' ); 126 127 if ( $posts.length ) { 128 $postsWrapper.append( $posts ); 129 130 const $newButton = $container.find( '#load_more_search_archive' ); 131 132 if ( $newButton.length ) { 133 $button.before( $newButton ); 134 } 135 } 136 137 $button.remove(); 138 doingAjax = false; 139 } 140 }); 141 } 142 }); 143 144 $('#load_more_archive').click(function () { 145 var button = $(this); 146 var data = { 147 'action': 'loadmore', 148 'query': posts_ar, 149 'page': current_page_ar 150 }; 151 $.ajax({ 152 url: ajaxurl_ar, // AJAX handler 153 data: data, 154 type: 'POST', 155 beforeSend: function (xhr) { 156 button.text('Loading...'); // change the button text, you can also add a preloader image 157 button.attr('disabled', 'disabled'); 158 }, 159 success: function (data) { 160 if (data) { 161 button.text('Load more'); 162 $('#archive_container').append(data); // insert new posts 163 button.removeAttr('disabled'); 164 current_page_ar++; 165 166 if (current_page_ar == max_page_ar) 167 button.remove(); // if last page, remove the button 168 169 // you can also fire the "post-load" event here if you use a plugin that requires it 170 // $( document.body ).trigger( 'post-load' ); 171 172 jsModalOpen(); 173 174 } else { 175 button.remove(); // if no data, remove the button as well 176 } 177 } 178 }); 179 }); 180 181});
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.