1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| function applyBlackAndWhiteFilterOnDate(targetDate) {
var currentDate = new Date();
var targetMonth = targetDate.split("-")[0];
var targetDay = targetDate.split("-")[1];
// 检查当前日期是否与目标日期相等
if (
currentDate.getMonth() + 1 === parseInt(targetMonth) &&
currentDate.getDate() === parseInt(targetDay)
) {
// 将整个 HTML 页面设置为黑白滤镜
document.documentElement.style.filter = "grayscale(100%)";
}
}
applyBlackAndWhiteFilterOnDate("12-31");
|