Greasy Fork is available in English.

ABPVN AdsBlock

Script chặn quảng cáo,loại bỏ chờ đợi của ABPVN

נכון ליום 13-05-2015. ראה הגרסה האחרונה.

// ==UserScript==
// @name        ABPVN AdsBlock
// @namespace   ABPVN
// @author      Hoàng Rio
// @copyright   ABPVN
// @homepage    http://abpvn.com
// @icon        http://abpvn.com/icon.png
// @description Script chặn quảng cáo,loại bỏ chờ đợi của ABPVN
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donghoang.nguyen@gmail.com&item_name=ABPVN Donation
// @run-at      document-end
// @include     http://*
// @include     https://*
// @version     1.6
// @grant       none
// ==/UserScript==
String.prototype.startWith = function strStart(str){
    return this.indexOf(str)===0;
};
String.prototype.ismatch = function (regex){
  return this.match(regex)!==null;
};
$.getcookie=function(cookiename){
	  var value = "; " + document.cookie;
	  var parts = value.split("; " + cookiename + "=");
	  if (parts.length == 2) return parts.pop().split(";").shift();
};
function abpvn_onoff(){
    if($.getcookie('abpvn')==undefined){
        var now = new Date();
        var time = now.getTime();
        var expireTime = time + 365*24*3600*1000;
        now.setTime(expireTime);
        document.cookie='abpvn=0;expires='+now.toGMTString()+';';
        $("#abpvn").css("background-color","red");
        $("#abpvn").html("ABPVN Xóa chuyển hướng đang <u>Tắt</u>");
        $("#abpvn").attr("title","Bấm vào để Bật");
    }
    else{
        document.cookie='abpvn'+'=;expires=Thu,01-Jan-1970 00:00:01 GMT;';
        $("#abpvn").css("background-color","green");
        $("#abpvn").html("ABPVN Xóa chuyển hướng đang <u>Bật</u>");
        $("#abpvn").attr("title","Bấm vào để Tắt");
    }
    if(confirm("Bạn có muốn tải lại trang không?")){
        location.reload();
    }
}
function VNZ_MF(){
    var hit=0;
    $("a").each(function() {
		var old_href=$(this).attr("href");
		if(old_href!==undefined){
			if(old_href.startWith("http://www.mediafire.com")){
				$(this).attr("href","http://ref.abpvn.com/?"+old_href);
				$(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng từ VNZ sang Mediafire.com" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
				console.info("ABPVN: "+old_href+" -> "+$(this).attr("href"));	
        hit++;
			}
		}			
	});
    if(hit==0){
         console.info("ABPVN: Không có link mediafire nào trong topic");
    }
    else{
        console.info("ABPVN: Đã xử lý "+hit+" link mediafire trong topic");
    }
}

function REMOVE_REF(ref_url,hostname){
    if($.getcookie('abpvn')==undefined){
        $(document.body).append('<div id="abpvn" style="font: 13px verdana,geneva,lucida,lucida grande,arial,helvetica,sans-serif; position: fixed; display:block; top: 97.2%; left: 0; width: 240px; height: auto; color: white; background-color: green; opacity: 0.7; cursor: pointer" title="Bấm vào để Tắt">ABPVN Xóa chuyển hướng đang <u>Bật</u></div>');
            var hit=0;
            $("a").each(function() {
            var old_href=$(this).attr("href");
            if(old_href!==undefined){
              if(old_href.startWith(ref_url+"http%3A%2F%2F")){
                    old_href=old_href.replace(ref_url+"http%3A%2F%2F","");
                    old_href=old_href.replace(/%2F/g,"/");
                    $(this).attr("href","http://"+old_href);
                    $(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng của '+hostname+'" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
                    console.info("ABPVN: "+ref_url+"http%3A%2F%2F"+old_href+" -> "+$(this).attr("href"));	
                    hit++;
              }
                else{
                    if(old_href.startWith(ref_url+"https%3A%2F%2F")){
                        old_href=old_href.replace(ref_url+"https%3A%2F%2F","");
                        old_href=old_href.replace(/%2F/g,"/");
                        $(this).attr("href","https://"+old_href);
                        $(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng của '+hostname+'" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
                        console.info("ABPVN: "+ref_url+"https%3A%2F%2F"+old_href+" -> "+$(this).attr("href"));	
                        hit++;
                    }
                }
            }			
          });
            if(hit==0){
                 console.info("ABPVN: Không có link chứa chuyển hướng nào trong topic");
            }
            else{
                console.info("ABPVN: Đã xử lý "+hit+" link chứa chuyển hướng trong topic");
            }
    }
    else{
        $(document.body).append('<div id="abpvn" style="font: 13px verdana,geneva,lucida,lucida grande,arial,helvetica,sans-serif; position: fixed; display:block; top: 97.2%; left: 0; width: 240px; height: auto; color: white; background-color: red; opacity: 0.7; cursor: pointer" title="Bấm vào để Bật">ABPVN Xóa chuyển hướng đang <u>Tắt</u></div>');
    }
    
    $("#abpvn").css("top",""+$(window).height()-$("#abpvn").height());
    $("#abpvn").css("left",""+$(window).width()-$("#abpvn").width());
    $(window).resize(function (){
        $("#abpvn").css("top",""+$(window).height()-$("#abpvn").height());
        $("#abpvn").css("left",""+$(window).width()-$("#abpvn").width());
    });
    $("#abpvn").click(abpvn_onoff);
}
 
function AntiHayhaytv(){
    $('head').append('<script src="https://cdn.hostjs.tk/hayhay_abpvn.js"></script>');
}
function FshareSkip() {
	var scripttext=$("script").text();
	var temp1=''+scripttext.match(/'.*'\n/);
	var temp2=temp1.replace("'","");
	var temp3=temp2.replace(/\n/g,"");
	var code=temp3.replace("'","");
    var speed = $(this).data('speed');
    var data = { 
	speed: speed,	
	fs_csrf: code
    };
    $.post('/download/index', data).done(function (data, statusText, xhr) {
        window.location = data.url;
        console.log("ABPVN: "+location.href+" -> "+data.url);
    }).fail(function(xhr, statusText, error){
			 $.alert({success: false, message: "ABPVN: Đã có lỗi fshare hoặc file có password"});
    });
}
function cTitle() {
    document.title = document.title + " - ABPVN";
}
function ByPassOnivn() {
    var scripttext = $("script").text();
    var data = scripttext.match(/code=.*\b/);
    var domain = window.location.protocol + "//" + window.location.host + '/';
    var urls = $('input[name=linknexttop]').val();
    if (urls == 1) {
        url = '';
        $.ajax({
            type: "GET",
            url: domain + "click.html",
            data: "" + data + "",
            contentType: "application/json; charset=utf-8",

            success: function (html) {
                $('input[name=linknexttop]').val(2);
                window.location = html;
            }
        })
    } else {
        console.info("ABPVN: Đây chắc là trang chủ oni.vn rồi. =))");
    }
}
(function ABPVNAdsBlock() {
    url=location.href;
    //Chặn popup quảng cáo không chặn được bằng ABP
    var popup_ar = ['http://blogtruyen.com'];
    for (var i = 0; i < popup_ar.length; i++) {
        if (url.startWith(popup_ar[i])) {
            cTitle();
            console.info("ABPVN: Đã chặn popup quảng cáo");
            document.body.onclick = null;
        }
    }
    //Chặn background quảng cáo 24h
    if (url.startWith('http://www.24h.com.vn')) {
        console.info("ABPVN: Đã xóa background quảng cáo");
        cTitle();
        document.body.style.background = "white";
    }
    if (url.startWith('http://www.oni.vn')) {
        cTitle();
        ByPassOnivn();
    }
    if (url.startWith('https://www.fshare.vn/file')) {
        $.alert({success: false, message: "ABPVN: Download fshare không cần đợi"});
        cTitle();
        FshareSkip();
    }
    if(url.startWith('http://www.hayhaytv.vn')){
        console.info('ABPVN: Anti hayhaytv.vn');
        cTitle();
        AntiHayhaytv();
    }
    if(url.ismatch('http://www.vn-zoom.com/f../.')||url.ismatch('http://www.vn-zoom.com/f.../.')){
        console.info("ABPVN: Xóa chuyển hướng Mediafire từ VNZ đã hoạt động");
        VNZ_MF();
    }
    if(url.startWith("http://sinhvienit.net/forum/")){
        console.info("ABPVN: Xóa redirect SVIT đã hoạt động");
        REMOVE_REF("http://sinhvienit.net/goto/?","SVIT");
    }
    if(url.startWith("http://vozforums.com/showthread.php")){
        console.info("ABPVN: Xóa redirect VOZ đã hoạt động");
        REMOVE_REF("/redirect/index.php?link=","VOZ");
    }
})();