-
Notifications
You must be signed in to change notification settings - Fork 0
/
autolab_submission_protector.user.js
36 lines (34 loc) · 1.19 KB
/
autolab_submission_protector.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// ==UserScript==
// @name Autolab Submission Protector
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Ask for confirmation that autolab submissions are in the right format before submitting.
// @author Raymond Chee
// @match https://autolab.andrew.cmu.edu/courses/*/assessments/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
let submitButton = document.getElementById('fake-submit');
if (submitButton === null) {
console.error("Page does not have a submit button!");
return;
}
let oldHandler = submitButton.onclick;
submitButton.onclick = function(event) {
if (confirm("Is your submission zipped up correctly?")) {
return oldHandler(event);
}
event.stopImmediatePropagation();
return false;
};
let submitForm = document.getElementById("new_submission");
if (submitForm === null) {
console.error("Page does not have the expected form!");
return;
}
submitForm.onsubmit = function(event) {
return confirm("Are you absolutely sure your submission is zipped up correctly?");
};
})();