1document.addEventListener('DOMContentLoaded', function() { 2 3 // ÑÑонÑовÑй ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÐµÐ½Ñ public/local/markup/src/component/blog-items/ 4 5 $ (".js-blog-list-wrapper").each (function () { 6 const $wrap = $ (this); 7 8 const ajaxUrl = $wrap.data ("ajaxUrl"); 9 const catId = $wrap.data ("categoryId"); 10 const authorId = $wrap.data ("authorId"); 11 let pageN = $wrap.data ("pagen"); 12 let sort = $wrap.data ("sort"); 13 let tags = []; 14 15 let checkAppend = true; 16 17 $wrap.removeAttr ("data-ajax-url").removeAttr ("data-sort").removeAttr ("data-pagen"); 18 19 // ÑоÑÑиÑовка 20 $ (document).on ("is:change", ".blog-sort", function (e, val) { 21 checkAppend = false; 22 sort = val; 23 pageN = 1; 24 appendArticles ("rebuild"); 25 }); 26 27 // изменение Ñегов 28 $ (document).on ("is:change", ".js-blogTag", function (e) { 29 tags = []; 30 $ (".js-blogTag._active").each (function (i, tag) { 31 tags.push ($ (tag).attr ("data-tag-id")); 32 }); 33 34 appendArticles ("rebuild"); 35 }); 36 37 // беÑконеÑÐ½Ð°Ñ Ð¿Ð¾Ð´Ð³ÑÑзка ÑÑаÑей 38 const articleLoadHandler = globalFunctions.delay(function (e) { 39 const $loader = $wrap.find (".js-blog-list-loading"); 40 if ($loader.length > 0) { 41 if (checkAppend && $ (window).scrollTop () >= ($loader.offset ().top + $loader.innerHeight () - $ (window).height ())) { 42 checkAppend = false; 43 appendArticles (); 44 } 45 } 46 }, 1000); 47 48 49 $ (window).on ("scroll", articleLoadHandler); 50 51 52 // полÑÑение ÑÑаÑей 53 // let counterFail = 0; 54 function appendArticles (action = "append") { 55 const ajaxData = {catId: catId, authorId: authorId, tags: tags, sort: sort, pageN: (action === "append") ? pageN+1 : pageN}; 56 const params = { 57 method: 'POST', 58 url: ajaxUrl, 59 data: JSON.stringify (ajaxData), 60 dataType: 'json' 61 }; 62 63 const promise = $.ajax (params); 64 promise 65 .done (function (response) { 66 if (response.success === true) { 67 // counterFail = 0; 68 69 if (action === "rebuild") { 70 $wrap.html ("").append ( 71 `<div class="blog-loading"><span></span></div>`); 72 } else { 73 pageN++; 74 } 75 76 setTimeout (function () { 77 $wrap.find (".blog-loading").remove (); 78 79 if (response.html) { 80 $wrap.append (response.html).append ( 81 `<div class="blog-loading js-blog-list-loading"><span></span></div>`); 82 checkAppend = true; 83 $ (document).trigger ('lazyloadblogitems'); 84 } 85 }, 1000); 86 87 } else { 88 // counterFail++; 89 // checkAppend = counterFail < 10 ? true : false; 90 checkAppend = false; 91 $wrap.find (".blog-loading").remove (); 92 } 93 }) 94 .fail (function (jqXHR, textStatus, errorThrown) { 95 // counterFail++; 96 // checkAppend = counterFail < 10 ? true : false; 97 checkAppend = false; 98 $wrap.find (".blog-loading").remove (); 99 }); 100 } 101 }); 102});
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.