|
// ==UserScript== |
|
// @name Check Speed |
|
// @namespace http://tampermonkey.net/ |
|
// @version 0.1 |
|
// @description try to take over the world! |
|
// @author oskr.nl |
|
// @match https://www.speedtest.net/* |
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=speedtest.net |
|
// @grant none |
|
// ==/UserScript== |
|
|
|
(function() { |
|
|
|
// copyright 2022, oskr.nl. For "Educational" use only. |
|
// Activate this script on speedtest.net and keeps |
|
// checking your speed. ;) |
|
|
|
// Every 46 seconds, |
|
// change with how long it usually takes for the full test to finish |
|
let INTERVAL = 46*1000 |
|
let keep_checking = false |
|
let startBtn |
|
window.n_times = 0 // keep track of how many times we ran |
|
|
|
// the loop function |
|
const speed_test_loop = (el) => { |
|
// return/exit if loop checkbox is off |
|
if (!keep_checking) return |
|
|
|
startBtn.click() |
|
n_times++ |
|
lbl_input_toggle.textContent = `Loop? n:${window.n_times}` |
|
} |
|
|
|
// create a custom element and inject into the page |
|
// which will toggle the loop |
|
const div_toggle_check = document.createElement('div') |
|
div_toggle_check.classList.add('custom_toggle_check') |
|
div_toggle_check.innerHTML = ` |
|
<style> |
|
.custom_toggle_check { |
|
position: fixed; |
|
margin: 1rem; |
|
padding: 0.2rem 1rem; |
|
outline: 1px solid hotpink; |
|
border-radius: 5rem; |
|
} |
|
|
|
</style> |
|
<input type="checkbox" id="input_toggle"> |
|
<label for="input_toggle" id="lbl_input_toggle">Loop?</label> |
|
` |
|
document.body.appendChild(div_toggle_check) |
|
window.lbl_input_toggle = document.querySelector('#lbl_input_toggle') |
|
|
|
// listen for the checkbox change event and toggle the loop |
|
const input_toggle_loop = div_toggle_check.querySelector('input') |
|
input_toggle_loop.addEventListener('change', e => { |
|
keep_checking = e.target.checked |
|
}) |
|
|
|
startBtn = document.querySelector('div.speedtest-container.main-row > div.start-button > a > span.start-text') |
|
|
|
// the actual loop |
|
setInterval(speed_test_loop, INTERVAL) |
|
|
|
})() |
كان الافضل تعمل سكربت بايثون يستغل الموضوع ده في تصفح مواقع اخري