-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved scripts outside of logo svg's * Fixed wrong variant of logo displaying in chromium-based browsers
- Loading branch information
Showing
15 changed files
with
1,469 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Sets festive theming on logo. | ||
* @param {String} festive | ||
*/ | ||
const setFestive = (festive) => { | ||
// logo.svg -> logo-${festive}.svg | ||
// logo-dark.svg -> logo-${festive}-dark.svg | ||
// logo-light.svg -> logo-${festive}-light.svg | ||
for (const logo of document.querySelectorAll(".navbar-brand img")) { | ||
for (const suffix of ["-dark.svg", "-light.svg", ".svg"]) { | ||
if (logo.src.endsWith(suffix)) { | ||
logo.src = `${logo.src.replace(suffix, "")}-${festive}${suffix}`; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
const date = new Date(); | ||
const month = date.getMonth() + 1; // Javascript's month starts from 0 and ends in 11 | ||
const day = date.getDate(); | ||
|
||
// Ylioppilaslakki | ||
if (month == 4 && day > 30 - 2 * 7 || month == 5 && day == 1) { | ||
setFestive("vappu"); | ||
} | ||
|
||
// Pride month | ||
else if (month == 6) { | ||
setFestive("pride"); | ||
} | ||
|
||
// Christmas | ||
else if (month == 12) { | ||
setFestive("joulu"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.