ABPVN AdsBlock

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

Version au 24/08/2015. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==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&[email protected]&item_name=ABPVN Donation
// @run-at      document-end
// @require 	https://greasyfork.org/scripts/11950-fshare-auto-login/code/Fshare%20Auto%20Login.js?version=69787
// @include     http://*
// @include     https://*
// @version     1.8.5
// @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);           
                    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);
                        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).load(function (){
       $("#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/libs/hostjs_17185813062015_hayhay_abpvn.js"></script>');
}
function FshareSkip() {
    $(document).ready(function(){
        var scripttext=$("script").text();
    	var temp1=''+scripttext.match(/fs_csrf:'.*\b/g);
        var temp2=temp1.replace("fs_csrf:'","");
    	var code=temp2.replace("'","");
        var speed = $(this).data('speed');
        var data ={
            'fs_csrf':code,
            'DownloadForm[pwd]':'',
            'ajax':'download-form',
            'undefined':'undefined'
        }
        $.post('/download/get', data).done(function (data, statusText, xhr) {
            if(data.url==undefined) location.reload();
			else {
				window.location = data.url;
        document.body.style.background='none';
        document.body.innerHTML='';
				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 FSVip(){
	window.addEventListener('DOMContentLoaded',function(){FSAL()});
}
function cTitle() {
    document.title = document.title + " - ABPVN";
}
function Bypasslink5s(){
	updateCountdown=function(){};
	var success=false;
	var cmpID = $("#iframeID").attr("data-cmp");
	var user= $("#iframeID").attr("data-u");
	var page=location.pathname.replace('/','');
	for(var i=10; i>=1;i--){
		/*if($('#red_msg a').attr('href')!=undefined){
			location.assign($('#red_msg a').attr('href'));
		}*/
		$.post("/ajax/r.php", {page : page, advID : cmpID, u : user}, function(data) {
		      	 	if(data >= 1) {
		      	 	   //$("#message_countdown").html(data);
		      	 	}
					else{
						success=true;
						var url=String(data.match(/http.*"\b/g));
						url=url.replace(/" class="/g,'');
						document.title="ABPVN bypass link5s.com";
						$(document.body).html("<center><font size='7' color='red'>ABPVN bypass link5s.com</font></br>Đang chuyển tới: </br><a href='"+url+"'>"+url+"</a></center>");
						//redirect to real url
						location.assign(url);
		      	 	}	
		});
		
	}
}
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 (url) {
                $('input[name=linknexttop]').val(2);
                $(document.body).html("<center><font size='7' color='red'>ABPVN bypass oni.vn</font></br>Đang chuyển tới: </br><a href='"+url+"'>"+url+"</a></center>");
                window.location = url;
            }
        })
    } else {
        console.info("ABPVN: Đây chắc là trang chủ oni.vn rồi. =))");
    }
}
function ztv_getlink(){
		$(window).load(function(){
			var basehtml='<div id="abpvn-dl-bar" title="Tải video bạn đang xem" style="width: 100px; background: rgb(126, 189, 3) none repeat scroll 0% 0%; border: 2px solid rgb(126, 189, 3); border-radius: 5px; color: white; height: 15px; text-align: center; font-size: 15px; cursor: pointer; padding: 2px;">Tải video</div><div id="abpvn-dl-links" style="position: absolute; background: rgb(126, 189, 3) none repeat scroll 0% 0%; border: 2px solid rgb(126, 189, 3); border-radius: 0px 5px 5px; padding: 10px; margin-top: -4px; display: none;">';
			var script=$('script').text();
			var video_link=script.match(/http.*?.mp4/g);
			var quality=['360p','480p','720p']
			for(var i=0;i<video_link.length;i++){
				basehtml+='<a href="'+video_link[i]+'">'+document.title+'('+quality[i]+')</a><br/>';
			}
			basehtml+='</div>';
			console.log(basehtml);
			$('.player').prepend(basehtml);
			$('#abpvn-dl-bar').click(function(){
				$('#abpvn-dl-links').show();
			});
			$('#abpvn-dl-links').mouseleave(function(){
				$(this).hide();
			});	
		});		
}
(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','http://www.khosachnoi.net','http://hamtruyen.vn/'];
    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;
            $(window).load(function(){
                $(document.body).unbind('click');
            });
            
        }
    }
    //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: true, message: "ABPVN: Download fshare không cần đợi"});
        cTitle();
        //FshareSkip();
		FSVip();
    }
    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");
    }
	if(url.startWith("http://iforum.vn/")){
		console.info("ABPVN: Xóa redirect iforum đã hoạt động");
        REMOVE_REF("redirect/?url=","iforum");
	}
	if(url.startWith("http://tv.zing.vn/video/")){
		console.info('Đã chạy lấy link download zing tv');
		ztv_getlink();
	}
    if(url.ismatch('http://link5s.com/.')){
        console.info("ABPVN: Bypass Link5s");
        Bypasslink5s();
    }
})();