1function jsPopunder(sUrl, sConfig) { 2 3 var _parent = (top != self && typeof(top.document.location.toString()) === 'string') ? top : self; 4 var popunder = null; 5 6 sConfig = (sConfig || {}); 7 8 var sName = (sConfig.name || Math.floor((Math.random() * 1000) + 1)); 9 var sWidth = (sConfig.width || window.outerWidth || window.innerWidth); 10 var sHeight = (sConfig.height || (window.outerHeight-100) || window.innerHeight); 11 12 var sPosX = (typeof(sConfig.left) != 'undefined') ? sConfig.left.toString() : window.screenX; 13 var sPosY = (typeof(sConfig.top) != 'undefined') ? sConfig.top.toString() : window.screenY; 14 15 /* capping */ 16 var sWait = (sConfig.wait || 3600); sWait = (sWait * 1000); 17 var sCap = (sConfig.cap || 2); 18 19 /* cookie stuff */ 20 var popsToday = 0; 21 var cookie = (sConfig.cookie || '__.popunder'); 22 23 var browser = function() { 24 var n = navigator.userAgent.toLowerCase(); 25 var b = { 26 webkit: /webkit/.test(n), 27 mozilla: (/mozilla/.test(n)) && (!/(compatible|webkit)/.test(n)), 28 chrome: /chrome/.test(n), 29 msie: (/msie/.test(n)) && (!/opera/.test(n)), 30 firefox: /firefox/.test(n), 31 safari: (/safari/.test(n) && !(/chrome/.test(n))), 32 opera: /opera/.test(n) 33 }; 34 b.version = (b.safari) ? (n.match(/.+(?:ri)[\/: ]([\d.]+)/) || [])[1] : (n.match(/.+(?:ox|me|ra|ie)[\/: ]([\d.]+)/) || [])[1]; 35 return b; 36 }(); 37 38 39 function isCapped() { 40 try { 41 popsToday = Math.floor(document.cookie.split(cookie + 'Cap=')[1].split(';')[0]); 42 } catch (err) {} 43 return (sCap <= popsToday || document.cookie.indexOf(cookie + '=') !== -1); 44 } 45 46 47 function doPopunder(sUrl, sName, sWidth, sHeight, sPosX, sPosY) { 48 if (isCapped()) return; 49 50 var sOptions = 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=' + sWidth.toString() + ',height=' + sHeight.toString() + ',screenX=' + sPosX + ',screenY=' + sPosY; 51 52 document.onclick = function() { 53 if (isCapped()) return; 54 55 // --- 56 // chrome27 fix 57 window.open("javascript:window.focus();", "_self", ""); 58 // --- 59 60 popunder = _parent.window.open(sUrl, sName, sOptions); 61 if (popunder) { 62 // cookie 63 var now = new Date(); 64 document.cookie = cookie + '=1;expires=' + new Date(now.setTime(now.getTime() + sWait)).toGMTString() + ';path=/;SameSite=Lax'; 65 now = new Date(); 66 document.cookie = cookie + 'Cap=' + (popsToday + 1) + ';expires=' + new Date(now.setTime(now.getTime() + (84600 * 1000))).toGMTString() + ';path=/;SameSite=Lax'; 67 pop2under(); 68 } 69 }; 70 } 71 72 73 function pop2under() { 74 try { 75 popunder.blur(); 76 popunder.opener.window.focus(); 77 window.self.window.blur(); 78 window.focus(); 79 80 if (browser.firefox) openCloseWindow(); 81 if (browser.webkit) openCloseTab(); 82 } catch (e) {} 83 } 84 85 function openCloseWindow() { 86 var ghost = window.open('about:blank'); 87 ghost.focus(); 88 ghost.close(); 89 } 90 91 function openCloseTab() { 92 var ghost = document.createElement("a"); 93 ghost.href = "about:blank"; 94 ghost.target = "PopHelper"; 95 document.getElementsByTagName("body")[0].appendChild(ghost); 96 ghost.parentNode.removeChild(ghost); 97 98 var clk = document.createEvent("MouseEvents"); 99 clk.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null); 100 ghost.dispatchEvent(clk); 101 102 // open a new tab for the link to target 103 window.open(ghost.href, ghost.target).close(); 104 } 105 106 107 // abort? 108 if (isCapped()) { 109 return; 110 } else { 111 doPopunder(sUrl, sName, sWidth, sHeight, sPosX, sPosY); 112 } 113}
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.