Skip to content

Instantly share code, notes, and snippets.

@Flummi
Last active February 22, 2023 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flummi/631f7e032f0f00b41299b36ecb34891e to your computer and use it in GitHub Desktop.
Save Flummi/631f7e032f0f00b41299b36ecb34891e to your computer and use it in GitHub Desktop.
Speedport Pro Tweaks (for version 120133.5.0.018.0)
// ==UserScript==
// @name Speedport Pro Tweaks
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author Flummi
// @match http://192.168.2.1/5.5/gui/*
// @match http://speedport.ip/5.5/gui/*
// @grant none
// ==/UserScript==
(() => {
'use strict';
let loaded = false;
let lastURL = '';
const UIChanges = () => {
[...document.querySelectorAll("[ui-sref='anon.manual']")].forEach(m => { // engineer menu
m.href = '/5.0/gui/engineer/html';
m.target = '_self';
m.querySelector('span').innerText = 'Engineer';
});
[...document.querySelectorAll("[ui-sref='user.internet.ping-test']")].forEach(m => { // ping test
m.classList.remove('ng-hide');
m.style.display = 'block';
});
[...document.querySelectorAll("[check-feature-state='gaming-wifi']")].forEach(m => { // gaming-wifi
m.classList.remove('ng-hide');
m.style.display = 'block';
});
let menu;
if(menu = document.querySelector('[ng-include="\'views/engineer/menu.html\'"]')) { // show hidden option in engineer menu
menu.innerHTML = menu.innerHTML.replace(/<!--<li>(.*?)<\/li>-->/, '<li>$1</li>');
document.querySelector("[ui-sref='user.engineer.abuse-detection']").href = '/5.0/gui/engineer/html/abuse-detection.html';
}
[...document.querySelectorAll("span[ng-repeat='lang in availableLanguages']")].forEach(m => { // toggle language in engineer menu
m.classList.remove('ng-hide');
});
};
const open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this.addEventListener('load', event => {
//console.log(event);
try {
if(((event.currentTarget.responseURL.match(/json-req/) && loaded) || event.currentTarget.responseURL.match(/last-visited/)) && lastURL !== document.URL) {
if(!loaded) loaded = !loaded;
lastURL = document.URL;
UIChanges();
}
} catch {}
}, false);
open.apply(this, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment