Adblock4limbo_adsRemoveProject

毒奶去广告计划油猴脚本版;通过 JavaScript 移除 Pornhub /低端影视/Jable/哔滴影视等视频网站上的视频广告和图片广告,保持界面清爽干净无打扰!

Versión del día 13/4/2022. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         Adblock4limbo_adsRemoveProject
// @namespace    https://limbopro.com/
// @version      0.1.1
// @license  CC BY-NC-SA 4.0
// @description  毒奶去广告计划油猴脚本版;通过 JavaScript 移除 Pornhub /低端影视/Jable/哔滴影视等视频网站上的视频广告和图片广告,保持界面清爽干净无打扰!
// @author       limbopro
// @match        https://ddrk.me/*
// @match        https://jable.tv/*
// @match        https://www.btbdys.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=limbopro.com
// @run-at document-end
// @grant        none
// ==/UserScript==

var ads_host=[
"pornhub.com",
"ddrk.me",
"jable.tv",
"www.btbdys.com"
]

var url = document.location.href;
console.log(url); // 看看当前 URL

var i;
for (i=0;i<ads_host.length;i++){
if (url.indexOf(ads_host[i]) !== -1){
    var values = ads_host[i]; // 释放参数值
    console.log(values) // 看看控制台输出了个啥
    }
}

function switch_ads_host(x){ // 匹配参数值 执行相应函数
    switch (x) {
        case 'pornhub.com':
            pornhub_skipAds()
            pornhub_scriptAds()
            pornhub_css_catch()
        break;
        case 'ddrk.me':
            ddrk_css_catch();
        break;
        case 'jable.tv':
            jable_css_catch();
            jable_removeAds();
            cloudflarePass();
        break;
        case 'www.btbdys.com':
            btbdys_css_catch();
            video_AdsSkip();
            url_blank2self();
            btbdys_delayRemoveAds();
        break;
    default:
        console.log("Catch Nothing!")
    }
}

switch_ads_host(values)

// 无数函数及方法的组合使脚本更灵活
// 移除带广告脚本

function pornhub_scriptAds(){
var i;
var script = document.getElementsByTagName("script");
for (i=0; i<script.length; i++){
    if (script[i].src.indexOf("ads_batch") !== -1) {
            script[i].remove()
        }
    if (script[i].innerHTML.indexOf("ads_batch") !== -1){
            script[i].remove()
        }
    }
}

// 移除网站上的图片广告

function pornhub_css_catch(){
var newstyle=".topAdContainter,div.topAdContainter,.adContainer.clearfix,.adContainer,div#adSpot,a[href*=\"ads\"]," +
".video-wrapper > #player + [class],.underplayerAd,.realsex,.adsbytrafficjunky,.adLink," +
"#pb_template,#main-container > .abovePlayer,.sponsor-text," +
".video-wrapper > div#player~div[class$=\" hd clear\"],#hd-rightColVideoPage > .clearfix:first-child," +
".playerFlvContainer > div#pb_template[style],a[href*='livehd']," +
"[href*='premium_signup?type=PremiumBtn'] {display:none !important;}" +
".mgp_container .mgp_optionsMenu.mgp_level3 .mgp_subPage>.mgp_content{opacity:0;pointer-events:auto;transform:translate(-260px, 0) !important}" +
".mgp_preRollSkipButton {z-index:8;position:absolute;padding:10px 25px;background:rgba(0,0,0,.55)}"; // 样式文本
var creatcss=document.createElement("style"); // 新建style tag
creatcss.innerHTML=newstyle; // 插入样式文本
document.getElementsByTagName('head')[0].appendChild(creatcss) // 追加新Style至第一个 head 标签后
}

// 自动跳过 interstitial 插页式广告

function pornhub_skipAds(){
const ele_skip = "[onclick*='clearModalCookie']"
const exist = document.querySelectorAll(ele_skip);
    if (document.querySelectorAll(ele_skip).length > 0){
    const href = exist[1].href;
            window.location = href;
    }
}

// 隐藏广告样式

function ddrk_css_catch(){
const newstyle = ".entry { padding: 0px !important ; margin: 0%; }"+
"[id*='afc_sidebar'], #fkasjgf, #sajdhfbjwhe, img,[href*='kst'],[href*='###']{"+
"visibility: hidden !important;"+
"width: 1px !important;"+
"height:1px !important; "+
"opacity:0 !important;"+
"cursor: pointer;"+
"pointer-events:none !important;"+
"z-index: -999;"+
"}"
const creatcss = document.createElement("style"); // 新建style tag
creatcss.innerHTML=newstyle; // 插入样式文本
document.getElementsByTagName('head')[0].appendChild(creatcss) // 追加新Style至第一个 head 标签后
}

// 隐藏广告样式

function jable_css_catch(){
const newstyle = "iframe," +
"div[class*=\"exo\"], " +
".exo-native-widget-outer-container," +
//"div[class*=\"col-6 col-sm-4 col-lg-3\"]," +
"a[target*=\"_blank\"]," +
"a[href*=\"trwl1\"]," +
"div[data-width=\"300\"]," +
"div.text-center.mb-e-30," +
"div[data-width*=\"300\"]," +
"div[style*=\"300px\"]," +
"section[class*=\"justify\"]," +
"iframe[width=\"728\"][height=\"90\"]," +
"#site-content > div.container > section.pb-3.pb-e-lg-40.text-center," +
".text-center > a[target=\"_blank\"] > img," +
"a[href*=\"?banner=\"]," +
".badge," +
"a[href=\"http://uus52.com/\"] {display:none !important;} "
const creatcss = document.createElement("style"); // 新建style tag
creatcss.innerHTML=newstyle; // 插入样式文本
document.getElementsByTagName('head')[0].appendChild(creatcss) // 追加新Style至第一个 head 标签后
}

// 设置 cookie

function jable_removeAds(){ // Cookie 设定及注入
document.cookie = "zone-cap-3403709=1";
document.cookie = "kt_tcookie=1";
document.cookie = "ts_popunder=1";
document.cookie = "cf_chl_prog=b";

var ads_host = [
    'r.trwl1.com',
    'r.www.com'
];

var i,l;
for (l = 0; l < ads_host.length; l++) {
var css_sel = "a[href*='" + ads_host[l] + "']";
var css_catch = [".video-img-box.mb-e-20,.col-6.col-sm-4.col-lg-3"];
var huge = document.querySelectorAll( css_catch );
for (i=0; i< huge.length; i++){
    if (huge[i].querySelectorAll( css_sel ).length > 0) {
        huge[i].style.display = "none";
        }
    }
}
}

function cloudflarePass(){
    // Cloudflare recaptcha 绕过
var title = document.title;
var key = "Attention";
var key_2 = "Cloudflare";
var values = title.search(key);
var values_2 = title.search(key_2);
var failed = "0";
    if ( values >= failed || values_2 >= failed ){
        window.location.reload();
}
}

/* 自动播放 */
function video_AutoPlay () {
var first_Ele = ["video[class*='poster'],video[id='player'],video[id='vjsp_html5_api']"];
var first_Ele_Catch = document.querySelectorAll( first_Ele );
    first_Ele_Catch[0].play()
}
setTimeout(function (){
video_AutoPlay()
},1000);

/* 禁止新页面跳转 */
function url_blank2self(){
var _blank = document.querySelectorAll("a");
var i;
for (i = 0; i < _blank.length; i++) {
        _blank[i].target = "_self";
    }
}

// 隐藏广告样式

function btbdys_css_catch(){
const newstyle = "#ad-index," +
".ayx[style^=\"position: fixed;bottom\"]," +
".ayx[style=\"display:block;\"]," +
"#adsbox  {display:none !important;}" +
"div.page-wrapper {overflow-x:hidden !important;}"
const creatcss = document.createElement("style"); // 新建style tag
creatcss.innerHTML=newstyle; // 插入样式文本
document.getElementsByTagName('head')[0].appendChild(creatcss) // 追加新Style至第一个 head 标签后
}

/* 延迟1秒中清除广告元素以避免bde4反屏蔽检测 */
function btbdys_delayRemoveAds(){
setTimeout(()=>{
var newstyle=".ayx[style^=\"position: fixed;bottom\"]," +
"#ad-index,#adsbox," +
".ayx[style=\"display:block;\"]," +
".ayx[style^=\"position: fixed;bottom\"]," +
"a[target*=_new] {display:none !important;}";
var creatcss=document.createElement("style");
    creatcss.innerHTML=newstyle;
        document.getElementsByTagName('head')[0].appendChild(creatcss)
    },500);
}

/* 视频页广告加速跳过 */

function video_AdsSkip() {
	// Based on uAssets
	// License: https://github.com/uBlockOrigin/uAssets/blob/master/LICENSE
	//  nano-setTimeout-booster.js
	var z = window.setInterval,
		needle = '{{1}}',
		delay = parseInt('{{2}}', 10),
		boost = parseFloat('{{3}}');
	if ( needle === '' || needle === '{{1}}' ) {
		needle = '.?';
	} else if ( needle.charAt(0) === '/' && needle.slice(-1) === '/' ) {
		needle = needle.slice(1, -1);
	} else {
		needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
	}
	needle = new RegExp(needle);
	if ( isNaN(delay) || !isFinite(delay) ) {
		delay = 1000;
	}
	if ( isNaN(boost) || !isFinite(boost) ) {
		boost = 0.05;
	}
	if ( boost < 0.02 ) {
		boost = 0.02;
	}
	if ( boost > 50 ) {
		boost = 50;
	}
	window.setInterval = function(a, b) {
		if ( b === delay && needle.test(a.toString()) ) {
			b *= boost;
		}
		return z.apply(this, arguments);
	}.bind(window);
};