Skip to content

Instantly share code, notes, and snippets.

@Kansattica
Last active September 2, 2021 18:38
Show Gist options
  • Save Kansattica/15b7336ae9be8f8da2f3bda8604de7f6 to your computer and use it in GitHub Desktop.
Save Kansattica/15b7336ae9be8f8da2f3bda8604de7f6 to your computer and use it in GitHub Desktop.
Fallen London wiki lookup script
// ==UserScript==
// @name Fallen London Wiki Lookup
// @namespace https://www.fallenlondon.com/
// @version 0.2
// @description Adds a link to the corersponding wiki page to Fallen London storylets.
// @author Princess Grace
// @match https://www.fallenlondon.com/
// @icon https://www.google.com/s2/favicons?domain=fallenlondon.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function setLink()
{
const titleHeading = document.getElementsByClassName("storylet-root__heading")[0];
if (titleHeading === undefined || titleHeading.children.length == 1)
{
return;
}
const wikipage = "https://fallenlondon.wiki/wiki/" + encodeURIComponent(titleHeading.textContent.replaceAll(' ', '_'));
const wikilink = document.createElement("a");
wikilink.href = wikipage;
wikilink.textContent = " wiki";
wikilink.target = "_blank";
titleHeading.insertAdjacentElement('beforeend', wikilink);
}
setInterval(setLink, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment