Results in Megabytes - librespeed.org

Automatically convert librespeed.org results to display MB/s instead of Megabit

当前为 2022-10-26 提交的版本,查看 最新版本

// ==UserScript==
// @name        Results in Megabytes - librespeed.org
// @namespace   librespeed-to-bytes
// @match       https://librespeed.org/
// @grant       none
// @version     1.0
// @author      Chopper1337
// @license MIT 
// @description Automatically convert librespeed.org results to display MB/s instead of Megabit
// ==/UserScript==


var x = setInterval(function() {

  if(document.getElementById("resultsImg").width > 10) {
    console.log("Exists!");
    var unit = document.getElementsByClassName("unit") ;
    var dlF = parseFloat(document.getElementById("dlText").innerHTML)
    var ulF = parseFloat(document.getElementById("ulText").innerHTML)
    document.getElementById("dlText").innerHTML = (dlF * 0.125);
    document.getElementById("ulText").innerHTML = (ulF * 0.125);

    clearInterval(x);

    unit[2].innerHTML = "MB/s"
    unit[3].innerHTML = "MB/s"
    clearInterval(x);
  }
}, 100); // check every 100ms