Skip to content

Instantly share code, notes, and snippets.

@ilyaskarim
Created November 19, 2020 21:31
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 ilyaskarim/61284772ee4a4b665f252d7b80da557f to your computer and use it in GitHub Desktop.
Save ilyaskarim/61284772ee4a4b665f252d7b80da557f to your computer and use it in GitHub Desktop.
limit-speed
var allSpeeds = document.querySelectorAll(".bEptLHDSpeeds");
var limits = document.querySelectorAll(".bEptLHDDownLimit");
allSpeeds.forEach((element, index) => {
element.setAttribute(`idx`, index);
});
limits.forEach((element, index) => {
element.setAttribute(`computer-${index}-limit`, null);
});
var limitUserSpeed = (el) => {
var id = el.getAttribute("idx")
var button = document.querySelector(`[computer-${id}-limit]`);
var downButton = button.querySelector(".bEptDownLSImg");
console.log(button)
var label = button.querySelector("label");
downButton.click()
var input = button.querySelector("input")
setTimeout(() => {
input.value = 300;
setTimeout(() => {
button.click()
}, 100);
}, 50);
};
allSpeeds.forEach((element, index) => {
let speed = element.querySelector(".bEptHostSpeedB .bSpeedSpn");
if (speed) {
var html = speed.innerHTML.split(" ");
var currentUserSpeed = html[0];
var currentUserSpeedType = html[1].toLowerCase().replace(/ /g,"")
if (currentUserSpeedType === "kb/s") {
if (currentUserSpeed > 600) {
limitUserSpeed(element)
}
} else if (currentUserSpeedType === "mb/s") {
limitUserSpeed(element)
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment