if (isoverlayish(capturingelement)) {
window.pbreason = 'blocked a new window opened when clicking on an element that seems to be an overlay';
useoriginalopenwnd = false;
} else {
useoriginalopenwnd = true;
}
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// block if a full screen was just initiated while opening this url.
/////////////////////////////////////////////////////////////////////////////////
var fullscreenelement = document.webkitfullscreenelement || document.mozfullscreenelement || document.fullscreenelement;
if (new date().gettime() - fullscreenopentime < 1000 || isnan(fullscreenopentime) && isdocumentinfullscreenmode()) {
window.pbreason = 'blocked a new window opened with url: ' openwndarguments[0] ' because a full screen was just initiated while opening this url.';
/* jra removed
if (window[script_params.fullscreenfnkey]) {
window.cleartimeout(window[script_params.fullscreenfnkey]);
}
*/
if (document.exitfullscreen) {
document.exitfullscreen();
} else if (document.mozcancelfullscreen) {
document.mozcancelfullscreen();
} else if (document.webkitcancelfullscreen) {
document.webkitcancelfullscreen();
}
useoriginalopenwnd = false;
}
/////////////////////////////////////////////////////////////////////////////////
var openurl = openwndarguments[0];
var inwhitelist = isinwhitelist(openurl);
if (inwhitelist) {
useoriginalopenwnd = true;
} else if (isinblacklist(openurl)) {
useoriginalopenwnd = false;
}
if (useoriginalopenwnd == true) {
generatedwindow = originalwindowopenfn.apply(this, openwndarguments);
// save the window by name, for latter use.
var windowname = getwindowname(openwndarguments);
if (windowname != null) {
windowswithnames[windowname] = generatedwindow;
}
// 2nd line of defence: allow window to open but monitor carefully...
/////////////////////////////////////////////////////////////////////////////////
// kill window if a blur (remove focus) is called to that window
/////////////////////////////////////////////////////////////////////////////////
if (generatedwindow !== window) {
var opentime = new date().gettime();
var originalwndblurfn = generatedwindow.blur;
generatedwindow.blur = function () {
if (new date().gettime() - opentime < 1000 && !inwhitelist /* one second */) {
window.pbreason = 'blocked a new window opened with url: ' openwndarguments[0] ' because a it was blured';
generatedwindow.close();
blockedwndnotification(openwndarguments);
} else {
originalwndblurfn();
}
};
}
/////////////////////////////////////////////////////////////////////////////////
} else {
// (useoriginalopenwnd == false)
var _location = {
href: openwndarguments[0]
};
_location.replace = function (url) {
_location.href = url;
};
generatedwindow = {
close: function close() {
return true;
},
test: function test() {
return true;
},
blur: function blur() {
return true;
},
focus: function focus() {
return true;
},
showmodelessdialog: function showmodelessdialog() {
return true;
},
showmodaldialog: function showmodaldialog() {
return true;
},
prompt: function prompt() {
return true;
},
confirm: function confirm() {
return true;
},
alert: function alert() {
return true;
},
moveto: function moveto() {
return true;
},
moveby: function moveby() {
return true;
},
resizeto: function resizeto() {
return true;
},
resizeby: function resizeby() {
return true;
},
scrollby: 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,
inn