Skip to content

Instantly share code, notes, and snippets.

@Flummi
Last active May 25, 2022
Embed
What would you like to do?
Speedport Pro Tweaks (for version 120133.5.0.018.0)
// ==UserScript==
// @name Speedport Pro Tweaks
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Flummi
// @match http://192.168.2.1/5.0/gui/*
// @match http://speedport.ip/5.0/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