Last active
April 4, 2020 06:59
-
-
Save long-woo/51c29a524a7657b295cefe1e8813d878 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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