Skip to content

Instantly share code, notes, and snippets.

@ray1980
Forked from YCF/auto_gray.html
Created February 8, 2020 03:02
Show Gist options
  • Select an option

  • Save ray1980/cc2fa2037c6d6f85e022f74849ef6561 to your computer and use it in GitHub Desktop.

Select an option

Save ray1980/cc2fa2037c6d6f85e022f74849ef6561 to your computer and use it in GitHub Desktop.
<style>
body.grayDay {
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-webkit-filter: grayscale(100%); }
</style>
<script>
window.onload = function() {
var grayDay = [108, 207, 219, 404, 420, 512, 815, 909, 918, 1213];
var today = new Date();
var d = (today.getMonth() + 1) * 100 + today.getDate();
grayDay.forEach(function(i) {
if (i == d) {
var classVal = document.getElementsByTagName('body')[0].getAttribute("class");
classVal = classVal.concat(" grayDay");
document.getElementsByTagName('body')[0].setAttribute("class", classVal);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment