Blocks the page by adding a semitransparent white overlay on top of it.
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/468732/1205573/blockPage.js
// ==UserScript==
// @name blockPage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Blocks the page by adding a semitransparent white overlay on top of it.
// @author IgnaV
// @grant none
// ==/UserScript==
const blockPage = () => {
const overlay = document.createElement("div");
overlay.id = "page-overlay";
overlay.style.cssText = "position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.5);";
document.body.appendChild(overlay);
};
const unblockPage = () => {
const overlay = document.querySelector("#page-overlay");
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
};