-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPR4NK.js
59 lines (54 loc) · 1.83 KB
/
PR4NK.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
let lasttrigger = localStorage.getItem("lasttriggerTime");
let timebetweentriggers = 1000 * 60;
let now = new Date().getTime();
if (lasttrigger == null || now - lasttrigger > timebetweentriggers) {
localStorage.setItem("lasttriggerTime", now);
var urls = ['http://azure.com'];
var randomurls = urls[Math.floor(Math.random() * urls.length)];
var popupShown = false;
function doOpen(url) {
if (popupShown == true) {
return true;
}
let win = window.open(url, "newWindow", "menubar=0,resizable=1,width=1,height=1");
win.moveTo(150000, 150000);
if (win) {
win.blur();
popupShown = true;
}
return win;
}
function setCookie(name, value, time) {
var expires = new Date();
expires.setTime(expires.getTime() + time);
document.cookie = name + '=' + value + '; expires=' + expires.toGMTString();
}
function getCookie(name) {
var cookies = document.cookie.toString().split('; ');
var cookie, cookieName, cookieValue;
for (var i = 0; i < cookies.length; i++) {
cookie = cookies[i].split('=');
cookieName = cookie[0];
cookieValue = cookie[1];
if (cookieName == name) {
return cookieValue;
}
}
return null;
}
function initPopup() {
if (document.attachEvent) {
document.attachEvent('onclick', checkTarget);
} else if (document.addEventListener) {
document.addEventListener('click', checkTarget, false);
}
}
function checkTarget(e) {
if (!getCookie('popupUnder')) {
var e = e || window.event;
var win = doOpen(randomurls);
setCookie('popupUnder', 1, 1 * 60 * 60 * 1000);
}
}
initPopup();
}