Greasy Fork

Greasy Fork is available in English.

ABPVN AdsBlock

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

当前为 2015-12-10 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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
// @require		http://greasyfork.icu/scripts/11950-fshare-auto-login/code/Fshare%20Auto%20Login.js
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&item_name=ABPVN Donation
// @run-at      document-end
// @include     http://*
// @include     https://*
// @version     2.0.6
// @grant       none
// ==/UserScript==
String.prototype.startWith = function strxStart(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://nullref.nazuka.net/?"+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 FS(){
    if(localStorage['off']!='true'){
        window.addEventListener('DOMContentLoaded',function(){FSAL()});
    }	
}
function FSConfig(){
    var background_image=localStorage['off']=='true'?'url("https://www.webanh.tk/full/NOIg2m.png")':'url("https://www.webanh.tk/full/DeN86p.png")';
    var title=localStorage['off']=='true'?'Bật get link fshare':'Tắt get link fshare';
    var html="<div id='fs_click' title='"+title+"' style='position: fixed; right: 0; bottom: 0; width: 30px; height: 30px; border-radius: 50%; background-image: "+background_image+"; background-size: cover; cursor: pointer;'></div>";  
    $(document).ready(function(){       
        $(document.body).append(html);
        $(document).on('click','#fs_click',function FS_on_off(){
            if(localStorage['off']=='false'){
                localStorage['off']=true;
                this.style.backgroundImage='url("https://www.webanh.tk/full/NOIg2m.png")';
                this.setAttribute('title','Bật get link fshare');
                alert('Đã tắt get link fshare');
            } 
            else {
                localStorage['off']=false; 
                this.setAttribute('title','Tắt get link fshare');
                this.style.backgroundImage='url("https://www.webanh.tk/full/DeN86p.png")';
                alert('Đã bật get link fshare');                
            }
        })
    });
}
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]+'" download="'+document.title+'('+quality[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/','http://phim14.net/','http://phim7.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;
            $(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')){       
        FSConfig();
    }
    if (url.startWith('https://www.fshare.vn/file')) {
        cTitle();        
        FS();
    }
    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.startWith("http://linktocdo.com/")){
		window.addEventListener('load',function(){
			document.getElementById('wrapperbaba').style.opacity=1;
		});
		
	}
    if(url.ismatch('http://link5s.com/.')){
        console.info("ABPVN: Bypass Link5s");
        Bypasslink5s();
    }
})();