canvas navigator

navigate left and right using arrow keys in canvas or even the assignments too!

  1. // ==UserScript==
  2. // @name canvas navigator
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description navigate left and right using arrow keys in canvas or even the assignments too!
  6. // @author icycoldveins
  7. // @icon none
  8. // @grant none
  9. // @license MIT
  10. // @match *://*.instructure.com/*
  11. // ==/UserScript==
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15.  
  16. document.addEventListener('keydown', function(event) {
  17. if (event.key === 'ArrowLeft') {
  18. // Use the custom selector for previous button
  19. let prevButton = document.querySelector('[data-testid="previous-assignment-btn"]') ||
  20. document.querySelector("[aria-label='Previous Module Item']") ||
  21. document.querySelector("[aria-label='Previous Module Item - opens in new window']");
  22. if (prevButton) {
  23. prevButton.click();
  24. }
  25. }
  26. if (event.key === 'ArrowRight') {
  27. // Use the custom selector for next button
  28. let nextButton = document.querySelector('[data-testid="next-assignment-btn"]') ||
  29. document.querySelector("[aria-label='Next Module Item']") ||
  30. document.querySelector("[aria-label='Next Module Item - opens in new window']");
  31. if (nextButton) {
  32. nextButton.click();
  33. }
  34. }
  35. if (event.key === 's' && event.metaKey && event.shiftKey) {
  36. // Download the file
  37. let downloadButton = document.querySelector("[download='true']");
  38. if (downloadButton) {
  39. downloadButton.click();
  40. }
  41. }
  42. });
  43. })();