屏蔽整个网站
当前为
// ==UserScript==
// @name 网站屏蔽器
// @version 1.0
// @description 屏蔽整个网站
// @namespace PPPScript
// @license MIT
// @author PPP
// @include *
// @grant unsafeWindow
// ==/UserScript==
function match() {
return localStorage.PPP_banned_sign == 'true';
}
function unmatch() {
return localStorage.PPP_unbanned_sign == 'true';
}
if(unmatch() === false) {
let hre = window.location.origin;
if(match() === true) {
let innerHtml = `<head>
<title>
此网站已被屏蔽
</title>
</head>
<body style="position: relative;">
<style>
PPP-banner {
top: 1em;
left: 1em;
position: fixed;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
PPP-banner-button {
font-size: 16px;
padding: 0.25em 0.5em;
border-radius: 0.5em;
border: 1px solid #000000;
cursor: pointer;
}
hr{
border: 0;
height: 1px;
background-image: linear-gradient(to right, #AAAAAAFF, #AAAAAA00);
}
a:link{
text-decoration: none;
}
a:active{
text-decoration: none;
}
a:visited{
text-decoration: none;
}
a:hover{
text-decoration: none;
}
</style>
<PPP-banner-button onclick="console.log(); if(confirm('您确定要取消屏蔽该网站吗?(${hre})') === true) { localStorage.PPP_banned_sign = null; window.location.reload(); }">取消屏蔽</PPP-banner-button>
<div style="margin-top: 25px; margin-left: 25px;">
<p style="font-size: 54px;">
此网站已被屏蔽
</p>
<hr>
<p style="font-size: 24px; color: #7F7F7F; padding-top: -5px;">
来自 <a href="https://github.com/PPPxcy" target="_blank">PPP</a> 创作的 网站屏蔽器。
</p>
</div>
</body>`;
console.log(`PPP 创作的 网页屏蔽器 已自动屏蔽该网站:${window.location.origin}`);
let last = 1, now, countChange = -1, dangerLevels = [1000000, 100000, 10000, 3000, 1250, 500, 200, 100, 50, 25, 10, 5, 2, 1];
for(let i = now = setInterval(function() {}, 1); i > last; i--)
clearInterval(i), clearTimeout(i);
last = now;
setInterval(
function() {
if(document.documentElement.innerHTML != innerHtml) {
for(let i = now = setInterval(function() {}, 1); i > last; i--)
clearInterval(i), clearTimeout(i);
last = now, countChange++, document.documentElement.innerHTML = innerHtml;
if(countChange > dangerLevels[dangerLevels.length])
console.log(`请确认你的脚本没有问题。对抗次数已经达到 ${dangerLevels.pop()} 次。`);
}
}, 16
);
} else {
let innerHtml = ` <style>
PPP-banner {
top: 1em;
left: 1em;
position: fixed;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
PPP-banner-button {
font-size: 16px;
padding: 0.25em 0.5em;
border-radius: 0.5em;
border: 1px solid #000000;
z-index: 998244353;
cursor: pointer;
}
</style>
<PPP-banner>
<PPP-banner-button onclick="if(confirm('您确定要屏蔽该网站吗?(${window.location.origin})') === true) { localStorage.PPP_banned_sign = 'true'; window.location.reload(); }">屏蔽该网站</PPP-banner-button>
<PPP-banner-button onclick="if(confirm('您确定要取消此按钮吗?(在 ${window.location.origin})') === true) { if(confirm('要永久隐藏吗?(否则本次会话会隐藏)') == true) { localStorage.PPP_unbanned_sign = 'true'; } document.getElementById('fsbfsb1').type = document.getElementById('fsbfsb2').type = 'hidden'}">隐藏</PPP-banner-button>
</PPP-banner>
`;
console.log(`PPP 创作的 网页屏蔽器 已开启`);
setInterval(
function() {
if(document.querySelector('PPP-banner') == null)
document.body.insertAdjacentHTML("beforeend", innerHtml);
}, 16
);
}
}