-
-
Save khongi/c12a5343a16b5d91629445839ea86257 to your computer and use it in GitHub Desktop.
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 GameTracker.com direct links | |
// @version 3.0 | |
// @namespace www.gametracker.com | |
// @author sapphyrus, khongi | |
// @description Adds steam links to logo on search page and server info page | |
// @include http*.gametracker.com/server_info/* | |
// @include http*.gametracker.com/search/* | |
// ==/UserScript== | |
if(document.URL.match(/gametracker\.com\/search\//i)) { //Search page | |
let tableBody = document.querySelector("table > tbody"); | |
for (let i = 1, l = tableBody.childElementCount; i < l - 1; i++) { | |
let row = tableBody.children[i]; | |
let addrCol = row.children[6]; | |
let logoCol = row.children[1]; | |
let link = "steam://connect/" + addrCol.children[0].textContent + addrCol.children[1].textContent; | |
logoCol.addEventListener ("click", function(){ | |
window.open(link,"_self"); | |
} , false); | |
} | |
} else { //Server info page | |
let link = "steam://connect/" + document.URL.match(/\d+\.\d+\.\d+\.\d+:\d+/)[0]; | |
let logo = document.querySelector("body > div.page_content > div.blockthm_alt > div.blocknew.blocknew980.blocknewheader > span.blocknewheader01"); | |
logo.addEventListener ("click", function(){ | |
window.open(link,"_self"); | |
} , false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment