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.

Revisions

  1. ellielle revised this gist Jul 20, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gw2-wiki-dark-mode.user.js
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,8 @@
    // @author ellielle
    // @match *://*.guildwars2.com/*
    // @icon https://www.google.com/s2/favicons?sz=64&domain=wiki.guildwars2.com
    // @downloadURL
    // @updateURL
    // @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() {
  2. ellielle created this gist Jul 20, 2023.
    27 changes: 27 additions & 0 deletions gw2-wiki-dark-mode.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    // ==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
    // @updateURL
    // ==/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);
    }
    })();