NitroType Auto Reload

Automatically reloads the page at the end of each race.

  1. // ==UserScript==
  2. // @name NitroType Auto Reload
  3. // @namespace https://github.com/Ray-Adams
  4. // @version 2.0.0
  5. // @description Automatically reloads the page at the end of each race.
  6. // @author Ray Adams/Nate Dogg
  7. // @match https://www.nitrotype.com/race
  8. // @match https://www.nitrotype.com/race/*
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. const options = {
  14. timerMs: 1000,
  15. reloadWhenDisqualified: true
  16. };
  17.  
  18. (() => {
  19.  
  20. 'use strict';
  21.  
  22. let letters, lastLetter;
  23.  
  24. if (options.reloadWhenDisqualified) {
  25.  
  26. const dqObserver = new MutationObserver(() => {
  27. if (document.querySelector('.modal--error')) {
  28.  
  29. dqObserver.disconnect();
  30.  
  31. location.reload();
  32.  
  33. }
  34. });
  35.  
  36. dqObserver.observe(raceContainer, {childList: true});
  37.  
  38. }
  39.  
  40. const lessonObserver = new MutationObserver(() => {
  41.  
  42. if (document.querySelector('.dash-copy')) {
  43.  
  44. lessonObserver.disconnect();
  45.  
  46. letters = document.querySelectorAll('.dash-letter'),
  47. lastLetter = letters[letters.length - 2];
  48.  
  49. lastLetterObserver.observe(lastLetter, {attributes: true});
  50.  
  51. }
  52.  
  53. });
  54.  
  55. const lastLetterObserver = new MutationObserver((mutations) => {
  56.  
  57. for (let mutation of mutations) {
  58. if (mutation.target.getAttribute('class').includes('is-correct')) {
  59.  
  60. lastLetterObserver.disconnect();
  61.  
  62. setTimeout(() => location.reload(), options.timerMs);
  63.  
  64. }
  65. }
  66.  
  67. });
  68.  
  69. lessonObserver.observe(document.querySelector('.dash-center'), {childList: true});
  70.  
  71. console.info('Auto Reload Activated.');
  72.  
  73. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址