使用者:WSTouty/灰暗開關
跳至導覽
跳至搜尋
<style> html, body {
position: relative; height: unset !important; min-height: 100vw;
}
html {
transition: .37s filter ease-in-out; filter: none; background: #f6f6f6;
}
html.gray {
filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%)
}
html.gray:before {
content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.please-donate {
display: none !important;
} </style><script>
"use strict"; window.RLQ = window.RLQ || []; window.RLQ.push(async () => {
await Promise.all([
mw.loader.using(["ext.gadget.libBottomRightCorner", "ext.gadget.libOOUIDialog", "ext.gadget.site-lib"]),
$.ready,
]);
$("html")[sessionStorage.getItem("WidgetDeceasedPersonGrayClass") !== "removeClass" ? "addClass" : "removeClass"]("gray");
mw.loader.addStyleTag(`html.gray:before { background: ${$("body").css("background")}; }`);
insertToBottomRightCorner(wgULS("切换灰度模式", "切換灰度模式")).on("click", () => {
$("html").toggleClass("gray");
if (sessionStorage.getItem("WidgetDeceasedPersonGrayClass") === null) {
oouiDialog.alert(wgULS("该切换功能会影响所有使用灰度模式的页面,并在浏览器关闭后会重置回默认的【开启】状态。", "該切換功能會影響所有使用灰度模式的頁面,並在瀏覽器關閉後會重置回預設的【開啟】狀態。"), {
title: wgULS("灰度模式切换提示", "灰度模式切換提示"),
});
}
sessionStorage.setItem("WidgetDeceasedPersonGrayClass", $("html").is(".gray") ? "addClass" : "removeClass");
});
}); </script>