// ==UserScript== // @name Speediergrader // @namespace http://tampermonkey.net/ // @version 0.2 // @description Make speedgrader more useable by opening the rubrics by alt + a, and alt + s to save and go to next person! // @author Noirgif // @match https://canvas.wisc.edu/courses/*/gradebook/speed_grader?* // @icon https://www.google.com/s2/favicons?domain=canvas.instructure.com // @grant none // @license CC0 // @require http://code.jquery.com/jquery-latest.js // @downloadURL none // ==/UserScript== (function(e,f){var b={},g=function(a){b[a]&&(f.clearInterval(b[a]),b[a]=null)};e.fn.waitUntilExists=function(a,h,j){var c=this.selector,d=e(c),k=d.not(function(){return e(this).data("waitUntilExists.found")});"remove"===a?g(c):(k.each(a).data("waitUntilExists.found",!0),h&&d.length?g(c):j||(b[c]=f.setInterval(function(){d.waitUntilExists(a,h,!0)},500)));return d}})(jQuery,window); (function() { 'use strict'; function setupRubricView() { $('.toggle_full_rubric').trigger('click'); $('input').focus(function() {console.log($(this)); $(this).val((i, e) => e.replace('--', '')); $(this).change();}) } function checkKey(e) { if(e.key == 's' && e.altKey) { $('.save_rubric_button').trigger('click'); setTimeout(() => { $('.toggle_full_rubric').trigger('click'); $('#next-student-button').trigger('click'); setTimeout(() => {$('input').each((i, e) => {if (e.value == '--') e.value = '';});}, 1000); }, 1000); // hack } else if (e.key == 'a' && e.altKey) { setupRubricView(); } } document.addEventListener('keydown', checkKey, false); $('.toggle_full_rubric').waitUntilExists(setupRubricView); })();