benkyo/iiKanji: automatically click answer
authorDariusz Murakowski <murakdar@gmail.com>
Sat, 11 Aug 2018 20:19:00 +0000 (16:19 -0400)
committerDariusz Murakowski <murakdar@gmail.com>
Sat, 11 Aug 2018 20:19:00 +0000 (16:19 -0400)
benkyou-iikanji auto click through answers.user.js [new file with mode: 0644]

diff --git a/benkyou-iikanji auto click through answers.user.js b/benkyou-iikanji auto click through answers.user.js
new file mode 100644 (file)
index 0000000..8c02e84
--- /dev/null
@@ -0,0 +1,50 @@
+// ==UserScript==
+// @name         benkyou/iikanji auto click through answers
+// @namespace    http://tampermonkey.net/
+// @version      0.1
+// @description  try to take over the world!
+// @author       You
+// @match        http://benkyo.co/iikanji/study/
+// @grant        none
+// @run-at       document-end
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    // Your code here...
+    // the following bookmarklet may be useful:
+    /*
+    javascript:void(function(){function sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms));} async function x(){$('#add_kanji_select').val(30); await sleep(100); $('#go_link').click();} function y(){$('.btn.btn-primary')[0].click();} async function z(a){$('#show_answer').click(); await sleep(100); $(a).click();} try{z('#i_remembered');}finally{try{y();}finally{x();}}}());
+    */
+
+    // even better, from the source code itself:
+    /*
+    // First Presentation
+    $('#i_know_this').click(function() {
+        $('#answer').val('6');
+        $('#answer_form').submit();
+    });
+
+    $('#i_want_to_study_this').click(function() {
+        $('#answer').val('0');
+        $('#answer_form').submit();
+    });
+
+    // Subsequent Presentations
+    $('#i_remembered').click(function() {
+        $('#answer').val('4');
+        $('#answer_form').submit();
+    });
+
+    $('#i_forgot').click(function() {
+        $('#answer').val('0');
+        $('#answer_form').submit();
+    });
+    */
+
+    $('#show_answer').click();
+
+    $('#answer').val('6');
+    $('#answer_form').submit();
+})();
\ No newline at end of file