Results in Megabytes - librespeed.org

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

目前为 2022-10-26 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Results in Megabytes - librespeed.org
  3. // @namespace librespeed-to-bytes
  4. // @match https://librespeed.org/
  5. // @grant none
  6. // @version 1.1
  7. // @author Chopper1337
  8. // @license MIT
  9. // @description Automatically convert librespeed.org results to display MB/s instead of Megabit
  10. // ==/UserScript==
  11.  
  12.  
  13. var x = setInterval(function() {
  14.  
  15. if(document.getElementById("resultsImg").width > 10) {
  16. console.log("Exists!");
  17. var unit = document.getElementsByClassName("unit") ;
  18. var dlF = parseFloat(document.getElementById("dlText").innerHTML)
  19. var ulF = parseFloat(document.getElementById("ulText").innerHTML)
  20. document.getElementById("dlText").innerHTML = (dlF * 0.125);
  21. document.getElementById("ulText").innerHTML = (ulF * 0.125);
  22.  
  23. clearInterval(x);
  24.  
  25. unit[2].innerHTML = "MB/s"
  26. unit[3].innerHTML = "MB/s"
  27. clearInterval(x);
  28. }
  29. }, 100); // check every 100ms
  30.  
  31.  
  32. var y = setInterval(function() {
  33.  
  34. if(document.getElementById("ip").innerHTML.length > 10) {
  35. console.log("Exists!");
  36. document.getElementById("ip").style.backgroundColor = "red";
  37. document.getElementById("ip").style.color = "transparent";
  38.  
  39. document.getElementById("ip").onmouseover = function() {
  40. this.style.color = "black"
  41. }
  42.  
  43. document.getElementById("ip").onmouseleave = function() {
  44. this.style.color = "transparent"
  45. }
  46.  
  47.  
  48. clearInterval(y);
  49. clearInterval(y);
  50. }
  51. }, 25); // check every 100ms