Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/15dc2733569b95ad6034b35fea26410f.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name Coursera EXT - Quiz option cross-out // @description Coursera Extension -- enables the user to temporary disable some quiz answers/options (eg. the obvious incorrect ones) // @namespace http://sepczuk.com/ // @version 0.10 // @include https://*.coursera.org/*/quiz/attempt* // @match https://*.coursera.org/*/quiz/attempt* // @include https://*.coursera.org/*/exam/attempt* // @match https://*.coursera.org/*/exam/attempt* // @copyright 2013, Damian Sepczuk, damian at sepczuk period delme com // @downloadURL https://update.greasyfork.icu/scripts/13799/Coursera%20EXT%20-%20Quiz%20option%20cross-out.user.js // @updateURL https://update.greasyfork.icu/scripts/13799/Coursera%20EXT%20-%20Quiz%20option%20cross-out.meta.js // ==/UserScript== function mainWrapper(){ var debug = !false; var US_SHORT_NAME = 'CourseraEXT-QACO'; var US_VERSION = 0.01; function debugLog(msg) { if (!debug) return; console.log(US_SHORT_NAME + ": " + msg); } function disableQuizOption(qo) { $(qo).css('opacity','.3').prop('disabled', true) .children('.cext-toggle-this-one').html('○').end() .children('input').prop('disabled', true).next().css('text-decoration', 'line-through').css('cursor','default'); } function enableQuizOption(qo) { $(qo).css('opacity','').prop('disabled', false) .children('.cext-toggle-this-one').html('●').end() .children('input').prop('disabled', false).next().css('text-decoration', '').css('cursor','pointer'); } function toggleQuizOption(qo) { if ($(qo).prop('disabled') === true) { enableQuizOption(qo); } else { disableQuizOption(qo); } } function main(){ debugLog("Running main!"); var stylesheetText = (function(){/*!HTML! */}).toString().slice(21,-3); $(stylesheetText).appendTo('head'); var chooseThisOne = $('').click(function(){ var quizOption = this.parentElement; var allButMe = $(quizOption).parent().children().not(quizOption); var otherEnabled = allButMe.filter(':not([disabled])'); var amIEnabled = $(quizOption).prop('disabled') !== true; if (otherEnabled.length === 0) { enableQuizOption(allButMe); } else { disableQuizOption(otherEnabled); enableQuizOption(quizOption); if($(quizOption).children('input').attr('type')==='radio') { $(quizOption).children('input').click(); } } }); var toggleThisOne = $('').click(function(){ toggleQuizOption(this.parentElement); }); var toggleQuestion = $(''); $('.course-quiz-option').prepend(toggleThisOne).prepend(chooseThisOne); $('.course-quiz-question-number').prepend(toggleQuestion).toggle( function(){ $(this).parent().css('opacity', '.3'); $(this).children('.cext-toggle-question').html('○'); }, function(){ $(this).parent().css('opacity', ''); $(this).children('.cext-toggle-question').html('●'); }); $('.course-quiz-submit-button-container input[type=submit]').click(function(){ enableQuizOption($('.course-quiz-option')); }); }; main(); }; if (!document.xmlVersion) { var script = document.createElement('script'); script.appendChild(document.createTextNode('('+ mainWrapper +')();')); document.documentElement.appendChild(script); }