您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows the context sentence in the question during vocab reviews. For Meaning questions, click to show English sentence.
当前为
// ==UserScript== // @name WaniKani Context Sentences in Reviews // @namespace nelemnaru // @description Shows the context sentence in the question during vocab reviews. For Meaning questions, click to show English sentence. // @include *://www.wanikani.com/review/session* // @version 1.7 // @license Please improve and repost! // @grant none // ==/UserScript== //Here you can change the scaling factor of the brightly-colored (purple, pink, blue) question area var rescale = 0.75; //Here you can set whether the vocab word is highlighted in the sentence. Set to 1 for yes var highlightword = 0; $("#character").wrap("<div style='font-size:" + rescale + "em'></div>"); $("#question-type").prepend("<div id='sentwrap' style='font-size:1.5em'><div id='sentj'></div><div id='sente'></div></div>"); $("#question-type").click(function() { if ($.jStorage.get("questionType") === "meaning") { $("#sente").toggle(); } }); var japanese, english, jvoc, previous_item; $.jStorage.listenKeyChange('currentItem', function() { $("#sente").hide(); var current_item = $.jStorage.get('currentItem'); if (previous_item !== current_item.voc) { $("#sentj").html(" ");//blank sentence area while fetching json } else if (highlightword == 1) {//immediately change highlight color when sentence stays same (smooth transition in Single Mode) if ($.jStorage.get('questionType') == "reading") {$(".highlighted").css({"color":"#2e2e2e","background-color":"#fff"});} if ($.jStorage.get('questionType') == "meaning") {$(".highlighted").css({"color":"#e9e9e9","background-color":"#555"});} } previous_item = current_item.voc; /*Following is code courtesy of rfindley to fetch sentences*/ // Only vocab has context sentences. if (current_item.voc !== undefined) { var url = '/json/vocabulary/' + current_item.id; // Grab the item info from WK server. Process result when it arrives. $.getJSON(url, function(json) { // Extract the sentences from the item info. var context_sentences = json.sentences; //console.log('Sentences for ' + current_item.voc + ':'); // Output each sentence to the console. $.each(context_sentences, function(idx, sentence) { japanese = sentence[0]; english = sentence[1]; //console.log(' J: ' + japanese); //console.log(' E: ' + english); }); /*End of code courtesy of rfindley*/ $("#sentj").html(japanese); $("#sente").html(english); if (highlightword == 1) { jvoc = current_item.voc; while (japanese.indexOf(jvoc) === -1) { if (jvoc.length == 1) {console.log("Search failed");break} jvoc = jvoc.slice(0,jvoc.length - 1); } $("#sentj").html(japanese.replace(new RegExp(jvoc,'g'),"<span class='highlighted' style=text-shadow:none>"+jvoc+"</span>")); if ($.jStorage.get('questionType') == "reading") {$(".highlighted").css({"color":"#2e2e2e","background-color":"#fff"});} if ($.jStorage.get('questionType') == "meaning") {$(".highlighted").css({"color":"#e9e9e9","background-color":"#555"});} } }); } else { $("#sentj").html(""); $("#sente").html(""); } });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址