Skip to content

Instantly share code, notes, and snippets.

@long-woo
Last active April 4, 2020 06:59
Show Gist options
  • Save long-woo/51c29a524a7657b295cefe1e8813d878 to your computer and use it in GitHub Desktop.
Save long-woo/51c29a524a7657b295cefe1e8813d878 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name 4.4
// @namespace https://longwoo.me
// @version 0.2.0
// @description 全网默哀模式
// @author long.woo
// @include *
// @grant none
// ==/UserScript==
(function() {
'use strict';
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
const date = now.getDate();
const time = new Date(year, month, date).getTime();
const yearShort = year.toString().slice(2); // 获取年份后两位
const chunFen = Math.round(yearShort * 0.2422 + 20.646 - yearShort / 4);
const qingMing = new Date(year, 2, chunFen).getTime() + 15 * 24 * 60 * 60 * 1000;
if(time !== qingMing) return;
document.getElementsByTagName('html')[0].style = '-webkit-filter: grayscale(100%); filter: grayscale(100%);';
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment