Change the order of lesson tabs
当前为
// ==UserScript==
// @name Wanikani Lesson Tab Transmutation
// @namespace mempo
// @description Change the order of lesson tabs
// @include https://www.wanikani.com/lesson/session
// @version 1
// @grant none
// @run-at document-end
// ==/UserScript==
var vocReorderReadingOption = false;
//ATTENTION: It's only possible to choose one of the options below.
//If you select multiple, only the last one will work
var kanReorderExamplesOption = true;
var kanReorderReadingOption = false;
console.log('START OF WLTT');
var intervalFunction = setInterval(function(){
if($('#loading-screen').css('display') !== 'none'){
console.log('WLTT loading...');
}else{
console.log("WLTT LOADED");
clearInterval(intervalFunction);
WLTTreorder();
$.jStorage.listenKeyChange('l/currentLesson', WLTTreorder);
}
},250);
var WLTTreorder = function(){
if($.jStorage.get('l/currentLesson').kan){ //kanji
//console.log('/// the current lesson is kanji');
//radical examples meaning reading
if(kanReorderExamplesOption){
kanReorderExamples();
}
//radical reading meaning examples
if(kanReorderReadingOption){
kanReorderReading();
}
}else{//vocab
//console.log('/// the current lesson is vocab');
//breakdown reading meaning
if(vocReorderReadingOption){
vocReorderReading();
}
}
}
var kanReorderExamples = function(){
$('#supplement-nav li:nth-child(2)')[0].innerHTML = "Examples";
$('#supplement-nav li:nth-child(3)')[0].innerHTML = "Meaning";
$('#supplement-nav li:nth-child(4)')[0].innerHTML = "Reading";
$('#supplement-kan-meaning').appendTo('#supplement-kan');
$('#supplement-kan-reading').appendTo('#supplement-kan');
}
var kanReorderReading = function(){
$('#supplement-nav li:nth-child(2)')[0].innerHTML = "Reading";
$('#supplement-nav li:nth-child(3)')[0].innerHTML = "Meaning";
$('#supplement-kan-meaning').appendTo('#supplement-kan');
$('#supplement-kan-related-vocabulary').appendTo('#supplement-kan');
}
var vocReorderReading = function(){
$('#supplement-nav li:nth-child(2)')[0].innerHTML = "Reading";
$('#supplement-nav li:nth-child(3)')[0].innerHTML = "Meaning";
$('#supplement-voc-meaning').appendTo('#supplement-voc');
}
// RESEARCH CODE - for educational purposes
//////////////// ATTEMPT #1
//Moves content, but internal counter li.active.data(index) jumps to 2
//Therefore, meaning is skipped altogether dispite index===1
//Manually selecting tabs really fucks shit up.
//$('#supplement-nav li:nth-child(3)').data("index",1);
//$('#supplement-nav li:nth-child(2)').data("index",2);
//////////////// ATTEMPT #2
/*
//moves needle out of order
//completes cycle
//shows meaning -> reading
$('#supplement-nav li:nth-child(3)').attr('data-index', 1);
$('#supplement-nav li:nth-child(2)').attr('data-index', 2);
*/
//////////////// ATTEMPT #3
/*
//Works, but fucks up page content every other item
//Cause unknown
var meaning = $('#supplement-voc-meaning').html();
var reading = $('#supplement-voc-reading').html();
$('#supplement-voc-reading').html(meaning);
$('#supplement-voc-meaning').html(reading);
$('#supplement-nav li:nth-child(2)')[0].innerHTML = "Reading";
$('#supplement-nav li:nth-child(3)')[0].innerHTML = "Meaning";
*/