NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Twitter Time of Day // @include https://twitter.com/* // @include http://twitter.com/* // ==/UserScript== var partOfDay = getPartOfDay(); var dayOfWeek = getDayOfWeek(); setRootClass(partOfDay); setRootClass(dayOfWeek); function setRootClass(addClass) { var root = document.documentElement; root.className += ' ' + addClass; } function getPartOfDay() { var myDate = new Date(); var ret = ''; if (myDate.getHours() < 12) { ret = 'Morning'; } else if (myDate.getHours() >= 12 && myDate.getHours() <= 17) { ret = 'Afternoon'; } else if (myDate.getHours() > 17 && myDate.getHours() <= 24) { ret = 'Evening'; } return ret; } function getDayOfWeek() { var myDate = new Date(); var weekday = new Array(7); weekday[0]= "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; return weekday[myDate.getDay()]; }