Javascript Adblocker Vietnam - Firefox only

Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv|forum.bkav.com.vn

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

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo 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 Vietnam - Firefox only
// @description    Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv|forum.bkav.com.vn
// @version        1.714
// @run-at         document-start
// @namespace       ...
// @include        *blogtruyen.com*
// @include        *hayhaytv.vn*
// @include        *vnsharing.net*
// @include        *vozforums.com*
// @include        *bkav.com.vn*
// ==/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;
checkForBadJavascripts ( [[ false, /vod\/info/, replaceJS ]] );
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;    
case "forum.bkav.com.vn":
fuck = 5;
checkForBadJavascripts ( [[ false, /jQuery\(document\)\.ready/, 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;
case 5: scriptSrc = scriptSrc.replace ("doc", "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);
} 

/* Kéo dài alt2 cho vOz */
addGlobalStyle('[style*=wrap] > STRONG {margin-right:100px}');

/* Autohide thanh trên cùng hh */
addGlobalStyle('.header:not(:hover) {opacity:0;margin-top:-100px;transition:0.4s}');

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}