1/** 2 * Pager Ad Loader 3 * ãã¼ã¸ã£ã¼ãããã¯è¡¨ç¤ºæã«åºåãåçèªã¿è¾¼ã¿ 4 * 5 * @package madameFIGARO.jp 6 * @since 1.0.0 7 */ 8(function() { 9 'use strict'; 10 11 // æ¢ã«èªã¿è¾¼ã¾ããåºåã管ç 12 const loadedAds = new Set(); 13 14 /** 15 * Billboard-2ndåºåã®è¡¨ç¤ºå¦ç 16 */ 17 function displayBillboard2nd() { 18 if (typeof googletag === 'undefined') { 19 console.warn('googletag is not defined'); 20 return; 21 } 22 23 googletag.cmd.push(function() { 24 console.log('Display Billboard-2nd and Showcase-2nd'); 25 googletag.display('div-gpt-ad-billboard-a-2nd'); 26 googletag.display('div-gpt-ad-showcase-2nd'); 27 }); 28 } 29 30 /** 31 * IntersectionObserverè¨å® 32 */ 33 const observerOptions = { 34 root: null, 35 rootMargin: '200px', // 200pxæåã§èªã¿è¾¼ã¿éå§ 36 threshold: 0 37 }; 38 39 const observer = new IntersectionObserver(function(entries) { 40 entries.forEach(function(entry) { 41 if (!entry.isIntersecting) { 42 return; 43 } 44 45 const pager = entry.target; 46 const adType = pager.dataset.showAd; 47 const postId = parseInt(pager.dataset.postId, 10); 48 const position = parseInt(pager.dataset.pagerPosition, 10); 49 const adKey = adType + '-' + postId + '-' + position; 50 51 // æ¢ã«èªã¿è¾¼ã¿æ¸ã¿ãªãã¹ããã 52 if (loadedAds.has(adKey)) { 53 return; 54 } 55 56 console.log('Pager ad triggered:', adType, 'postID:', postId, 'position:', position); 57 58 // åºå表示å¦ç 59 if (adType === 'billboard-2nd') { 60 displayBillboard2nd(); 61 } else if (adType === 'infinity-page') { 62 // dynamic_whatpagerAD() ãå¼ã³åºã 63 if (typeof dynamic_whatpagerAD === 'function') { 64 dynamic_whatpagerAD(postId, position); 65 } else { 66 console.error('dynamic_whatpagerAD function not found'); 67 } 68 } 69 70 // èªã¿è¾¼ã¿æ¸ã¿ã¨ãã¦ãã¼ã¯ 71 loadedAds.add(adKey); 72 73 // ç£è¦è§£é¤ 74 observer.unobserve(pager); 75 }); 76 }, observerOptions); 77 78 /** 79 * åæå颿° 80 */ 81 function init() { 82 // data-show-ad屿§ãæã¤ãã¼ã¸ã£ã¼ãããã¯ãå ¨ã¦ç£è¦ 83 const pagers = document.querySelectorAll('.whatpager-pager[data-show-ad]'); 84 85 console.log('Pager ad loader initialized. Found', pagers.length, 'ad pagers'); 86 87 pagers.forEach(function(pager) { 88 observer.observe(pager); 89 }); 90 } 91 92 /** 93 * æå®è¦ç´ å ã®ãã¼ã¸ã£ã¼ãããã¯ãç£è¦å¯¾è±¡ã«è¿½å 94 * ï¼ç¡éã¹ã¯ãã¼ã«çã§åçã«è¿½å ãããè¨äºç¨ï¼ 95 * 96 * @param {HTMLElement} container - æ¤ç´¢å¯¾è±¡ã®ã³ã³ããè¦ç´ 97 */ 98 function observePagers(container) { 99 if (!container) return; 100 var pagers = container.querySelectorAll('.whatpager-pager[data-show-ad]'); 101 pagers.forEach(function(pager) { 102 observer.observe(pager); 103 }); 104 } 105 106 // ã°ãã¼ãã«ã«å ¬éï¼ç¡éã¹ã¯ãã¼ã«ããå¼ã³åºãç¨ï¼ 107 window.figaroPagerAdLoader = { 108 observePagers: observePagers 109 }; 110 111 // DOMèªã¿è¾¼ã¿å¾ã«åæå 112 if (document.readyState === 'loading') { 113 document.addEventListener('DOMContentLoaded', init); 114 } else { 115 init(); 116 } 117})();
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.