ID:2704257
 
Resolved
Applies to:Website
Status: Resolved

This issue has been resolved.
The web reference has a dark mode. It's nice.

What's not nice is having to click the lightbulb toggle button to turn it on each time I open it.

I open the web ref quite a bit, and it'd be neat if my choice of dark mode (or not) was saved when I opened it up and it automatically loaded my most recent choice.

Save the clicks!
cookies please!

edit:
function setCookie(cname, cvalue, exdays) {
cvalue = escaper(cvalue);
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = 'expires='+d.toUTCString();
var cookie = cname + '=' + cvalue + '; ' + expires + '; path=/';
document.cookie = cookie;
}

function getCookie(cname) {
var name = cname + '=';
var ca = document.cookie.split(';');
for(var i=0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) === 0) {
return decoder(c.substring(name.length,c.length));
}
}
return '';
}

there, brr
boop
easy win boop
Update: Changes to the web ref have made this script unnecessary.

Got bored and made a userscript to clicky clicky the lightbulb for me so that the web reference is always in dark mode.

If you use a script manager for your browser like Tampermonkey you can click this to install it. Otherwise you can take my crappy JS code and inject it into your browser through whatever magical means you need to.

// ==UserScript==
// @name BYOND Web Ref Always Dark
// @version 1.0
// @description Web ref is now always dark.
// @author Spevacus
// @match http://www.byond.com/docs/ref/*
// @match https://www.byond.com/docs/ref/*
// @downloadURL http://files.byondhome.com/Spevacus/BYONDWebRefAlwaysDark.user.js
// @updateURL http://files.byondhome.com/Spevacus/BYONDWebRefAlwaysDark.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function() {
const bodyelement = document.body;
if(bodyelement.classList.contains('dark') == false) {
document.querySelector('[title="Toggle dark mode"]')?.click();
}
}, 500);
})();
The web reference now changes to dark/light mode based on your theme settings, which is awesome and totally good enough for me. I'll self-mark this as resolved.
Spevacus resolved issue