1/** 2 * b247-taboola.js 3 * Taboola widget initializer â reads page type from B247TaboolaConfig, 4 * pushes slot configurations to the _taboola command queue, then flushes. 5 * The CDN loader (loader.js) is enqueued separately in <head> by PHP. 6 */ 7(function (w, d) { 8 'use strict'; 9 10 var cfg = w.B247TaboolaConfig || {}; 11 var pageType = cfg.pageType || 'article'; 12 13 w._taboola = w._taboola || []; 14 15 /** 16 * Whether a container is actually laid out. A display:none box (the sidebar 17 * copy on a phone) has no client rects â and Taboola would still fill it: 18 * five items rendered into a hidden box on every mobile article view, 19 * never seen (measured on production). 20 */ 21 function visivel(el) { 22 return !!el && el.getClientRects().length > 0; 23 } 24 25 /** 26 * Push one placement into the first of its containers that is on the page 27 * and visible. `containers` lists alternatives for the same placement â 28 * the article's recommendations sit in the sidebar on desktop and inside 29 * the body on a phone (inc/taboola.php), and CSS shows one or the other by 30 * width. A placement whose containers are all hidden is not requested. 31 */ 32 function pushSlot(slot) { 33 var ids = slot.containers || [slot.container]; 34 for (var i = 0; i < ids.length; i++) { 35 if (visivel(d.getElementById(ids[i]))) { 36 _taboola.push({ 37 mode: slot.mode, 38 container: ids[i], 39 placement: slot.placement, 40 target_type: 'mix' 41 }); 42 return; 43 } 44 } 45 } 46 47 // ââ Slot definitions â mirrors the Next.js PWA placements ââââââââââââ 48 // "Article Personalization" runs on every page type: in the sidebar after 49 // the two sticky ads on desktop, higher up in the page itself on mobile 50 // (article body after the 3rd paragraph, home rail after the 9th 51 // headline, listings after the 4th 52 // card). The archives used to run "Right Rail" in the sidebar instead. 53 var personalization = { 54 mode: 'thumbnails-a-1x5-stream', 55 containers: ['taboola-article-personalization-mobile', 'taboola-article-personalization'], 56 placement: 'Article Personalization' 57 }; 58 59 var slots = { 60 homepage: [ 61 { mode: 'thumbnails-h', container: 'taboola-home-page', placement: 'Home Page' }, 62 personalization, 63 { mode: 'thumbs-feed-01-b', container: 'taboola-below-home', placement: 'Below Home' } 64 ], 65 article: [ 66 { mode: 'alternating-thumbnails-a', container: 'taboola-below-article-thumbnails-new', placement: 'Below Article Thumbnails New' }, 67 personalization 68 ], 69 category: [ 70 { mode: 'thumbs-feed-01-b', container: 'taboola-below-category-thumbnails', placement: 'Below Category Thumbnails' }, 71 personalization 72 ] 73 }; 74 75 (slots[pageType] || slots.article).forEach(pushSlot); 76 77 _taboola.push({ flush: true }); 78 79}(window, document));
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.