if (typeof console === 'undefined' || typeof console.log === 'undefined') { console = {}; console.log = function() {}; } var thenewslens = 1036820734; var appledaily = -599536824; var mappledaily = 1279734942; var mamaclub = 752231025; var cool3c = -1407993245; var everydayhealth = -1330785334; String.prototype.hashCode = function() { var hash = 0, i, chr, len; if (this.length == 0) return hash; for (i = 0, len = this.length; i < len; i++) { chr = this.charCodeAt(i); hash = ((hash << 5) - hash) + chr; hash |= 0; } return hash; }; function trimpath(path, start) { if (path.length == 0) { return path; } var e = path.length - 1; var end = e; for (; path[e] == '/' && e > 0; e--) { end = e; } if (path[end] == '/') { return path.substring(start, end); } else { return path.substring(start, path.length); } } function hackurl(l) { switch (l.host.hashCode()) { case thenewslens: return 'thenewslens:' + trimpath(l.pathname, 6); case appledaily: case mappledaily: var p = trimpath(l.pathname, 0); var parray = p.split('/'); if (parray.length >= 6) { return 'appledaily:' + parray.slice(4, 6).join('.'); } else { return 'appledaily:' + p; } case cool3c: return 'cool3c:' + trimpath(l.pathname, 9); case mamaclub: return 'mamaclub:' + trimpath(l.pathname, 7); case everydayhealth: return 'everydayhealth:' + l.pathname.split('/')[2]; default: return ''; } } function createXMLHttpRequest() { var xmlHttp = null; if (typeof XDomainRequest !== 'undefined' && window.FormData === undefined) { return new XDomainRequest(); } if (typeof XMLHttpRequest !== 'undefined') { xmlHttp = new XMLHttpRequest(); } else if(typeof window.ActiveXObject !== 'undefined') { try { xmlHttp = new ActiveXObject('Msxml2.XMLHTTP.4.0'); } catch(e) { try { xmlHttp = new ActiveXObject('MSXML2.XMLHTTP'); } catch(e) { try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) { xmlHttp = null; } } } } return xmlHttp; } function getWidthid57a462c30f37c() { var ins = [[240, 320],[320, 480], [480, 800], [768, 1024]]; if (0 == 1) { var h = screen.height; var w = screen.width; var hid = h>=240?h>320?h>=480?h>=768?3:2:1:0:0; var wid = w>=320?w>480?w>=800?w>=1024?3:2:1:0:0; return hid>wid?ins[wid][1]:ins[hid][1]; } else { return 300; } } function getHeightid57a462c30f37c() { var ins = [[240, 320],[320, 480], [480, 800], [768, 1024]]; if (0 == 1) { var h = screen.height; var w = screen.width; var hid = h>=240?h>320?h>=480?h>=768?3:2:1:0:0; var wid = w>=320?w>480?w>=800?w>=1024?3:2:1:0:0; return hid>wid?ins[wid][0]:ins[hid][0]; } else { return 250; } } function errid57a462c30f37c() { var ps_u = (location.protocol=='https:'?'https://anet.apx.appier.net/www/delivery/passback.php':'http://anet.apx.appier.net/www/delivery/passback.php'); var src = ps_u+"?zoneid=268&id=id57a462c30f37c"; var e = createXMLHttpRequest(); e.open('GET', src); e.onload = function() { console.log('error load'); var i = document.createElement('iframe'); i.frameBorder = 0; i.scrolling = 'no'; i.style.border = 'none'; i.style.overflow = 'hidden'; //adiv.appendChild(i) document.getElementById('id57a462c30f37c').appendChild(i); var fw = (i.contentWindow || i.contentDocument); fw.document.open(); fw.document.write(this.responseText); fw.document.close(); i.height = getHeightid57a462c30f37c(); i.width = getWidthid57a462c30f37c(); } e.send(); } function fireieid57a462c30f37c(data) { var x = createXMLHttpRequest(); var m3_u = (location.protocol=='https:'?'https://anet.apx.appier.net/www/delivery/ajs.php':'http://anet.apx.appier.net/www/delivery/ajs.php'); m3_u += '?' + data.toString(); var i = document.createElement('iframe'); i.frameBorder = 0; i.scrolling = 'no'; i.style.border = 'none'; i.style.overflow = 'hidden'; i.height = getHeightid57a462c30f37c(); i.width = getWidthid57a462c30f37c(); i.marginheight = '0'; i.marginwidth = '0'; i.hspace='0'; i.vspace='0'; i.src = m3_u; document.getElementById('id57a462c30f37c').appendChild(i); } function fireid57a462c30f37c(data) { if (window.FormData === undefined) { if (window.attachEvent) window.attachEvent('onload', function(event) {fireieid57a462c30f37c(data);}); else fireid57a462c30f37c(data); return; } var x = createXMLHttpRequest(); var m3_u = (location.protocol=='https:'?'https://anet.apx.appier.net/www/delivery/ajs.php':'http://anet.apx.appier.net/www/delivery/ajs.php'); x.open('POST', m3_u, true); x.withCredentials = true; x.timeout = 1000; x.ontimeout = function() { x.abort(); if('0' === '1'){ try { apxHandleNoBuy('268', 'id57a462c30f37c', '1892034b152b612c3f2b65413c0868e2ff77491d667f4299769b4626a943610a', '300', '250'); } catch(err) { errid57a462c30f37c(); } }else{ errid57a462c30f37c(); } }; x.onerror = function() { if('0' === '1'){ try { apxHandleNoBuy('268', 'id57a462c30f37c', '1892034b152b612c3f2b65413c0868e2ff77491d667f4299769b4626a943610a', '300', '250'); } catch(err) { errid57a462c30f37c(); } }else{ errid57a462c30f37c(); } } x.onload = function() { console.log('normal load'); var is_hb_no_buy = (this.responseText.indexOf('0ed031bc7196559a75381e56a4a2d584') != -1); if (true) { var i = document.createElement('iframe'); i.frameBorder = 0; i.scrolling = 'no'; //adiv.appendChild(i) document.getElementById('id57a462c30f37c').appendChild(i); var fw = (i.contentWindow || i.contentDocument); fw.document.open(); fw.document.write(this.responseText); fw.document.close(); if(is_hb_no_buy){ i.height = 0; i.width = 0; } else { i.height = getHeightid57a462c30f37c(); i.width = getWidthid57a462c30f37c(); } } else { document.write(this.responseText); } if('0' === '1'){ try { if(is_hb_no_buy){ apxHandleNoBuy('268', 'id57a462c30f37c', '1892034b152b612c3f2b65413c0868e2ff77491d667f4299769b4626a943610a', '300', '250'); } else { apxHandleBuy('268', 'id57a462c30f37c', '1892034b152b612c3f2b65413c0868e2ff77491d667f4299769b4626a943610a', '300', '250'); } } catch(err) { } } } x.send(data); } function getCookie(cname) { var name = cname + '='; var ca = document.cookie.split(name); if (ca.length > 1) return ca[1].split(';')[0]; return ''; } function getMetaKeywords() { var k1 = document.getElementsByName('keywords'); var k2 = document.getElementsByName('news_keywords'); var k3 = document.getElementsByName('shareaholic:keywords'); if (k1.length > 0) return k1[0].content; else if (k2.length > 0) return k2[0].content; else if (k3.length > 0) return k3[0].content; return ''; } var connectionInfo = navigator.connection || {'type': ''}; var CBFormData = function() { if (window.FormData === undefined) { this.data = []; this.append = function(n, v) { this.data.push(encodeURIComponent(n) + '=' + encodeURIComponent(v)); }; this.toString = function() { return this.data.join('&').replace(/%20/g, '+'); }; } else { return new FormData(); } } var data = new CBFormData(); data.append('zoneid', 268); data.append('sw', screen.width); data.append('sh', screen.height); data.append('acid', 'IOjMtwztT9q6T1wiPQXFSw'); data.append('conntype', connectionInfo.type); data.append('loc', escape(window.location)); data.append('hb', '0'); if (document.referrer) data.append('referer', escape(document.referrer)); var kurl = hackurl(location); if (kurl === '') { var a = document.createElement('a'); a.href = document.referrer; kurl = hackurl(a); } console.log(kurl); var keywords = getMetaKeywords(); if (kurl.length > 0) { if (keywords.length == 0) keywords = getCookie(kurl); if (keywords.length > 0) { console.log('kw' + keywords); data.append('kw', keywords); fireid57a462c30f37c(data); } else { var y = createXMLHttpRequest(); y.open('GET', 'https://ctrapx-04.apx.appier.net/' + kurl); y.timeout = 600; y.onload = function() { data.append('kw', encodeURIComponent(this.responseText)); console.log(this.responseText); fireid57a462c30f37c(data); }; y.ontimeout = function() { y.abort(); fireid57a462c30f37c(data); }; y.onerror = function() { fireid57a462c30f37c(data); }; y.send(); } } else { if (keywords.length > 0) data.append('kw', keywords); fireid57a462c30f37c(data); }