Created
March 7, 2024 13:30
-
-
Save jh34ghu43gu/5c8ac324c9b778d41309ae3e12e13f94 to your computer and use it in GitHub Desktop.
open all pages on the retired case page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Quicklinks for wiki case page | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-03-07 | |
// @description try to take over the world! | |
// @author You | |
// @match https://wiki.teamfortress.com/wiki/Mann_Co._Supply_Crate/Retired_case_series/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=teamfortress.com | |
// @grant none | |
// ==/UserScript== | |
var tables = document.getElementsByClassName("wikitable collapsible"); | |
for(var i = 0; i < tables.length; i++) { | |
var link = document.createElement("button"); | |
link.innerText = "Open Links"; | |
link.id = "JHButton" + i; | |
link.data_JHid = i; | |
document.getElementsByClassName("wikitable collapsible")[i].appendChild(link); | |
link.addEventListener("click", function() { | |
var nodes = tables[this.data_JHid].getElementsByClassName("item-grade"); | |
var newLinks = []; | |
for(var j = 0; j < nodes.length; j++) { | |
var n = nodes[j].getElementsByClassName("new"); | |
if(n.length == 0) { | |
var url = nodes[j].getElementsByTagName("a")[0].href; | |
url = url.replace("wiki/", "w/index.php?title="); | |
url += "&action=edit"; | |
newLinks.push(url); | |
} | |
} | |
for(j = 0; j < newLinks.length; j++) { | |
window.open(newLinks[j], '_blank'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment