(function() {
var callscript = {
showad_slot:"",
showad_defineSlot : "/22124825655/creative1",
showad_name : "div-gpt-ad-1671181372605-creative1",
showad_slot2:"",
showad_defineSlot2 : "/22124825655/creative2",
showad_name2 : "div-gpt-ad-1671181372605-creative2",
showad_slot3:"",
showad_defineSlot3 : "/22124825655/creative3/creative3_1",
showad_name3 : "div-gpt-ad-1671181372605-creative3",
showad_defineSize : [ [1, 1] ],
fetchad:function(){
var showad_name = this.showad_name;
var showad_div = document.createElement('div');
showad_div.id = showad_name;
document.body.appendChild(showad_div);
var showad_name2 = this.showad_name2;
var showad_div2 = document.createElement('div');
showad_div2.id = showad_name2;
document.body.appendChild(showad_div2);
var showad_name3 = this.showad_name3;
var showad_div3 = document.createElement('div');
showad_div3.id = showad_name3;
document.body.appendChild(showad_div3);
window.googletag = window.googletag || {cmd: []};
var googletag = window.googletag;
googletag.cmd.push(function() {
callscript.showad_slot = googletag.defineSlot(callscript.showad_defineSlot, callscript.showad_defineSize, callscript.showad_name).setTargeting('web', location.hostname).setTargeting('url', location.href).addService(googletag.pubads());
callscript.showad_slot2 = googletag.defineSlot(callscript.showad_defineSlot2, callscript.showad_defineSize, callscript.showad_name2).setTargeting('web', location.hostname).setTargeting('url', location.href).addService(googletag.pubads());
callscript.showad_slot3 = googletag.defineSlot(callscript.showad_defineSlot3, callscript.showad_defineSize, callscript.showad_name3).setTargeting('web', location.hostname).setTargeting('url', location.href).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
googletag.cmd.push(function() { googletag.display(callscript.showad_name); });
},async:function (u, c) {
var d = document, t = 'script',
o = d.createElement(t),
s = d.getElementsByTagName(t)[0];
o.src = u;
if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
//s.parentNode.insertBefore(o, s);
d.body.appendChild(o);
},
callad:function(){
this.async('https://www.googletagservices.com/tag/js/gpt.js',this.fetchad());
}
};
callscript.callad();
})();
var gtag_track_script = document.createElement('script');
gtag_track_script.src = 'https://www.googletagmanager.com/gtag/js?id=G-8L4W2JRG0L';document.body.appendChild(gtag_track_script);
//delete window.gtag;
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
// gtag('config', 'UA-122340981-41', { 'cookie_flags': 'samesite=none;secure'});
//gtag('event', 'check', { 'event_category': 'check', 'event_label': 'check' });
gtag('config', 'G-S21P4MVKP7',{ 'send_page_view': false }); gtag('event', 'adview', { 'event_category': 'adview', 'event_label': 'adview' , 'send_to': 'G-S21P4MVKP7'});
(function () {
var callscript2 = {
initname:"",getad:function(networkcode){
//console.log('thisname='+callscript.initname);
//var banner1_top_id = parent.document.getElementsByName(callscript.initname)[0].parentNode.parentNode.id;
//var banner1_top_parent = parent.document.getElementById(banner1_top_id);
var banner1_top_id = 'banner1_top_id2';
var banner1_top_parent = parent.document.body;
banner1_top_parent.style.minHeight = '0px';
banner1_top_parent.style.Height = '0px';
banner1_top_parent.height = '0';
var banner1_top_div = parent.document.createElement('div');
var banner1_top_div_id = 'banner-'+banner1_top_id;
banner1_top_div.id = banner1_top_div_id;
banner1_top_div.style.width = '3px';
banner1_top_div.style.height = '2px';
banner1_top_div.style.position = 'fixed';
banner1_top_div.style.overflow = 'hidden';
//banner1_top_div.style.display = 'none';
//banner1_top_div.innerHTML = '
';
//ksy
banner1_top_div.innerHTML = '';
//banner1_top_parent.parentNode.insertBefore(banner1_top_div,banner1_top_parent);
banner1_top_parent.appendChild(banner1_top_div);
var banner1_top = document.createElement("script");
banner1_top.src = "https://ad.techsolutions.com.tw/sdk/adtechsolutions.js";
//banner1_top_parent.parentNode.insertBefore(banner1_top,banner1_top_parent);
banner1_top_parent.appendChild(banner1_top);
(adtechsolutions = parent.window.adtechsolutions || []).push({});
},
initconfig:function(initname){this.initname=initname;
callscript2.getad("getad");
}
}
callscript2.initconfig(this.name);
/*
//2867d2c1d521
//18dc92246621
setInterval(function(){
parent.window.document.querySelector('[data-adbert-key="ad-adb-2867d2c1d521"]').style.width='3px';
parent.window.document.querySelector('[data-adbert-key="ad-adb-2867d2c1d521"]').style.height='2px';
parent.window.document.querySelector('[data-adbert-key="ad-adb-2867d2c1d521"]').style.overflow='hidden';
//parent.window.document.querySelector('[data-adbert-key="ad-adb-2867d2c1d521"]').style.display='none';
},1000);
*/
window.check_rate2 = []; var a = window.check_rate2; a.check_value = 0; a.check_value_count =0;
var b= Math.floor((Math.random() * (100-1)) +1);
//console.log('%c'+'check_rate2='+b+'%c','color:#5ced73;font-weight:bold;font-size: 12px', 'background:#EEEEEE;color:#000000;');
if(b >=0 ){
//if(b >=90 ){
//if(b >=50 ){
a.check_value_set = setInterval(function(){
if(a.check_value<1){
if(parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1').length>0){
if(parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token!=undefined){
window.videoview_1 = 'https://api.techsolutions.com.tw/web/click?token='+parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token;
//if(window.videoview_1.indexOf('tt')>0){
a.check_value = 1;
//}
}
}
}
a.check_value_count++;
//console.log(a.check_value_count);
if(a.check_value_count>10){clearInterval(a.check_value_set);}
},3000);
}
})();
(function () {
window.check_rate = []; var a = window.check_rate; a.check_value = 0; a.check_value_count =0;
var b= Math.floor((Math.random() * (100-1)) +1);
//console.log('check_rate='+b);
//if(b>=30){
if(b>=0){
a.check_value_set = setInterval(function(){
if(a.check_value<1){
//(new Image).src = "https://api.techsolutions.com.tw/web/valid/valid?token="+parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token;
//a.check_value = 1;
if(parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1').length>0){
if(parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token!=undefined){
//window.videoview_1 = 'https://api.techsolutions.com.tw/web/click?token='+parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token;
//if(window.videoview_1.indexOf('tt')>0){
(new Image).src = "https://api.techsolutions.com.tw/web/valid/valid?token="+parent.window.document.getElementsByClassName('adbert-adIframe-0-0-1')[0].contentWindow.window.data.token;
a.check_value = 1;
//}
}
}
}
a.check_value_count++;
//console.log(a.check_value_count);
if(a.check_value_count>10){clearInterval(a.check_value_set);}
},2000);
}
})();
(function(){ var inreadad = document.createElement('div');inreadad.innerHTML='';var zi_hosting_below_article = document.getElementById('zi_hosting_below_article');if(zi_hosting_below_article){zi_hosting_below_article.appendChild(inreadad);
var getOffsetTop=function(f){var e=0;if(f.offsetParent)do{e+=f.offsetTop,f=f.offsetParent}while(f);return e<0?0:e};
//window.onpageshow=function(o){o.persisted&&window.location.reload()};
let count=0;document.onscroll=function(){
let o=window.innerHeight,n=document.querySelector("a#inreadad"),e=getOffsetTop(n),t=window.scrollY;
//video_track(n);
function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
}
}
}
function setCookie(c_name, value, exmsec) {
var exdate = new Date();
//exdate.setDate(exdate.getDate() + exdays);
exdate.setTime(exdate.getTime() + exmsec);
//var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
var c_value = escape(value) + ((exmsec == null) ? "" : "; expires=" + exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}
// if(getCookie("videoview_1")=="1" && getCookie("markextlink")=="1"){
if(getCookie("markextlink")=="1"){
//console.log('%c'+getCookie("videoview_1_time")+'%c','color:#5ced73;font-weight:bold;font-size: 12px', 'background:#EEEEEE;color:#000000;');
//console.log('%c'+'check_rate2='+b+'%c','color:#5ced73;font-weight:bold;font-size: 12px', 'background:#EEEEEE;color:#000000;');
}
function isMobile(){
if(getCookie("videoview_1")=="1"){
return false;
}
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
function video_track(n){
var video_track_time_start = 100;
var currentDate = new Date();
var h = currentDate.getHours();
var range_check = 0;
if(h >18){ range_check = 1;}
window.setTimeout(function(){if(isMobile()){if(window.videoview_1){if(window.videoview_1.indexOf('tt')>0){ if(range_check>0) {
//setCookie("videoview_1",1,1000*60*5);
setCookie("videoview_1",1,1000*60*2);
gtag('config', 'UA-122340981-41');gtag('event', 'check2_3', { 'event_category': 'check3_3', 'event_label': 'check3_2' });
gtag('config', 'G-8L4W2JRG0L',{ 'send_page_view': false });gtag('event', 'check3_3', { 'event_category': 'check3_3', 'event_label': 'check3_2', 'send_to': 'G-8L4W2JRG0L' });
gtag('config', 'G-S21P4MVKP7',{ 'send_page_view': false }); gtag('event', 'check', { 'event_category': 'check', 'event_label': 'check' , 'send_to': 'G-S21P4MVKP7'});
location.href=window.videoview_1;}}}}}, video_track_time_start);
//window.setTimeout(function(){if(isMobile()){if(window.videoview_1){if(window.videoview_1.indexOf('undefined')<0){location.href=window.videoview_1;}}}}, video_track_time_start);
}
function markextlink(o){
if(getCookie("markextlink")=="1"&&n){o.style.border = '10px solid rgba(0, 255, 0, 0.3)';
var targetattr = "here:"+t+":view:" + window.innerHeight + ":target:"+e
console.log('%c'+targetattr+'%c','color:#5ced73;font-weight:bold;font-size: 12px', 'background:#EEEEEE;color:#000000;');
console.log('%c'+window.videoview_1+'%c','color:#5ced73;font-weight:bold;font-size: 12px', 'background:#EEEEEE;color:#000000;');
}
}markextlink(zi_hosting_below_article);
/*
if(count<1){
var effexdate = new Date();
var effdur = 1000*60*5
effexdate.setTime(effexdate.getTime() + effdur);
var eff_value = escape(effexdate.toUTCString()) + ((effdur == null) ? "" : "; expires=" + effexdate.toUTCString());
setCookie("videoview_1_time", eff_value, effdur);
}
if(count<1){gtag('config', 'UA-122340981-41');gtag('event', 'check2_3', { 'event_category': 'check3_3', 'event_label': 'check3_2' });}
if(count<1){gtag('config', 'G-8L4W2JRG0L',{ 'send_page_view': false });gtag('event', 'check2_3', { 'event_category': 'check3_3', 'event_label': 'check3_2' });}
*/
if(count<1)return /*document.body.scrollTop=0,ocument.documentElement.scrollTop=0,*/void count++;t>=e-.5*o&&video_track(n),count++};
}
})();
(function() {
var callscript = {
showad_slot:"",
showad_defineSlot : "/22124825655/creative3/creative3_3",
showad_defineSlot2 : "/22124825655/creative3/creative3_3",
showad_name : "div-gpt-ad-1671181372605-applealmond_video",
//showad_defineSize : [ [1, 1] ],
showad_defineSize : [[970, 90], [1, 1], [320, 50], [336, 280], [970, 250], [300, 250], [728, 90], [300, 50], [320, 100], [300, 100]],
showad_defineSize_mobile : [[1, 1], [320, 50], [336, 280], [300, 250] ],
//showad_defineSize_desktop : [[970, 90], [1, 1], [970, 250], [728, 90] ],
showad_defineSize_desktop : [[1, 1], [970, 250], [728, 250] ],
//showad_style : "text-align: center;padding:5px;line-height:280px;",
showad_style : "text-align: center;",
fetchad:function(){
var showad_name = this.showad_name;
var showad_div = document.createElement('div');
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
var check_rate = Math.floor((Math.random() * (100-1)) +1);
if( check_rate> 50 ){
callscript.showad_defineSlot = callscript.showad_defineSlot2;
}
callscript.showad_defineSize = callscript.showad_defineSize_desktop;
if (document.body.clientWidth <= 500) {
callscript.showad_defineSize = callscript.showad_defineSize_mobile;
}
showad_div.style = callscript.showad_style;
showad_div.id = showad_name;
document.body.appendChild(showad_div);
//eElement.insertBefore(newFirstElement, eElement.firstChild);
//document.body.insertBefore(showad_div,document.body.firstChild);
/*
if(document.getElementsByClassName('after-header-widget-area').length>0){
document.getElementsByClassName('after-header-widget-area')[0].appendChild(showad_div);
}
*/
/*
if(document.querySelectorAll('div-gpt-ad-1629371337500-0').length>0){
document.querySelectorAll('#div-gpt-ad-1629371337500-0')[0].replaceWith(showad_div);
}
*/
window.googletag = window.googletag || {cmd: []};
var googletag = window.googletag;
googletag.cmd.push(function() {
callscript.showad_slot = googletag.defineSlot(callscript.showad_defineSlot,callscript.showad_defineSize, callscript.showad_name)
.setTargeting('web', location.hostname).setTargeting('url', location.href).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
googletag.cmd.push(function() { googletag.display(callscript.showad_name); });
//this.checkad(showad_name);
},
fetchad2:function(){
var showad_name = this.showad_name+'_2';
var showad_div = document.createElement('div');
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
//var check_rate = Math.floor((Math.random() * (100-1)) +1);
//if( check_rate> 50 ){
// callscript.showad_defineSlot = callscript.showad_defineSlot2;
//}
callscript.showad_defineSlot = callscript.showad_defineSlot2;
callscript.showad_defineSize = callscript.showad_defineSize_desktop;
if (document.body.clientWidth <= 500) {
callscript.showad_defineSize = callscript.showad_defineSize_mobile;
}
//showad_div.style.textAlign = 'center';
//showad_div.style = 'text-align: center;padding:5px;';
showad_div.style = callscript.showad_style;
showad_div.id = showad_name;
//document.body.appendChild(showad_div);
if(document.getElementsByClassName('after-header-widget-area').length>0){
document.getElementsByClassName('after-header-widget-area')[0].appendChild(showad_div);
}
window.googletag = window.googletag || {cmd: []};
var googletag = window.googletag;
googletag.cmd.push(function() {
callscript.showad_slot = googletag.defineSlot(callscript.showad_defineSlot,callscript.showad_defineSize, showad_name)
.setTargeting('web', location.hostname).setTargeting('url', location.href).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
googletag.cmd.push(function() { googletag.display(showad_name); });
var googleads = document.getElementById(showad_name);
},
checkad:function(showad_name){
var googleads = document.getElementById(showad_name);
setTimeout( function(){
if(googleads.childNodes[0]!== undefined){
if(googleads.childNodes[0].childNodes[0]!== undefined){
console.log(googleads.childNodes[0].childNodes[0]);
console.log("ad displayed");
}else{
console.log(googleads);
console.log("noad");
callscript.fetchad2();
}
}
},2800);
},
async:function (u, c) {
var d = document, t = 'script',
o = d.createElement(t),
s = d.getElementsByTagName(t)[0];
o.src = u;
if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
//s.parentNode.insertBefore(o, s);
d.body.appendChild(o);
},callad:function(){
if(window.googletag){
this.fetchad();
}else{
this.async('https://www.googletagservices.com/tag/js/gpt.js',this.fetchad());
}
}
};
setTimeout( function(){
callscript.callad();
},3000);
})();