canvas navigator

navigate left and right using arrow keys in canvas

As of 04.12.2022. See ბოლო ვერსია.

// ==UserScript==
// @name         canvas navigator
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  navigate left and right using arrow keys in canvas
// @author       icycoldveins
// @icon         none
// @grant        none
// @license     MIT
// @match      *://*.instructure.com/*
// ==/UserScript==
(function () {
  "use strict";

  // detect if text has Previos  or Next
  // if yes, click it
  // if no, do nothing
  //using left and right arrow keys
  //   aria-label="Previous Module Item"
  document.addEventListener("keydown", function (event) {
    if (event.key == "ArrowLeft") {
      if (document.querySelector("[aria-label='Previous Module Item']")) {
        document.querySelector("[aria-label='Previous Module Item']").click();
        // Previous Module Item - opens in new window

      }else if(document.querySelector("[aria-label='Previous Module Item - opens in new window']"))
      {
        document.querySelector("[aria-label='Previous Module Item - opens in new window']").click();
      }
    }
    if (event.key == "ArrowRight") {
      if (document.querySelector("[aria-label='Next Module Item']")) {
        document.querySelector("[aria-label='Next Module Item']").click();
      }
      else if(document.querySelector("[aria-label='Next Module Item - opens in new window']"))
      {
        document.querySelector("[aria-label='Next Module Item - opens in new window']").click();
      }
    }
    if (event.key == "s" && event.metaKey && event.shiftKey) {
      // download the file
      document.querySelector("[download='true']").click();
    }
  });
})();