1jQuery(function($){ 2 $('#true_loadmore').click(function(){ 3 $(this).text('ÐагÑÑжаÑ...'); // изменÑем ÑекÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¸, Ð²Ñ Ñакже можеÑе добавиÑÑ Ð¿ÑÐµÐ»Ð¾Ð°Ð´ÐµÑ 4 $(this).addClass('loading'); 5 var data = { 6 'action': 'loadmore', 7 'page' : current_page, 8 'query': true_posts, 9 'offset' : offset, 10 }; 11 $.ajax({ 12 url:ajax_url.url, // обÑабоÑÑик 13 data:data, // даннÑе 14 type:'POST', // Ñип запÑоÑа 15 success:function(data){ 16 if( data ) { 17 $('#true_loadmore').text('ÐоказаÑÑ ÐµÑÑ'); 18 $('#true_loadmore').removeClass('loading'); 19 $('#uploadAjaxPost').before(data); // вÑÑавлÑем новÑе поÑÑÑ 20 current_page++; // ÑвелиÑиваем Ð½Ð¾Ð¼ÐµÑ ÑÑÑаниÑÑ Ð½Ð° единиÑÑ 21 if (current_page == max_pages) $("#true_loadmore").remove(); // еÑли поÑледнÑÑ ÑÑÑаниÑа, ÑдалÑем ÐºÐ½Ð¾Ð¿ÐºÑ 22 } else { 23 $('#true_loadmore').remove(); // еÑли Ð¼Ñ Ð´Ð¾Ñли до поÑледней ÑÑÑаниÑÑ Ð¿Ð¾ÑÑов, ÑкÑоем ÐºÐ½Ð¾Ð¿ÐºÑ 24 } 25 } 26 }); 27 }); 28}); 29 30jQuery(function($){ 31 $('#true_loadmore_best').click(function(){ 32 $(this).text('ÐагÑÑжаÑ...'); // изменÑем ÑекÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¸, Ð²Ñ Ñакже можеÑе добавиÑÑ Ð¿ÑÐµÐ»Ð¾Ð°Ð´ÐµÑ 33 $(this).addClass('loading'); 34 var data = { 35 'action': 'loadmore_best', 36 'page' : current_page, 37 'query': true_posts, 38 'offset' : offset, 39 }; 40 $.ajax({ 41 url:ajax_url.url, // обÑабоÑÑик 42 data:data, // даннÑе 43 type:'POST', // Ñип запÑоÑа 44 success:function(data){ 45 if( data ) { 46 $('#true_loadmore_best').text('ÐоказаÑÑ ÐµÑÑ'); 47 $('#true_loadmore_best').removeClass('loading'); 48 $('#uploadAjaxPost').before(data); // вÑÑавлÑем новÑе поÑÑÑ 49 current_page++; // ÑвелиÑиваем Ð½Ð¾Ð¼ÐµÑ ÑÑÑаниÑÑ Ð½Ð° единиÑÑ 50 if (current_page == max_pages) $("#true_loadmore_best").remove(); // еÑли поÑледнÑÑ ÑÑÑаниÑа, ÑдалÑем ÐºÐ½Ð¾Ð¿ÐºÑ 51 } else { 52 $('#true_loadmore_best').remove(); // еÑли Ð¼Ñ Ð´Ð¾Ñли до поÑледней ÑÑÑаниÑÑ Ð¿Ð¾ÑÑов, ÑкÑоем ÐºÐ½Ð¾Ð¿ÐºÑ 53 } 54 } 55 }); 56 }); 57}); 58 59 60jQuery(document).ready(function($){ 61 62 function uploaddAJAXimg(elem) { 63 let arr = new Array(); 64 $(elem).each(function( index ) { 65 el = $( this ); 66 let arr2 = new Array(); 67 arr2.push($( el ).attr("thumbnail")); 68 arr2.push($( el ).attr("id_thumbnail")); 69 arr.push(arr2); 70 }); 71 72 var data = { 73 'action': 'loadimg', 74 'arr': arr, 75 'width' : screen.width, 76 }; 77 78 $.ajax({ 79 url: ajax_url.url, // обÑабоÑÑик 80 data: data, // даннÑе 81 type: 'POST', // Ñип запÑоÑа 82 success:function(data){ 83 if( data ) { 84 data.data.forEach(function(item, index) { 85 $('.imgsrc[id_thumbnail = '+item[1]+']').attr("src", item[2]).on("load", function() { 86 $(this).removeClass('preload-img'); 87 $(this).removeClass('on-load-img'); 88 $(this).removeClass('imgsrc'); 89 }); 90 }); 91 } 92 } 93 }); 94 } 95 function uploaddAJAXarchive(elem) { 96 $(elem).removeClass('on-load-archive'); 97 let arr = new Array(); 98 $(elem).each(function( index ) { 99 if ((screen.width < 1024)) { 100 if ($( this ).hasClass("onload_m") == false) { 101 return; 102 } 103 } 104 el = $( this ); 105 let arr2 = new Array(); 106 arr2.push($( el ).attr("archive")); 107 arr.push(arr2); 108 }); 109 if (arr.length == 0) {return;} 110 var data = { 111 'action': 'loadarchive', 112 'arr': arr, 113 'width' : screen.width, 114 }; 115 $.ajax({ 116 url: ajax_url.url, // обÑабоÑÑик 117 data: data, // даннÑе 118 type: 'POST', // Ñип запÑоÑа 119 success:function(data){ 120 if( data ) { 121 data.data.forEach(function(item, index) { 122 $('.opload-ajax-archive[archive = '+item[0]+']').html(item[1]); 123 $('.opload-ajax-archive[archive = '+item[0]+']').removeClass('preload-load'); 124 }); 125 } 126 } 127 }); 128 129 } 130 131 let target = $('.content-wrapper')[0]; 132 let target_single = $('.front-col-single')[0]; 133 134 // Ñоздаем новÑй ÑкземплÑÑ Ð½Ð°Ð±Ð»ÑдаÑÐµÐ»Ñ 135 let observer = new MutationObserver(function(mutations) { 136 mutations.forEach(function(mutation) { 137 if (mutation.type === 'childList') {
138 mutation.addedNodes.forEach((element) => { 139 if ( $(element).hasClass('front-ajax-conteiner') ) { 140 uploaddAJAXimg($('.imgsrc')); 141 } 142 }); 143 } 144 }); 145 }); 146 147 // Ñоздаем конÑигÑÑаÑии Ð´Ð»Ñ Ð½Ð°Ð±Ð»ÑдаÑÐµÐ»Ñ 148 let config = { attributes: true, childList: true, characterData: true }; 149 150 // запÑÑкаем Ð¼ÐµÑ Ð°Ð½Ð¸Ð·Ð¼ наблÑÐ´ÐµÐ½Ð¸Ñ 151 observer.observe(target, config); 152 // observer.observe(target_single, config); 153 154 //observer.disconnect(); 155 156 157 if ($('.imgsrc.on-load-img')) { 158 uploaddAJAXimg($('.imgsrc')); 159 } 160 161 if ($('.opload-ajax-archive').length > 0) { 162 uploaddAJAXarchive($('.opload-ajax-archive')); 163 } 164 165 const myBody = document.getElementsByTagName('body')[0]; 166 167 window.addEventListener('scroll', function() { 168 if (window.scrollY >= 300) { 169 myBody.classList.add('fixed-menu'); 170 } else { 171 myBody.classList.remove('fixed-menu'); 172 } 173 }); 174 175 //const showMoreBtns = document.querySelectorAll('.archive-show-more-btn'); 176 177 // ÐобавлÑем обÑабоÑÑик ÑобÑÑÐ¸Ñ Ð½Ð° каждÑÑ ÐºÐ½Ð¾Ð¿ÐºÑ 178 //showMoreBtns.forEach(function(btn) { 179 180 document.addEventListener('click', function(event) { 181 // ÐÑовеÑÑем, ÑÑо клик пÑоизоÑел на кнопке Ñ Ð½ÑжнÑм клаÑÑом 182 if (event.target && event.target.classList.contains('archive-show-more-btn')) { 183 const btn = event.target; 184 //btn.addEventListener('click', function() { 185 // ÐолÑÑаем каÑегоÑиÑ, ÑвÑзаннÑÑ Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¾Ð¹ 186 btn_add = $(btn); 187 const cat = btn.dataset.cat; 188 const offset = parseInt(btn_add.attr('data-offset')); 189 let get_news = false; 190 191 192 // let hiddenItems = $('.wrapper-archive-' + cat).children('.hidden'); 193 let hiddenItems = $('.wrapper-archive-' + cat + ' .hidden'); 194 195 196 if (screen.width > 900) { 197 // ÐÑполÑзÑем jQuery Ð´Ð»Ñ Ð²ÑбоÑа ÑлеменÑов, коÑоÑÑе оÑноÑÑÑÑÑ Ðº ÑекÑÑей каÑегоÑии 198 hiddenItems.removeClass('hidden'); // jQuery меÑод .eq() Ð´Ð»Ñ ÑабоÑÑ Ñ ÑлеменÑами 199 hiddenItems = $('.wrapper-archive-' + cat).children('.hidden'); 200 } 201 202 console.log(hiddenItems); 203 204 // ÐоказÑваем ÑледÑÑÑие 5 ÑкÑÑÑÑÑ ÑлеменÑа 205 if (hiddenItems.length > 0) { 206 for (let i = 0; i < Math.min(5, hiddenItems.length); i++) { 207 hiddenItems.eq(i).removeClass('hidden'); // jQuery меÑод .eq() Ð´Ð»Ñ ÑабоÑÑ Ñ ÑлеменÑами 208 } 209 } else { 210 //ÐагÑÑжаем Ñ ÑеÑвеÑа 211 212 $.ajax({ 213 url: ajax_url.url, 214 type: 'POST', 215 data: { 216 action: 'load_more_news_archive', 217 cat: cat, 218 offset: offset, 219 }, 220 beforeSend: function () { 221 btn_add.text('ÐагÑÑжаеÑÑÑ...'); // ÐенÑем ÑекÑÑ Ð½Ð° кнопке 222 }, 223 success: function (response) { 224 if (response) { 225 $('.wrapper-archive-' + cat + ' .upload').append(response); // ÐобавлÑем новоÑÑи в ÐºÐ¾Ð½ÐµÑ 226 btn_add.attr('data-offset', offset + 5); // УвелиÑиваем ÑмеÑение 227 btn_add.text('ÐоказаÑÑ ÐµÑе'); 228 } else { 229 //btn.text('ÐолÑÑе новоÑÑей неÑ').prop('disabled', true); // ÐÑклÑÑаем ÐºÐ½Ð¾Ð¿ÐºÑ 230 get_news = true; 231 } 232 }, 233 error: function () { 234 btn.text('ÐÑибка загÑÑзки'); 235 } 236 }); 237 } 238 // ÐÑовеÑÑем, еÑÑÑ Ð»Ð¸ еÑе ÑкÑÑÑÑе ÑлеменÑÑ 239 // hiddenItems = $('.wrapper-archive-' + cat).children('.hidden'); 240 if (get_news) { 241 btn.style.display = 'none'; // СкÑÑваем кнопкÑ, еÑли вÑе ÑлеменÑÑ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ñ 242 } 243 }; 244 }); 245 246}); 247 248 249 250 251 252 253
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.