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 * IntersectionObserverè¨å® 16 */ 17 const observerOptions = { 18 root: null, 19 rootMargin: '200px', // 200pxæåã§èªã¿è¾¼ã¿éå§ 20 threshold: 0 21 }; 22 23 const observer = new IntersectionObserver(function(entries) { 24 entries.forEach(function(entry) { 25 if (!entry.isIntersecting) { 26 return; 27 } 28 29 const pager = entry.target; 30 const adType = pager.dataset.showAd; 31 const postId = parseInt(pager.dataset.postId, 10); 32 const position = parseInt(pager.dataset.pagerPosition, 10); 33 const adKey = adType + '-' + postId + '-' + position; 34 35 // æ¢ã«èªã¿è¾¼ã¿æ¸ã¿ãªãã¹ããã 36 if (loadedAds.has(adKey)) { 37 return; 38 } 39 40 console.log('Pager ad triggered:', adType, 'postID:', postId, 'position:', position); 41 42 // åºå表示å¦ç 43 if (adType === 'infinity-page') { 44 // Infinity-Pageæ ãå®ç¾©ï¼div id: FIGARO_*_Article_Infinity-Page_300x250-{postId}-{position}ï¼ 45 if (typeof dynamic_pagerInfinityPageAD === 'function') { 46 dynamic_pagerInfinityPageAD(postId, position); 47 } else { 48 console.error('dynamic_pagerInfinityPageAD function not found'); 49 } 50 } 51 52 // èªã¿è¾¼ã¿æ¸ã¿ã¨ãã¦ãã¼ã¯ 53 loadedAds.add(adKey); 54 55 // ç£è¦è§£é¤ 56 observer.unobserve(pager); 57 }); 58 }, observerOptions); 59 60 /** 61 * åæå颿° 62 */ 63 function init() { 64 // data-show-ad屿§ãæã¤ãã¼ã¸ã£ã¼ãããã¯ãå ¨ã¦ç£è¦ 65 const pagers = document.querySelectorAll('.whatpager-pager[data-show-ad]'); 66 67 console.log('Pager ad loader initialized. Found', pagers.length, 'ad pagers'); 68 69 pagers.forEach(function(pager) { 70 observer.observe(pager); 71 }); 72 } 73 74 /** 75 * æå®è¦ç´ å ã®ãã¼ã¸ã£ã¼ãããã¯ãç£è¦å¯¾è±¡ã«è¿½å 76 * ï¼ç¡éã¹ã¯ãã¼ã«çã§åçã«è¿½å ãããè¨äºç¨ï¼ 77 * 78 * @param {HTMLElement} container - æ¤ç´¢å¯¾è±¡ã®ã³ã³ããè¦ç´ 79 */ 80 function observePagers(container) { 81 if (!container) return; 82 var pagers = container.querySelectorAll('.whatpager-pager[data-show-ad]'); 83 pagers.forEach(function(pager) { 84 observer.observe(pager); 85 }); 86 } 87 88 // ã°ãã¼ãã«ã«å ¬éï¼ç¡éã¹ã¯ãã¼ã«ããå¼ã³åºãç¨ï¼ 89 window.figaroPagerAdLoader = { 90 observePagers: observePagers 91 }; 92 93 // DOMèªã¿è¾¼ã¿å¾ã«åæå 94 if (document.readyState === 'loading') { 95 document.addEventListener('DOMContentLoaded', init); 96 } else { 97 init(); 98 } 99})();
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.