Skip to content

Instantly share code, notes, and snippets.

@ellielle
Last active July 20, 2023 14:00
Show Gist options
  • Save ellielle/e9182e1822d089122db9c8f6981f4ba5 to your computer and use it in GitHub Desktop.
Save ellielle/e9182e1822d089122db9c8f6981f4ba5 to your computer and use it in GitHub Desktop.
A simple userscript to automatically enable the dark theme on GW2's wiki
// ==UserScript==
// @name GW2 Wiki Dark Mode
// @version 0.2
// @description Automatically set the GW2 wiki theme to the Vector dark theme
// @author ellielle
// @match *://*.guildwars2.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=wiki.guildwars2.com
// @downloadURL https://gist.github.com/ellielle/e9182e1822d089122db9c8f6981f4ba5#file-gw2-wiki-dark-mode-user-js
// @updateURL https://gist.github.com/ellielle/e9182e1822d089122db9c8f6981f4ba5#file-gw2-wiki-dark-mode-user-js
// ==/UserScript==
(function() {
'use strict';
const isDarkMode = window.location.search;
if (!isDarkMode.includes("vector")) {
const newURL = window.location.protocol
+ "//"
+ window.location.host
+ window.location.pathname
+ window.location.search
+ (window.location.search === "" ? "?useskin=vector" : "&useskin=vector")
+ window.location.hash;
window.location.replace(newURL);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment