1(function ($) { 2 $(document).ready(function () { 3 $(".scroll-top").click(function () { 4 $("html, body").animate( 5 { 6 scrollTop: 0, 7 }, 8 100 9 ); 10 return false; 11 }); 12 13 function initSwiper() { 14 new Swiper(".top-campaign", { 15 slidesPerView: 1, 16 spaceBetween: 30, 17 loop: true, 18 noSwiping: false, 19 noSwipingClass: 'swiper-slide', 20 autoplay: { 21 delay: 5000, 22 disableOnInteraction: false, 23 }, 24 navigation: { 25 nextEl: ".swiper-button-next", 26 prevEl: ".swiper-button-prev", 27 }, 28 }); 29 } 30 initSwiper(); 31 32 function resizeMain() { 33 const headerEl = document.getElementById('masthead') 34 const footerEl = document.getElementById('appFooter') 35 const mainEl = document.getElementById('primary') 36 37 if (mainEl) { 38 const headerHeight = headerEl ? headerEl.getBoundingClientRect().height : 0 39 const footerHeight = footerEl ? footerEl.getBoundingClientRect().height : 0 40 mainEl.style.minHeight = `calc(100vh - ${headerHeight}px - ${footerHeight}px)` 41 } 42 } 43 resizeMain(); 44 window.addEventListener('resize', resizeMain); 45 46 function isIOS() { 47 return (/iPad|iPhone|iPod/.test(navigator.userAgent)) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) 48 } 49 function isSafari() { 50 // Safari 3.0+ "[object HTMLElementConstructor]" 51 return /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification)); 52 } 53 function setLineClampElementOnSafari() { 54 if (isSafari() || isIOS()) { 55 $('.container-search .search-result__block--content').each(function () { 56 let html = '', elCount = 0; 57 const contentPreview = $(this).children().first(); 58 const contentPreviewChildren = $(contentPreview).children(); 59 60 for (let i = 0; i < contentPreviewChildren.length; i++) { 61 const el = contentPreviewChildren[i]; 62 if ($(el).html().trim() && $(el).height() > 0) { 63 elCount++; 64 html += el.outerHTML; 65 } 66 if (elCount === 2) break; 67 } 68 $(contentPreview).html(html) 69 $(contentPreview).css('display', 'block') 70 }); 71 } 72 } 73 setLineClampElementOnSafari(); 74 75 76 const HISTORY_ITEMS_KEY = 'history_items' 77 function initSessionStorage() { 78 const historyItemsStg = sessionStorage.getItem(HISTORY_ITEMS_KEY) || null 79 const historyItems = historyItemsStg ? JSON.parse(historyItemsStg) : [] 80 81 if (historyItems.length > 0) { 82 const lastItem = historyItems[historyItems.length - 1] 83 if (window.location.href !== lastItem) historyItems.push(window.location.href) 84 } else historyItems.push(window.location.href) 85 86 sessionStorage.setItem(HISTORY_ITEMS_KEY, JSON.stringify(historyItems)) 87 } 88 initSessionStorage(); 89 90 $('.button-back').click(function () { 91 const historyItemsStg = sessionStorage.getItem(HISTORY_ITEMS_KEY) || null 92 if (historyItemsStg) { 93 const historyItems = JSON.parse(historyItemsStg) 94 historyItems.pop() // pop current 95 const historyTarget = historyItems.pop() // pop previous 96 97 if (historyItems.length <= 0 || historyTarget === `${window.location.origin}/`) 98 sessionStorage.setItem(HISTORY_ITEMS_KEY, JSON.stringify([])) 99 else if (historyItems.length > 0) 100 sessionStorage.setItem(HISTORY_ITEMS_KEY, JSON.stringify(historyItems)) 101 102 window.location.href = historyTarget || '/' 103 } else window.location.href = '/' 104 }); 105 }); 106 107})(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.