您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Prevents premature wrong answer submission.
当前为
// ==UserScript== // @name Bunpro: Mistake Delay // @namespace http://tampermonkey.net/ // @version 0.1.0 // @description Prevents premature wrong answer submission. // @author Kumirei // @include *bunpro.jp* // @require http://greasyfork.icu/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012 // @require http://greasyfork.icu/scripts/370623-bunpro-helpful-events/code/Bunpro:%20Helpful%20Events.js?version=615700 // @grant none // ==/UserScript== (function() { const delay = 2; // Seconds of delay // Wait until we're reviewing $('HTML')[0].addEventListener('quiz-page', function() { // Make placeholder look like the answer $('head').append('<style>#study-answer-input.delay::placeholder {color: white;}</style>'); // Do stuff when we press enter or backspace $(document).on('keydown', function(event) { var elem = $('#study-answer-input'); var ans = elem[0].value; // Initiate delate when we press enter, get the answer wrong, and no delay is already active if (event.which == 13 && elem[0].style.background == "rgba(255, 77, 77, 0.8)" && elem[0].placeholder == "Your Answer") { startDelay(elem, ans); setTimeout(function(){ cancelDelay(elem, ans); }, delay*1000); } // Cancel delay if we press backspace after getting an answer wrong else if (event.which == 8) cancelDelay(elem, ans); }); }); // Makes user unable to continue to the next item function startDelay(elem, ans) { elem.addClass('delay'); elem[0].value = ""; elem[0].placeholder = ans; elem.blur(); } // Makes user able to continue to the next item again function cancelDelay(elem, ans) { if (elem[0].placeholder != "Your Answer") { elem[0].value = ans; elem.removeClass('delay'); elem[0].placeholder = "Your Answer"; } } })();