🏠 Home 

NitroType Perfect Nitros

Highlights the largest words for perfect nitros.


Install this script?
  1. // ==UserScript==
  2. // @name NitroType Perfect Nitros
  3. // @namespace https://github.com/Ray-Adams
  4. // @version 1.0.2
  5. // @description Highlights the largest words for perfect nitros.
  6. // @author Ray Adams
  7. // @match *://*.nitrotype.com/race
  8. // @match *://*.nitrotype.com/race/*
  9. // @run-at document-end
  10. // @grant none
  11. // @license MIT
  12. // @homepageURL https://github.com/Ray-Adams/NitroType-Archive
  13. // ==/UserScript==
  14. console.log("'NitroType Perfect Nitros' is no longer maintained, see https://github.com/Ray-Adams/NitroType-Archive for more info.");
  15. const options = {
  16. highlightColor: '#ffff00',
  17. intervalMs: 100
  18. };
  19. (() => {
  20. const client = () => {
  21. if (document.body.contains(document.querySelector('.dash-letter'))) {
  22. clearInterval(intervalId);
  23. // Generate word list from DOM
  24. let wordList = []
  25. for (let words of document.getElementsByClassName('dash-word')) {
  26. wordList.push(
  27. words.textContent.replace(/\s/g, '')
  28. )
  29. }
  30. // Find the largest words
  31. let largestWords = [];
  32. for (let word of wordList) {
  33. if (typeof largestWords[0] === 'undefined' || largestWords[0].length === word.length) {
  34. largestWords.push(word);
  35. }
  36. if (word.length > largestWords[0].length) {
  37. largestWords = [word];
  38. }
  39. }
  40. // Return all occurrences of a specific value
  41. Array.prototype.indexesOf=function(t){for(var r=[],n=this.length-1;0<=n;n--)this[n]===t&&r.unshift(n);return r};
  42. // Find the indexes of the largest words in wordList
  43. let largestWordIndexes = []
  44. for (let values of wordList.values()) {
  45. if (largestWords.includes(values)) largestWordIndexes.push(
  46. wordList.indexesOf(values)
  47. )
  48. }
  49. // Flatten array and remove duplicate values
  50. largestWordIndexes = [...new Set(largestWordIndexes.flat())];
  51. // Highlight largest words
  52. for (let indexes of largestWordIndexes) {
  53. document.getElementsByClassName('dash-word')[indexes].style.backgroundColor = options.highlightColor
  54. }
  55. }
  56. }
  57. const intervalId = setInterval(client, options.intervalMs);
  58. console.info('Perfect Nitros Activated.')
  59. })()