Adds stopwatch to quiz pages; use Ctrl+S to submit and continue on quiz and quiz answer pages
当前为
// ==UserScript==
// @name Fontz Quiz Timer & Keyboard Shortcuts
// @namespace http://idlewords.net
// @description Adds stopwatch to quiz pages; use Ctrl+S to submit and continue on quiz and quiz answer pages
// @include http://50.116.7.11:9998/learningQuizController_turk/quiz
// @include http://50.116.7.11:9998/learningQuizController_turk/quiz_answer
// @include http://50.116.7.11:9998/learningQuizController_turk/main_menu
// @version 0.2
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require https://greasyfork.org/scripts/12377-timecircles/code/TimeCircles.js?version=73868
// @grant GM_log
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var keycode = 83; // 83 = S. Change this to a valid code from http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes to change the keyboard shortcut
$(document).ready(function() {
if (document.location.href == 'http://50.116.7.11:9998/learningQuizController_turk/quiz') {
$("head").append(
$("<link></link>")
.attr('rel', 'stylesheet')
.attr('href', 'https://raw.githubusercontent.com/wimbarelds/TimeCircles/master/inc/TimeCircles.css')
.attr('type', 'text/css')
);
$("div[align='right']").after(
$("<div></div>")
.css({'height': '200px', 'width': '500'})
.addClass('timer')
);
$(".timer").TimeCircles({
time: {
Days: { show: false },
Hours: { show: false },
Minutes: { color: "#BBFFBB" },
Seconds: { color: "#FF9999" }
}
});
$(document).keydown(function(event) {
if (event.which == 83 && event.ctrlKey) {
event.preventDefault();
$("#submitButton").click();
} else if (event.which == 89 || event.which == 49 || event.which == 97) {
event.preventDefault();
$("#deformfield1-0").prop('checked', true);
} else if (event.which == 78 || event.which == 50 || event.which == 98) {
event.preventDefault();
$("#deformfield1-1").prop('checked', true);
}
});
} else if (document.location.href == 'http://50.116.7.11:9998/learningQuizController_turk/quiz_answer'){
$(document).keydown(function(event) {
if (event.which == keycode && event.ctrlKey) {
event.preventDefault();
$("input[name='Continue']").click();
}
});
}
});
$(window).load(function() {
if (document.location.href == 'http://50.116.7.11:9998/learningQuizController_turk/main_menu') {
setTimeout(function(){$('div#bodycontainer p').eq(0).before('Questions Answered: ' + $('circle').length);},200);
}
});