Last active
July 16, 2019 16:48
-
-
Save eduzappa18/3fe86e884fa022797236153d37e3559f to your computer and use it in GitHub Desktop.
[Userscript] Killing Floor Web Admin Linkifier
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 Killing Floor Web Admin Linkifier | |
// @namespace KillingFloorWebAdminLinkifier | |
// @description Turn Player's IPs and IDs into clickable links | |
// @author Zappa (eduzappa18) | |
// @version 1.0.0 | |
// @license MIT | |
// @homepageURL https://gist.github.com/eduzappa18/3fe86e884fa022797236153d37e3559f | |
// @updateURL https://gist.githubusercontent.com/eduzappa18/3fe86e884fa022797236153d37e3559f/raw/KillingFloorWebAdminLinkifier.user.js | |
// @downloadURL https://gist.githubusercontent.com/eduzappa18/3fe86e884fa022797236153d37e3559f/raw/KillingFloorWebAdminLinkifier.user.js | |
// @icon https://i.imgur.com/E6aNg4P.png | |
// @match */ServerAdmin/current_players* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const form = document.querySelector('form'); | |
const table = form.querySelectorAll('table')[1]; | |
const totalplayers = table.rows.length - 1; | |
if (table.rows[1].innerText == '** No Players Connected **') { | |
return; | |
} | |
let a, c, ip, id, url; | |
for (let r = 1; r < table.rows.length; r++) { | |
// IP | |
c = table.rows[r].cells.length - 2; | |
ip = table.rows[r].cells[c].innerHTML.substring(6); | |
url = `https://whatismyipaddress.com/ip/${ip}`; | |
table.rows[r].cells[c].innerHTML = ''; | |
a = document.createElement('a'); | |
a.setAttribute('href', url); | |
a.setAttribute('target', '_blank'); | |
a.innerHTML = `${ip} `; | |
table.rows[r].cells[c].append(a); | |
// STEAM ID | |
c = table.rows[r].cells.length - 1; | |
id = table.rows[r].cells[c].innerHTML.substring(6); | |
url = `https://steamcommunity.com/profiles/${id}/`; | |
table.rows[r].cells[c].innerHTML = ''; | |
a = document.createElement('a'); | |
a.setAttribute('href', url); | |
a.setAttribute('target', '_blank'); | |
a.innerHTML = ` ${id}`; | |
table.rows[r].cells[c].append(a); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment