Javascript Adblocker Vietnam - Firefox only

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

Verze ze dne 12. 10. 2014. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
}