noredinkhack

Clicks a button with ID 'nri-quiz-submit-button' every 500ms for 5 seconds. If not found, clicks 'try-similar-problem' instead.

  1. // ==UserScript==
  2. // @name noredinkhack
  3. // @version 0.7
  4. // @description Clicks a button with ID 'nri-quiz-submit-button' every 500ms for 5 seconds. If not found, clicks 'try-similar-problem' instead.
  5. // @match *://www.noredink.com/learn/quiz/*
  6. // @grant none
  7. // @namespace https://greasyfork.org/users/1365527
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. // Count of clicks for each button
  14. let submitButtonCount = 0;
  15. let trySimilarButtonCount = 0;
  16.  
  17. // Function to click the buttons
  18. function clickButton() {
  19. // Try to select the button with ID 'nri-quiz-submit-button'
  20. const submitButton = document.getElementById('nri-quiz-submit-button');
  21. if (submitButton) {
  22. submitButton.click();
  23. submitButtonCount++;
  24. console.log(`'Submit answer' button clicked ${submitButtonCount} times`);
  25. } else {
  26. // If 'nri-quiz-submit-button' is not found, try the 'try-similar-problem' button
  27. const trySimilarButton = document.getElementById('try-similar-problem');
  28. if (trySimilarButton) {
  29. trySimilarButton.click();
  30. trySimilarButtonCount++;
  31. console.log(`'Try a similar problem' button clicked ${trySimilarButtonCount} times`);
  32. } else {
  33. console.log('Both buttons not found');
  34. }
  35. }
  36. }
  37.  
  38. // Click the buttons every 500 milliseconds
  39. const intervalId = setInterval(clickButton, 500);
  40.  
  41. // Stop clicking after 5 seconds
  42. setTimeout(() => {
  43. clearInterval(intervalId);
  44. console.log(`Stopped clicking. Total 'Submit answer' clicks: ${submitButtonCount}`);
  45. console.log(`Total 'Try a similar problem' clicks: ${trySimilarButtonCount}`);
  46. }, 5000); // 5000 milliseconds = 5 seconds
  47. })();