1jQuery.noConflict(); 2jQuery(document).ready(function ($) { 3 $(".search-results").each(function () { 4 var component = $(this); 5 var resultsCount = 0; 6 var signature = component.data("properties") ? component.data("properties").sig : null; 7 var loadMore = $(".component.load-more").filter(function (index, el) { 8 return $(el).data("properties").searchResultsSignature === signature; 9 }); 10 XA.component.search.vent.on("results-loaded", function (results) { 11 var hash = window.location.hash.substr(1); 12 var hashResult = hash.split('&').reduce(function (result, item) { 13 var parts = item.split('='); 14 result[parts[0]] = parts[1]; 15 return result; 16 }, {}); 17 var title = hashResult[results.searchResultsSignature + "_q"] != "" && hashResult[results.searchResultsSignature + "_q"] != undefined ? decodeURI(hashResult[results.searchResultsSignature + "_q"]) : "Recherche"; 18 if (results.searchResultsSignature == signature) { 19 triggerEllipsis(); 20 lazyloadImages(); 21 if (component.parents(".section-search-result:first").length > 0) { 22 component.parents(".section-search-result:first").find(".items-number").text("".concat(results.dataCount, " r\xE9sultat").concat(results.dataCount > 1 ? "s" : "")); 23 component.parents(".section-search-result:first").find(".field-title:empty").text(title).addClass("title-empty"); 24 component.parents(".section-search-result:first").find(".title-empty").text(title); 25 results.dataCount > 0 ? component.parents(".section-search-result:first").removeClass("hidden") : component.parents(".section-search-result:first").addClass("hidden"); 26 } else if ($(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).length > 0) { 27 $(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).find(".items-number").text("".concat(results.dataCount, " r\xE9sultat").concat(results.dataCount > 1 ? "s" : "")); 28 $(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).find(".field-title:empty").text(title).addClass("title-empty"); 29 $(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).find(".title-empty").text(title); 30 results.dataCount > 0 ? $(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).removeClass("hidden") : $(".section-search-result[data-signature=\"".concat(results.searchResultsSignature, "\"]")).addClass("hidden"); 31 } 32 } 33 }); 34 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; 35 var obsConfig = { 36 childList: false, 37 subtree: false, 38 characterData: false, 39 characterDataOldValue: false, 40 attributes: true, 41 attributeOldValue: true 42 }; 43 formObserver = new MutationObserver(mutationHandler); 44 component.each(function () { 45 formObserver.observe(this, obsConfig); 46 }); 47 function mutationHandler(mutationRecords) { 48 // if (component.data("searchpagetools") === "liste" && component.hasClass("list-search-result-v2") && component.data("properties").sig === "pagerecherchelist") { 49 // console.log(mutationRecords[0]) 50 // } 51 //if(component.find(".search-result-list").children().length >= 27) { 52 //component.nextAll(".component.load-more").first().addClass("hidden") 53 //} 54 if (mutationRecords[0] && mutationRecords[0].attributeName === "class" && mutationRecords[0].oldValue.includes("d-none") && !mutationRecords[0].target.classList.contains("d-none")) { 55 // Update slider 56 setTimeout(function () { 57 triggerEllipsis(true); 58 lazyloadImages(); 59 }, 200); 60 } 61 } 62 // Fix loadmore display with hxr 63 $(document).ajaxComplete(function (event, xhr, settings) { 64 if (xhr.status !== 200) { 65 return; 66 } 67 if (settings.url.indexOf("search/result") > -1 && settings.url.indexOf("sig") > -1) { 68 if (!loadMore || loadMore.length < 1) return; 69 var xhrSignature = xhr.responseJSON && xhr.responseJSON.Signature && xhr.responseJSON.Signature != "" ? xhr.responseJSON.Signature : "undefined"; 70 if (signature !== xhrSignature || xhr.responseJSON.Count === 0) return; 71 resultsCount += xhr.responseJSON.Results.length; 72 if (xhr.responseJSON.Count > resultsCount) {
73 loadMore.addClass("force-display"); 74 } else if (resultsCount >= xhr.responseJSON.Count) { 75 loadMore.removeClass("force-display"); 76 } 77 } 78 }); 79 }); 80});
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.