From 2e09e8800db12bf410245148d722c643a202c031 Mon Sep 17 00:00:00 2001 From: yujinpan <1192878390@qq.com> Date: Sat, 4 Apr 2020 14:20:09 +0800 Subject: [PATCH] update version --- README.md | 4 ++++ scripts/black-and-white.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 scripts/black-and-white.js diff --git a/README.md b/README.md index 2625a2f..03c613d 100644 --- a/README.md +++ b/README.md @@ -121,3 +121,7 @@ - 兼容 img 的 `srcset` 属性 - 去掉重复的资源 - 修改按钮的动态透明度,不遮挡内容 + +## 黑白 + +黑白化网站。 \ No newline at end of file diff --git a/scripts/black-and-white.js b/scripts/black-and-white.js new file mode 100644 index 0000000..687d0f0 --- /dev/null +++ b/scripts/black-and-white.js @@ -0,0 +1,19 @@ +// ==UserScript== +// @name 黑白 +// @namespace https://github.com/yujinpan/tampermonkey-extension +// @version 1.0 +// @license MIT +// @description 网站黑白化。 +// @author yujinpan +// @include http*://** +// ==/UserScript== + +(function () { + var html = document.querySelector('html'); + var style = html.getAttribute('style') || ''; + if (style && style.slice(-1) !== ';') style += ';'; + html.setAttribute('style', + style + + 'filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);' + + 'filter: grayscale(100%);'); +})(); \ No newline at end of file