PageSourceSearch

https://www.beritaharian.sg/web2-assets/useHideInvisibleAds-ByTuBE1-.js

js beritaharian.sg collected 2026-10-01 10:36:36 UTC 30,974 bytes, 906 lines download raw bytes

1import{B as e,K as t}from"./utils-7dcmseyr.js";import{r as n}from"./removeTrailingLeadingSlash-Dq7LkeYT.js";import{At as r,b as i,d as a}from"./getErrorMessage-B6QttKlK.js";import{d as o,n as s,o as c,r as l,t as u}from"./useScriptFunction-DtbH60V9.js";import{i as d}from"./useUserVarStore-_XpjlHlQ.js";var f={invisible:`_invisible_1jl3z_1`},p=t(e(),1);function m(e,t){let[n,r]=(0,p.useState)(!1),i=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let n=t||h(e),a=()=>{try{i.current?.children[0]?.firstElementChild?.tagName===`IFRAME`&&r(!0)}catch(e){console.warn(`[AdvertObserver] Error while checking iframe:`,e)}};i.current=document.getElementById(n);let o=new MutationObserver(a);i.current&&o.observe(i.current,{childList:!0,subtree:!0})},[t,e,r]),n}var h=e=>e===o.IMU1ARTICLE?`dfp-ad-imu1`:`dfp-ad-${e}`,g={prefix:`/5908/bh`,midarticlespecial:e=>`${g.prefix}/midarticlespecial/${e}`,imu1:e=>`${g.prefix}/imu1/${e}`,imu2:e=>`${g.prefix}/imu2/${e}`,imu3:e=>`${g.prefix}/imu3/${e}`,lb1:e=>e==null?`${g.prefix}/lb1`:`${g.prefix}/lb1/${e}`,lb2:e=>e==null?`${g.prefix}/lb2`:`${g.prefix}/lb2/${e}`,lb3:e=>e==null?`${g.prefix}/lb1`:`${g.prefix}/lb1/${e}`,prestitial:e=>e==null?`${g.prefix}/prestitial`:`${g.prefix}/prestitial/${e}`,catfish:e=>e==null?`${g.prefix}/catfish`:`${g.prefix}/catfish/${e}`},_=t(r(),1);function v({autoFire:e=!0}={}){let t=(0,p.useCallback)(()=>{if(!i||window._data===void 0)return;let e=window._data,t=a(`visitorcat`),n=a(`mysphw`);t!==void 0&&n!==void 0&&(e.visitorcat=t,e.at=n);let r=localStorage.getItem(`mybh-keywords`);if(r)try{let t=JSON.parse(r);e.user_keyword=(Array.isArray(t.state?.tags)?t.state.tags:[]).filter(e=>typeof e.name==`string`).map(e=>e.name.toLowerCase()).join(`|`)||``}catch{e.user_keyword=``}let o={event:`pageview`,at:e.at,visitorcat:e.visitorcat,articleid:e.articleid,cue_articleid:e.cue_articleid,author:e.author||``,chapter1:e.chapter1,chapter2:e.chapter2,chapter3:``,contentcat:e.contentcat,contenttype:e.contenttype,keyword:e.keyword,level2:e.level2,pubdate:e.pubdate,content_publication_date_utc:e.content_publication_date_utc,content_update_date_utc:e.content_update_date_utc,titleGa:e.title,url:window.location.href,user_keyword:e.user_keyword};_.default.dataLayer({dataLayer:o})},[]);return(0,p.useEffect)(()=>{if(!e||!i)return;if(window._data!==void 0){t();return}let n=setInterval(()=>{window._data!==void 0&&(t(),clearInterval(n))},100);return()=>{clearInterval(n)}},[e,t]),t}var y=`
2// ===============================================
3// AdBlock detector
4//
5// Attempts to detect the presence of Ad Blocker software
6// and notify listener of its existence.
7// Copyright (c) 2015 IAB
8//
9// The MIT License (MIT)
10//
11// Permission is hereby granted, free of charge, to any person obtaining a copy
12// of this software and associated documentation files (the "Software"), to deal
13// in the Software without restriction, including without limitation the rights
14// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15// copies of the Software, and to permit persons to whom the Software is
16// furnished to do so, subject to the following conditions:
17//
18// The above copyright notice and this permission notice shall be included in all
19// copies or substantial portions of the Software.
20//
21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27// SOFTWARE.
28//
29// THIS SCRIPT IS PROVIDED STRICTLY "AS IS", AND SHOULD ONLY BE USED IN COMPLIANCE WITH EXISTING LOCAL LAWS AND REGULATIONS.
30// ===============================================
31
32/**
33* @name window.adblockDetector
34*
35* IAB Adblock detector.
36* Usage: window.adblockDetector.init(options);
37*
38* Options object settings
39*
40* @prop debug:  boolean
41*         Flag to indicate additional debug output should be printed to console
42*
43* @prop found: @function
44*         Callback function to fire if adblock is detected
45*
46* @prop notfound: @function
47*         Callback function to fire if adblock is not detected.
48*         NOTE: this function may fire multiple times and give false negative
49*         responses during a test until adblock is successfully detected.
50*
51* @prop complete: @function
52*         Callback function to fire once a round of testing is complete.
53*         The test result (boolean) is included as a parameter to callback
54*
55* example:  window.adblockDetector.init(
56        {
57          found: function(){ ...},
58          notFound: function(){...}
59        }
60      );
61*
62*
63*/
64
65"use strict";
66(function(win) {
67
68  var version = '1.0';
69
70  var ofs = 'offset', cl = 'client';
71  var noop = function(){};
72
73  var testedOnce = false;
74  var testExecuting = false;
75
76  var isOldIEevents = (win.addEventListener === undefined);
77
78  /**
79  * Options set with default options initialized
80  *
81  */
82  var _options = {
83    loopDelay: 50,
84    maxLoop: 5,
85    debug: true,
86    found: noop,          // function to fire when adblock detected
87    notfound: noop,         // function to fire if adblock not detected after testing
88    complete: noop          // function to fire after testing completes, passing result as parameter
89  }
90
91  function parseAsJson(data){
92    var result, fnData;
93    try{
94      result = JSON.parse(data);
95    }
96    catch(ex){
97      try{
98        fnData = new Function("return " + data);
99        result = fnData();
100      }
101      catch(ex){
102        log('Failed secondary JSON parse', true);
103      }
104    }
105
106    return result;
107  }
108
109  /**
110  * Ajax helper object to download external scripts.
111  * Initialize object with an options object
112  * Ex:
113    {
114      url : 'http://example.org/url_to_download',
115      method: 'POST|GET',
116      success: callback_function,
117      fail:  callback_function
118    }
119  */
120  var AjaxHelper = function(opts){
121    var xhr = new XMLHttpRequest();
122
123    this.success = opts.success || noop;
124    this.fail = opts.fail || noop;
125    var me = this;
126
127    var method = opts.method || 'get';
128
129    /**
130    * Abort the request
131    */
132    this.abort = function(){
133      try{
134        xhr.abort();
135      }
136      catch(ex){
137      }
138    }
139
140    function stateChange(vals){
141      if(xhr.readyState == 4){
142        if(xhr.status == 200){
143          me.success(xhr.response);
144        }
145        else{
146          // failed
147          me.fail(xhr.status);
148        }
149      }
150    }
151
152    xhr.onreadystatechange = stateChange;
153
154    function start(){
155      xhr.open(method, opts.url, true);
156      xhr.send();
157    }
158
159    start();
160  }
161
162  /**
163  * Object tracking the various block lists
164  */
165  var BlockListTracker = function(){
166    var me = this;
167    var externalBlocklistData = {};
168
169    /**
170    * Add a new external URL to track
171    */
172    this.addUrl = function(url){
173      externalBlocklistData[url] = {
174        url: url,
175        state: 'pending',
176        format: null,
177        data: null,
178        result: null
179      }
180
181      return externalBlocklistData[url];
182    }
183
184    /**
185    * Loads a block list definition
186    */
187    this.setResult = function(urlKey, state, data){
188      var obj = externalBlocklistData[urlKey];
189      if(obj == null){
190        obj = this.addUrl(urlKey);
191      }
192
193      obj.state = state;
194      if(data == null){
195        obj.result = null;
196        return;
197      }
198
199      if(typeof data === 'string'){
200        try{
201          data = parseAsJson(data);
202          obj.format = 'json';
203        }
204        catch(ex){
205          obj.format = 'easylist';
206          // parseEasyList(data);
207        }
208      }
209      obj.data = data;
210
211      return obj;
212    }
213
214  }
215
216  var listeners = []; // event response listeners
217  var baitNode = null;
218  var quickBait = {
219    cssClass: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links'
220  };
221  var baitTriggers = {
222    nullProps: [ofs + 'Parent'],
223    zeroProps: []
224  };
225
226  baitTriggers.zeroProps = [
227    ofs +'Height', ofs +'Left', ofs +'Top', ofs +'Width', ofs +'Height',
228    cl + 'Height', cl + 'Width'
229  ];
230
231  // result object
232  var exeResult = {
233    quick: null,
234    remote: null
235  };
236
237  var findResult = null; // result of test for ad blocker
238
239  var timerIds = {
240    test: 0,
241    download: 0
242  };
243
244  function isFunc(fn){
245    return typeof(fn) == 'function';
246  }
247
248  /**
249  * Make a DOM element
250  */
251  function makeEl(tag, attributes){
252    var k, v, el, attr = attributes;
253    var d = document;
254
255    el = d.createElement(tag);
256
257    if(attr){
258      for(k in attr){
259        if(attr.hasOwnProperty(k)){
260          el.setAttribute(k, attr[k]);
261        }
262      }
263    }
264
265    return el;
266  }
267
268  function attachEventListener(dom, eventName, handler){
269    if(isOldIEevents){
270      dom.attachEvent('on' + eventName, handler);
271    }
272    else{
273      dom.addEventListener(eventName, handler, false);
274    }
275  }
276
277  function log(message, isError){
278    if(!_options.debug && !isError){
279      return;
280    }
281    if(win.console && win.console.log){
282      if(isError){
283        console.error('[ABD] ' + message);
284      }
285      else{
286        console.log('[ABD] ' + message);
287      }
288    }
289  }
290
291  var ajaxDownloads = [];
292
293  /**
294  * Load and execute the URL inside a closure function
295  */
296  function loadExecuteUrl(url){
297    var ajax, result;
298
299    blockLists.addUrl(url);
300    // setup call for remote list
301    ajax = new AjaxHelper(
302      {
303        url: url,
304        success: function(data){
305          log('downloaded file ' + url); // todo - parse and store until use
306          result = blockLists.setResult(url, 'success', data);
307          try{
308            var intervalId = 0,
309              retryCount = 0;
310
311            var tryExecuteTest = function(listData){
312              if(!testExecuting){
313                beginTest(listData, true);
314                return true;
315              }
316              return false;
317            }
318
319            if(findResult == true){
320              return;
321            }
322
323            if(tryExecuteTest(result.data)){
324              return;
325            }
326            else{
327              log('Pause before test execution');
328              intervalId = setInterval(function(){
329                if(tryExecuteTest(result.data) || retryCount++ > 5){
330                  clearInterval(intervalId);
331                }
332              }, 250);
333            }
334          }
335          catch(ex){
336            log(ex.message + ' url: ' + url, true);
337          }
338        },
339        fail: function(status){
340          log(status, true);
341          blockLists.setResult(url, 'error', null);
342        }
343      });
344
345    ajaxDownloads.push(ajax);
346  }
347
348
349  /**
350  * Fetch the external lists and initiate the tests
351  */
352  function fetchRemoteLists(){
353    var i, url;
354    var opts = _options;
355
356    for(i=0;i<opts.blockLists.length;i++){
357      url = opts.blockLists[i];
358      loadExecuteUrl(url);
359    }
360  }
361
362  function cancelRemoteDownloads(){
363    var i, aj;
364
365    for(i=ajaxDownloads.length-1;i >= 0;i--){
366      aj = ajaxDownloads.pop();
367      aj.abort();
368    }
369  }
370
371
372  // =============================================================================
373  /**
374  * Begin execution of the test
375  */
376  function beginTest(bait){
377    log('start beginTest');
378    if(findResult == true){
379      return; // we found it. don't continue executing
380    }
381    testExecuting = true;
382    castBait(bait);
383
384    exeResult.quick = 'testing';
385
386    timerIds.test = setTimeout(
387      function(){ reelIn(bait, 1); },
388      5);
389  }
390
391  /**
392  * Create the bait node to see how the browser page reacts
393  */
394  function castBait(bait){
395    var i, d = document, b = d.body;
396    var t;
397    var baitStyle = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;'
398
399    if(bait == null || typeof(bait) == 'string'){
400      log('invalid bait being cast');
401      return;
402    }
403
404    if(bait.style != null){
405      baitStyle += bait.style;
406    }
407
408    baitNode = makeEl('div', {
409      'class': bait.cssClass,
410      'style': baitStyle
411    });
412
413    log('adding bait node to DOM');
414    b.appendChild(baitNode);
415
416    // touch these properties
417    for(i=0;i<baitTriggers.nullProps.length;i++){
418      t = baitNode[baitTriggers.nullProps[i]];
419    }
420    for(i=0;i<baitTriggers.zeroProps.length;i++){
421      t = baitNode[baitTriggers.zeroProps[i]];
422    }
423  }
424
425  /**
426  * Run tests to see if browser has taken the bait and blocked the bait element
427  */
428  function reelIn(bait, attemptNum){
429    var i, k, v;
430    var body = document.body;
431    var found = false;
432
433    if(baitNode == null){
434      log('recast bait');
435      castBait(bait || quickBait);
436    }
437
438    if(typeof(bait) == 'string'){
439      log('invalid bait used', true);
440      if(clearBaitNode()){
441        setTimeout(function(){
442          testExecuting = false;
443        }, 5);
444      }
445
446      return;
447    }
448
449    if(timerIds.test > 0){
450      clearTimeout(timerIds.test);
451      timerIds.test = 0;
452    }
453
454    // test for issues
455
456    if(body.getAttribute('abp') !== null){
457      log('found adblock body attribute');
458      found = true;
459    }
460
461    for(i=0;i<baitTriggers.nullProps.length;i++){
462      if(baitNode[baitTriggers.nullProps[i]] == null){
463        found = true;
464        log('found adblock null attr: ' + baitTriggers.nullProps[i]);
465        break;
466      }
467      if(found == true){
468        break;
469      }
470    }
471
472
473    for(i=0;i<baitTriggers.zeroProps.length;i++){
474      if(found == true){
475        break;
476      }
477      if(baitNode[baitTriggers.zeroProps[i]] == 0){
478        found = true;
479        log('found adblock zero attr: ' + baitTriggers.zeroProps[i]);
480      }
481    }
482
483    if(window.getComputedStyle !== undefined) {
484      var baitTemp = window.getComputedStyle(baitNode, null);
485      if(baitTemp.getPropertyValue('display') == 'none'
486      || baitTemp.getPropertyValue('visibility') == 'hidden') {
487        found = true;
488        log('found adblock computedStyle indicator');
489      }
490    }
491
492    testedOnce = true;
493    if(found || attemptNum++ >= _options.maxLoop){
494      findResult = found;
495      log('exiting test loop - value: ' + findResult);
496      notifyListeners();
497      if(clearBaitNode()){
498        setTimeout(function(){
499          testExecuting = false;
500        }, 5);
501      }
502    }
503    else{
504      timerIds.test = setTimeout(function(){
505        reelIn(bait, attemptNum);
506      }, _options.loopDelay);
507    }
508  }
509
510  function clearBaitNode(){
511    if(baitNode === null){
512      return true;
513    }
514
515    try{
516      if(isFunc(baitNode.remove)){
517        baitNode.remove();
518      }
519      document.body.removeChild(baitNode);
520    }
521    catch(ex){
522    }
523    baitNode = null;
524
525    return true;
526  }
527
528  /**
529  * Halt the test and any pending timeouts
530  */
531  function stopFishing(){
532    if(timerIds.test > 0){
533      clearTimeout(timerIds.test);
534    }
535    if(timerIds.download > 0){
536      clearTimeout(timerIds.download);
537    }
538
539    cancelRemoteDownloads();
540
541    clearBaitNode();
542  }
543
544  /**
545  * Fire all registered listeners
546  */
547  function notifyListeners(){
548    var i, funcs;
549    if(findResult === null){
550      return;
551    }
552    for(i=0;i<listeners.length;i++){
553      funcs = listeners[i];
554      try{
555        if(funcs != null){
556          if(isFunc(funcs['complete'])){
557            funcs['complete'](findResult);
558          }
559
560          if(findResult && isFunc(funcs['found'])){
561            funcs['found']();
562          }
563          else if(findResult === false && isFunc(funcs['notfound'])){
564            funcs['notfound']();
565          }
566        }
567      }
568      catch(ex){
569        log('Failure in notify listeners ' + ex.Message, true);
570      }
571    }
572  }
573
574  /**
575  * Attaches event listener or fires if events have already passed.
576  */
577  function attachOrFire(){
578    var fireNow = false;
579    var fn;
580
581    if(document.readyState){
582      if(document.readyState == 'complete'){
583        fireNow = true;
584      }
585    }
586
587    fn = function(){
588      beginTest(quickBait, false);
589    }
590
591    if(fireNow){
592      fn();
593    }
594    else{
595      attachEventListener(win, 'load', fn);
596    }
597  }
598
599
600  var blockLists; // tracks external block lists
601
602  /**
603  * Public interface of adblock detector
604  */
605  var impl = {
606    /**
607    * Version of the adblock detector package
608    */
609    version: version,
610
611    /**
612    * Initialization function. See comments at top for options object
613    */
614    init: function(options){
615      var k, v, funcs;
616
617      if(!options){
618        return;
619      }
620
621      funcs = {
622        complete: noop,
623        found: noop,
624        notfound: noop
625      };
626
627      for(k in options){
628        if(options.hasOwnProperty(k)){
629          if(k == 'complete' || k == 'found' || k == 'notFound'){
630            funcs[k.toLowerCase()] = options[k];
631          }
632          else{
633            _options[k] = options[k];
634          }
635        }
636      }
637
638      listeners.push(funcs);
639
640      blockLists = new BlockListTracker();
641
642      attachOrFire();
643    }
644  }
645
646  win['adblockDetector'] = impl;
647
648})(window)
649`,b=`
650var canRunAds = true;
651`,x=`
652var postitial_redirecturl;
653var prestitial_timer;
654var show_overlay;
655
656if (window.canRunAds !== undefined && (show_overlay === 1 || (dfp_preview_ids != undefined &&
657  dfp_preview_ids.length != 0 && dfp_preview_ids != "")) && screen.width > 767 && prestitial_enabled === 1 && window.adBlockerDetected == false) {
658  document.getElementById("MyPageOverlay").style.display = "block"; unloadScrollBars();
659}
660
661if (window.canRunAds !== undefined && screen.width <= 767 && postitial_enabled === 1) {
662  bindPostitial();
663}
664
665googletag.pubads().addEventListener('slotRenderEnded', function (event) {
666  if (googletag.slots["prestitial"] == event.slot) {
667    if (event.isEmpty) {
668      if (document.getElementById("MyPageOverlay") != null) {
669        document.getElementById("MyPageOverlay").style.display = "none";
670      }
671      reloadScrollBars();
672    } else {
673      //Kill the prestitial_timer
674      window.clearTimeout(prestitial_timer);
675    }
676  }
677});
678
679var val_test_adid = '';
680var val_test_plid = '';
681
682if (window.location.search.indexOf("test_adid") !== -1) {
683  val_test_adid = parse_query_string('test_adid');
684}
685if (window.location.search.indexOf("test_plid") !== -1) {
686  val_test_plid = parse_query_string('test_plid');
687}
688if (val_test_adid !== "") {
689  googletag.setConfig({ targeting: { test_adid: val_test_adid } });
690}
691if (val_test_plid !== "") {
692  googletag.setConfig({ targeting: { test_plid: val_test_plid } });
693}
694
695var key = "dfp_preview";
696if (Object.entries(dfp_preview_ids).length !== 0 && dfp_preview_ids != "") {
697  googletag.cmd.push(function () {
698    googletag.setConfig({ targeting: { [key]: dfp_preview_ids } });
699  });
700}
701
702window.addEventListener('message', closetopoverlay, false);
703googletag.setConfig({ singleRequest: true });
704googletag.enableServices();
705
706function bindPostitial() {
707  //googletag.destroySlots([googletag.slots["topoverlay"]])
708  document.addEventListener('click', function (event) {
709    var anchor = event.target.closest("a");     // Find closest Anchor (or self)
710    var currentdomain = window.location.href.split('/')[2];
711    if (anchor !== null) {
712      var anchorHref = anchor.getAttribute('href');
713      if ((anchorHref.indexOf(currentdomain) !== -1 || anchorHref.charAt(0) == "/" ) && anchorHref.match(/http(s)*:\\/\\/traffic.outbrain.com/) == null && anchorHref.match(/http(s)*:\\/\\/subscribe.sph.com.sg/) == null && anchorHref.search(/rolex-/i) == -1 && anchorHref.search(/we-the-earth/i) == -1 ) {
714        event.preventDefault();// Don't navigate!
715        postitial_redirecturl = anchorHref;
716        var dfpadunits = JSON.parse(loaded_dfp_tags);
717        var dynamic_postitial_template_unit = 'lb1';
718        if(!dfpadunits[dynamic_postitial_template_unit]) { dynamic_postitial_template_unit = 'lb2'; }
719        if(dfpadunits[dynamic_postitial_template_unit]) { var dynamic_postitial = dfpadunits[dynamic_postitial_template_unit]['adunit']; }
720        // var dynamic_postitial = dfpadunits[dynamic_postitial_template_unit]['adunit'];
721        if (typeof dynamic_postitial !== "undefined" ) {
722          dynamic_postitial = dynamic_postitial.replace( "/"+dynamic_postitial_template_unit+"/" , "/postitial/" );
723          if ((topOverlayImpressionsServed < topOverlayImpressions && document.cookie.indexOf("postitialDisplayed=") == -1) || (dfp_preview_ids != undefined && dfp_preview_ids.length != 0) ) {
724            googletag.cmd.push(function () {
725              var slot_topoverlay = googletag.defineSlot( dynamic_postitial , [1,1], 'postitial_holder' ).addService(googletag.pubads());
726              slot_topoverlay.setConfig({ targeting: { pos: "postitial" } });
727              googletag.pubads().addEventListener('slotRenderEnded',function (eventtopoverlay) {
728                if(slot_topoverlay == eventtopoverlay.slot) {
729                  if (eventtopoverlay.isEmpty) {
730                    if (document.getElementById("MyPageOverlay") != null) {
731                      document.getElementById("MyPageOverlay").style.display = "none";
732                    }
733                    // make sure to destroy slot to handle back or swipe right
734                    googletag.destroySlots([slot_topoverlay]);
735                    window.location.href = postitial_redirecturl;
736                  }
737                  else {
738                    if (document.getElementById("MyPageOverlay") != null) {
739                      document.getElementById("MyPageOverlay").style.display = "block";
740                    }
741                    unloadScrollBars();
742                    var expiry = new Date();expiry.setTime(expiry.getTime() + (postitial_validity * 60 * 60 * 1000));
743                    topOverlayImpressionsServed = topOverlayImpressionsServed + 1;
744                    if(topOverlayImpressionsServed == topOverlayImpressions) {
745                      document.cookie = "postitialDisplayed=yes;path=/; expires=" + expiry.toGMTString();
746                      document.cookie = "topOverlayImpressionsServed=0;path=/; expires=" + expiry.toGMTString();
747                    } else {
748                      document.cookie = "topOverlayImpressionsServed=" + topOverlayImpressionsServed + ";path=/; expires=" + expiry.toGMTString();
749                    }
750                    window.clearTimeout(postitial_timer);
751                  }
752                }
753              });
754              googletag.cmd.push( function () {
755                googletag.display( 'postitial_holder' );
756                googletag.pubads().refresh([slot_topoverlay], { changeCorrelator: false });
757              });
758            });
759          }
760          else {
761            window.location.href = postitial_redirecturl;
762          }
763          var postitial_timer = window.setTimeout(kill_postitial, 15000);
764        }
765        else {
766          window.location.href = postitial_redirecturl;
767        }
768      }
769    }
770  }, true);
771}
772`,S=`
773var taboola_enable = 1;
774var overlay_validity = 4;
775var catfish_validity = 4;
776var postitial_validity = 4;
777var prestitial_enabled = 1; // this value will get override in prebid.js
778var postitial_enabled = 1; // this value will get override in prebid.js
779var catfish_enabled = 1; // this value will get override in prebid.js
780var key = 'dfp_preview';
781var keycode = querystring(key);
782var topOverlayImpressions = 1;
783var topOverlayImpressionsServed = 0;
784var dfp_preview_ids = querystring("dfp_preview");
785
786/** Get cookie by name */
787window.getCookieByName = function (name) {
788  match = document.cookie.match(new RegExp(name + '=([^;]+)'));
789  if (match) { return decodeURIComponent(match[1]);
790  }
791}
792
793if (window.getCookieByName("topOverlayImpressionsServed") != undefined) {
794  topOverlayImpressionsServed = parseInt(window.getCookieByName("topOverlayImpressionsServed"));
795}
796
797
798function getCookieValue(a) {
799  var b = document.cookie.match('(^|[^;]+)\\s*' + a + '\\s*=\\s*([^;]+)');
800  return b ? b.pop() : '';
801}
802
803function setCookieValue(cname, cvalue, expdays) {
804  var d = new Date();
805  expdays = expdays || 1;
806  d.setTime(d.getTime() + (expdays * 24 * 60 * 60 * 1000));
807  var expires = "expires=" + d.toUTCString();
808  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
809}
810
811function querystring(key) {
812    if (!key) return [];
813    var exp = '(?:\\\\?|&)' + key + '=(.*?)(?=&|$)';
814    var re = new RegExp(exp, 'gi');
815    var r = [],
816        m;
817    while ((m = re.exec(document.location.search)) != null) { r[r.length] = m[1];
818    }
819    return r;
820}
821// Remove the catfish and prestitial ads for mobile & Tablet.
822if (typeof loaded_dfp_tags !== 'undefined') {
823    var dfpObj = JSON.parse(loaded_dfp_tags);
824    if(window.canRunAds !== undefined) {
825        if(screen.width > 767 && dfpObj.hasOwnProperty('catfish')) {
826            delete dfpObj.catfish;
827        }
828        if(screen.width <= 767 && dfpObj.hasOwnProperty('prestitial')) {
829            delete dfpObj.prestitial;
830        }
831        var loaded_dfp_tags = JSON.stringify(dfpObj);
832    }
833}
834
835function reloadScrollBars() {
836  document.body.style.overflowY = 'visible';
837  document.documentElement.style.overflowY = 'visible'; // firefox, chrome.
838  if (navigator.appVersion.indexOf("MSIE") != -1) {
839    document.body.scroll = "yes";
840  } // ie only
841}
842
843function continueToSite() {
844  document.getElementById("MyPageOverlay").style.display = "none";
845  reloadScrollBars();
846}
847
848function unloadScrollBars() {
849  prestitial_timer = window.setTimeout(continueToSite, 15000);
850  document.body.style.overflowY = 'hidden';
851  document.documentElement.style.overflowY = 'hidden'; // firefox, chrome.
852  if (navigator.appVersion.indexOf("MSIE") != -1) {
853    document.body.scroll = "no";
854  } // ie only
855}
856
857function parse_query_string(key) {
858  var re = new RegExp('(?:\\\\?|&)' + key + '=(.*?)(?=&|$)', 'gi');
859  var r = [],
860    m;
861  while ((m = re.exec(document.location.search)) != null) { r[r.length] = m[1];
862  }
863  return r;
864}
865
866function kill_postitial() {
867  if (document.getElementById("MyPageOverlay") != null) {
868    document.getElementById("MyPageOverlay").style.display = "none";
869  }
870  window.location.href = postitial_redirecturl;
871}
872
873function closetopoverlay(evt) {
874  if (evt.data == 'close' || evt.data == 'bz-interstitial-close') {
875    if (postitial_redirecturl) {
876      window.location.href = postitial_redirecturl;
877    } else {
878      if (document.getElementById("MyPageOverlay") != null) {
879        document.getElementById("MyPageOverlay").style.display = "none";
880      }
881      document.getElementById("dfp-ad-prestitial").style.height = "0";
882      reloadScrollBars();
883    }
884  }
885}
886`,C=`
887//prestitial_enabled = 1; // this value will get override in prebid.js
888//postitial_enabled = 1; // this value will get override in prebid.js
889//catfish_enabled = 1; // this value will get override in prebid.js';
890
891
892var cname    = "mySPHUserType";
893var user_sub = 0;
894match = document.cookie.match(new RegExp(cname + '=([^;]+)'));
895var cval;
896if (match) { cval =  match[1]; }
897if(cval == 'y-sub' || cval == 'sub'){
898  user_sub = 1;
899}
900
901if ((user_sub == 1) && (dfp_preview_ids != undefined && dfp_preview_ids.length == 0)) {
902  postitial_enabled = 0;
903  prestitial_enabled = 0;
904}
905`;function w(){let[e,t]=(0,p.useState)(void 0),[r,i]=(0,p.useState)(void 0),[a,o]=(0,p.useState)(3),[s,l]=(0,p.useState)(4),[f,m]=(0,p.useState)(void 0);return d({id:`ads-checker-script`,src:n+`/tag/ads/ads_checker.js`,type:`text/javascript`}),d({id:`suid-script`,src:`https://cdn.sphlabs.com/suid/suid.min.js`,type:`text/javascript`}),d({id:`smx-prebid-script`,src:n+`/tag/smx/prebid.js`,type:`text/javascript`}),u({id:`ads-checker-custom-script`,value:b,portion:`head`}),u({id:`ad-block-detector-script`,value:y,portion:`head`}),(0,p.useEffect)(()=>{window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd,window.googletag.slots=window.googletag.slots||{},googletag.cmd.push(function(){let e=googletag.pubads().getSlots().map(e=>{let t=e.getSlotElementId().replaceAll(`dfp-ad-`,``),n=t.startsWith(`lb`)||t.startsWith(`imu2`)?t.split(`-`)[0]:t,r=Object.keys(c[n]).map((e,t)=>c[n][t].toString().replaceAll(`,`,`x`)),i={[t]:{adunit:e.getAdUnitPath(),slotname:e.getSlotElementId(),size:r.join(`,`)}};return window.googletag.slots[e.getSlotElementId().replaceAll(`dfp-ad-`,``)]=e,i}),r={};
905e.forEach(e=>{let t=Object.keys(e).at(0);t&&(r[t]=e[t])});let a=`loadDfpTagsScript`;if(!document.getElementById(a)){let e=document.createElement(`script`);e.id=a,e.dataset.testid=a,e.innerHTML=`var loaded_dfp_tags = '${JSON.stringify(r)}';`,e.type=`text/javascript`,document.body.appendChild(e)}let s=`betteradsHeadScript`;if(!document.getElementById(s)){let e=document.createElement(`script`);e.id=s,e.dataset.testid=s,e.innerHTML=S,e.type=`text/javascript`,document.body.appendChild(e)}let u=`loadSmxPrebidScript`;if(!document.getElementById(u)){let r=document.createElement(`script`);r.id=u,r.dataset.testid=u,r.src=n+`/tag/smx/smx_prebid.js`,r.onload=()=>{typeof window<`u`&&(t(window.prestitial_enabled===1),i(window.catfish_enabled===1),o(window.topOverlayImpressions),l(window.overlay_validity),m(window.taboola_enable===1))},e.length===0?setTimeout(()=>{document.body.appendChild(r),console.log(`[smx prebid added] after 3ms delay`)},300):(document.body.appendChild(r),console.log(`[smx prebid added]`))}let d=`betteradsScript`;if(!document.getElementById(d)){let e=document.createElement(`script`);e.id=d,e.dataset.testid=d,e.innerHTML=C,e.type=`text/javascript`,document.body.appendChild(e)}let f=`betteradsHead2Script`;if(!document.getElementById(f)){let e=document.createElement(`script`);e.id=f,e.dataset.testid=f,e.innerHTML=x,e.type=`text/javascript`,document.body.appendChild(e)}})},[]),{isPrestitialEnabled:e,isCatfishEnabled:r,topOverlayImpressions:a,topOverlayValidity:s,isTaboolaEnabled:f}}function T({targeting:e}={}){let{isScriptReady:t}=d({id:l,src:s,checkScriptIsLoaded:()=>window.googletag!==void 0&&!!googletag.apiReady}),{isPrestitialEnabled:n,isCatfishEnabled:r,topOverlayImpressions:i,topOverlayValidity:a,isTaboolaEnabled:o}=w(),c=(0,p.useCallback)(()=>{googletag.cmd.push(function(){e&&googletag.setConfig({targeting:{[e.key]:e.value}}),googletag.setConfig({singleRequest:!0}),googletag.setConfig({collapseDiv:`ON_NO_FILL`})})},[e]);return(0,p.useEffect)(()=>{typeof window<`u`&&t&&c()},[c,t]),{isPrestitialEnabled:n,isCatfishEnabled:r,topOverlayImpressions:i,topOverlayValidity:a,isTaboolaEnabled:o}}function E(e=`[data-testid='advertisement-element']`){(0,p.useEffect)(()=>{let t=()=>{document.querySelectorAll(e).forEach(e=>{let t=e,n=t.closest(`[data-testid='ads-container']`);if(!n)return;let r=t.querySelector(`[data-testid^='dfp-']`);if(!r)return;let i=t.className.includes(`invisible`),a=window.getComputedStyle(r).display===`none`;n.style.display=i||a?`none`:``})},n=null,r=()=>{n&&clearTimeout(n),n=setTimeout(t,3e3)};r();let i=new MutationObserver(r);return i.observe(document.body,{childList:!0,subtree:!0}),()=>{n&&clearTimeout(n),i.disconnect()}},[e])}export{h as a,g as i,T as n,m as o,v as r,f as s,E as t};
906//# sourceMappingURL=useHideInvisibleAds-ByTuBE1-.js.map

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.