网站一键灰色代码


今天是清明节,禁止一切娱乐活动。政府部门的网站都是灰色
看代码~

        var date = new Date();
        var graydate = ['04-05','05-12','12-13', '09-18']//国家公祭日,918国耻日
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = month + seperator1 + strDate;


        if (graydate.includes(currentdate)) {
            document.querySelector('html').style.webkitFilter = 'grayscale(1)'
        }