// ==UserScript==
// @name 广告屏蔽
// @namespace http://tampermonkey.net/
// @version 1.7.0
// @update 2024.11.19
// @description 自用,屏蔽一些网站的广告,如果也符合你的需求就下载吧(=・ω・=) 具体屏蔽列表看简介,不需要的屏蔽可以注释掉。
// @author charghet
// @run-at document-body
// @license GPL
// @match http*://www.yhdmp.net/*
// @match http*://api.xiaomingming.org/cloud/mp6.php*
// @match http*://www.bilibili.com/
// @match http*://live.bilibili.com/*
// @match http*://www.bilibili.com/video/*
// @match http*://t.bilibili.com/
// @match http*://www.baidu.com/
// @match http*://fanyi.baidu.com/*
// @match http*://forum.xda-developers.com/*
// @match http*://www.btnull.nu/*
// @downloadURL none
// ==/UserScript==
//屏蔽列表
//樱花动漫
var imomoe = RegExp("http.*://www.yhdmp.net/.*");
var imomoe2 = RegExp("http.*://api.xiaomingming.org/cloud/mp6.php.*");
//哔哩哔哩
var bilibili = RegExp("http.*://www.bilibili.com/$");
var bilibili2 = RegExp("http.*://live.bilibili.com/.*");
var bilibili3 = RegExp("http.*://www.bilibili.com/video/.*");
var bilibili4 = RegExp("http.*://t.bilibili.com/$");
//百度首页
var baidu = RegExp("http.*://www.baidu.com/$");
//百度翻译
var baidufanyi = RegExp("http.*://fanyi.baidu.com/.*");
//XDA
var xda = RegExp("http.*://forum.xda-developers.com/.*");
//btnull
var btnull = RegExp("http.*://www.btnull.nu/.*");
var s = '';
(function() {
if(imomoe.test(location.href)){//樱花动漫
//右下角屏蔽
document.head.insertAdjacentHTML('beforeend','');
//左右横幅屏蔽
document.head.insertAdjacentHTML('beforeend','');
//底部横幅
document.head.insertAdjacentHTML('beforeend','');
//不新建标签,直接打开链接
document.onreadystatechange = function(){
if(document.readyState == "interactive"){
var list = document.getElementsByTagName('a');
for(let i = 0;i < list.length;i++){
list[i].target = '_self';
}
}
}
}else if(imomoe2.test(location.href)){
//暂停页面屏蔽
document.head.insertAdjacentHTML('beforeend','');
}else if(bilibili.test(location.href)){//哔哩哔哩
//开头,勿注释
s = '';
document.head.insertAdjacentHTML('beforeend',s);
}else if(bilibili2.test(location.href)){//哔哩哔哩直播
//开头,勿注释
s = '';
document.head.insertAdjacentHTML('beforeend',s);
window.onload = function() {
//播放器模糊阻挡(遮罩)
var t = setInterval(() => {
var e = document.getElementById('web-player-module-area-mask-panel');
if (e !== null) {
setTimeout(()=> {
e.style.display = 'none';
clearInterval(t);
}, 800);
}
},500);
setTimeout(() => {
clearInterval(t);
}, 10000);
// 自动切换清晰度为原画
var t2;
var st = document.createElement('style');
st.innerText = 'div.control-area{display:none !important;}';
t2 = setInterval(() => {
var player = document.getElementById("live-player");
if (player) {
document.head.appendChild(st);
player.dispatchEvent(new Event('mousemove'));
var wrap = document.querySelectorAll(".quality-wrap");
if (wrap.length > 0) {
wrap[0].dispatchEvent(new Event("mouseenter"));
var li = document.querySelectorAll(".list-it");
if (li.length > 0) {
li[0].click();
player.dispatchEvent(new Event('mouseleave'));
if (st.parentNode) {
document.head.removeChild(st);
}
clearInterval(t2);
}
}
}
},500);
setTimeout(() => {
if (st.parentNode) {
document.head.removeChild(st);
}
clearInterval(t2);
}, 3000);
};
}else if(bilibili3.test(location.href)){//哔哩哔哩视频
//右下角、横幅屏蔽
document.head.insertAdjacentHTML('beforeend','');
}else if(bilibili4.test(location.href)){//哔哩哔哩动态
//右边广告
document.head.insertAdjacentHTML('beforeend','');
}else if(baidu.test(location.href)){//百度首页
//搜索框底部新闻屏蔽
document.head.insertAdjacentHTML('beforeend','');
}else if(baidufanyi.test(location.href)){//百度翻译
//右边和底部广告
document.head.insertAdjacentHTML('beforeend','');
}else if(xda.test(location.href)){//XDA
document.head.insertAdjacentHTML('beforeend','');
}else if(btnull.test(location.href)){//btnull
document.head.insertAdjacentHTML('beforeend','');
}else{
console.log('广告屏蔽:无匹配');
}
})();