Skip to content

Instantly share code, notes, and snippets.

@hkamran80
Last active August 22, 2020 04:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkamran80/8f0778b0f5379305674742682cb17b5e to your computer and use it in GitHub Desktop.
Save hkamran80/8f0778b0f5379305674742682cb17b5e to your computer and use it in GitHub Desktop.
Canvas LMS - Keystrokes
// ==UserScript==
// @name Canvas LMS - Keystrokes
// @namespace https://hkamran.com
// @version 1.0.1
// @description Snippets for the Canvas LMS
// @author H. Kamran
// @downloadUrl https://gist.github.com/hkamran80/8f0778b0f5379305674742682cb17b5e/raw/canvas_lms.user.js
// @updateUrl https://gist.github.com/hkamran80/8f0778b0f5379305674742682cb17b5e/raw/canvas_lms.user.js
// @match https://*.instructure.com/courses/*
// @grant none
// ==/UserScript==
function pagination(e) {
var evtobj = window.event? event : e
// Module Page Pagination
if (evtobj.keyCode == 78 && evtobj.shiftKey) {
// Next Page Keystroke (Shift + N)
const next_button_element = document.querySelector("span.module-sequence-footer-button--next a")
window.location.href = next_button_element.href;
} else if (evtobj.keyCode == 80 && evtobj.shiftKey) {
// Previous Page Keystroke (Shift + P)
const prev_button_element = document.querySelector("span.module-sequence-footer-button--previous a")
window.location.href = prev_button_element.href;
}
}
document.onkeydown = pagination;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment