Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name WaniKani Flash Forward
- // @namespace thenn42.eu/userscripts
- // @description Automatically moves to the next item, and replaces the back button with previous item.
- // @include http://www.wanikani.com/review/*
- // @version 0.2
- // @run-at document-end
- // @require http://code.jquery.com/jquery-1.9.1.min.js
- // @grant GM_log
- // ==/UserScript==
- var timer = 200;
- var lastItem = "";
- var currentItem = "";
- var lastType = "";
- var currentType = "";
- var url = "";
- setTimeout(WhenNewQuestion1, timer);
- $("#option-end-session a").replaceWith("<i class=\"icon-arrow-left\"></i>");
- WhenNewQuestion();
- function WhenNewQuestion1() {
- if ($('fieldset').attr("class") == "correct") {
- $('#option-submit').click();
- }
- setTimeout(WhenNewQuestion1, timer);
- }
- function WhenNewQuestion() {
- currentType = $("#item-box").find("h1").attr("class");
- if (currentType == "vocabulary") {
- currentItem = $("#item-box").find("h1 small").text();
- } else if (currentType == "kanji") {
- currentItem = $("#item-box").find("h1").text();
- } else {
- currentItem = $("#meanings p").text().toLowerCase();
- currentItem = currentItem.replace(" ","-");
- }
- if (currentItem != lastItem) {
- url = "http://www.wanikani.com/quickview/";
- if (lastType == "kanji") {
- url += "kanji\/"+lastItem;
- } else if (lastType=="vocabulary") {
- url += "vocabulary\/" + lastItem;
- } else {
- url += "radicals\/" + lastItem;
- }
- $("#option-end-session").replaceWith("<li id=\"option-end-session\"><a target=\"_blank\" href=\""+url+"\"><i class=\"icon-arrow-left\"></i></a></li>");
- }
- lastType = currentType;
- lastItem = currentItem;
- }
- $('#item-info-sub').bind('DOMNodeInserted', WhenNewQuestion);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement