Skip to content

Instantly share code, notes, and snippets.

@eduzappa18
Last active July 16, 2019 16:48
Show Gist options
  • Save eduzappa18/3fe86e884fa022797236153d37e3559f to your computer and use it in GitHub Desktop.
Save eduzappa18/3fe86e884fa022797236153d37e3559f to your computer and use it in GitHub Desktop.
[Userscript] Killing Floor Web Admin Linkifier
// ==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}&nbsp;`;
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 = `&nbsp;${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