Skip to content

Instantly share code, notes, and snippets.

@0xFEEDC0DE64
Created February 28, 2025 21:39
Show Gist options
  • Save 0xFEEDC0DE64/2dc65608ccb6bc0b30ef001f4538f39b to your computer and use it in GitHub Desktop.
Save 0xFEEDC0DE64/2dc65608ccb6bc0b30ef001f4538f39b to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Funkfeuer IPs anzeigen
// @namespace http://tampermonkey.net/
// @version 2025-02-27
// @description try to take over the world!
// @author 0xFEEDC0DE64
// @match *://manman.ffgraz.net/*
// @match *://manman.graz.funkfeuer.at/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ffgraz.net
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
const navbarList = document.querySelector('#navbarText > ul');
if (navbarList) {
const listItem = document.createElement('li');
listItem.classList.add('nav-item');
const link = document.createElement('a');
link.href = '#';
link.textContent = 'All IPs';
link.addEventListener('click', function(e) {
e.preventDefault();
const container = document.querySelector('body > .container');
if (container) {
container.innerHTML = '';
const heading = document.createElement('h1');
heading.textContent = 'loading locations...';
container.appendChild(heading);
GM.xmlHttpRequest({
method: "GET",
url: "/location/list",
headers: {
"Accept": "text/html",
},
onload: function(response) {
let htmlText = response.responseText;
if (response.status === 200) {
let parser = new DOMParser();
let doc = parser.parseFromString(htmlText, "text/html");
let rows = doc.querySelectorAll("tbody > tr > td:nth-child(5) > a");
heading.textContent = rows.length + " locations:";
rows.forEach((row, index) => {
const locationHref = row.href;
const heading = document.createElement('h1');
heading.textContent = 'Loading ' + locationHref + ' ...';
container.appendChild(heading);
GM.xmlHttpRequest({
method: "GET",
url: locationHref,
headers: {
"Accept": "text/html",
},
onload: function(response) {
let htmlText = response.responseText;
if (response.status === 200) {
let parser = new DOMParser();
let doc = parser.parseFromString(htmlText, "text/html");
const page = doc.querySelector('body > .container');
if (page) {
heading.replaceWith(page);
} else {
heading.textContent = 'Loading ' + locationHref + ' no container element!';
}
} else {
heading.textContent = 'Loading ' + locationHref + ' error response: ' + response.status;
}
},
onerror: function(error) {
heading.textContent = 'Loading ' + locationHref + ' threw an error: ' + error;
}
});
});
} else {
heading.textContent = "Failed to fetch locations: " + response.status;
}
},
onerror: function(error) {
heading.textContent = "Request failed: " + error;
}
});
}
});
listItem.appendChild(link);
navbarList.appendChild(listItem);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment