1_ = function(selector){ 2 var seletor = seletor || 'document'; 3 return document.querySelectorAll(selector); 4}; 5const body = document.querySelector('body'); 6 7window.locale = window.locale.replace(/_/,'-') || 'nl-BE'; 8window.disableads = window.disableads || false; 9 10Element.prototype._ = _; 11Element.prototype.addClass = function(c){ if(!this.classList.contains(c)){ this.classList.add(c); }}; 12Element.prototype.removeClass = function(c){ if(this.classList.contains(c)){ this.classList.remove(c); }}; 13Element.prototype.hasClass = function(c){ return (this.classList.contains(c)) }; 14Element.prototype.toggleClass = function(c){ if(this.classList.contains(c)){ this.classList.remove(c); } else { this.classList.add(c); }}; 15Element.prototype.attr = function(n,v){ var v = (typeof v=='undefined'?null:v); if(v!=null){ this.setAttribute(n,v); return v; } else { return this.getAttribute(n); }}; 16Element.prototype.html = function(v){ var v = (typeof v=='undefined'?null:v); if(v!=null){ this.innerHTML = v; return v; } else { return this.innerHTML; }}; 17 18NodeList.prototype.addClass = function(c){for(var i=0;i<this.length;i++){ this[i].addClass(c);}}; 19NodeList.prototype.removeClass = function(c){for(var i=0;i<this.length;i++){ this[i].removeClass(c);}}; 20NodeList.prototype.toggleClass = function(c){for(var i=0;i<this.length;i++){ this[i].toggleClass(c);}}; 21NodeList.prototype.attr = function(n,v){ var v = (typeof v=='undefined'?null:v); for(var i=0;i<this.length;i++){ if(v!=null){ this[i].setAttribute(n,v); } else { v = this[i].getAttribute(n); }} return v;}; 22NodeList.prototype.html = function(v){ var v = (typeof v=='undefined'?null:v); for(var i=0;i<this.length;i++){ if(v!=null){ this[i].innerHTML = v; } else { v = this[i].innerHTML; }} return v;}; 23 24NodeList.prototype.val = function(v){ 25 var r = ''; 26 if(this.length>0){ 27 var t = this[0].type; 28 if(this[0].classList.contains('geocomplete')){ t='geo'; } 29 switch (t){ 30 case 'geo': 31 r = this[0].data; 32 break; 33 case 'checkbox': 34 r = []; 35 for(var i=0;i<this.length;i++){ 36 if(this[i].checked){ 37 r.push(this[i].value); 38 } 39 } 40 r = r.join(','); 41 break; 42 default: 43 r = this[0].value; 44 break; 45 } 46 } 47 return r; 48}; 49 50String.prototype.dateformat = function(dateFormat,locale){ 51 var locale = locale || window.locale; 52 var r = this.replace(/([0-9]+)\/([0-9]+)\/([0-9]+)/gi,'$3-$2-$1'); 53 return (new Date(r)!='Invalid Date'?new Date(r).dateformat(dateFormat):''); 54}; 55Date.prototype.dateformat = function(dateFormat,locale){ 56 var locale = locale || window.locale; 57 var date = this.getDate(),month = this.getMonth(),hours = this.getHours(),minutes = this.getMinutes(),seconds = this.getSeconds(); 58 date_string = dateFormat; 59 date_string = date_string 60 .replace(/(dddd)/gi,'8888') 61 .replace(/(ddd)/gi,'888') 62 .replace(/(dd)/gi,date<10?'0'+date:date) 63 .replace(/(d)/gi,date) 64 .replace(/(mmmm)/gi,'9999') 65 .replace(/(mmm)/gi,'999') 66 .replace(/(m3U)/gi,'777') 67 .replace(/(mm)/gi,month<9?'0'+(month+1):month+1) 68 .replace(/(m)/gi,month+1) 69 .replace(/(yyyy)/gi,this.getFullYear()) 70 .replace(/(yy)/gi,(this.getFullYear()+'').substring(2,4)) 71 .replace(/(y)/gi,(this.getFullYear()+'').substring(2,4)) 72 .replace(/(dd)/gi,date<10?'0'+date:date) 73 .replace(/(hh)/gi,hours<10?'0'+hours:hours) 74 .replace(/(h)/gi,hours) 75 .replace(/(nn)/gi,minutes<10?'0'+minutes:minutes) 76 .replace(/(n)/gi,minutes) 77 .replace(/(ss)/gi,seconds<10?'0'+seconds:seconds) 78 .replace(/(s)/gi,seconds) 79 .replace(/(8888)/gi,this.toLocaleDateString(locale,{weekday:'long'})) 80 .replace(/(888)/gi,this.toLocaleDateString(locale,{weekday:'short'})) 81 .replace(/(9999)/gi,this.toLocaleDateString(locale,{month:'long'})) 82 .replace(/(999)/gi,this.toLocaleDateString(locale,{month:'short'})) 83 .replace(/(777)/gi,this.toLocaleDateString(locale,{month:'short'}).replace(/^(...).*$/gi,'$1').toUpperCase()); 84 return date_string; 85}; 86String.prototype.parsedate = function(locale){ 87 var locale = locale || window.locale; 88 if(parseInt(this)>100000){ 89 return new Date(this*1000); 90 } else { 91 var r = this.replace(/([0-9]+)\/([0-9]+)\/([0-9]+)/gi,'$3-$2-$1'); 92 r=r.replace(/\s([0-9]+):([0-9]+)/gi,'T$1:$2'); 93 return (new Date(r)!='Invalid Date'?new Date(r):-1); 94 } 95}; 96Number.prototype.parsedate = function(locale){ 97 return new Date(this*1000); 98}; 99Date.prototype.parsedate = function(locale){ 100 var locale = locale || window.locale; 101 return this; 102}; 103Date.prototype.dateadd = function(i,t){ 104 var t = t || 'd'; 105 var d = this.parsedate(); 106 if(t=='m'){ 107 return new Date(d.getFullYear(),d.getMonth()+i,d.getDate()); 108 } else { 109 return new Date(d+((1000*60*60*24)*i)); 110 } 111}; 112String.prototype.parseurl = function(slash,cadre){ 113 var slash = slash || false; 114 var cadre = (cadre===false?false:true); 115 var r = this.toLowerCase(); 116 if(slash){ r = r.replace(/\//gi,'-'); } 117 r = (!cadre===false?"/"+r+"/":r); 118 r = r.replace(/[\|\\/]+/gi,'/'); 119 r = r.replace(/[à áâãäå]/gi,'a'); 120 r = r.replace(/æ/gi,'ae'); 121 r = r.replace(/ç/gi,'c'); 122 r = r.replace(/[èéêë]/gi,'e'); 123 r = r.replace(/[ìÃîï]/gi,'i'); 124 r = r.replace(/ñ/gi,'n'); 125 r = r.replace(/[òóôõö]/gi,'o'); 126 r = r.replace(/Å/gi,'oe'); 127 r = r.replace(/[ùúûü]/gi,'u'); 128 r = r.replace(/[ýÿ]/gi,'y'); 129 r = r.replace(/[&]/gi,'-'); 130 r = r.replace(/[^A-Za-z0-9_\/\.]/gi,'-');
131 r = r.replace(/\s/gi,'-'); 132 r = r.replace(/[-]+/gi,'-'); 133 r = r.replace(/([-]+\/|\/[-]+)/gi,'/'); 134 r = r.replace(/[\/]+/gi,'/'); 135 return r; 136} 137 138const loader = { 139 js : function(f,callback){ 140 var callback = callback || function(){}; 141 if(f.length>1){ var cb = function(){ loader.js(f.slice(1),callback)}; } else { var cb = callback; } 142 if(document.querySelectorAll('[src="'+f[0].link+'"]').length==0){ 143 var s = document.createElement('script'); 144 s.setAttribute('src',f[0].link); 145 f[0].type = f[0].type || ''; 146 f[0].vendor = f[0].vendor || ''; 147 if(f[0].type!=null&&f[0].vendor!=null&&f[0].type!=''&&f[0].vendor!=''&&f[0].type.indexOf('didomi')>=0){ 148 var f = f; 149 document.addEventListener('didomi_change',function(){ 150 Didomi.getObservableOnUserConsentStatusForVendor(f[0].vendor.replace(/.*([^c]\:)(.*)/gi,'$2')).first().filter(function(status){ return status !== undefined; }).subscribe(function(state){ 151 if(state){ 152 f[0].type = 'text/javascript'; 153 f[0].vendor = ''; 154 loader.js(f,cb); 155 } 156 }); 157 }); 158 if(Didomi!=null){ 159 document.dispatchEvent(new Event('didomi_change')); 160 } 161 return; 162 } else { 163 if(f[0].type!=''){ s.setAttribute('type',f[0].type); } else { s.setAttribute('type','text/javascript'); }; 164 if(f[0].vendor!=''){ s.setAttribute('data-vendor',f[0].vendor); } 165 s.onload=cb; 166 setTimeout(() => { 167 document.querySelectorAll('head')[0].appendChild(s); 168 }, (f[0].wait!=null?f[0].wait:1)); 169 } 170 } else { cb(); } 171 }, 172 css : function(f,callback){ 173 var callback = callback || function(){}; 174 if(f.length>1){ var cb = function(){loader.css(f.slice(1),callback)}; } else { var cb = callback; } 175 if(document.querySelectorAll('[src="'+f[0]+'"]').length==0){ 176 var s = document.createElement('link'); 177 s.setAttribute('rel',"stylesheet"); 178 s.setAttribute('type',"text/css"); 179 s.setAttribute('href',f[0]); 180 s.onload=cb; 181 document.querySelectorAll('head')[0].appendChild(s); 182 } else { cb(); } 183 } 184}; 185document.cookies = { 186 get : function(n,json){ 187 var value = "; " + document.cookie; 188 var r = null; 189 document.cookie.split(';').forEach(x=>{ 190 if(x.split('=')[0].search(new RegExp(n,'gi'))>=0){ 191 r = x.split('=')[1]; 192 }}); 193 if(json){ 194 r = JSON.parse(decodeURIComponent(r)); 195 } 196 return r; 197 }, 198 set : function(name,value,day){ 199 var days = days || 30; 200 var d = new Date; 201 d.setTime(d.getTime() + 24*60*60*1000*days); 202 var domain = document.location.host.replace(/.*?(businessam)(\..*?$)/gi,'.$1$2'); 203 document.cookie = name + "=" + value + ";path=/;domain=" + domain + ";samesite=Lax;expires=" + d.toGMTString(); 204 }, 205 prepend : function(n,v,c){ 206 var a = []; 207 if(document.cookies.get(n)!=null){ a = document.cookies.get(n).split(','); } 208 if(a.indexOf(v)>-1){ a.splice(a.indexOf(v), 1); } else { a.splice(0, 0, v); } 209 if(a.length>c) { a.pop(); } 210 document.cookies.set(n,a.join(','),360); 211 } 212} 213const elTop = (element, horizontal = false) => { 214 if(!element) return 0; 215 return parseInt(elTop(element.offsetParent, horizontal)) + parseInt(horizontal ? element.offsetLeft : element.offsetTop); 216} 217window.lazy = function(){ 218 document.querySelectorAll('[data-src]:not(.lzl)').forEach(el=>{ 219 if((el.getBoundingClientRect().y-window.innerHeight)<300){ 220 el.setAttribute('src',el.getAttribute('data-src')); 221 el.classList.add('lzl'); 222 } 223 }); 224 225 document.querySelectorAll('[data-bg]:not(.lzl)').forEach(el=>{ 226 if((el.getBoundingClientRect().y-window.innerHeight)<300){ 227 var img = new Image(); 228 img.src=el.getAttribute('data-bg'); 229 img.onload = function(){ 230 el.style.backgroundImage = "url("+el.getAttribute('data-bg')+")"; 231 el.classList.add('lzl'); 232 } 233 } 234 }); 235}; 236window.addEventListener('checksize',function(e){ 237 var w = window.innerWidth||e.clientWidth||document.querySelectorAll('body')[0].clientWidth; 238 var d = ''; 239 var s = ''; 240 if(w>=1200){ d='xl';s='desktop'; } else if(w>=992){ d='lg';s='desktop'; } else if(w>=768){ d='md';s='tab'; } else if(w>=576){ d='sm';s='mobile'; } else if(w<576&&w>0){ d='xs';s='mobile'; } 241 if(!document.querySelectorAll('body')[0].classList.contains('device-'+d)){ 242 document.querySelectorAll('body')[0].classList.remove('device-xl','device-lg','device-md','device-sm','device-xs'); 243 document.querySelectorAll('body')[0].classList.add('device-'+d); 244 } 245 if(!document.querySelectorAll('body')[0].classList.contains('device-'+s)){ 246 document.querySelectorAll('body')[0].classList.remove('device-desktop','device-tab','device-mobile'); 247 document.querySelectorAll('body')[0].classList.add('device-'+s); 248 } 249 window.mmdevice = s; 250 window.dispatchEvent(new CustomEvent('device',{'detail':s})); 251}); 252window.onscroll = function(e){ 253 var top = window.pageYOffset || document.documentElement.scrollTop; 254 var dir = (window.lastscroll!=null&&window.lastscroll>top?'up':'down'); 255 var conflict = (window.lastdir!=null&&window.lastdir!=dir?true:false); 256 var h = document.querySelectorAll('.site-header').length>0?document.querySelectorAll('.site-header')[0].clientHeight:0; 257 window.lastscroll = top; 258 window.lastdir = dir; 259 window.lazy(); 260 document.querySelectorAll('.site-header').forEach(el=>{ 261 if(el.querySelectorAll('.advert').length>0){ el.querySelectorAll('.advert')[0].style.marginTop = '0px'; } 262 if(el.querySelectorAll('.head').length>0){ el.querySelectorAll('.head')[0].style.marginTop = '0px'; }
263 if(document.querySelectorAll('body.nav-fix').length>0){ 264 document.headerMargin = document.headerMargin || 0; 265 var new_headerMargin = -parseInt((el.querySelectorAll('.head').length>0?el.querySelectorAll('.head')[0].clientHeight:0)); 266 if(document.headerMargin!=new_headerMargin){ 267 if(el.querySelectorAll('.head').length>0){ el.querySelectorAll('.head')[0].style.marginTop = '-'+(parseInt(document.querySelectorAll('.head')[0].clientHeight))+'px'; } 268 } 269 if(document.querySelectorAll('body.nav-fix.div-gpt-ad-leaderboard-top-1-viewed').length>0 || document.querySelectorAll('body.nav-fix.ad_large_leaderboard-t1-viewed').length>0){ 270 if(el.querySelectorAll('.advert').length>0){ el.querySelectorAll('.advert')[0].style.marginTop = '-'+(parseInt(document.querySelectorAll('.advert')[0].clientHeight))+'px'; } 271 } 272 } 273 if(conflict){ 274 } else if(top>h&&dir=='down'){ 275 if(!document.querySelector('body').classList.contains('nav-fix')){ document.querySelector('body').classList.add('nav-fix'); } 276 } else if(top<=h&&dir=='up'){ 277 if(document.querySelector('body').classList.contains('nav-fix')){ document.querySelector('body').classList.remove('nav-fix'); } 278 } 279 280 document.querySelectorAll('[data-sticky-height]:not(.gpt-hide)').forEach(el=>{ 281 if(el.children.length>0){ 282 el.style.height = el.getAttribute('data-sticky-height')+'px'; 283 for(var i=0;i<el.children.length;i++){ 284 /* el.children[i].style.height = el.getAttribute('data-sticky-height')+'px'; */ 285 el.children[i].style.position='sticky'; 286 el.children[i].style.top=((document.querySelectorAll('.nav-fix header').length>0?parseInt(document.querySelectorAll('.nav-fix header')[0].offsetHeight):0)+10)+'px'; 287 } 288 289 } 290 }); 291 292 window.headerHeight = document.querySelectorAll('header')[0].offsetHeight; 293 if(window.headerHeight>100){ 294 body.classList.add('header-enlarge'); 295 } else { 296 body.classList.remove('header-enlarge'); 297 } 298 }); 299 /* size-ctrl */ 300 document.querySelectorAll('.size-ctrl').forEach(el=>{ 301 var a = (elTop(el)+el.offsetHeight)-window.innerHeight-top; 302 var b = elTop(el)+el.offsetHeight-window.innerHeight; 303 var p = 100-Math.round((a/b)*100); 304 p = (p<0?0:(p>100?100:p)); 305 document.querySelectorAll('.size-ctrl-width').forEach(el=>{ 306 el.style.width=p+'%'; 307 }); 308 if(el.getAttribute('data-time-ctrl')!=null){ 309 var t = el.getAttribute('data-time-ctrl')*60*1000; 310 var r = Math.round(t-(t*(p*0.01))); 311 if(r>0){ 312 var d = new Date(new Date('1979-01-01T00:00:00').getTime()+(r)); 313 document.querySelectorAll('.size-ctrl-time').forEach(elt=>{ 314 elt.innerHTML = d.dateformat('nn:ss'); 315 }); 316 } else { 317 document.querySelectorAll('.size-ctrl-time').innerHTML = ''; 318 } 319 } 320 }); 321 322 document.querySelectorAll('img').forEach(el=>{ 323 if(elTop(el)-top>(window.innerHeight)||(elTop(el)+el.offsetHeight)-top<(window.innerHeight/5)){ 324 el.classList.remove('onview'); 325 } else { 326 el.classList.add('onview'); 327 } 328 }); 329 document.querySelectorAll('.isvisible:not(.viewed)').forEach(el=>{ 330 var v = (el.offsetTop-top-window.innerHeight)+el.offsetHeight; 331 if(v<0){ 332 el.classList.add('viewed'); 333 } 334 }); 335 document.querySelectorAll('[load-on-scroll]:not(.loaded)').forEach(el=>{ 336 if(elTop(el)-top>(window.innerHeight)||(elTop(el)+el.offsetHeight)-top<(window.innerHeight/5)){ } else { 337 var el = el; 338 el.classList.add('loaded'); 339 fetch(el.getAttribute('load-on-scroll'),{}).then(response => response.text()).then(data => { 340 el.innerHTML = data; 341 document.dispatchEvent(new Event('loaded')); 342 ads_kaching.reload(); 343 }); 344 } 345 }); 346} 347window.addEventListener('scroll', window.onscroll()); 348 349/*** call ***/ 350window.urlrewrite = function(u,h){ 351 var h = h || false; 352 if(h){history.pushState(null, null, window.location.href);} 353 window.history.replaceState(null,null,u); 354} 355window.call = function(u,e,d,callback){ 356 var data = d || {}; 357 var element = e || ''; 358 var callback = callback || function(){}; 359 data.noheader = 1; 360 if(element==''){ 361 document.location.href=u; 362 } else { 363 if(element=='#modal'){ 364 window.modal.call(u,'modal',{method:'POST',data:data}); 365 return; 366 } else if(window.cntrlIsPressed){ 367 var win = window.open(u,'_blank'); 368 win.focus(); 369 return; 370 } 371 window.ajax({url:u,method:'POST',data:data},function(r){ 372 if(element=='#modal'){ 373 window.modal.open('modal',r.responseText); 374 } else { 375 document.querySelectorAll('.modal').forEach(el=>{ el.remove(); }); 376 document.querySelectorAll(element)[0].innerHTML = r.responseText; 377 window.urlrewrite(u,true); 378 window.scrollTo(0,0); 379 } 380 document.querySelectorAll(element+' script').forEach(script => { 381 eval(script.innerText); 382 }); 383 setTimeout(function(){ 384 document.dispatchEvent(new Event('loaded')); 385 callback(r.status); 386 },100); 387 }); 388 } 389 return; 390} 391window.modal = { 392 call : function(link,id,options){ 393 var id = id || 'modal'; 394 var options = options || {}; 395 options = Object.assign({ 396 method:'GET', 397 data:{}, 398 cache:true, 399 size:'' 400 },options); 401 var link = link + (options.cache===false?'?'+Date.parse(new Date()):''); 402 var fetchoptions = {method:options.method,redirect:"follow",referrer:"no-referrer"}; 403 if(Object.keys(options.data).length>0||options.method=='POST'){ 404 options.method='POST'; 405 var fdata = new FormData(); 406 for(var d in options.data){ fdata.append(d,options.data[d]); } 407 fetchoptions.body=fdata; 408 } 409 fetch(link,fetchoptions).then(response => response.text()).then(data => { 410 var modal = document.querySelector('#'+id); 411 if(modal==null){ 412 var modal = document.createElement('div'); 413 modal.id = id; 414 modal.innerHTML = '<div></div><div><div><a href="javascript:void(0);" class="close-modal"><i class="icon"></i></a><div class="modal-content"></div></div></div><div></div>'; 415 document.body.appendChild(modal); 416 } 417 modal.querySelector('.modal-content').innerHTML = data; 418 modal.setAttribute('class','modal open'); 419 modal.querySelectorAll('script').forEach(script => { 420 eval(script.innerText); 421 }); 422 document.dispatchEvent(new Event('loaded')); 423 }); 424 }, 425 close : function(id){ 426 document.querySelectorAll('.modal.open').forEach(el=>{ 427 el.classList.remove('open'); 428 }); 429 } 430} 431window.sidebar = { 432 opened : false, 433 uri : '', 434 toggle : function(u){ 435 this.opened = (document.querySelectorAll('body')[0].classList.contains('sidebar-open')); 436 if(this.opened===false||this.uri!=u){ 437 this.open(u); 438 } else { 439 this.close(); 440 } 441 }, 442 open : function(u){ 443 this.uri = u; 444 document.querySelectorAll('#sidebar')[0].innerHTML = ""; 445 fetch(u).then(response => response.text()).then(data => { 446 document.querySelectorAll('#sidebar')[0].innerHTML = data; 447 document.querySelectorAll('body')[0].classList.add('sidebar-open'); 448 document.querySelectorAll('#sidebar script')[0].forEac
448h(script => { 449 eval(script.innerText); 450 }); 451 document.dispatchEvent(new Event('loaded')); 452 }); 453 }, 454 close : function(){ 455 document.querySelectorAll('body')[0].classList.remove('sidebar-open'); 456 } 457}; 458window.addEventListener('popstate', function(e) { 459 if(event.state === null) { 460 event.preventDefault(); 461 return false; 462 } 463 document.location.href=window.location.href; 464}); 465 466window.scrollUntil = function(e,o){ 467 var o = o || 10; 468 if(document.querySelectorAll(e).length>0){ 469 window.scrollTo(0,document.querySelectorAll(e)[0].offsetTop-document.querySelectorAll('header')[0].offsetHeight-o); 470 } 471} 472window.ajax = function(options,callback){ 473 var method = options.method || 'GET'; 474 var data = options.data || {}; 475 var fdata = new FormData(); 476 for(var d in data){ fdata.append(d,data[d]); } 477 var xhttp = new XMLHttpRequest(); 478 xhttp.onreadystatechange = function(){if(this.readyState==4){ callback(this); }}; 479 xhttp.open(method,options.url,true); 480 xhttp.send(fdata); 481} 482 483window.hashCode = function(s){ 484 var h=s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); 485 return (h<0?'a':'b') + Math.abs(h); 486} 487 488window.radio = Object.assign((window.radio || { active : false }),{ 489 init : function(){ 490 if(this.active){ 491 document.querySelectorAll('.place-btn-radio:not(.radioloaded)').forEach(el=>{ 492 var span = document.createElement('span'); 493 span.innerHTML = '<a href="javascript:void(0)" onclick="window.radio.open();" class="btn-radio"><span class="btn btn-c2">LIVE RADIO</span></a>'; 494 el.appendChild(span); 495 el.classList.add('radioloaded'); 496 }); 497 var div = document.createElement('div'); 498 div.classList.add('btn-fly-radio'); 499 div.innerHTML = '<i class="icon"></i>'; 500 div.addEventListener('click',function(){ 501 window.radio.open(); 502 }); 503 document.body.appendChild(div); 504 } 505 }, 506 open : function(options){ 507 window.open('/radioplayer/?' + options,'radio',"toolbar=no,status=no,scrollbars=no,menubar=no,width=400,height=748"); 508 } 509}); 510 511/******************************************************************************************************************/ 512/****************************************************** KA-CHING *******************************************************/ 513var ads_kaching = ads_kaching || {}; 514ads_kaching = { 515 config : window.config.kaching || {}, 516 ititialized : false, 517 slots : [], 518 debugslots : function(){ 519 this.slots.forEach(el => { 520 el._el.style.display = 'block'; 521 el._el.style.position = 'relative'; 522 el._el.style.minWidth = '100px'; 523 el._el.style.minHeight = '50px'; 524 var div = document.createElement('div'); 525 div.style = 'display:grid;align-items:center;position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:rgba(0,255,0,0.5);'; 526 div.innerHTML = '<span style="color:#000;font-size:1em;">'+el._el.getAttribute('id')+'</span>'; 527 el._el.appendChild(div); 528 }); 529 }, 530 init : function(){ 531 if(window.config.kaching.active){ 532 if(window.mmdevice==null){ 533 this.timeout = this.timeout || setTimeout(() => {}, 1000); 534 clearTimeout(this.timeout); 535 this.timeout = setTimeout(() => { 536 ads_kaching.init(); 537 }, 500); 538 return; } 539 if(this.ititialized){ return; } 540 ads_kaching.config = Object.assign({ 541 script : '', 542 adunit : 'businessam', 543 lang : window.locale.split('-')[0].toLowerCase(), 544 page_type : window.config.page.type || 'overview', 545 page_paid : window.config.page.paywall || false, 546 taglist : [] 547 },ads_kaching.config); 548 if(window.config.page.category!=''){ ads_kaching.config.taglist.push(window.config.page.category); } 549 if(window.config.page.post_type!='' && window.config.page.post_type!=window.config.page.category){ ads_kaching.config.taglist.push(window.config.page.post_type); } 550 switch (this.config.page_type){ 551 case 'homepage': 552 case 'home': 553 this.config.page_type = 'home'; 554 break; 555 case 'article': 556 case 'page': 557 case 'author': 558 this.config.page_type = 'detail'; 559 break; 560 default : 561 this.config.page_type = 'overview'; 562 break; 563 } 564 if(this.config.script!=''){ 565 console.log("%c KACHING : INIT","color:#0000FF"); 566 var script = document.createElement("script"); 567 script.type = "text/javascript" 568 script.src = this.config.script + '?v=' + Math.floor((new Date()).getTime()/3600000); 569 script.setAttribute('onload','ads_kaching.loaded();'); 570 document.head.appendChild(script); 571 } 572 document.addEventListener('KaChing.render.init', event => { 573 if(event.detail!=null && event.detail.identifier!=null){ 574 console.log("%c KACHING - RENDER INIT : ","color:#4e7d5b",event.detail); 575 var el = document.getElementById(event.detail.identifier); 576 if(event.detail.isEmpty){ 577 el.style.display = 'none'; 578 } else { 579 el.classList.add('rendered'); 580 /* if(event.detail.size!=null && event.detail.size.length==2){ 581 el.style.width = event.detail.size[0] + 'px'; 582 el.style.height = event.detail.size[1] + 'px'; 583 } */ 584 setTimeout(() => { 585 document.body.classList.add(event.detail.identifier+'-viewed'); 586 }, 3000); 587 } 588 } 589 }); 590 document.addEventListener('KaChing.render.complete', event => { 591 console.log("%c KACHING - RENDER COMPLETE : ","color:#4e7d5b",event.detail); 592 }); 593 } 594 }, 595 loaded : async function(){ 596 console.log("%c KACHING : LOADED","color:#0000FF"); 597 if(typeof kaching=='undefined'){ 598 kaching = new KaChing(); 599 } 600 this.config.settings = { 601 adunit: this.config.adunit, 602 page: { 603 paid: this.config.page_paid, 604 taglist: this.config.taglist, 605 type: this.config.page_type 606 }, 607 platform: (window.mmdevice=='mobile'?'MOB':'WWW'), 608 targeting: { 609 page_type: this.config.page_type, 610 lang: this.config.lang, 611 }, 612 lazyload: { 613 fetchMarginPercent: 25, 614 renderMarginPercent: 10, 615 mobileScaling: 2.0, 616 scatterSlots: true 617 } 618 }; 619 this.checker(); 620 }, 621 checker : async function(){ 622 var kaslots = []; 623 this.kacount = this.kacount || {}; 624 await document.querySelectorAll('[data-kaching]:not(.loaded)').forEach(el=>{ 625 var j = Object.assign({ 626 format : '', 627 position : 't', 628 devices : ['mobile','tab','desktop'] 629 },JSON.parse(el.getAttribute('data-kaching').replace(/[\s]/gi,''))); 630 if(j.devices.includes(window.mmdevice)){
631 ads_kaching.kacount[j.format+'-'+j.position] = (ads_kaching.kacount[j.format+'-'+j.position] || 0) + 1; 632 el.setAttribute('id','ad_' + j.format + '-' + j.position + (j.num || ads_kaching.kacount[j.format+'-'+j.position])); 633 var d = { 634 id : el.getAttribute('id'), 635 format : j.format, 636 position : j.position, 637 num : j.num || ads_kaching.kacount[j.format+'-'+j.position] 638 }; 639 if(j.group!=null&&j.group!=''){ d.group = j.group; } 640 kaslots.push(d); 641 ads_kaching.slots.push(Object.assign(d,{ _el:el, run:false })); 642 el.style.display = 'block'; 643 } else { 644 el.style.display = 'none'; 645 } 646 el.classList.add('loaded'); 647 }); 648 649 if(kaslots.length>0){ 650 var init = false; 651 for(var k of ads_kaching.slots) { 652 if(k.run==false){ 653 kaching.defineSlot(k.format,k.position+k.num); 654 console.log("%c KACHING - LOAD SLOT : " + k.format + '-' + k.position + k.num,"color:#4e7d5b"); 655 k.run = true; 656 init = true; 657 } 658 } 659 if(init){ 660 if(this.ititialized){ 661 kaching.init(); 662 } else { 663 kaching.init(this.config.settings).then(() => { setTimeout(() => { 664 if(document.location.search.search(/debugslots/gi)>=0){ ads_kaching.debugslots(); } 665 }, 1000); }); 666 this.ititialized = true; 667 console.log("%c KACHING - INIT","color:#4e7d5b"); 668 } 669 } 670 } 671 }, 672 reload : function(){ 673 if(window.config.kaching.active){ 674 this.loaded(); 675 } 676 } 677} 678 679/******************************************************************************************************************/ 680/****************************************************** DMP / Cxsens *******************************************************/ 681var ads_dmp = ads_dmp || {}; 682ads_dmp = { 683 config : window.config.dmp || { script : '' }, 684 ititialized : false, 685 init : function(){ 686 if(this.config.script!=''){ 687 console.log("%c ADS : DMP : INIT","color:#0000FF"); 688 var script = document.createElement("script"); 689 script.type = "text/javascript" 690 script.src = this.config.script /* + '?v=' + Math.floor((new Date()).getTime()/3600000) */; 691 script.setAttribute('onload','ads_dmp.loaded();'); 692 document.head.appendChild(script); 693 } 694 }, 695 loaded : function(){ 696 console.log("%c ADS : DMP : LOADED","color:#0000FF"); 697 this.ititialized = true; 698 } 699} 700ads_dmp.init(); 701 702/******************************************************************************************************************/ 703/************************************************ CONSENT CHOISE **************************************************/ 704window.googlefc = window.googlefc || {}; 705if(window.config.gfc.disabled){ ads_kaching.init(); } else { 706 window.googlefc.ccpa = window.googlefc.ccpa || {} 707 window.googlefc.callbackQueue = window.googlefc.callbackQueue || []; 708 window.bam_consent = 'EXTENSION_LEVEL_AD_BLOCKER'; 709 dataLayer = window.dataLayer || []; 710 googlefc.callbackQueue.push({ 711 'CONSENT_DATA_READY': 712 () => { 713 switch (googlefc.getConsentStatus()) { 714 case googlefc.ConsentStatusEnum.CONSENTED_TO_PERSONALIZED_ADS: 715 case googlefc.ConsentStatusEnum.CONSENTED_TO_NON_PERSONALIZED_ADS: 716 case googlefc.ConsentStatusEnum.CONSENT_NOT_REQUIRED: 717 case googlefc.ConsentStatusEnum.UNKNOWN: 718 console.log('%c CONSENTED OK', 'color: #0884f4'); 719 window.bam_consent = 'NO_AD_BLOCKER'; 720 document.body.classList.remove('adblock'); 721 document.querySelectorAll('[type="googlefc/javascript"][data-vendor]').forEach(el=>{ 722 el.type="text/javascript"; 723 el.src=el.src; 724 }); 725 dataLayer.push({'googlefc_status': 'active','event': 'googlefc'});
726 ads_kaching.init(); 727 break; 728 case googlefc.ConsentStatusEnum.NO_CONSENT: 729 // Donât load ads. 730 console.log('%c NO_CONSENT', 'color: #0884f4'); 731 document.body.classList.add('adblock'); 732 break; 733 } 734 } 735 }); 736} 737/* if(document.cookies.get('fastly_bot')==0&&document.cookies.get('fastly_geo_continent')=='EU'){} */ 738/******************************************************************************************************************/ 739/****************************************************** ADS *******************************************************/ 740var googletag = googletag || {}; 741googletag.cmd = googletag.cmd || []; 742googletag.slots = {}; 743googletag.custom = { 744 init : function(){ 745 for(s in googletag.slots){ 746 googletag.slots[s]['viewed'] = 0; 747 googletag.slots[s]['offset_top'] = elTop(document.getElementById(s)); 748 document.getElementById(s).classList.add('gpt-hide'); 749 } 750 window.addEventListener('scroll',function(){ 751 googletag.custom.verify(); 752 }); 753 setTimeout(() => { 754 googletag.custom.verify(); 755 }, 500); 756 }, 757 verify : function(){ 758 var pos = window.pageYOffset || document.documentElement.scrollTop; 759 pos = pos+window.innerHeight; 760 for(s in googletag.slots){ 761 if(googletag.slots[s]['viewed']==0){ 762 var ot = elTop(googletag.slots[s].el); 763 if(ot>200){ 764 googletag.slots[s]['offset_top'] = ot; 765 } 766 if(googletag.slots[s]['offset_top']<=pos){ 767 googletag.pubads().refresh([googletag.slots[s]], {changeCorrelator:false}); 768 googletag.slots[s]['viewed'] = 1; 769 } 770 } 771 } 772 }, 773 viewed : function(e){ 774 var s = e.slot.getSlotElementId(); 775 console.log("%c ADS : GAM : " + s + " viewed","color:#0000FF"); 776 setTimeout(function(){ 777 if(e.slot.el!=null){e.slot.el.classList.add('viewed');} 778 document.body.classList.add(s+'-viewed'); 779 },1000); 780 }, 781 rendered : function(e){ 782 var s = e.slot.getSlotElementId(); 783 if(!e.isEmpty){ 784 document.getElementById(s).classList.remove('gpt-hide'); 785 console.log("%c ADS : GAM : " + s + " rendered ("+e.campaignId+")","color:#4e7d5b"); 786 } else { 787 console.log("%c ADS : GAM : " + s + " rendered ("+e.campaignId+")","color:#0000FF"); 788 } 789 } 790} 791googletag.cmd.push(function() { 792 if(window.config.gpt.active){ 793 document.querySelectorAll('[data-googletag]').forEach(el=>{ 794 try { 795 var j = JSON.parse(el.getAttribute('data-googletag').replace(/[\s]/gi,'').replace(/\[\[\"fluid\"\]\]/gi,'["fluid"]')); 796 j.path = j.path || ''; 797 j.path=(j.path.search(/^\//gi)==-1?window.config.gpt.path:'')+j.path; 798 var options = Object.assign({ 799 id:el.id, 800 path:'', 801 desktop:[], 802 tab:[], 803 mobile:[], 804 targeting:[] 805 },j); 806 if(window.mmdevice=='desktop' && options.desktop.length==0){ el.remove(); return; } 807 if(window.mmdevice=='tab' && options.tab.length==0){ el.remove(); return; } 808 if(window.mmdevice=='mobile' && options.mobile.length==0){ el.remove(); return; } 809 if(window.config.page.type!=null && window.config.page.type=='homepage'){ 810 options.targeting.push({name:'HOMEPAGE',value:'Ja'}); 811 } else { 812 options.targeting.push({name:'HOMEPAGE',value:'Nee'}); 813 } 814 options.targeting.push({name:'dns',value:window.location.host}); 815 var sizemap = googletag.sizeMapping(). 816 addSize([1000,1],options.desktop). 817 addSize([866,1],options.tab). 818 addSize([0,0],options.mobile). 819 build(); 820 googletag.slots[options.id] = googletag.defineSlot(options.path,options.desktop.concat(options.tab).concat(options.mobile), options.id).defineSizeMapping(sizemap).addService(googletag.pubads()).setCollapseEmptyDiv(true); 821 googletag.slots[options.id].el = el; 822 for(var t in options.targeting){ 823 googletag.slots[options.id].setTargeting(options.targeting[t].name,options.targeting[t].value); 824 } 825 console.log("%c ADS : GAM : " + options.id + " loaded","color:#0000FF"); 826 } catch(err){ 827 console.log("%c ADS : GAM : " + el.id + " error","color:#FF0000"); 828 console.log(err,options,sizemap,options.path,options.desktop.concat(options.tab).concat(options.mobile)) 829 /* el.remove(); */ 830 }; 831 }); 832 833 googletag.pubads().setTargeting("dns",window.location.host); 834 if(window.config.page.type!=null && window.config.page.type=='homepage'){ 835 googletag.pubads().setTargeting('HOMEPAGE','Ja'); 836 } else { 837 googletag.pubads().setTargeting('HOMEPAGE','Nee'); 838 }
839 try {googletag.pubads().getTargetingKeys().forEach(x=>{ 840 console.log("%c ADS : GAM : TARGET : '" + x + "' : " + googletag.pubads().getTargeting(x).join('/'),"color:#0000FF"); 841 });} catch(err){}; 842 843 /*+++++ cXense +++++*/ 844 var cX = cX || null; 845 if(cX!=null&&cX.getUserSegmentIdsLocal!=null){ 846 googletag.pubads().setTargeting("CxSegments",cX.getUserSegmentIdsLocal()); 847 } else { 848 var segments = []; 849 if(typeof window.localStorage === 'object' && typeof window.localStorage.getItem === 'function' && localStorage.getItem("cxSegments") !== null && localStorage.getItem("cxSegments").length>0) { 850 segments = localStorage.getItem("cxSegments").split(','); 851 } 852 googletag.pubads().setTargeting("CxSegments",segments); 853 } 854 855 if(window.disableads===true){ } else { 856 googletag.pubads().addEventListener('impressionViewable',function(event){ 857 googletag.custom.viewed(event); 858 }); 859 860 googletag.pubads().addEventListener('slotRenderEnded', function(event) { 861 googletag.custom.rendered(event); 862 }); 863 googletag.pubads().enableSingleRequest(); 864 googletag.pubads().enableLazyLoad({ 865 fetchMarginPercent: 25, 866 renderMarginPercent: 10, 867 mobileScaling: 2.0 868 }); 869 googletag.pubads().disableInitialLoad(); 870 googletag.enableServices(); 871 872 googletag.custom.init(); 873 } 874 } 875}); 876 877 878 879oauth = { 880 data : {}, 881 call : function(action,callback){ 882 var callback = callback || function(){}; 883 fetch('/oauth/call.php?action=' + action + '&access_token='
883+ oauth.data.token + '&tl='+new Date().getTime(),{method:"GET",redirect:"follow",referrer:"no-referrer"}).then(response => response.json()).then(res => { callback(res); }); 884 }, 885 connect : function(redirect){ 886 var redirect = redirect || document.location.href; 887 document.location.href=window.config.oauth.portal + '/oauth/authorize?client_id=' + window.config.oauth.client_id + '&scope=&redirect_uri=' + document.location.origin + '/oauth/callback.php&response_type=code&state=' + redirect; 888 }, 889 disconnect : function(redirect){ 890 var redirect = redirect || ''; 891 this.call('disconnect',function(res){ oauth.load(); if(redirect!=''){ document.location.href=redirect; } }); 892 }, 893 reload : function(noload){ 894 var noload = noload || false; 895 oauth.data.token = document.cookies.get('BAM_TOKEN'); 896 if(oauth.data.token==null){ oauth.data = { connected : false, token : '', user : { products:[] }, renew : 0 }; } else { 897 this.call('reload',function(res){ oauth.data = Object.assign(oauth.data,res.data); document.dispatchEvent(new Event('oauth_reloaded')); console.log('%c USER OAUTH : reload', 'color: #1BB9A9'); if(!noload){ oauth.load(); } }); 898 } 899 }, 900 access : function(value,secure,field){ 901 var r = false, field = field || 'slug', value = value || null, secure = secure || false; 902 if(secure){ oauth.reload(); } 903 if(value=='connected'){ return oauth.data.connected; }; 904 if(oauth.data.connected==true&&oauth.data.user.products.length>0&&field!=null){ 905 var reg = new RegExp(value,'gi'); 906 oauth.data.user.products.forEach(el => { 907 if(el[field]!=null){ 908 if(el[field].search(reg)>=0){ /* console.log(el[field]); */ r=true; } 909 } 910 }); 911 } 912 return r; 913 }, 914 use_freemium : function(id){ 915 var id = String(id || ''); 916 if(oauth.access('wordpress-' + window.locale.split('-')[0] + '-premium',1)){ 917 return; 918 } 919 if(oauth.access('wordpress-' + window.locale.split('-')[0] + '-freemium.*?') && id!=''){ 920 window.config.freemium_quota = window.config.freemium_quota || 3; 921 var quota = (window.config.freemium_quota>0?window.config.freemium_quota:3); 922 for(var i of oauth.data.user.products){ 923 if(i.slug!=null && i.slug.search(new RegExp('wordpress-' + window.locale.split('-')[0] + '-freemium.*?','gi'))>=0){ 924 var x = i.slug.replace(/.*?p([0-9]+).*?/gi,'$1'); 925 if(x.search(/^[0-9]+$/gi)>=0){ 926 quota = parseInt(x); 927 } 928 } 929 } 930 var access = false; 931 var now = new Date(); 932 var thisMonth = new Date(now.getFullYear(),now.getMonth(), 1).getTime(); 933 var s = localStorage.getItem('bam_freemium_date'); 934 if(!s || (new Date(parseInt(s))).getTime() < thisMonth){ 935 localStorage.setItem('bam_freemium_ids', id); 936 localStorage.setItem('bam_freemium_date', thisMonth); 937 access = true; 938 } else { 939 var ids = localStorage.getItem('bam_freemium_ids').split(','); 940 for(var i of ids){ 941 if(String(i)==String(id)){ 942 access = true; 943 } 944 } 945 if(!access && ids.length<quota){ 946 ids.push(id); 947 localStorage.setItem('bam_freemium_ids',ids); 948 access = true; 949 } 950 } 951 var rest = (quota-localStorage.getItem('bam_freemium_ids').split(',').length); 952 rest = (rest>=0?rest:0); 953 document.body.setAttribute('data-freemium','yes'); 954 document.body.setAttribute('data-freemium-access','yes'); 955 document.body.setAttribute('data-freemium-rest',rest); 956 document.dispatchEvent(new CustomEvent('freemium-loaded', { detail: { active : true, access : access, rest : rest } })); 957 return { access : access, rest : rest }; 958 } else { 959 return { access : false, rest : 0 } 960 } 961 }, 962 load : function(){ 963 oauth.data = { connected : false, token : '', user : { products:[] }, renew : 0, updated : 0 }; 964 if(document.cookies.get('BAM_DATA')!=null&&document.cookies.get('BAM_DATA')!='undefined'){ 965 oauth.data = Object.assign(oauth.data,document.cookies.get('BAM_DATA',true)); 966 oauth.data.connected = true; 967 oauth.data.token = document.cookies.get('BAM_TOKEN'); 968 } 969 if(oauth.data.token==null){ oauth.data.connected=false; } 970 if(document.location.href.search(/bam_user_reload/)>=0){ 971 document.cookies.set('BAM_USER_RELOAD',1,365); 972 } 973 if((oauth.data.renew>100000&&(oauth.data.renew*1000)<new Date().getTime())||document.cookies.get('BAM_USER_RELOAD')!=null){ 974 oauth.reload(true); 975 } 976 document.querySelectorAll('[data-oauth-access]').forEach(el => { 977 var a = el.getAttribute('data-oauth-access'); 978 var s = el.getAttribute('data-oauth-secure'); 979 var v = el.getAttribute('data-oauth-value'); 980 v = (v=='0'?false:true); 981 var r = false;
982 r=oauth.access(a,s)==v; 983 if(r==true){ el.classList.add('auth-display'); } else { el.classList.remove('auth-display'); } 984 }); 985 document.dispatchEvent(new Event('oauth_loaded')); 986 console.log('%c USER OAUTH : load', 'color: #1BB9A9'); 987 988 if(document.location.href.search(/refresh_profile/gi)>=0 && document.cookies.get('BAM_PAGE')!=null && document.cookies.get('BAM_PAGE')!='' && document.cookies.get('BAM_PAGE')!=document.location.href){ 989 /* fetch(window.config.oauth.portal + '/oauth/authorize?client_id=' + window.config.oauth.client_id + '&scope=&redirect_uri=' + document.location.origin + '/oauth/callback.php&response_type=code&state=' + document.location.origin,{method:"GET",redirect:"follow"}).then(res => { 990 document.location.href = document.cookies.get('BAM_PAGE'); 991 }); */ 992 oauth.connect(document.cookies.get('BAM_PAGE')); 993 } 994 995 // Refresh JS 996 var articlepremium = document.querySelector('article.premium'); 997 // Use querySelectorAll() to get all script elements within the <article> 998 if (articlepremium !== null) { 999 var scripts = articlepremium.querySelectorAll('script[async]'); 1000 // Use a for loop to iterate through the scripts and log each one to the console 1001 for (var i = 0; i < scripts.length; i++) { 1002 var script = scripts[i]; 1003 //console.log(script.src); 1004 const script_paywall = document.createElement("script"); 1005 script_paywall.type = "text/javascript" 1006 script_paywall.src = script.src 1007 document.head.appendChild(script_paywall) 1008 eval(script_paywall) 1009 } 1010 } 1011 document.cookies.set('BAM_PAGE',document.location.href.replace(/(&|\?)?refresh_profile=.*/gi,''),365); 1012 window.dispatchEvent(new Event('oauth_changed')); 1013 } 1014} 1015class bam_modal { 1016 constructor (selector,opts){ 1017 var opts = opts || {}; 1018 this.options = opts; 1019 this.selector = selector; 1020 this.selector.close = this.close; 1021 this.selector.open = this.open; 1022 this.selector.querySelectorAll('.modal-close').forEach(el => { 1023 el.addEventListener('click',function(){ 1024 this.closest('.modal').close(); 1025 }); 1026 }); 1027 this.selector.addEventListener('click',function(e){ 1028 if(e.target.classList.contains('modal')){ 1029 this.close(); 1030 } 1031 }); 1032 this.selector.classList.add('loaded'); 1033 } 1034 close (){ 1035 this.classList.remove('open'); 1036 } 1037 open () { 1038 this.classList.add('open'); 1039 } 1040}; 1041 1042/**** BREAKINGNEWS ****/ 1043breakingnews = { 1044 params : { active:true, ma:0, begin:0, items:[], lastactivity:0 }, 1045 init : async function(){ 1046 var go = true; 1047 var disabled = document.cookies.get('BAM_BREAKINGNEWS_DISABLED'); 1048 if(disabled>0){ 1049 go = false; 1050 var response = await fetch('/api/breakingnews/index.php?locale=' + window.locale,{method:"GET",redirect:"follow",referrer:"no-referrer"}); 1051 var res = await response.json(); 1052 if(res!=null&&res.length>0){ 1053 var items = res; 1054 for(var i=0;i<items.length;i++){ 1055 if(new Date(items[i].createdat).getTime()>this.params.lastactivity){ 1056 if(parseInt(disabled)<new Date(items[i].createdat).getTime()){ 1057 document.cookies.set('BAM_BREAKINGNEWS_DISABLED',0,-1); 1058 setInterval(() => { 1059 breakingnews.load(); 1060 },3000); 1061 breakingnews.load(this.reset(breakingnews.move())); 1062 go = true; 1063 } 1064 } 1065 } 1066 } 1067 } 1068 if(go){ 1069 setInterval(() => { 1070 breakingnews.load(); 1071 },3000); 1072 breakingnews.load(this.reset(breakingnews.move())); 1073 } 1074 }, 1075 compare : function(a,id){ 1076 var r = false;
1077 for(var i=0;i<a.length;i++){ 1078 if(a[i].tweetid==id){ r=true; } 1079 } 1080 return r; 1081 }, 1082 load : async function(callback){ 1083 var callback = callback || function(){}; 1084 if(this.params.active){ 1085 var response = await fetch('/api/breakingnews/index.php?locale=' + window.locale,{method:"GET",redirect:"follow",referrer:"no-referrer"}); 1086 var res = await response.json(); 1087 if(res!=null&&res.length>0){ 1088 var items = res; 1089 if(this.params.items.length==0){ 1090 for(var i=0;i<items.length;i++){ 1091 this.params.items.push(Object.assign(items[i],{'action':'add'})); 1092 } 1093 } else { 1094 for(var i=0;i<items.length;i++){ 1095 if(!this.compare(this.params.items,items[i].tweetid)){ 1096 this.params.items.push(Object.assign(items[i],{'action':'add'})); 1097 } 1098 } 1099 for(var i=0;i<this.params.items.length;i++){ 1100 if(!this.compare(items,this.params.items[i].tweetid)){ 1101 this.params.items[i].action = 'remove'; 1102 } 1103 } 1104 var d=0; 1105 for(var i=this.params.items.length-1;i>=0;i--){ 1106 if(this.params.items[i].action == 'remove'){ 1107 this.params.items.splice(i,1); 1108 } 1109 } 1110 } 1111 for(var i=0;i<items.length;i++){ 1112 if(new Date(items[i].createdat).getTime()>this.params.lastactivity){ 1113 this.params.lastactivity=new Date(items[i].createdat).getTime(); 1114 } 1115 } 1116 document.body.classList.add('breakingnews'); 1117 callback(); 1118 } else { 1119 document.body.classList.remove('breakingnews'); 1120 } 1121 /* console.log(this.params); */ 1122 } 1123 }, 1124 reset : function(callback){ 1125 var callback = callback || function(){}; 1126 if(document.querySelectorAll('#breakingnews').length==0){ 1127 var selector = document.createElement('div'); 1128 selector.setAttribute('id','breakingnews'); 1129 document.body.appendChild(selector); 1130 this.params.selector = document.querySelectorAll('#breakingnews')[0]; 1131 this.params.selector.style.paddingLeft = /* (this.params.selector.offsetWidth/2) +*/'1em'; 1132 var close = document.createElement('span'); 1133 close.classList.add('close'); 1134 close.addEventListener('click',function(e){ 1135 breakingnews.params.active=false; 1136 document.body.classList.remove('breakingnews'); 1137 document.cookies.set('BAM_BREAKINGNEWS_DISABLED',breakingnews.params.lastactivity,1); 1138 }); 1139 this.params.selector.appendChild(close); 1140 } 1141 if(document.querySelectorAll('#breakingnews>div').length>0){ 1142 this.params.selector.remove(); 1143 } 1144 var scroller = document.createElement('div'); 1145 this.params.selector.appendChild(scroller); 1146 this.params.scroller = scroller; 1147 this.params.begin=0; 1148 this.params.ma=0; 1149 callback(); 1150 }, 1151 move : function(){ 1152 if(this.params.scroller!=null&&this.params.active){ 1153 this.params.ma=this.params.ma+30; 1154 this.params.scroller.style.marginLeft=(-this.params.ma)+'px'; 1155 for(var i=this.params.begin;i<this.params.items.length+this.params.begin;i++){ 1156 if(this.params.scroller.offsetWidth-this.params.ma<this.params.selector.offsetWidth){ 1157 this.params.begin=i; 1158 if(this.params.begin>=this.params.items.length){ 1159 this.params.begin=0; 1160 } 1161 var j=this.params.begin; 1162 var item = document.createElement('div'); 1163 //item.innerHTML = '<a href="' + this.params.items[j].link + '" target="_blank">' + this.params.items[j].text + '</a>'; 1164 item.innerHTML = '<a href="/">' + this.params.items[j].text + '</a>'; 1165 this.params.scroller.appendChild(item); 1166 this.params.begin++; 1167 } 1168 } 1169 if(this.params.ma>20000){ 1170 this.reset(); 1171 } 1172 } 1173 setTimeout(() => { 1174 breakingnews.move(); 1175 }, 1000); 1176 1177 } 1178}; 1179/******************************************************************************************************************/ 1180/****************************************************** LOAD ******************************************************/ 1181document.addEventListener('loaded',function(e){ 1182 if(!oauth.initialized){ oauth.load(); oauth.initialized=true; }; 1183 window.dispatchEvent(new Event('checksize')); 1184 window.addEventListener('resize',function(e){ 1185 window.dispatchEvent(new Event('checksize')); 1186 }); 1187 window.cntrlIsPressed = false;
1188 document.addEventListener('keydown',function(e){ window.cntrlIsPressed = (event.which=="17"); }); 1189 document.addEventListener('keyup',function(e){ window.cntrlIsPressed = false;}); 1190 document.addEventListener('click',function(e){ 1191 document.dispatchEvent(new CustomEvent('click_target',{'detail':e.target})); 1192 }); 1193 window.onscroll(); 1194 1195 //mk_utils.favorites.update(); 1196 /* document.querySelectorAll('.wrap-title').forEach(el=>{ 1197 el.setAttribute('style','white-space:nowrap;position: absolute;'); 1198 el.parentElement.style.display = 'block'; 1199 var max = el.parentElement.offsetWidth; 1200 var tx = el.textContent; 1201 var w = tx.split(' '); 1202 var r = []; 1203 var line = 0; 1204 el.innerHTML=''; 1205 for(var i=0;i<w.length;i++){ 1206 el.textContent = el.textContent + ' ' + w[i]; 1207 if(el.offsetWidth>max){ 1208 line++; 1209 el.textContent=''; 1210 } 1211 r[line] = r[line] || ''; 1212 r[line] += ' ' + w[i]; 1213 } 1214 el.innerHTML=''; 1215 for(var i=0;i<r.length;i++){ 1216 el.innerHTML += '<p>'+r[i]+'</p>'; 1217 var fStart = 10; 1218 for(var s=0;s<2;s++){ 1219 fStart++; 1220 el.lastElementChild.style.fontSize=fStart/10+'em'; 1221 if(el.lastElementChild.offsetWidth>max){ 1222 el.lastElementChild.style.fontSize=(fStart-1)/10+'em'; 1223 break; 1224 } 1225 } 1226 var fStart = 10; 1227 for(var s=0;s<2;s++){ 1228 fStart--; 1229 if(el.lastElementChild.offsetWidth>max){ 1230 el.lastElementChild.style.fontSize=(fStart-1)/10+'em'; 1231 } 1232 } 1233 } 1234 console.log(r); 1235 el.setAttribute('style',''); 1236 }); */ 1237 /* IMAGE */ 1238 document.querySelectorAll('[data-figure]:not(.loaded)').forEach(el=>{ 1239 var u = el.getAttribute('data-figure'); 1240 u = u.replace(/^.*?businessam.be\/media\//gi,'https://media.businessam.be/'); 1241 u = u.replace(/-scaled\./gi,'.'); 1242 var s = [el.offsetWidth,el.offsetHeight]; 1243 var sizes = { 1244 'def':s[0], 1245 'x1':s[0], 1246 'x2':Math.round(s[0]*1.5), 1247 'x4':Math.round(s[0]*2) 1248 }; 1249 /* var sizes = [] */ 1250 if(s[0]<=100){ 1251 sizes = { 'def':100, 'x1':100, 'x2':300, 'x4':600 }; 1252 } else if(s[0]<=300){ 1253 sizes = { 'def':300, 'x1':300, 'x2':600, 'x4':900 }; 1254 } else if(s[0]<=600){ 1255 sizes = { 'def':300, 'x1':600, 'x2':900, 'x4':1200 }; 1256 } else if(s[0]<=900){ 1257 sizes = { 'def':300, 'x1':900, 'x2':1200, 'x4':1200 }; 1258 } else if(s[0]>900){ 1259 sizes = { 'def':300, 'x1':1200, 'x2':1200, 'x4':1200 }; 1260 } 1261 /* s[0] = Math.ceil(s[0]/100)*100; */ 1262 var ratio = el.getAttribute('data-ratio'); 1263 var alt = el.getAttribute('data-alt'); 1264 var watermark = el.getAttribute('data-watermark'); 1265 if(s[0]<=200){ ratio = '1:1'; } 1266 if(ratio!=null){ 1267 rat = ratio.split(':'); 1268 s[1] = Math.round(s[0]*((rat[1]/rat[0]))); 1269 } 1270 var c = el.getAttribute('data-caption'); 1271 var figure = document.createElement('figure'); 1272 if(ratio!=null){ figure.setAttribute('style','width:100%;aspect-ratio:' + ratio.replace(/:/gi,'/')); } 1273 /* figure.setAttribute('style','aspect-ratio:' + ratio); 1274 if(ratio!=null){ figure.style.aspectRatio = ratio; } */ 1275 /* figure.style.width = s[0]+'px'; 1276 figure.style.height = s[1]+'px'; 1277 figure.style.overflow = 'hidden'; */ 1278 var img = document.createElement('img'); 1279 if(ratio!=null){ img.setAttribute('style','aspect-ratio:' + ratio.replace(/:/gi,'/')); } 1280 /*img.setAttribute('src',u+'?quality=50&width='+(s[0])+'&height='+(s[1])+(ratio!=null?'aspect_ratio='+ratio:'')); 1281 img.setAttribute('srcset',u+'?quality=50&width='+(s[0])+'&height='+(s[1])+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 1x, ' + u+'?width='+Math.round(s[0]*1.5)+'&height='+Math.round(s[1]*1.5)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 2x, ' + u+'?width='+(s[0]*2)+'&height='+(s[1]*2)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 4x'); */ 1282 /* 800 - */ 1283 img.setAttribute('src',u+'?auto_optimize=low&width='+(sizes.def)+(ratio!=null?'&aspect_ratio='+ratio:'')); 1284 //img.setAttribute('srcset',u+'?auto_optimize=low&width='+(sizes.x1)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 1x, ' + u+'?auto_optimize=low&width='+(sizes.x2)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 2x, ' + u+'?auto_optimize=low&width='+(sizes.x4)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 4x');/* */ 1285 if (watermark == 'video' || watermark == 'audio') { 1286 img.setAttribute('srcset',u+'?class=bamfigure1xplay 1x, ' + u+'?class=bamfigure2xplay 2x, ' + u+'?class=bamfigure4xplay 4x');/* */ 1287 } else { 1288 img.setAttribute('srcset',u+'?auto_optimize=low&width='+(sizes.x1)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 1x, ' + u+'?auto_optimize=low&width='+(sizes.x2)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 2x, ' + u+'?auto_optimize=low&width='+(sizes.x4)+(ratio!=null?'&aspect_ratio='+ratio:'') + ' 4x');/* */ 1289 } 1290 img.setAttribute('width',s[0]); 1291 img.setAttribute('height',s[1]); 1292 if(el.getAttribute('data-lazy')!='false'){ 1293 img.setAttribute('loading','lazy'); 1294 } else { 1295 img.setAttribute('loading','eager'); 1296 } 1297 if(alt!=null&&alt!=''){ img.setAttribute('alt',alt); } 1298 el.classList.add('loaded'); 1299 figure.appendChild(img); 1300 if(c!=null&&c!=''){ 1301 var figcaption = document.createElement('figcaption'); 1302 figcaption.innerHTML = c; 1303 figure.appendChild(figcaption); 1304 } 1305 /* console.log(sizes,figure); */ 1306 el.replaceWith(figure); 1307 }); 1308 1309 document.querySelectorAll('.currentdatetime:not(.loaded)').forEach(el=>{ 1310 var timer = function(){ 1311 var d = new Date().dateformat('dddd d mmmm yyyy'); 1312 var t = new Date().dateformat('hh:nn'); 1313 el.innerHTML = d+' - '+t; 1314 } 1315 setInterval(() => {timer();}, 30000); 1316 timer(); 1317 el.classList.add('loaded'); 1318 }); 1319 document.querySelectorAll('[data-datestring]:not(.loaded)').forEach(el=>{ 1320 var d = el.getAttribute('data-datestring').parsedate().dateformat('dddd d mmmm yyyy'); 1321 el.innerHTML = d; 1322 el.classList.add('loaded'); 1323 }); 1324 document.querySelectorAll('[data-timestring]:not(.loaded)').forEach(el=>{ 1325 var d = el.getAttribute('data-timestring').parsedate().dateformat('hh:nn'); 1326 el.innerHTML = d; 1327 el.classList.add('loaded'); 1328 }); 1329 document.querySelectorAll('[data-datewhen]:not(.loaded)').forEach(el=>{ 1330 var locale = window.locale; 1331 var d = el.getAttribute('data-datewhen').parsedate(); 1332 var diff = Math.round(Math.abs(d.getTime()-new Date().getTime())/60000); 1333 var diff_h = Math.round(diff/60); 1334 var r = d; 1335 if(diff_h<1){ 1336 r = (locale=='fr-BE'?'Il y a ' + diff + 'min':diff + ' min geleden' ); 1337 } else if(diff_h<24){ 1338 r = (locale=='fr-BE'?'Il y a ' + diff_h + 'h':diff_h + ' uur geleden' ); 1339 } else if(diff_h<48){ 1340 r = (locale=='fr-BE'?'Hier à ' + d.getHours() + 'h':'Gisteren om ' + d.getHours() + ' uur'); 1341 } else if(diff_h<(14*24)){ 1342 r = (locale=='fr-BE'?'Il y a ' + Math.floor(diff_h/24) + 'j':Math.floor(diff_h/24) + ' dagen geleden'); 1343 } else if(diff_h<(31*24)){ 1344 r = (locale=='fr-BE'?'Il y a ' + Math.floor(diff_h/(7*24)) + ' sem.':Math.floor(diff_h/(7*24)) + ' weken geleden'); 1345 } else if(diff_h>(31*24)){ 1346 r = '';
1347 r = d.toLocaleString('default', { month: 'long' }) + ' ' + d.getFullYear(); 1348 } else { 1349 r = d.getFullYear(); 1350 } 1351 el.innerHTML = r; 1352 el.classList.add('loaded'); 1353 }); 1354 1355 document.querySelectorAll('.social:not(.loaded)').forEach(el=>{ 1356 var r = ''; 1357 r += '<span class="social-items">'; 1358 r += '<a href="javascript:void(0);" data-share="fb" class="icos_social-fb"></a>'; 1359 r += '<a href="javascript:void(0);" data-share="linkedin" class="icos_social-in"></a>'; 1360 r += '<a href="javascript:void(0);" data-share="twitter" class="icos_social-twitter"></a>'; 1361 //r += '<a href="javascript:void(0);" data-share="messenger" class="icos_social-messenger"></a>'; 1362 r += '<a href="javascript:void(0);" data-share="whatsapp" class="icos_social-whatsapp"></a>'; 1363 //r += '<a href="javascript:void(0);" data-share="pinterest" class="icos_social-pinterest"></a>'; 1364 //r += '<a href="javascript:void(0);" data-share="sms" class="icos_social-sms"></a>'; 1365 r += '</span>'; 1366 /* r += '<span class="social-toggle" style="background: var(--b4);"><i class="icon"></i></span>'; */ 1367 el.innerHTML = r; 1368 el.classList.add('loaded'); 1369 }); 1370 /*** nav ***/ 1371 document.querySelectorAll('[data-body-toggle]:not(.loaded)').forEach(el => { 1372 el.addEventListener('click',function(){ 1373 var active = document.querySelectorAll('body')[0].classList.contains(el.getAttribute('data-body-toggle')); 1374 document.querySelectorAll('body')[0].classList.remove('nav-open'); 1375 document.querySelectorAll('body')[0].classList.remove('users-open'); 1376 document.querySelectorAll('body')[0].classList.remove('search-open'); 1377 if(!active){ 1378 document.querySelectorAll('body')[0].classList.toggle(el.getAttribute('data-body-toggle')); 1379 } 1380 if(el.getAttribute('data-body-toggle')=='search-open'){ 1381 setTimeout(() => { document.querySelectorAll('.search input')[0].click(); document.querySelectorAll('.search input')[0].select(); document.querySelectorAll('.search input')[0].focus(); }, 100); 1382 } 1383 }); 1384 el.classList.add('loaded'); 1385 }); 1386 /*** tab ***/ 1387 document.querySelectorAll('.box-tab-nav [data-tab]:not(.loaded)').forEach(el => { 1388 el.addEventListener('click',function(e){ 1389 this.closest('.box-tab').querySelectorAll('.box-tab-contents [data-tab]').forEach(el2 => { el2.classList.remove('active'); }); 1390 this.closest('.box-tab').querySelectorAll('[data-tab="' + this.getAttribute('data-tab') + '"]').forEach(el2 => { el2.classList.add('active'); }); 1391 this.closest('.box-tab-nav').querySelectorAll('[data-tab]').forEach(el2 => { el2.classList.remove('active'); }); 1392 this.classList.add('active'); 1393 }); 1394 el.classList.add('loaded'); 1395 }); 1396 /*** href ***/ 1397 document.querySelectorAll('[href][data-call]:not([data-url])').forEach(el => { 1398 el.setAttribute('data-url',el.getAttribute('href')); 1399 el.setAttribute('href','javascript:void(0);'); 1400 el.addEventListener('click',function(e){ 1401 window.call(this.getAttribute('data-url'),this.getAttribute('data-call')); 1402 e.preventDefault(); 1403 }); 1404 }); 1405 if(window.mmdevice=='mobile'){ 1406 document.querySelectorAll('[data-move-mobile]').forEach(el => { 1407 document.querySelectorAll(el.getAttribute('data-move-mobile')).forEach(el2 => { 1408 el.append(el2); 1409 }); 1410 }); 1411 } 1412 /*** data crop ***/ 1413 document.querySelectorAll('[data-crop]:not(.loaded)').forEach(el => { 1414 var t = el.textContent; 1415 el.innerHTML = t.replace(new RegExp('^((.){'+el.getAttribute('data-crop')+'}[^\\s\\b\\!\\?\\.]+).*$','gi'),'$1...'); 1416 el.classList.add('loaded'); 1417 }); 1418 /*** go_up ***/ 1419 document.querySelectorAll('.go_up:not(.loaded)').forEach(el => { 1420 el.addEventListener('click',function(){ 1421 window.scrollTo(0,0); 1422 }); 1423 el.classList.add('loaded'); 1424 }); 1425 /*** form ***/ 1426 document.querySelectorAll('.checkbox:not(.loaded)').forEach(el => { 1427 el.addEventListener('click',function(){ 1428 if(this.querySelector('[type=checkbox]').checked){ 1429 this.classList.remove('checked'); 1430 this.querySelector('[type=checkbox]').checked = false;
1431 } else { 1432 this.classList.add('checked'); 1433 this.querySelector('[type=checkbox]').checked = true; 1434 } 1435 }); 1436 if(el.querySelector('[type=checkbox]').checked){ 1437 el.classList.add('checked'); 1438 } else { 1439 el.classList.remove('checked'); 1440 } 1441 el.classList.add('loaded'); 1442 }); 1443 /*** social ***/ 1444 document.load_social = (() => { 1445 document.querySelectorAll('[data-share]:not(.loaded)').forEach(e=>{ 1446 e.addEventListener('click',function(){ 1447 var d = { 1448 s:this.getAttribute('data-share'), 1449 u:this.getAttribute('data-url'), 1450 t:this.getAttribute('data-title'), 1451 v:this.getAttribute('data-via')||'@businessam' + window.locale.split('-')[0], 1452 d:this.getAttribute('data-description'), 1453 w:'' 1454 }; 1455 if(d.u==null&&e.closest('.social')!=null&&e.closest('.social').getAttribute('data-url')!=null){ d.u=e.closest('.social').getAttribute('data-url'); } 1456 if(d.t==null&&e.closest('.social')!=null&&e.closest('.social').getAttribute('data-title')!=null){ d.t=e.closest('.social').getAttribute('data-title'); } 1457 d.u = (d.u!=null?d.u:document.location.href); 1458 d.t = (d.t!=null?d.t:document.title); 1459 switch(d.s){ 1460 case 'fb': d.w = "https://www.facebook.com/sharer/sharer.php?u="+d.u+"&t="+d.t; break; 1461 case 'messenger': d.w = "https://www.facebook.com/dialog/send?link="+d.u+"&t="+d.t; break; 1462 case 'whatsapp': d.w = "https://api.whatsapp.com/send?text="+d.t+' '+d.u; break; 1463 case 'sms': d.w = "sms:?&body="+d.t+" "+d.u; break; 1464 case 'twitter': d.w = "https://twitter.com/share/?url="+d.u+"&text="+d.t+" "+d.v; break; 1465 case 'google': d.w = "https://plus.google.com/share?url="+d.u; break; 1466 case 'linkedin': d.w = "https://www.linkedin.com/sharing/share-offsite/?url="+d.u; break; 1467 case 'pinterest': d.w = "https://pinterest.com/pin/create/bookmarklet/?url="+d.u+"&description="+d.t; break; 1468 } 1469 if(d.w!=''){ 1470 win = window.open(d.w,d.s,"toolbar=no,status=no,scrollbars=no,menubar=no,width=600,height=400"); 1471 win.focus(); 1472 } 1473 ga('send', 'event', 'share', d.s, d.t); 1474 }); 1475 e.classList.add('loaded'); 1476 }); 1477 }); 1478 document.load_social(); 1479 document.querySelectorAll('.custom-select:not(.loaded)').forEach(el=>{ 1480 var select = el.getElementsByTagName("select")[0]; 1481 select.addEventListener("change", function(e){ 1482 this.parentNode.querySelector('.select-selected').innerHTML = (this.querySelectorAll('option')[this.selectedIndex].getAttribute('data-label')!=null?this.querySelectorAll('option')[this.selectedIndex].getAttribute('data-label'):this.querySelectorAll('option')[this.selectedIndex].innerHTML); 1483 s = this.parentNode.parentNode.querySelector('.select-items'); 1484 sl = s.childNodes.length; 1485 for (i = 0; i < sl; i++) { 1486 if (s.childNodes[i].getAttribute('value') == this.querySelectorAll('option')[this.selectedIndex].getAttribute('value')) { 1487 s.childNodes[i].classList.add("same-as-selected"); 1488 } else { 1489 s.childNodes[i].classList.remove("same-as-selected"); 1490 } 1491 } 1492 }); 1493 var ll = select.length; 1494 var a = document.createElement("div"); 1495 a.setAttribute("class", "select-selected"); 1496 a.innerHTML = (select.options[select.selectedIndex].getAttribute('data-label')!=null?select.options[select.selectedIndex].getAttribute('data-label'):select.options[select.selectedIndex].innerHTML); 1497 el.appendChild(a); 1498 var b = document.createElement("div"); 1499 b.setAttribute("class", "select-items select-hide"); 1500 for (j=0;j<ll;j++) { 1501 c = document.createElement("div"); 1502 c.innerHTML = (select.options[j].getAttribute('data-label')!=null?select.options[j].getAttribute('data-label'):select.options[j].innerHTML); 1503 c.setAttribute('value',select.options[j].getAttribute('value')); 1504 if(a.getAttribute('value')==c.getAttribute('value')){ 1505 c.setAttribute("class", "same-as-selected"); 1506 } 1507 if(select.options[j].getAttribute('data-class')!=null){ 1508 c.classList.add(select.options[j].getAttribute('data-class')); 1509 } 1510 c.addEventListener("click", function(e){ 1511 s = this.parentNode.parentNode.getElementsByTagName("select")[0]; 1512 sl = s.length; 1513 h = this.parentNode.previousSibling; 1514 for (i = 0; i < sl; i++) { 1515 if (s.options[i].getAttribute('value') == this.getAttribute('value')) { 1516 s.selectedIndex = i; 1517 h.innerHTML = (this.getAttribute('data-label')!=null?this.getAttribute('data-label'):this.innerHTML); 1518 y = this.parentNode.getElementsByClassName("same-as-selected"); 1519 yl = y.length; 1520 for (var k = 0; k < yl; k++) { 1521 y[k].classList.remove("same-as-selected"); 1522 } 1523 this.setAttribute("class", "same-as-selected"); 1524 if(s.options[i].getAttribute('data-class')!=null){ 1525 this.classList.add(s.options[i].getAttribute('data-class')); 1526 } 1527 break; 1528 } 1529 } 1530 h.click(); 1531 select.dispatchEvent(new Event('change')); 1532 }); 1533 b.appendChild(c); 1534 } 1535 el.appendChild(b); 1536 a.addEventListener("click", function(e) { 1537 e.stopPropagation(); 1538 closeAllSelect(this); 1539 this.nextSibling.classList.toggle("select-hide"); 1540 this.classList.toggle("select-arrow-active"); 1541 }); 1542 el.classList.add('loaded'); 1543 }); 1544 function closeAllSelect(el) { 1545 var x, y, i, xl, yl, arrNo = []; 1546 x = document.getElementsByClassName("select-items"); 1547 y = document.getElementsByClassName("select-selected"); 1548 xl = x.length; 1549 yl = y.length; 1550 for (i = 0; i < yl; i++) { 1551 if (el == y[i]) { 1552 arrNo.push(i) 1553 } else { 1554 y[i].classList.remove("select-arrow-active"); 1555 } 1556 } 1557 for (i = 0; i < xl; i++) { 1558 if (arrNo.indexOf(i)) { 1559 x[i].classList.add("select-hide"); 1560 } 1561 } 1562 } 1563 document.addEventListener("click", closeAllSelect); 1564 1565 /*** modal ***/ 1566 document.querySelectorAll('.close-modal:not(.loaded)').forEach(el => { 1567 el.addEventListener('click',function(e){ 1568 e.target.closest('.modal').classList.remove('open'); 1569 }); 1570 }); 1571 document.querySelectorAll('.modal:not(.loaded)').forEach(el => { 1572 new bam_modal(el); 1573 }); 1574 1575 /* slider */
1576 document.querySelectorAll('[data-slider-action]:not(.loaded)').forEach(el => { 1577 document.querySelectorAll('.grid-post .slider').forEach(el=>{ 1578 el.style.maxWidth = document.querySelectorAll('.grid-post')[0].offsetWidth + 'px'; 1579 }); 1580 el.addEventListener('click',function(){ 1581 var action = el.getAttribute('data-slider-action'); 1582 var el_body = el.closest('.slider').querySelector('.body'); 1583 var pos = el_body.scrollLeft+100, i=0, idx=0; 1584 el_body.querySelectorAll('.grid-item').forEach(e=>{ if(pos>=e.offsetLeft){ idx=i; i++; } }); 1585 switch(action){ 1586 case 'next': 1587 if(el_body.querySelectorAll('.grid-item').length>=i){ 1588 el_body.scrollTo(el_body.querySelectorAll('.grid-item')[i].offsetLeft-6,0); 1589 } 1590 break; 1591 case 'back': 1592 if(i>=2){ 1593 el_body.scrollTo(el_body.querySelectorAll('.grid-item')[i-2].offsetLeft-6,0); 1594 } 1595 break; 1596 } 1597 }); 1598 el.classList.add('loaded'); 1599 }); 1600 1601 /****************** infinity ******************/ 1602 if(document.querySelectorAll('.infinity-more-content:not(.loaded)').length>0){ 1603 window.infinity_auto = 0; 1604 window.infinity_auto_int = 2; 1605 var el_infinity = document.querySelectorAll('.infinity-more-content')[0]; 1606 window.addEventListener('scroll',function(){ 1607 var top = window.pageYOffset || document.documentElement.scrollTop; 1608 var bottom = el_infinity.offsetTop+el_infinity.offsetHeight; 1609 var pos = bottom-top-window.innerHeight; 1610 if(pos<0&&window.infinity_auto==0){ 1611 window.infinity_auto=1; 1612 el_infinity.click(); 1613 } 1614 }); 1615 el_infinity.addEventListener('click',function(e){ 1616 var el = this; 1617 var data = { 1618 offset : parseInt(this.getAttribute('data-offset'))+1, 1619 limit : parseInt(this.getAttribute('data-limit')), 1620 by3 : parseInt(this.getAttribute('data-by3')) 1621 } 1622 data.limit = data.limit-((data.offset+data.limit)%2); 1623 var data_f = new FormData(); 1624 for(var d in data){data_f.append(d,data[d]);} 1625 fetch('/wp-infinity.php?v4', {method:"POST",redirect:"follow",referrer:"no-referrer",body:data_f}).then(function(response){ 1626 if (response.ok) { 1627 return response.text(); 1628 } else { 1629 return Promise.reject(response); 1630 } 1631 }).then(function(res) { 1632 el.insertAdjacentHTML('beforebegin', res); 1633 el.setAttribute('data-offset',data.offset+data.limit); 1634 window.infinity_auto_int--; 1635 if(window.infinity_auto_int>0){ 1636 window.infinity_auto = 0; 1637 } 1638 document.dispatchEvent(new Event('loaded')); 1639 ads_kaching.reload(); 1640 }).catch(function (err) { 1641 console.warn('Something went wrong.', err); 1642 }); 1643 }); 1644 el_infinity.classList.add('loaded'); 1645 }; 1646 1647 if(document.querySelectorAll('.wp-block-audio audio').length>0){ 1648 if(document.querySelectorAll('#id-script-minibplay').length==0){ 1649 var script = document.createElement('script'); 1650 script.setAttribute('id','id-script-minibplay'); 1651 script.setAttribute('src','/wp-content/themes/bamv2/assets/radioplayer/minibplay.js?ver=2.1'); 1652 document.head.appendChild(script); 1653 } 1654 if(document.querySelectorAll('#id-css-minibplay').length==0){ 1655 var css = document.createElement('link'); 1656 css.setAttribute('rel','stylesheet'); 1657 css.setAttribute('id','id-css-minibplay'); 1658 css.setAttribute('href','/wp-content/themes/bamv2/assets/radioplayer/minibplay.css?ver=2.1'); 1659 document.head.appendChild(css); 1660 } 1661 } 1662 1663 document.querySelectorAll('.gotop:not(.loaded)').forEach(el=>{ 1664 el.addEventListener('click',function(){ 1665 window.scrollTo({top: 0,behavior: 'smooth',}); 1666 }); 1667 el.classList.add('loaded'); 1668 }); 1669 if(window.breakingnews_init!=true){ 1670 window.breakingnews_init=true; 1671 breakingnews.init(); 1672 } 1673 document.querySelectorAll('.head-newsfeeds-scroller:not(.loaded)').forEach(el => { 1674 var el = el; 1675 el.rolltimer = setInterval(() => { }, 2000); 1676 el.getNewsfeeds = async () => { 1677 var h = ''; 1678 var response = await fetch('/api/newsfeeds/index.php?locale=' + window.locale,{method:"GET",redirect:"follow",referrer:"no-referrer"}); 1679 var res = await response.json(); 1680 if(res!=null&&res.length>0){ 1681 for(var item of res){ 1682 h += '<li><a href="' + item.link + '"><b class="time">' + item.time + '</b>' + (item.category!=null && item.category.name!=null?'<b class="tax">'+item.category.name + '</b>':'') + '' + item.title + '</a></li>'; 1683 } 1684 el.innerHTML = '<ul class="menu">' + h + '</ul>'; 1685 } 1686 el.rollpos = 0; 1687 el.style.marginTop = 0 + 'px'; 1688 clearInterval(el.rolltimer); 1689 el.rolltimer = setInterval(() => { 1690 el.rollpos = (el.querySelectorAll('ul')[0].childElementCount-1<=el.rollpos?0:(el.rollpos + 1)); 1691 el.style.marginTop = (el.rollpos*-36) + 'px'; 1692 }, 6000); 1693 }; 1694 el.getNewsfeeds(); 1695 setInterval(el.getNewsfeeds,60000); 1696 el.classList.add('loaded'); 1697 }); 1698 window.radio.init(); 1699 1700 document.querySelectorAll('[href^="#"]').forEach(el => { 1701 switch (el.getAttribute('href')){ 1702 case '#sidebar-newsfeeds': 1703 el.href = "javascript:window.sidebar.toggle('/wp-sidebar.php?type=sidebar-newsfeeds');"; 1704 break; 1705 case '#sidebar-stocks': 1706 el.href = "javascript:window.sidebar.toggle('/wp-sidebar.php?type=sidebar-stocks');"; 1707 break; 1708 case '#radiolive': 1709 el.href = "javascript:window.radio.open();"; 1710 break; 1711 } 1712 }); 1713}); 1714document.addEventListener('ready',function(e){ 1715 document.dispatchEvent(new Event('loaded')); 1716 document.baseloaded = 1; 1717}); 1718document.onreadystatechange = function () { 1719 if(document.readyState == "complete") { 1720 document.dispatchEvent(new Event('ready')); 1721 } 1722} 1723document.customjs_ready = true;
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.