1(function ($) { 2 "use strict"; 3 4 $(document).ready(function () { 5 initStickyFooters(); 6 }); 7 8 function initStickyFooters() { 9 $(".wfe-sticky-footer").each(function () { 10 setupStickyFooter($(this)); 11 }); 12 } 13 14 function setupStickyFooter($footer) { 15 const $closeButton = $footer.find(".wfe-sticky-footer__close"); 16 17 if ($closeButton.length === 0) { 18 return; 19 } 20 21 let footerId = $footer.attr("data-footer-id"); 22 if (!footerId) { 23 return; 24 } 25 26 if (isDismissed(footerId)) { 27 $footer.hide(); 28 return; 29 } 30 31 $closeButton.on("click", function (e) { 32 e.preventDefault(); 33 dismissStickyFooter($footer, footerId); 34 }); 35 36 $closeButton.on("keydown", function (e) { 37 if (e.which === 13 || e.which === 32) { 38 e.preventDefault(); 39 dismissStickyFooter($footer, footerId); 40 } 41 }); 42 } 43 44 function dismissStickyFooter($footer, footerId) { 45 $footer.addClass("wfe-sticky-footer--dismissing"); 46 rememberDismissal(footerId); 47 48 setTimeout(function () { 49 $footer.hide(); 50 }, 300); 51 } 52 53 function isDismissed(footerId) { 54 try { 55 const dismissed = localStorage.getItem("dismissed-sticky-footers"); 56 if (!dismissed) return false; 57 58 const dismissedList = JSON.parse(dismissed); 59 return dismissedList.indexOf(footerId) !== -1; 60 } catch (e) { 61 return false; 62 } 63 } 64 65 function rememberDismissal(footerId) { 66 try { 67 const dismissed = localStorage.getItem("dismissed-sticky-footers"); 68 const dismissedList = dismissed ? JSON.parse(dismissed) : []; 69 70 if (dismissedList.indexOf(footerId) === -1) { 71 dismissedList.push(footerId); 72 localStorage.setItem( 73 "dismissed-sticky-footers", 74 JSON.stringify(dismissedList) 75 ); 76 } 77 } catch (e) {} 78 } 79})(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.