// ==UserScript==
// @name 网页屏蔽器
// @name:en-US Website Blocker
// @version 1.3.5-refix
// @description 屏蔽整个网站
// @description:en-US Block the whole site
// @namespace PPPScript
// @license MIT
// @author PPPxcy
// @include *
// @noframes false
// @grant unsafeWindow
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @run-at document-start
// @supportURL [email protected]
// ==/UserScript==
var getValue = function(name, defaultValue, isValid) {
let orig = GM_getValue(name);
if((isValid && !isValid(orig)) || orig === undefined || orig === null)
GM_setValue(name, orig = defaultValue);
return orig;
}, toTable = function(thing) {
let res = [];
for(let i in thing)
res.push(i);
return res;
}, isHexColor = function(color) {
color = String(color);
return color.length == 7 && color.charAt(0) == '#' && /^[0-9a-fA-F]{6}$/.test(color.substr(1));
}, languagePackage = {
'zh': {
name: () => '简体中文',
settings: () => '设置',
banner: () => 'PPPxcy 创作的 网页屏蔽器',
blackList: () => (languagePackage.zh.banner() + ' 屏蔽名单:'),
whiteList: () => (languagePackage.zh.banner() + ' 白名单:'),
isBanned: () => '此网站已被屏蔽',
cancelBan: () => '取消屏蔽',
comefromWithLink: () => '来自 <a href="https://github.com/PPPxcy" target="_blank">PPPxcy</a> 创作的 网页屏蔽器。',
comefrom: () => ('来自' + languagePackage.zh.banner() + '。'),
autoBan: () => (languagePackage.zh.banner() + '已自动屏蔽该网站:'),
bannerOpened: () => (languagePackage.zh.banner() + ' 已开启。'),
youBannedIt: [() => '你屏蔽了它:', () => ',对吧?'],
battle: [() => '请确认你的其他脚本没有问题。对抗次数已经达到', () => '次。'],
cancelConfirm: [() => '您确定要取消屏蔽该网站吗?(', () => ')'],
dragToMove: () => '拖拽以移动按钮',
banTheSite: () => '屏蔽该网站',
hide: () => '隐藏',
banConfirm: [() => '您确定要屏蔽该网站吗?(', () => ')'],
hideConfirm: [() => '您确定要隐藏此按钮吗?(在', () => ')'],
hideForever: () => '要永久隐藏吗?(否则本次会话会隐藏)',
sureToSettings: () => '你确定要进入设置页面吗?(这会导致该网页刷新!)',
settingsTitle: () => 'PPPxcy 创作的 网页屏蔽器 设置',
language: () => '语言:',
displayIt: () => '点击刷新以查看结果'
}, 'en': {
name: () => 'English',
settings: () => 'Settings',
banner: () => 'The \x1B[3mWebsite Blocker\x1B[23m written by PPPxcy',
blackList: () => ('The blocked-list of ' + languagePackage.en.banner() + ': '),
whiteList: () => ('The white-list of ' + languagePackage.en.banner() + ': '),
isBanned: () => 'The website is blocked. ',
cancelBan: () => 'Unblock',
comefromWithLink: () => 'From the <i>Website Blocker</i> written by <a href="https://github.com/PPPxcy" target="_blank">PPPxcy</a>. ',
comefrom: () => ('From ' + 'the Website Blocker written by PPPxcy' + '. '),
autoBan: () => (languagePackage.en.banner() + ' automatically blocked this site: '),
bannerOpened: () => (languagePackage.en.banner() + ' is opened. '),
youBannedIt: [() => 'You banned the site: ', () => ', currect? '],
battle: [() => 'Please check your other scripts. The confrontations\' count is at', () => '. '],
cancelConfirm: [() => 'Are you sure to unblock this site? (', () => ')'],
dragToMove: () => 'Drag to move the buttons. ',
banTheSite: () => 'Block the site',
hide: () => 'Hide',
banConfirm: [() => 'Are you sure to block this site? (', () => ')'],
hideConfirm: [() => 'Are you sure to hide the buttons? (At', () => ')'],
hideForever: () => 'Are you sure to hide these buttons forever? (If you press "No", the buttons will be hiden until you reload this page.)',
sureToSettings: () => 'Are you sure to settings page? (It will reload this tab!)',
settingsTitle: () => 'Settings of the <i>Website Blocker</i> written by PPPxcy',
language: () => 'Language: ',
displayIt: () => 'Click it to reload to display the settings'
}
};
let currentLang = getValue("PPP_banner_currentlanguage", 'zh', value => (languagePackage[value] !== undefined)), langPkg = languagePackage[currentLang];
var PPPbanner = Object.assign(PPPbanner || {}, {top: 0, left: 0, listener: null, selectl: null, optionl: null});
let hre = window.location.origin, menu_command_id = GM_registerMenuCommand(langPkg.settings(), function() {
// TODO: Things of settings...
if(confirm(langPkg.sureToSettings()) === false)
return;
let styles = document.createElement('style'), options = document.createElement('PPP-mask');
styles.innerText = `body {
overflow: clip;
}
PPP-inline-group {
flex: 1;
display: inline-block;
}
PPP-group {
display: flex;
flex-wrap: wrap;
text-align: left;
align-items: center;
flex-direction: row;
align-content: stretch;
justify-content: center;
}
PPP-flex-rowwrap {
width: 100%;
height: 0.5em;
display: inline-block;
}
PPP-flex-space {
flex: 1;
min-width: 1px;
display: inline-block;
}
PPP-mask {
all: initial;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
position: fixed;
font-size: 16px;
z-index: 998244353;
justify-content: center;
background-color: #000A;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
PPP-mask * {
line-height: 1.5em;
box-sizing: content-box;
font-family: sans-serif;
vertical-align: initial;
}
PPP-banner-setter {
--bgc: ${getValue("PPP_banner_settingsbackgroundcolor", '#FFFFFF', isHexColor)};
--fgc: ${getValue("PPP_banner_settingsforegroundcolor", '#000000', isHexColor)};
--cdk: ${getValue("PPP_banner_settingsmaincolordark", '#114466', isHexColor)};
--clt: ${getValue("PPP_banner_settingsmaincolorlight", '#99EEFF', isHexColor)};
--cmn: ${getValue("PPP_banner_settingsmaincolor", '#22CCFF', isHexColor)};
color: var(--fgc);
margin: 1.5625em 0;
overflow-x: hidden;
border-radius: 2.5em;
padding-bottom: 1.75em;
background-color: var(--bgc);
}
PPP-banner-setter > :first-child {
color: var(--cdk);
font-size: 1.5em;
position: relative;
text-align: center;
line-height: 1.5em;
padding: 0.25em 1.75em;
background-color: var(--clt);
}
PPP-banner-setter > :first-child > :last-child {
width: 1.5em;
height: 1.5em;
color: var(--bgc);
text-align: center;
margin-left: 0.5em;
line-height: 1.5em;
margin-right: -1em;
display: inline-block;
border-radius: 0.75em;
background-color: var(--cdk);
box-shadow: inset 0.0234375em 0.0234375em 0 0.0625em var(--cmn);
}
PPP-banner-setter > :first-child > :last-child:hover {
filter: brightness(0.875);
backdrop-filter: brightness(0.875);
box-shadow: inset -0.0234375em -0.0234375em 0 0.0625em var(--fgc);
}
PPP-banner-setter > :not(PPP-banner-setter > :first-child, PPP-banner-setter > :last-child) {
border-bottom: 1px solid var(--fgc);
}
PPP-banner-setter > :not(PPP-banner-setter > :first-child) {
padding: 0.625em;
margin: 0 1.5625em;
}
PPP-banner-setter PPP-select {
color: var(--cdk);
height: 1.75em;
min-width: 3.5em;
overflow-x: clip;
display: inline-block;
border-radius: 0.25em;
vertical-align: middle;
border: 1px solid var(--cdk);
background-color: var(--bgc);
}
PPP-banner-setter PPP-select > PPP-option {
width: 100%;
height: 1.75em;
padding: 0 0.125em;
line-height: 1.75em;
white-space: nowrap;
}
PPP-banner-setter PPP-select[expanded] {
overflow-y: auto;
border-width: 2px;
z-index: 998244353;
position: relative;
height: calc(var(--things-count) * 1.75em);
margin: -1px -1px calc(var(--things-count) * -1.75em + 1.75em - 1px) -1px;
}
PPP-banner-setter PPP-select > PPP-option:hover {
filter: brightness(0.875);
backdrop-filter: brightness(0.875);
}
PPP-banner-setter PPP-select[expanded] > PPP-option {
width: 100%;
display: block;
text-align: left;
}
PPP-banner-setter PPP-select:focus > PPP-option[chosen] {
color: var(--bgc);
background-color: var(--cmn);
}
PPP-banner-setter PPP-select > PPP-option[chosen] {
display: inline-block;
}
PPP-banner-setter PPP-select:not(PPP-banner-setter PPP-select[expanded], PPP-banner-setter PPP-select:has(PPP-option[chosen])):hover {
filter: brightness(0.875);
backdrop-filter: brightness(0.875);
}
PPP-banner-setter PPP-select:not(PPP-banner-setter PPP-select[expanded]) > PPP-option:not(PPP-banner-setter PPP-select > PPP-option[chosen]) {
display: none;
}
PPP-color-chooser > input[type=color]:hover {
cursor: pointer;
filter: brightness(0.875);
backdrop-filter: brightness(0.875);
}
PPP-color-chooser {
--width: 1.5em;
--height: 1.5em;
margin: 0;
padding: 0;
overflow: clip;
font-size: inherit;
width: var(--width);
pointer-events: none;
height: var(--height);
display: inline-block;
vertical-align: middle;
border: 1px solid var(--cdk);
}
PPP-color-chooser > input[type=color] {
padding: 0;
border: none;
margin: -7px -5px;
font-size: inherit;
pointer-events: auto;
background-color: transparent;
width: calc(var(--width) + 10px);
height: calc(var(--height) + 14px);
}`, options.innerHTML = `<PPP-banner-setter><PPP-group>${langPkg.settingsTitle()}<span>×</span></PPP-group><PPP-group><PPP-inline-group><PPP-label>${langPkg.language()}</PPP-label><PPP-select forvalue="PPP_banner_currentlanguage" tabindex="0">${(function() {
let res = '';
for(let i in languagePackage)
res += `<PPP-option value="${i}"${i == currentLang ? ' chosen' : ''}>${languagePackage[i].name()}</PPP-option>`;
return res;
})()}</PPP-select></PPP-inline-group></PPP-group><PPP-group><PPP-inline-group><PPP-label>主颜色:</PPP-label><PPP-color-chooser forvalue="PPP_banner_settingsmaincolor"><input type="color" /></PPP-color-chooser></PPP-inline-group>
<PPP-inline-group><PPP-label>前景色:</PPP-label><PPP-color-chooser forvalue="PPP_banner_settingsforegroundcolor"><input type="color" /></PPP-color-chooser></PPP-inline-group>
<PPP-inline-group><PPP-label>背景色:</PPP-label><PPP-color-chooser forvalue="PPP_banner_settingsbackgroundcolor"><input type="color" /></PPP-color-chooser></PPP-inline-group><PPP-flex-space></PPP-flex-space><PPP-flex-rowwrap></PPP-flex-rowwrap>
<PPP-flex-space></PPP-flex-space><PPP-inline-group><PPP-label>较暗色:</PPP-label><PPP-color-chooser forvalue="PPP_banner_settingsmaincolordark"><input type="color" /></PPP-color-chooser></PPP-inline-group>
<PPP-inline-group><PPP-label>较亮色:</PPP-label><PPP-color-chooser forvalue="PPP_banner_settingsmaincolorlight"><input type="color" /></PPP-color-chooser></PPP-inline-group><PPP-flex-space></PPP-flex-space></PPP-group></PPP-banner-setter>`,
document.head.appendChild(styles), document.body.appendChild(options),
options.querySelector('PPP-banner-setter > :first-child > :last-child').title = `${langPkg.displayIt()}`,
options.querySelector('PPP-banner-setter > :first-child > :last-child').onclick = function() {
window.location.reload();
}, [...options.querySelectorAll('PPP-select')].forEach(function(sel) {
sel.onclick = function() {
sel.focus(), sel.setAttribute('expanded', '');
if(!PPPbanner.optionl) {
PPPbanner.optionl = [];
let opts = [...sel.querySelectorAll('PPP-option')];
for(let i = 0; i < opts.length; i++) {
opts[i].addEventListener('click', PPPbanner.optionl[i] = function(event) {
event.stopPropagation(), event.preventDefault();
if(sel.querySelector('PPP-option[chosen]'))
sel.querySelector('PPP-option[chosen]').removeAttribute('chosen');
opts[i].setAttribute('chosen', ''), GM_setValue(sel.getAttribute('forvalue'), opts[i].getAttribute('value'));
if(PPPbanner.optionl) {
let opts = [...sel.querySelectorAll('PPP-option')];
for(let i = 0; i < opts.length; i++)
opts[i].removeEventListener('click', PPPbanner.optionl[i]);
PPPbanner.optionl = null, sel.removeAttribute('expanded');
}
});
}
}
return false;
}, sel.onfocus = function() {
if(!PPPbanner.selectl) {
document.addEventListener('keydown', PPPbanner.selectl = function(event) {
switch(event.keyCode) {
case 38: {
let lastChosen = sel.querySelector('PPP-option[chosen]');
if(!lastChosen)
lastChosen = sel.firstChild;
if(lastChosen.previousElementSibling || lastChosen.previousSibling) {
let then = (lastChosen.previousElementSibling || lastChosen.previousSibling);
lastChosen.removeAttribute('chosen'), then.setAttribute('chosen', ''), GM_setValue(sel.getAttribute('forvalue'), then.getAttribute('value')), then.scrollIntoView({block: 'nearest', behavior: 'smooth'});
}
break;
} case 40: {
let lastChosen = sel.querySelector('PPP-option[chosen]');
if(!lastChosen)
lastChosen = sel.firstChild;
if(lastChosen.nextElementSibling || lastChosen.nextSibling) {
let then = (lastChosen.nextElementSibling || lastChosen.nextSibling);
lastChosen.removeAttribute('chosen'), then.setAttribute('chosen', ''), GM_setValue(sel.getAttribute('forvalue'), then.getAttribute('value')), then.scrollIntoView({block: 'nearest', behavior: 'smooth'});
}
break;
}
}
return false;
});
}
}, sel.onblur = function() {
if(PPPbanner.selectl)
document.removeEventListener('keydown', PPPbanner.selectl), PPPbanner.selectl = null;
if(PPPbanner.optionl) {
let opts = [...sel.querySelectorAll('PPP-option')];
for(let i = 0; i < opts.length; i++)
opts[i].removeEventListener('click', PPPbanner.optionl[i]);
PPPbanner.optionl = null, sel.removeAttribute('expanded');
}
}, sel.style = `--things-count: ${Math.min(sel.querySelectorAll('PPP-option').length, 5)};`;
}), [...options.querySelectorAll('PPP-color-chooser')].forEach(function(csr) {
csr.firstChild.value = GM_getValue(csr.getAttribute('forvalue')), csr.firstChild.addEventListener("input", function(event) {
GM_setValue(csr.getAttribute('forvalue'), csr.firstChild.value);
});
});
});
(function() {
let orig = GM_getValue("PPP_banner_bannedlist");
if(localStorage.PPP_banned_sign == 'true')
GM_setValue("PPP_banner_bannedlist", (typeof orig == 'object' ? (orig[hre] = null, orig) : (orig = {}, orig[hre] = null, orig)));
console.log(langPkg.blackList() + '%O', [...toTable(orig)]);
})(), (function() {
let orig = GM_getValue("PPP_banner_whitelist");
if(localStorage.PPP_unbanned_sign == 'true')
GM_setValue("PPP_banner_whitelist", (typeof orig == 'object' ? (orig[hre] = null, orig) : (orig = {}, orig[hre] = null, orig)));
console.log(langPkg.whiteList() + '%O', [...toTable(orig)]);
})();
if(localStorage.PPP_unbanned_sign != 'true') {
if(localStorage.PPP_banned_sign == 'true') {
let innerHtml = ` <head>
<title>
${langPkg.isBanned()}
</title>
<link rel="icon" href="https://what" type="image/png">
</head>
<body style="position: relative;">
<style>
html {
font-size: 16px;
}
PPP-banner {
--bgc: ${getValue("PPP_banner_settingsbackgroundcolor", '#FFFFFF', isHexColor)};
--fgc: ${getValue("PPP_banner_settingsforegroundcolor", '#000000', isHexColor)};
--cdk: ${getValue("PPP_banner_settingsmaincolordark", '#114466', isHexColor)};
--clt: ${getValue("PPP_banner_settingsmaincolorlight", '#99EEFF', isHexColor)};
--cmn: ${getValue("PPP_banner_settingsmaincolor", '#22CCFF', isHexColor)};
all: initial;
top: 1em;
left: 1em;
color: var(--fgc);
display: block;
position: fixed;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
PPP-banner-button:hover {
filter: brightness(87.5%);
}
PPP-banner-button {
all: initial;
cursor: pointer;
border-radius: 0.5em;
padding: 0.25em 0.5em;
display: inline-block;
background-color: var(--bgc);
border: 1px solid var(--cdk);
}
hr{
border: 0;
height: 1px;
background-image: linear-gradient(to right, #AAAF, #AAA0);
}
a:link{
text-decoration: none;
}
a:active{
text-decoration: none;
}
a:visited{
text-decoration: none;
}
a:hover{
text-decoration: none;
}
</style>
<PPP-banner>
<PPP-banner-button>${langPkg.cancelBan()}</PPP-banner-button>
</PPP-banner>
<div style="margin-top: 25px; margin-left: 25px;">
<p style="font-size: 3em;">
${langPkg.isBanned()}
</p>
<hr>
<p style="font-size: 1.5em; color: gray; margin-top: -5px;">
${langPkg.comefromWithLink()}
</p>
</div>
</body>`;
console.log(`${langPkg.autoBan()}${window.location.origin}`);
let last = 1, now, iself, countChange = -1, first = true, 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, iself = setInterval(function() {
if(document.documentElement.innerHTML != innerHtml) {
for(let i = now = setInterval(function() {}, 1); i > last; i--)
if(i != iself)
clearInterval(i), clearTimeout(i);
last = now, countChange++, document.documentElement.innerHTML = innerHtml;
if(countChange >= dangerLevels[dangerLevels.length - 1])
console.error(`${langPkg.battle[0]()} ${dangerLevels.pop()} ${langPkg.battle[1]()}`);
document.querySelector('PPP-banner > PPP-banner-button:last-child').onclick = function() {
if(confirm(`${langPkg.cancelConfirm[0]()}${hre}${langPkg.cancelConfirm[1]()}`) === true) {
let orig = GM_getValue("PPP_banner_bannedlist");
GM_setValue("PPP_banner_bannedlist", typeof orig == 'object' ? (delete orig[hre], orig) : {}),
delete localStorage.PPP_banned_sign, window.location.reload();
}
};
if(first)
innerHtml = document.documentElement.innerHTML, first = false;
}
}, 16);
} else {
let innerHtml = ` <style>
PPP-banner {
--bgc: ${getValue("PPP_banner_settingsbackgroundcolor", '#FFFFFF', isHexColor)};
--fgc: ${getValue("PPP_banner_settingsforegroundcolor", '#000000', isHexColor)};
--cdk: ${getValue("PPP_banner_settingsmaincolordark", '#114466', isHexColor)};
--clt: ${getValue("PPP_banner_settingsmaincolorlight", '#99EEFF', isHexColor)};
--cmn: ${getValue("PPP_banner_settingsmaincolor", '#22CCFF', isHexColor)};
all: initial;
top: ${localStorage.PPP_banner_lasttop == undefined ? (localStorage.PPP_banner_lasttop = 16) : localStorage.PPP_banner_lasttop}px;
left: ${localStorage.PPP_banner_lastleft == undefined ? (localStorage.PPP_banner_lastleft = 16) : localStorage.PPP_banner_lastleft}px;
color: var(--fgc);
display: block;
position: fixed;
font-size: 16px;
z-index: 998244353;
white-space: nowrap;
pointer-events: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
PPP-banner-dragger:hover, PPP-banner-button:hover {
filter: brightness(87.5%);
}
PPP-banner-dragger {
width: 2em;
height: 2em;
z-index: 998244353;
position: relative;
border-radius: 0.5em;
pointer-events: auto;
display: inline-block;
vertical-align: middle;
background-color: var(--fgc);
}
PPP-banner-dragger:hover {
cursor: grab;
}
PPP-banner-dragger::before {
width: 2em;
padding: 0;
height: 2em;
overflow: hidden;
content: "\\FEFF";
border-radius: 1em;
display: inline-block;
background-image: radial-gradient(var(--bgc), var(--clt) 12.5%, var(--cmn) 35.5%, var(--cdk) 65%, var(--fgc));
}
PPP-banner-button {
all: initial;
color: var(--fgc);
cursor: pointer;
z-index: 998244353;
position: relative;
border-radius: 0.5em;
pointer-events: auto;
display: inline-block;
padding: 0.25em 0.5em;
vertical-align: middle;
background-color: var(--bgc);
border: 1px solid var(--fgc);
}
</style>
<PPP-banner>
<PPP-banner-dragger title="${langPkg.dragToMove()}"></PPP-banner-dragger>
<PPP-banner-button>${langPkg.banTheSite()}</PPP-banner-button>
<PPP-banner-button>${langPkg.hide()}</PPP-banner-button>
</PPP-banner>
`;
console.log(`${langPkg.bannerOpened()}`), setInterval(function() {
if(document.body && document.querySelector('PPP-banner') == null) {
document.body.insertAdjacentHTML("beforeend", innerHtml),
document.body.querySelector('PPP-banner-dragger').onmousedown = function(event) {
if(PPPbanner.listener !== null)
return;
document.querySelector('PPP-banner-dragger').focus(),
PPPbanner.top = event.clientY - document.querySelector('PPP-banner').style.top.substr(0, document.querySelector('PPP-banner').style.top.length - 2),
PPPbanner.left = event.clientX - document.querySelector('PPP-banner').style.left.substr(0, document.querySelector('PPP-banner').style.left.length - 2),
document.querySelector('PPP-banner').style.willChange = "top, left", PPPbanner.listener = function(event) {
document.querySelector('PPP-banner').style.opacity = '0.75',
document.querySelector('PPP-banner').style.top = Math.min(Math.max(0, localStorage.PPP_banner_lasttop = event.clientY - PPPbanner.top), window.innerHeight - document.body.querySelector('PPP-banner').getBoundingClientRect().height) + 'px',
document.querySelector('PPP-banner').style.left = Math.min(Math.max(0, localStorage.PPP_banner_lastleft = event.clientX - PPPbanner.left), window.innerWidth - document.body.querySelector('PPP-banner').getBoundingClientRect().width) + 'px';
}, document.addEventListener('mousemove', PPPbanner.listener), window.onmouseup = function(event) {
document.removeEventListener('mousemove', PPPbanner.listener),
document.querySelector('PPP-banner').style.opacity = document.querySelector('PPP-banner').style.willChange = PPPbanner.listener = window.onmouseup = null;
};
}, document.querySelector('PPP-banner > PPP-banner-button:not(PPP-banner > PPP-banner-button:last-child)').onclick = function(event) {
if(confirm(`${langPkg.banConfirm[0]()}${hre}${langPkg.banConfirm[1]()}`) === true) {
localStorage.PPP_banned_sign = 'true';
let orig = GM_getValue("PPP_banner_bannedlist");
GM_setValue("PPP_banner_bannedlist", typeof orig == 'object' ? (orig[hre] = null, orig) : (orig = {}, orig[hre]= null, orig)), window.location.reload();
}
}, document.querySelector('PPP-banner > PPP-banner-button:last-child').onclick = function(event) {
if(confirm(`${langPkg.hideConfirm[0]()} ${hre}${langPkg.hideConfirm[1]()}`) === true) {
if(confirm(`${langPkg.hideForever()}`) == true) {
localStorage.PPP_unbanned_sign = 'true';
let orig = GM_getValue("PPP_banner_whitelist");
GM_setValue("PPP_banner_whitelist", typeof orig == 'object' ? (orig[hre] = null, orig) : (orig = {}, orig[hre]= null, orig));
}
document.querySelector('PPP-banner').style.display = 'none';
}
}, setInterval(function() {
document.querySelector('PPP-banner').style.top = Math.min(Math.max(0, localStorage.PPP_banner_lasttop), window.innerHeight - document.body.querySelector('PPP-banner').getBoundingClientRect().height) + 'px',
document.querySelector('PPP-banner').style.left = Math.min(Math.max(0, localStorage.PPP_banner_lastleft), window.innerWidth - document.body.querySelector('PPP-banner').getBoundingClientRect().width) + 'px';
}, 16);
}
}, 16);
}
}
if(!(localStorage.PPP_unbanned_sign != 'true' && localStorage.PPP_banned_sign == 'true')) {
let styles = document.createElement('style');
styles.innerText = `a[href][PPP-blocked] { filter: brightness(0.5) sepia(1); backdrop-filter: brightness(0.5) sepia(1); border: 1px solid brown; }`, document.head.appendChild(styles), setInterval(function() {
let orig = GM_getValue('PPP_banner_bannedlist'), alist = [...document.querySelectorAll('a[href]:not(a[href][PPP-checked], a[href][PPP-blocked])')];
if(orig != undefined) {
for(let i = 0; i < alist.length; i++) {
try {
if(orig[new URL(alist[i].getAttribute('href'), window.location.href).origin] !== undefined)
alist[i].setAttribute('PPP-blocked', ''), alist[i].setAttribute('title', `${langPkg.youBannedIt[0]()}` + new URL(alist[i].getAttribute('href'), window.location.href).origin + `${langPkg.youBannedIt[1]()}\n${langPkg.comefrom()}`);
else
alist[i].setAttribute('PPP-checked', '');
} catch(error) {
alist[i].setAttribute('PPP-checked', '');
}
}
}
}, 16);
}