Javascript Adblocker

Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv

Versione datata 10/10/2014. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name Javascript Adblocker
// @description Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv
// @include *blogtruyen.com*
// @include *hayhaytv.vn*
// @include *vnsharing.net*
// @version 1.3
// @run-at document-start
// @namespace ...
// ==/UserScript==

var hostname = location.hostname;
var fuck = 0;
switch(hostname) {
case "www.hayhaytv.vn":
fuck = 1;
checkForBadJavascripts ( [[ false, /vod\/info/, replaceJS ]] );
window.addEventListener('load', function(){  $("#btn_xemngay").click()});
break;
case "jj.hayhaytv.vn":
fuck = 2;
window.addEventListener('load', function(){ $(".banner_player_img, .mh-player-info").css("display", "none"); startMainPlayer(); });
break;
case "blogtruyen.com":
fuck = 3;
checkForBadJavascripts ( [[ false, /popunder/, replaceJS ]] );
break;
case "vnsharing.net":
fuck = 4;
checkForBadJavascripts ( [[ false, /btpop/, replaceJS ]] );
break;    
default:
break;
}

function replaceJS (scriptNode) {
var scriptSrc = scriptNode.textContent;
switch(fuck) {
case 1: scriptSrc = scriptSrc.replace ("vod", "shit"); break;
case 3: scriptSrc = scriptSrc.replace ("pop", "shit"); break;
case 4: scriptSrc = scriptSrc.replace ("pop", "shit"); break;
default: break;
}
addJS_Node (scriptSrc)
} 

function checkForBadJavascripts (controlArray) {
if ( ! controlArray.length) return null;
checkForBadJavascripts = function (zEvent) {
for (var J = controlArray.length - 1; J >= 0; --J) {
var bSearchSrcAttr = controlArray[J][0];
var identifyingRegex = controlArray[J][1];
if (bSearchSrcAttr) {
if (identifyingRegex.test (zEvent.target.src) ) {
stopBadJavascript (J);
return false;
}
}
else {
if (identifyingRegex.test (zEvent.target.textContent) ) {
stopBadJavascript (J);
return false;
}
}
}

function stopBadJavascript (controlIndex) {
zEvent.stopPropagation ();
zEvent.preventDefault ();

var callbackFunction = controlArray[J][2];
if (typeof callbackFunction == "function")
callbackFunction (zEvent.target);
zEvent.target.parentNode.removeChild (zEvent.target);
controlArray.splice (J, 1);
if ( ! controlArray.length) {
window.removeEventListener (
'beforescriptexecute', checkForBadJavascripts, true
);
}
}
}

window.addEventListener ('beforescriptexecute', checkForBadJavascripts, true);

return checkForBadJavascripts;
}

function addJS_Node (text, s_URL, funcToRun) {
var D = document;
var scriptNode = D.createElement ('script');
scriptNode.type = "text/javascript";
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';

var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (scriptNode);
}