Commit 770ce101 authored by Daniel W Bond's avatar Daniel W Bond

pride.codes now loads specifically on the third week of that March

parent 46244cb6
......@@ -2,9 +2,25 @@ function checkDate() {
var d = new Date(),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate()
if (month == 3 && day > 20) {
var body = document.getElementById("body");
body.classList.add("pride-bar");
year = '' + d.getYear();
// if it is March
if (month == 3) {
// find out what the third week of March is
var marchFirst = new Date(year, month, 1);
// days of the week are 0 - 6
// Sunday is 0
var weekday = marchFirst.getDay();
var daysInFirstWeek = 7 - weekday;
// hopefully they won't schedule a different week
// overlap from March into April would be especially annoying
var thirdWeek = daysInFirstWeek + 14;
var fourthWeek = daysInFirstWeek + 21;
if (day > thirdWeek && day <= fourthWeek){
// appends the pride bar to existing classes,
// maintaining all of the Masonstrap formatting
document.body.className += " pride-bar";
}
}
}
window.onload = checkDate
\ No newline at end of file
window.onload = checkDate
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment