Greasy Fork

哔滴影视广告屏蔽

哔滴影视广告屏蔽(图片广告屏蔽及视频广告跳过)

目前为 2022-04-11 提交的版本。查看 最新版本

// ==UserScript==
// @name         哔滴影视广告屏蔽
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  哔滴影视广告屏蔽(图片广告屏蔽及视频广告跳过)
// @author       limbopro
// @match        https://www.btbdys.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=btbdys.com
// @grant        none
// @run-at document-end
// @license GNU GPLv3
// ==/UserScript==

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

(function() {
	// 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);
})();


/* 禁止新页面跳转 */

var _blank = document.querySelectorAll("a");
var i;
for (i = 0; i < _blank.length; i++) {
_blank[i].target = "_self";
}

/* 延迟1秒中清除广告元素以避免bde4反屏蔽检测 */

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);