Jump to content

Simple Creation Kit wiki link JS for TamperMonkey


Recommended Posts

I usually ask for help on here so I figured I would try and give back.

I myself do a lot of research when I'm learning new methods of scripting, I go through many pages seeing how other people have done things, and I often attempt to follow their links to see the specific resource from which they learned. And when those links are to the Creation Kit wiki, I hit a bump in the road when the correct page doesn't actually load.

So, JS, TamperMonkey, and a bit of research later, I have written a working script that adds the proper string to the links, thus allowing a quick and painless transition to the info I seek.

// ==UserScript==
// @name           Creation Kit Link Fixer
// @description    Fixes CreationKit.com links.
// @license        CC0; https://creativecommons.org/publicdomain/zero/1.0/
// @license        MIT license; https://pastebin.com/raw.php?i=4TMeeUXC
// @compatible     chrome Works with Chrome and Tampermonkey
// @include        http://creationkit.com/*
// @include        http://www.creationkit.com/*
// @include        https://creationkit.com/*
// @include        https://www.creationkit.com/*
// @include        http://forums.nexusmods.com/*
// @include        http://www.forums.nexusmods.com/*
// @include        https://forums.nexusmods.com/*
// @include        https://www.forums.nexusmods.com/*
// @exclude        http://creationkit.com/fallout4/*
// @exclude        http://www.creationkit.com/fallout4/*
// @exclude        https://creationkit.com/fallout4/*
// @exclude        https://www.creationkit.com/fallout4/*
// @version        1
// @grant          none
// ==/UserScript==

/* This script is dual-licensed under CC0 and the MIT license.
 * You can choose which one you want to use.
 * CC0 license: http://creativecommons.org/publicdomain/zero/1.0/deed.en
 * MIT license: https://pastebin.com/raw.php?i=4TMeeUXC
 */
 
/* Version 1: First attempt, seems to work
*/
 

for (var i = 0; i < window.document.links.length; i++)
{
  /* add necessary parameter */
  if(window.document.links[i].href.indexOf('creationkit.com/') >= 0){
      if(window.document.links[i].href.indexOf('creationkit.com/index.php?title=') === -1){
          window.document.links[i].href = window.document.links[i].href.replace("creationkit.com/", "creationkit.com/index.php?title=");
      }
  }
}

I'm posting it here in case anyone would like to add it to their Chrome/Firefox(I think it will still work in Greasemonkey). In case you're a tad bit lazy, I will upload it as well:
Creation Kit Link Fixer


EDIT: Forgot to exclude Fallout 4, code edited to reflect this.

Edited by Fantafaust
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...