rollBy: function scrollBy() {
return true;
},
scrollTo: function scrollTo() {
return true;
},
getSelection: function getSelection() {
return true;
},
onunload: function onunload() {
return true;
},
print: function print() {
return true;
},
open: function open() {
return this;
},
opener: window,
closed: false,
innerHeight: 480,
innerWidth: 640,
name: openWndArguments[1],
location: _location,
document: { location: _location }
};
copyMissingProperties(window, generatedWindow);
generatedWindow.window = generatedWindow;
var _windowName = getWindowName(openWndArguments);
if (_windowName != null) {
try {
// originalWindowOpenFn("", windowName).close();
windowsWithNames[_windowName].close();
} catch (err) {}
}
var fnGetUrl = function fnGetUrl() {
var url = void 0;
if (!(generatedWindow.location instanceof Object)) {
url = generatedWindow.location;
} else if (!(generatedWindow.document.location instanceof Object)) {
url = generatedWindow.document.location;
} else if (_location.href != null) {
url = _location.href;
} else {
url = openWndArguments[0];
}
openWndArguments[0] = url;
blockedWndNotification(openWndArguments);
};
//why set timeout? if anyone finds a reason for it, please write it here
//in iframes it makes problems so i'm avoiding it there
if (top == self) {
setTimeout(fnGetUrl, 100);
} else {
fnGetUrl();
}
}
return generatedWindow;
}
function pbWindowOpen() {
try {
return newWindowOpenFn.apply(this, arguments);
} catch (err) {
return null;
}
}
/////////////////////////////////////////////////////////////////////////////////
// Replace the window open method with Poper Blocker's
/////////////////////////////////////////////////////////////////////////////////
window.open = pbWindowOpen;
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Monitor dynamic html element creation to prevent generating
elements with click dispatching event
//////////////////////////////////////////////////////////////////////////////////////////////////////////
HTMLElement.prototype.appendChild = function () {
var newElement = originalAppendChildFn.apply(this, arguments);
if (newElement.nodeName == 'IFRAME' && newElement.contentWindow) {
try {
var code = '(function () {\n var pb_blacklist = ' + JSON.stringify(pb_blacklist) + ';\n var pb_whitelist = ' + JSON.stringify(pb_whitelist) + ';\n ' + inject.toString() + ';\n inject();\n })();';
var s = document.createElement('script');s.text = code;
newElement.contentWindow.document.body.appendChild(s);
} catch (e) {}
}
return newElement;
};
document.createElement = function () {
var newElement = originalCreateElementFn.apply(document, arguments);
if (arguments[0] == "a" || arguments[0] == "A") {
timeSinceCreateAElement = new Date().getTime();
var originalDispatchEventFn = newElement.dispatchEvent;
newElement.dispatchEvent = function (event) {
if (event.type != null && ('' + event.type).toLocaleLowerCase() == "click") {
if (!isInWhitelist(newElement.href)) {
window.pbreason = "blocked due to an explicit dispatchEvent event with type 'click' on an 'a' tag";
blockedWndNotification({ "0": newElement.href });
return true;
}
}
return originalDispatchEventFn.call(this, event);
};
lastCreatedAElement = newElement;
}
return newElement;
};
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// Block artificial mouse click on frashly created elements
/////////////////////////////////////////////////////////////////////////////////
document.createEvent = function () {
try {
if (arguments[0].toLowerCase().includes("mouse") && new Date().getTime() - timeSinceCreateAElement <= 50) {
var openUrlDomain = void 0,
topUrl = void 0,
topDomain = void 0;
try {
openUrlDomain = new URL(lastCreate