Added '(Classic)' postifx to 'The Network', fixed small theming bug

This commit is contained in:
rainbow napkin 2026-10-05 22:31:11 -04:00
parent e6e061ab44
commit 1d09833c2a
3 changed files with 31 additions and 9 deletions

View file

@ -353,7 +353,7 @@ class channel{
["syncTolerance",1],
["liveSyncTolerance", 10],
["syncDelta", 6],
["theme", "The Network"],
["theme", "The Network (Classic)"],
["chatWidthMin", 20],
["disablePortrait", false],
["disableSendButton", false],

View file

@ -27,14 +27,14 @@ class themeManager{
*/
this.themes = new Map([
["Movie Night", "/css/theme/movie-night.css"],
["The Network", "/css/theme/the-network.css"]
["The Network (Classic)", "/css/theme/the-network-classic.css"]
]);
/**
* Sets default theme for new users
*/
this.defaultTheme = "The Network";
this.defaultTheme = "The Network (Classic)";
/**
* Define property to hold theme link DOM node
@ -51,7 +51,7 @@ class themeManager{
*/
setTheme(theme = localStorage.getItem("theme")){
//If we didnt get a theme to set
if(theme == null){
if(theme == null || theme == ""){
//Use the first theme in the list
theme = this.defaultTheme;
}
@ -65,6 +65,14 @@ class themeManager{
//Create new link element and use it to set themeLink
this.themeLink = this.genThemeLink(theme);
//If we got a bad link
if(this.themeLink == null){
//Reset the theme to the default theme
this.setTheme(this.defaultTheme);
//Do not pass go, do not collect $200
return;
}
//Append themeLink to header
document.querySelector('head').appendChild(this.themeLink);
@ -73,6 +81,15 @@ class themeManager{
}
genThemeLink(theme = localStorage.getItem("theme")){
//Grab themePath by name
let themePath = this.themes.get(theme)
//If we got dookie-dick for a theme
if(themePath == null || themePath == ""){
//GIMME A THEME WITH NUTHIN'! NUTHIN'?!?! NUTHIN'!! https://i.ytimg.com/vi/CccHBlGrOu8/hqdefault.jpg
return;
}
//Create new link element and use it to set themeLink
const themeLink = document.createElement('link');
@ -81,7 +98,7 @@ class themeManager{
themeLink.rel = "stylesheet";
//Set theme href to theme location
themeLink.href = this.themes.get(theme);
themeLink.href = themePath;
return themeLink;
}