[Userscript]: Reorder Ultimate 2 [newest]

You can also leave the vocab field blank to keep all vocab lessons. :slight_smile:

2 Likes

So I’ve been getting a few problems recently.
First, it appears doubled on the screen.


I thought this would be fine as long as it was still working (for example, if i deleted the radicals, all four of the bars would disappear.)

But then, a radical still appeared in a kanji only study.

I then reinstalled the newest version, and the parts that were being doubled was fixed, but radicals showing up in a kanji only study is still happening.

Any ideas?

1 Like

Right-click on radicals and kanji to remove them

1 Like

thanks, that seems to work

Lately, I’ve been doing increasing level, vocab, then kanji, then radicals, and had a radical show up in the middle of my vocab lessons.

Also, lately it’s been randomly getting stuck on one lesson. It might be the first one of the batch, or it might be a later one. But at some point, it’ll just keep repeating the same lesson, with no way to advance. I tried WK Lesson Filter, too, and it also got stuck, so I suspect something’s changed on the backend that’s broken both scripts.

2 Likes

Based on one or two other threads, it sounds like there may be some recent Wanikani changes causing the “getting stuck” issue. At least one person said they have the issue without using scripts.

I am also experiencing the “getting stuck” in lessons issue. I think for me it’s just this script as every time I turn it off everything works fine.

Also having problems in lessons with this script.

For some reason the Breeze Dark theme hides the minimize button.

minimizbotanegadokodesuka

I’m not sure why it disappeared, but I fixed it in the style.

1 Like

Thanks, I really appreciate this! :slight_smile:

1 Like

This script has started to break constantly for me… I checked both framework and reorder are on their latest versions. Also, I’m using Violentmonkey. Could I get some help please?
What do I mean by break? Well, sometimes it doesn’t show up at all, sometimes it shows up twice, sometimes the interface shows up, but it’s missing the levels.

How long has it been doing this?

Just based on the type of issues, my first suspicion is that you either have two copies of the script running somehow, or another script is causing havoc… though I don’t rule out other possibilities yet.

Just as a sanity check, can you start by turning off the copy of Reorder that you are aware is running, and see if the Reorder interface still shows up?

If I turn it off, the script disappears as expected. Also the script has stopped acting up currently. Maybe turning it on an off has fixed it somehow? I won’t count it as a win just yet, I’ll report back if it starts acting up again.

1 Like

Alright, so it’s started up again…

Hello, and thank you for your great scripts!

Still, there are some issues that bother me recently. Sorry if I’m not the first mentioning them, but with this being issue for quite long, I’ve just begun considering it’s me doing something wrong, maybe? (like back then, when I was waiting Mistake Delay script to be fixed… and when I came to inquire about that issue, it turned to be just obsolete and I just had to switch to Double-Check script long-long ago, ouch!)

So, for some time being, reviews interface of this reorder panel got broken. I mean,

back then there was a nice “+” button above the balance scale thing to hide it. But now there is just a thin line that is quite hard to press. Not like I can’t, but I believe it could be fixed somehow?

“Mark Right” and “Retype” buttons of Double-Check script got broken as well. As you can see on the snap above, they lost their labels as well. With author of both scripts being the same, I hope it’s fine to ask about them both just once here?

I think this has been fixed in the newest version of the Double-Check script – are you on version 2.2.37?

1 Like

Ouch, you right. I knew it was something not so difficult. I was on 2.2.34… Now I wonder why didn’t it upgraded automatically? It enabled to auto-update, as I can see… Anyways, thanks a lot, half of the problem solved!
image

and Double-Check buttons are back.
But the issue with Reorder Ultimate 2 hide button is still here. If anything, I’m on v2.2.8 that seem to be the most recent.
Is it intended to be like this? I’ve just used to immediately hide this panel so it doesn’t give me hints regarding level of an items I’m solving. And having it to be a bit bigger would be quite… convenient.

Yes, Reorder Ultimate 2 still has to be adapted to the WK icon change. Just three lines need to be changed, but here is the entire code for convenience:

Code
// ==UserScript==
// @name          Wanikani Reorder Ultimate 2
// @namespace     https://www.wanikani.com
// @description   Learn in the order you want to.
// @version       2.2.8
// @include       /^https://(www|preview).wanikani.com/(lesson|review)/session/
// @grant         none
// ==/UserScript==

// Original source:  https://gist.github.com/xMunch/6beafa1a79a77386cd92/raw/WKU.user.js
// Wanikani thread:  https://www.wanikani.com/chat/api-and-third-party-apps/8471/page/31#post332221
// Author: xMunch

window.reorder = {};

(function(gobj) {

    /* globals $, jQuery, wkof */

    //===================================================================
    // Initialization of the Wanikani Open Framework.
    //-------------------------------------------------------------------
    var script_name = 'Reorder Ultimate 2';
    if (!window.wkof) {
        if (confirm(script_name+' requires Wanikani Open Framework.\nDo you want to be forwarded to the installation instructions?')) {
            window.location.href = 'https://community.wanikani.com/t/instructions-installing-wanikani-open-framework/28549';
        }
        return;
    }

    // HTML5 Sortable jQuery Plugin
    // http://farhadi.ir/projects/html5sortable
    // Copyright 2012, Ali Farhadi
    // Released under the MIT license.
    (function(e){var t,n=e();e.fn.sortable=function(r){var i=String(r);r=e.extend({connectWith:false},r);return this.each(function(){var s;if(/^enable|disable|destroy$/.test(i)){s=e(this).children(e(this).data("items")).attr("draggable",i=="enable");if(i=="destroy"){s.add(this).removeData("connectWith items").off("dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s");}return;}var o,u;s=e(this).children(r.items);var a=e("<"+(/^ul|ol$/i.test(this.tagName)?"li":"div")+' class="sortable-placeholder">');s.find(r.handle).mousedown(function(){o=true;}).mouseup(function(){o=false;});e(this).data("items",r.items);n=n.add(a);if(r.connectWith){e(r.connectWith).add(this).data("connectWith",r.connectWith);}s.attr("draggable","true").on("dragstart.h5s",function(n){if(r.handle&&!o){return false;}o=false;var i=n.originalEvent.dataTransfer;i.effectAllowed="move";i.setData("Text","dummy");u=(t=e(this)).addClass("sortable-dragging").index();}).on("dragend.h5s",function(){if(!t){return;}t.removeClass("sortable-dragging").show();n.detach();if(u!=t.index()){t.parent().trigger("sortupdate",{item:t});}t=null;}).not("a[href], img").on("selectstart.h5s",function(){if(this.dragDrop&&this.dragDrop()){return false;}}).end().add([this,a]).on("dragover.h5s dragenter.h5s drop.h5s",function(i){if(!s.is(t)&&r.connectWith!==e(t).parent().data("connectWith")){return true;}if(i.type=="drop"){i.stopPropagation();n.filter(":visible").after(t);t.trigger("dragend.h5s");return false;}i.preventDefault();i.originalEvent.dataTransfer.dropEffect="move";if(s.is(this)){if(r.forcePlaceholderSize){a.height(t.outerHeight());}t.hide();e(this)[a.index()<e(this).index()?"after":"before"](a);n.not(a).detach();}else if(!n.is(this)&&!e(this).children(r.items).length){n.detach();e(this).append(a);}return false;});});};})(jQuery);

    var rad_levels, kan_levels, voc_levels;

    function storage_set(name, value) {localStorage[name] = JSON.stringify(value);}
    function storage_get(name) {try {return JSON.parse(localStorage[name]);} catch(err) {return null;};}

    var ui_css =
        '.ui, .ui-small {'+
        '	list-style: none;'+
        '	color: rgb(255, 255, 255);'+
        '	border-radius: 6px;'+
        '	margin: 5px;'+
        '	padding: 5px;'+
        '	min-height: 30px;'+
        '	background: rgb(85, 85, 85);'+
        '}'+
        '.ui-small {text-align: right; margin-bottom: 5px;}'+
        '.center {margin: 0 auto;}'+
        '#left {min-width: 150px; min-height: 150px;}'+
        '#mid {padding-top: 20px; text-align: center;}'+
        '#right {min-width: 150px; min-height: 150px; text-align: right;}'+
        '.unsorted, .hidden {display: none !important; visibility: none !important}'+
        'item[id^=level-] {background: gray}'+
        '.sortable {padding: 0}'+
        '.sortable item {'+
        '    display: inline-block;'+
        '    font-size: 12px;'+
        '    height: 20px;'+
        '    width: 55px;'+
        '    list-style: none;'+
        '    border-radius: 6px;'+
        '    text-align: center;'+
        '    margin: 5px;'+
        '    padding: 5px 15px;'+
        '    border: 1px solid rgb(51, 51, 51)'+
        '}'+
        '.sortable-placeholder {'+
        '    display: inline !important;'+
        '    border: 1px dashed #CCC !important;'+
        '    background: none;'+
        '    padding: 6px 40px !important'+
        '}'+
        '#priority, #priority2 {'+
        '    background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAAEwCAMAAAAEvhGsAAACbVBMVEUAAAD///+AgICqqqqAgICZmZmAgICSkpKAgICOjo6AgICLi4uAgICJiYmAgICIiIiAgICHh4eAgICGhoaAgIB/f3+FhYWFhYWEhISAgICEhISAgICEhISAgICDg4OAgICDg4OGhoaDg4OGhoaDg4OGhoaCgoKFhYWFhYWCgoKCgoKFhYWCgoKEhISCgoKEhISEhISCgoKEhISCgoKEhISEhISCgoKDg4OBgYGBgYGDg4OBgYGDg4OFhYWDg4OFhYWEhISDg4OEhISEhISDg4OEhISDg4OEhISCgoKCgoKEhISCgoKEhISCgoKEhISCgoKCgoKDg4OCgoKCgoKDg4OCgoKDg4OCgoKDg4OEhISEhISEhISEhISDg4OEhISEhISDg4OEhISDg4ODg4OCgoK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lRa0SMmwpANg+55xz7hM4HNwNvgxxn5RfJFYbl2Lxmmp5UZuEjFoaCMlYWOUVfCMd4SdjlFckVhuXYvEaVMuL2iRk1FIAsHlwZXVDIS3u8X7if/OKxOriUi1eUy4vapGQySIxWMx1eZ8x5gS3Hx5ltJ+sAcguEqubq2zxmnp5UXuETBaJAZQw5rigxIXDYXkMjIYlXqFlFYnVzVW2eA3q5UXtEXLQUgAWt5lLCPFttxeMC8AoOjxRJTY+q1QDl0LxWgXlRa0RMtFSADaF3WOMUdhkZIouu6V1cykUr6GC8qLWCFlFkZjGXMrlRa0RsooiMY25lMuLWiNkFUViGnMplxe1RsgqisR05lItL2rPqLWKIrFDl6u1RTyGywTMCGm4jJCGywTMcJmAGSENlxHScBkww2UCZoQ0ATNCGi4DZrhMwAyXCZgR0nAZIQ2XCZjhMgEzQhouI6ThMmCGywTMcJmAGSENlwEzXCZghssEzAhpuIyQhsuAGS4TMCOk4TJCGi4DZrhMwA51rrWPHxC12oHH1xqu+rngitrt94arfi4cqB/s34arfi6IBsxw1c9lAnaoCGmsTfb/aU9UqSuyTeAAAAAASUVORK5CYII=");'+
        '    background-repeat: no-repeat;'+
        '    width: 150px;'+
        '    height: 150px;'+
        '    display: block'+
        '}'+
        '#priority {float: right;}'+
        '.balance {background-position: -1px -1px !important}'+
        '.balance2 {background-position: -153px -1px !important}'+
        '.level-heavy {background-position: -1px -153px !important}'+
        '.meaning-heavy {background-position: -153px -153px !important}'+
        '.reading-heavy {background-position: -305px -1px !important}'+
        '.type-heavy {background-position: -305px -153px !important}'+
        '#overlay {'+
        '  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATAAAAEwCAMAAAAHJd3BAAAC4lBMVEUAAAAAAACAgIBVVVVAQEBmZmZVVVVJSUlgYGBVVVVNTU1GRkZVVVVOTk5JSUlVVVVQUFBLS0tRUVFNTU1RUVFOTk5VVVVSUlJOTk5SUlJPT09NTU1QUFBNTU1TU1NQUFBOTk5OTk5TU1NNT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7Bt9diCEbYe9TIeJySog3qpg6qp69QjqIhHvNW3Vm/xiCji0ePqqOKol+IoEnI8xsdogrG9nbAs4sQ1wSiCSqm3+NbirTSKoAYZV46wLHK8bYOkxse4Fvugob5MzfYyRU7FER8pSYr49oImofERR/QEHS97dHwpKc5muca1Y42hxDpYSLCjjquoRzymCZpS315piqTjEY+irqOykWDhLKGMWbJd4xHqVJQ9lo3WYxBk1EsVh9I0fog0pRxUvdQEwXi02JbZVPQo8RiPYwchx/J2OOiJVDl+iStCmqofoJqGiCt+OVQjpzgcb8sJQbbjMd7WcdW12a4RTFQiKlEsb1VXI/HtJVJX1dtCJSoSlUGMa7NddZ3lbfyWeixfOksqjiuU0e1liCvV+vZajSuMl11DieuIxpr6sjwav42PMWX8RRx2lKLTxGGFcoLWFT9AXC1yKFkcSacolc0RfzF0jI/xto8jYezD8jLohKgcrWsjHg1p/BBpSD2C7WqdqJApxsvibEPiONvb+JiKHodhu8q2HMZjEFfVoypSP0Qjqh5VVzAew7Fs6toMx6no+BhvSxT1slxx7eAQPV6CcDSERv0AlRJShyBeToWDbFdcy0tRsbyN3yIy49quequrjEdROiK0qfgBommJmFLUY6ir3urarpmI+G18HKq+LL+FiitMuoS4qokQ316IpOoKsZohrijx2/KlyvExfksNVlk7xFlUicbLYatriKirvr26KsK4anO8pEKVdYTsRRdG47fxMTSOc4StDrO7giEldYW4jqsN6gco0rqOK8TV0DDI6h6O2sQ5jpTxMd4240u85ax4HC8N461eoip+gKiKl3obUi/HI+vEW3wZtrfxto6jGTNOkY7adoehiJfliquaSPwIiaTqimt5Ccow3baaBj1mTOo4y9v4LXqcY7AaZZETh6D0sL1MRVrqRyhtRMfL5pQiHDlhUenCOMep+G18jCGD49qI2VbV+Ajq7VASV3x7cSWU462Ij1Fd9gi262DCGB/jt+pBsbwcRBzq0fhlgrZofXst2iLjl9SjHBEcLwvFqfpt/HIIY2G7apbtSzzGX4QEob61EiTEX4xHfNnWqGtjGcLxy/g4JsrheItrdWoqiL86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Qf4sYrD8ldAsmnBJK7hOSrTH6SJL9IICEEMvkTybvkWd145f+cAcYn47/GjTcgJAmE5CFJIOQuDHkXEgaSXDIwLhJmYEIYd2ZChnExA0niIoGBPKsbr2QGhiGZAWbcmUmScRHiIpBxMZAwJIyLYYbxSZIMTAgDCQMk7oyndeM1wwyTDCHu5JJJEoYJISQZGCYBkiGBCQmZkITJXWACmQRmBkgYEk/rxit/RjI+GT9IfGU8GBh/xcD4U8ZxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMdxHMfxn/kfgxFASnC7YtEAAAAASUVORK5CYII=");'+
        '  background-repeat: no-repeat;'+
        '	display: block;'+
        '}'+
        '.left {width: 150px; height: 150px; background-position: -1px -1px;}'+
        '.right {width: 150px; height: 150px; background-position: -153px -1px;}'+
        '.top {width: 150px; height: 150px; background-position: -1px -153px;}'+
        '#reorder_ultimate .reverse {margin-left:20px; cursor:pointer;}'+
        '#quick-next {cursor: pointer; display: inline-block; color: gray; font-size: 20px;}'+
        '#quick-next.active {color: green;}'+
        '#version {float: right;}'+
        '#reorder_ultimate {margin-bottom:75px;}';

    var ui_html =
        '<div class="ui-small hidden pure-g-r">'+
        '  <button class="fa fa-plus"></button>'+
        '</div>'+
        '<div id="reorder_ultimate" class="ui pure-g-r">'+
        '  <div class="pure-u-1-4" id="left">'+
        '    <div id="r-only">'+
        '      <div style="padding: 10px;"><input type="checkbox" id="mode">1x1 Mode</div>'+
        '      <div class="balance2" id="priority2">'+
        '        <div id="overlay" class=""></div>'+
        '      </div>'+
        '    </div>'+
        '  </div>'+
        '  <div class="pure-u-1-2" id="mid">'+
        '    <div class="sort_group">'+
        '      <div>'+
        '        <input type="checkbox" class="sort-types" value="checked" checked=""> Sort Types'+
        '        <span class="reverse icon-refresh"> Reverse</span>'+
        '      </div>'+
        '      <ul class="types sortable">'+
        '        <item class="radical" style="background-color:#0af;" draggable="true">部首</item>'+
        '        <item class="kanji" style="background-color:#f0a;" draggable="true">漢字</item>'+
        '        <item class="vocabulary" style="background-color:#a0f;" draggable="true">単語</item>'+
        '      </ul>'+
        '    </div>'+
        '    <div class="sort_group">'+
        '      <div>'+
        '        <input type="checkbox" class="sort-levels" checked=""> Sort Levels'+
        '        <span class="reverse icon-refresh"> Reverse</span>'+
        '      </div>'+
        '      <ul class="levels sortable">'+
        '      </ul>'+
        '    </div>'+
        '    <div>'+
        '      <button class="reorder" onclick="this.blur();" tabindex="-1" style="border-radius: 6px; padding: 5px; color: black;">Force Reorder</button>'+
        '    </div>'+
        '  </div>'+
        '  <div class="pure-u-1-4" id="right">'+
        '    <div><button class="fa fa-minus" style="color:black; margin-bottom: 17px;"></button></div>'+
        '    <div class="balance" id="priority">'+
        '      <div id="overlay" class=""></div>'+
        '    </div>'+
        '  </div>'+
        '  <div class="pure-u-1">'+
        '    <div id="quick-next" class="icon-fast-forward"></div>'+
        '    <div id="version">v2.0.X</div>'+
        '  </div>'+
        '</div>';

    var activeLevels = [];
    var dataset = {};
    var lastUpdate = new Date().getTime();
    var lessonset = {
        quick: 'l',
        queue: 'l/lessonQueue',
        active: 'l/activeQueue',
        updateVisual: function() {
            $('li[data-index="0"]').click();
            var items = $.jStorage.get(dataset.queue).concat($.jStorage.get(dataset.active));
            $.jStorage.set('l/count/rad', sorter.filterType("rad", items).length);
            $.jStorage.set('l/count/kan', sorter.filterType("kan", items).length);
            $.jStorage.set('l/count/voc', sorter.filterType("voc", items).length);
        }
    };

    var showerr = function(err) {
        $('#supplement-info, #information').first().after('<div id="error" style="text-align:center;">An error has occurred within WaniKani Reorder Ultimate.  Please post the error below on the forum thread.<br><a href="https://community.wanikani.com/t/userscript-reorder-ultimate-2-newest/35152" target="_blank">https://community.wanikani.com/t/userscript-reorder-ultimate-2-newest/35152</a><br><br>' + err.stack.replace(/\n/g,'<br>') + '<br><br>Logs:<br>' + console.dlog.join('<br>') + '</div>');
    };

    var reviewset = {
        quick: 'r',
        queue: 'reviewQueue',
        active: 'activeQueue',
        updateVisual: function() {
            var item = $.jStorage.get(dataset.active)[Math.floor(window.Math.random(true))];
            if (item.rad !== undefined) {
                $.jStorage.set('questionType', 'meaning');
            }
            if (item) {
                $.jStorage.set('currentItem', item);
            }
            var count = $.jStorage.get(dataset.queue).length + $.jStorage.get(dataset.active).length;
            $("#available-count").html(count); // to stop the double-up bug.
        }
    };
    var ordered = false;
    var settings = {
        data: {
            sorttypes: !0,
            sortlevels: !0,
            onebyone: !1,
            quickNext: !1,
            priority: {
                'rad': 1,
                'kan': 2,
                'voc': 3,
            },
            questionTypeMode: "0",
            typePriorityMode: "0"
        },
        load: function() {
            var a = storage_get('WKU/' + dataset.quick + '/settings');
            if (a === null) {
                settings.save();
                return settings.load();
            }
            utilities.log("Loading settings...");
            for (var s in settings.data) {
                if (a[s] !== null) settings.data[s] = a[s];
            }
            $('#reorder_ultimate .types item').sort(function(a, b) {
                return sorter.getHTMLElementPriority(a) - sorter.getHTMLElementPriority(b);
            }).appendTo('#reorder_ultimate .types');
            $('#reorder_ultimate .sort-types').prop('checked', settings.data.sorttypes).change();
            $('#reorder_ultimate .sort-levels').prop('checked', settings.data.sortlevels).change();
            $('#priority').removeClass().addClass(utilities.settingsValueToClass('priority', settings.data.typePriorityMode));
            $('#quick-next').toggleClass('active', settings.data.quickNext);
            if (dataset.quick === 'r') {
                $('#mode').prop('checked', settings.data.onebyone).change();
                $('#priority2').removeClass().addClass(utilities.settingsValueToClass('priority2', settings.data.questionTypeMode));
            }
            utilities.log(settings.data);
        },
        save: function() {
            storage_set('WKU/' + dataset.quick + '/settings', settings.data);
        }
    };
    var setup = {
        init: function() {
//            try {
                $('div[id*="loading"]').off('hide');
                console.dlog = [];
                utilities.log("WKU Init()");
                setup.ui.create();
//            } catch (err) {
//                showerr(err);
//            }
        },
        update: {
            apply: function() {
                try {
                    var queue = $.jStorage.get(dataset.active).concat($.jStorage.get(dataset.queue));
                    var current = $.jStorage.get('currentItem');
                    $.each(queue, function() {
                        if (this.voc !== undefined) {
                            this.level = voc_levels[this.voc];
                        } else if (this.kan !== undefined) {
                            this.level = kan_levels[this.kan];
                        } else {
                            this.level = rad_levels[this.en[0].toLowerCase().replace(' ','-')];
                        }
                        if (current && utilities.toUID(this) === utilities.toUID(current)) {
                            $.jStorage.set('currentItem', this);
                        }
                        if (activeLevels.indexOf(this.level) == -1) {
                            activeLevels.push(this.level);
                        }
                    });
                    activeLevels.sort(function(a, b) {
                        return a - b;
                    });
                    var review = queue.splice((dataset.quick === 'r' ? 10 : $.jStorage.get('l/batchSize')));
                    $.jStorage.set(dataset.active, queue);
                    $.jStorage.set(dataset.queue, review);
                    dataset.updateVisual();
                } catch (err) {
                    showerr(err);
                }
            }
        },
        ui: {
            create: function() {
                setup.update.apply();
                $('head').append('<style>'+ui_css+'</style>');
                utilities.log("Creating UI...");
                var info = $('#supplement-info, #information').first();
                info.after(ui_html);
                $('#version').text("v" + GM_info.script.version);
                if (dataset.quick === 'l') {
                    $('.ui').find('#r-only').remove();
                }
                $('fieldset').on('addClass', function(evt) {
                    if (settings.data.quickNext) {
                        setTimeout(function() {
                            if ($('fieldset').hasClass('correct')) {
                                $('fieldset button').click();
                            }
                        }, 25);
                    }
                });
                $('#quick-next').click(function() {
                    $(this).toggleClass('active');
                    settings.data.quickNext = $(this).hasClass('active');
                    settings.save();
                });
                $('#priority, #priority2').click(function(e) {
                    var offset = $(this).offset();
                    var x = (e.pageX - offset.left);
                    var y = (e.pageY - offset.top);
                    var id = $(this).attr('id');
                    if (y > 50) {
                        if (x < 75) {
                            if (id === "priority") {
                                $(this).removeClass().addClass("level-heavy");
                                settings.data.typePriorityMode = "1";
                                sorter.reorder();
                            } else {
                                $(this).removeClass().addClass("reading-heavy");
                                settings.data.questionTypeMode = "1";
                                utilities.forceQuestionTypeUpdate();
                            }
                        } else {
                            if (id === "priority") {
                                $(this).removeClass().addClass("type-heavy");
                                settings.data.typePriorityMode = "2";
                                sorter.reorder();
                            } else {
                                $(this).removeClass().addClass("meaning-heavy");
                                settings.data.questionTypeMode = "2";
                                utilities.forceQuestionTypeUpdate();
                            }
                        }
                    } else {
                        if (id === "priority") {
                            $(this).removeClass().addClass("balance");
                            settings.data.typePriorityMode = "0";
                            sorter.reorder();
                        } else {
                            $(this).removeClass().addClass("balance2");
                            settings.data.questionTypeMode = "0";
                            utilities.forceQuestionTypeUpdate();
                        }
                    }
                    settings.save();
                }).mousemove(function(e) {
                    var offset = $(this).offset();
                    var x = (e.pageX - offset.left);
                    var y = (e.pageY - offset.top);
                    var ele = $(this).find('#overlay');
                    if (y > 50) {
                        if (x < 75) {
                            ele.removeClass().addClass('left');
                        } else {
                            ele.removeClass().addClass('right');
                        }
                    } else {
                        ele.removeClass().addClass('top');
                    }
                }).mouseleave(function(e) {
                    $(this).find('#overlay').removeClass();
                });
                activeLevels.forEach(function(ele) {
                    $('#reorder_ultimate .levels').append('<item id="level-' + ele + '">' + ele + '</item>');
                });
                $('#reorder_ultimate .reverse').click(function() {
                    var parent = $(this).closest('.sort_group').find('.sortable');
                    var items = parent.children('item');
                    parent.append(items.get().reverse());
                    sorter.reorder();
                    settings.save();
                });
                $('.fa-minus, .fa-plus').click(function() {
                    $('.ui, .ui-small').toggleClass('hidden');
                });
                $('#reorder_ultimate .sort-types, #reorder_ultimate .sort-levels').change(function() {
                    $(this).closest('sort_group').find('.sortable item').toggleClass('unsorted', !this.checked);
                    settings.data[$(this).attr('class').replace("-", "")] = this.checked;
                    settings.save();
                });
                if (dataset.quick === 'r') {
                    $('#mode').on('change', function() {
                        settings.data.onebyone = this.checked;
                        if (settings.data.questionTypeMode > 0) {
                            utilities.forceQuestionTypeUpdate();
                        }
                        settings.save();
                    });
                    $('#option-wrap-up').click(function() {
                        if ($(this).attr('class') === 'wrap-up-selected') {
                            var fullQueue = $.jStorage.get(dataset.active).concat($.jStorage.get(dataset.queue));
                            $.jStorage.set(dataset.active, fullQueue.splice(0, 10));
                            $.jStorage.set(dataset.queue, fullQueue);
                            setup.ui.toggler();
                        } else {
                            if (ordered) {
                                sorter.reorder();
                            }
                        }
                    });
                }
                settings.load();
                setup.ui.toggler();
                $('#reorder_ultimate .reorder').click(function() {
                    sorter.reorder();
                });
                $('body').on('contextmenu', '.ui', function(e) {
                    e.preventDefault();
                });
                $('item').mousedown(function(event) {
                    if (event.which === 3) {
                        var ele = $(this).addClass('hidden');
                        if (ele.attr('id')) {
                            sorter.removeLevel(parseInt(ele.text()));
                        } else {
                            sorter.removeType(ele.attr('class'));
                        }
                    }
                });
                $('.sortable').sortable({
                    items: ':not(div, button)'
                }).bind('sortupdate', function() {
                    sorter.reorder();
                    settings.save();
                });
            },
            toggler: function() {
                if ($('.sortable').length) {
                    var fq = $.jStorage.get(dataset.queue).concat($.jStorage.get(dataset.active));
                    if (!fq.length) {
                        utilities.log("There are no options available... Removing UI.");
                        $('.ui').remove();
                    } else {
                        $('#reorder_ultimate .types .radical').toggleClass('hidden', !sorter.filterType("rad", fq).length).prop('title', function() {
                            var filtered = sorter.filterType("rad", fq);
                            var text = "Total: " + filtered.length;
                            $.each(activeLevels, function() {
                                var amount = sorter.filterLevel(this, filtered).length;
                                if (amount) {
                                    text += "\nLevel " + this + ": " + amount + "";
                                }
                            });
                            return text;
                        });
                        $('#reorder_ultimate .types .kanji').toggleClass('hidden', !sorter.filterType("kan", fq).length).prop('title', function() {
                            var filtered = sorter.filterType("kan", fq);
                            var text = "Total: " + filtered.length;
                            $.each(activeLevels, function() {
                                var amount = sorter.filterLevel(this, filtered).length;
                                if (amount) {
                                    text += "\nLevel " + this + ": " + amount + "";
                                }
                            });
                            return text;
                        });
                        $('#reorder_ultimate .types .vocabulary').toggleClass('hidden', !sorter.filterType("voc", fq).length).prop('title', function() {
                            var filtered = sorter.filterType("voc", fq);
                            var text = "Total: " + filtered.length;
                            $.each(activeLevels, function() {
                                var amount = sorter.filterLevel(this, filtered).length;
                                if (amount) {
                                    text += "\nLevel " + this + ": " + amount + "";
                                }
                            });
                            return text;
                        });
                        activeLevels.forEach(function(level) {
                            $('#level-' + level).toggleClass('hidden', !sorter.filterLevel(level, fq).length).prop('title', function() {
                                var filtered = sorter.filterLevel(level, fq);
                                var rad = sorter.filterType("rad", filtered).length;
                                var kan = sorter.filterType("kan", filtered).length;
                                var voc = sorter.filterType("voc", filtered).length;
                                var text = "Total: " + filtered.length;
                                if (rad) {
                                    text += "\nRadicals: " + rad;
                                }
                                if (kan) {
                                    text += "\nKanji: " + kan;
                                }
                                if (voc) {
                                    text += "\nVocabulary: " + voc;
                                }
                                return text;
                            });
                        });
                        $('input[type="checkbox"]:disabled').removeAttr('disabled');
                    }
                }
            }
        },
        listeners: function() {
            var lastCount = $.jStorage.get(dataset.active).length + $.jStorage.get(dataset.queue).length;
            $.jStorage.listenKeyChange('currentItem', function() {
                if (lastCount < ($.jStorage.get(dataset.active).length + $.jStorage.get(dataset.queue).length)) {
                    lastCount = $.jStorage.get(dataset.active).length + $.jStorage.get(dataset.queue).length; // will infinitely trigger if not here.
                    setup.init();
                }
                lastCount = $.jStorage.get(dataset.active).length + $.jStorage.get(dataset.queue).length;
            });
            $.jStorage.listenKeyChange('currentItem', utilities.forceQuestionTypeUpdate);
            $.jStorage.listenKeyChange(dataset.active, setup.ui.toggler);
        }
    };
    var sorter = {
        filterLevel: function(level, list) {
            if (!list) {
                return [];
            }
            return list.filter(function(ele, ind) {
                return ele.level == level;
            });
        },
        filterType: function(type, list) {
            if (!list) {
                return [];
            }
            return list.filter(function(ele, ind) {
                return ele[type.substr(0, 3)];
            });
        },
        getHTMLElementPriority: function(a) {
            return a.className === 'radical' ? settings.data.priority.rad : a.className === 'kanji' ? settings.data.priority.kan : settings.data.priority.voc;
        },
        getPriority: function(a) {
            return (a.rad !== undefined) ? settings.data.priority.rad : (a.kan !== undefined) ? settings.data.priority.kan : settings.data.priority.voc;
        },
        randomize: function(list) {
            // Old randomizer used sort() with comparison function {return 0.5 - random();}.
            // Due to internals of sort algorithm, the resulting list doesn't randomize very well (values are unevenly favored).
            // Method below attaches a random number to each list item, sorts by the random numbers, then removes the random numbers.
            return list.map(function(v){return [window.Math.randomB(),v];}).sort(function(a,b){return a[0]-b[0];}).map(function(v){return v[1];});
        },
        reorder: function() {
            ordered = true;
            sorter.setPriorities();
            var fullQueue = $.jStorage.get(dataset.queue).concat($.jStorage.get(dataset.active));
            fullQueue = sorter.randomize(fullQueue);
            if (parseInt(settings.data.typePriorityMode) == 1) {
                if (settings.data.sortlevels) {
                    $('#reorder_ultimate .levels > item').each(function() {
                        var level = parseInt(this.innerHTML);
                        var sorted = sorter.filterLevel(level, fullQueue);
                        if (settings.data.sorttypes) {
                            sorted = sorter.sortByType(sorted);
                        } else {
                            sorted = sorter.randomize(sorted);
                        }
                        fullQueue = sorter.removeLevel(level, fullQueue);
                        fullQueue = fullQueue.concat(sorted);
                    });
                }
            }
            if (parseInt(settings.data.typePriorityMode) == 2) {
                if (settings.data.sorttypes) {
                    $('#reorder_ultimate .types > item').each(function() {
                        var typeFilter = sorter.filterType(this.className, fullQueue);
                        if (settings.data.sortlevels) {
                            $('#reorder_ultimate .levels > item').each(function() {
                                var level = parseInt(this.innerHTML);
                                var sorted = sorter.filterLevel(level, typeFilter);
                                typeFilter = sorter.removeLevel(level, typeFilter);
                                typeFilter = typeFilter.concat(sorted);
                            });
                        } else {
                            typeFilter = sorter.randomize(typeFilter);
                        }
                        fullQueue = sorter.removeType(this.className, fullQueue);
                        fullQueue = fullQueue.concat(typeFilter);
                    });
                }
            }
            $.jStorage.set(dataset.active, (dataset.quick === 'r' ? fullQueue : fullQueue.splice(0, $.jStorage.get('l/batchSize'))));
            $.jStorage.set(dataset.queue, (dataset.quick === 'r' ? [] : fullQueue));
            setup.ui.toggler();
            dataset.updateVisual();
        },
        removeLevel: function(level, list) {
            if (!list) {
                var fullQueue = sorter.removeLevel(level, $.jStorage.get(dataset.queue));
                var activeQueue = sorter.removeLevel(level, $.jStorage.get(dataset.active));
                $.jStorage.set(dataset.queue, fullQueue);
                $.jStorage.set(dataset.active, activeQueue);
                sorter.reorder();
                return;
            }
            return list.filter(function(ele, ind) {
                return ele.level != level;
            });
        },
        removeType: function(type, list) {
            if (!list) {
                var fullQueue = sorter.removeType(type, $.jStorage.get(dataset.queue));
                var activeQueue = sorter.removeType(type, $.jStorage.get(dataset.active));
                $.jStorage.set(dataset.queue, fullQueue);
                $.jStorage.set(dataset.active, activeQueue);
                sorter.reorder();
                return;
            }
            return list.filter(function(ele, ind) {
                return !ele[type.substr(0, 3)];
            });
        },
        sortByType: function(list) {
            return list.sort(function(a, b) {
                return (sorter.getPriority(a) - sorter.getPriority(b));
            });
        },
        setPriorities: function() {
            settings.data.priority.rad = $('#reorder_ultimate .types .radical').index();
            settings.data.priority.kan = $('#reorder_ultimate .types .kanji').index();
            settings.data.priority.voc = $('#reorder_ultimate .types .vocabulary').index();
        }
    };
    var utilities = {
        forceQuestionTypeUpdate: function() {
            var current = $.jStorage.get("currentItem");
            if (!current) {
                return;
            }
            var type = $.jStorage.get("questionType");
            if (current.rad !== undefined) {
                if (type !== "meaning") {
                    $.jStorage.set("questionType", "meaning");
                    $.jStorage.set("currentItem", current);
                }
                return;
            }
            var typeMethod = parseInt(settings.data.questionTypeMode);
            var data = $.jStorage.get(utilities.toUID(current));
            if (!typeMethod && (!data || (!data.mc && !data.rc))) {
                if ((new Date().getTime() - lastUpdate) > 500) {
                    lastUpdate = new Date().getTime();
                    var nextRandType = ["reading", "meaning"][Math.round(window.Math.randomB())];
                    if (type != nextRandType) {
                        $.jStorage.set('questionType', nextRandType);
                        $.jStorage.set("currentItem", current);
                    }
                }
            }
            if (typeMethod === 1) {
                if (!data || !data.rc) {
                    if (type !== "reading") {
                        $.jStorage.set("questionType", "reading");
                        $.jStorage.set("currentItem", current);
                    }
                } else {
                    if (type !== "meaning") {
                        $.jStorage.set("questionType", "meaning");
                        $.jStorage.set("currentItem", current);
                    }
                }
            }
            if (typeMethod === 2) {
                if (!data || !data.mc) {
                    if (type !== "meaning") {
                        $.jStorage.set("questionType", "meaning");
                        $.jStorage.set("currentItem", current);
                    }
                } else {
                    if (type !== "reading") {
                        $.jStorage.set("questionType", "reading");
                        $.jStorage.set("currentItem", current);
                    }
                }
            }
        },
        highestPriorityType: function() {
            return $('#reorder_ultimate .types item:not(.hidden)').first().attr('class');
        },
        highestPriorityLevel: function() {
            return parseInt($('#reorder_ultimate .levels item:not(.hidden)').first().text());
        },
        log: function(msg) {
            console.dlog.push(msg);
            console.debug(msg);
        },
        newRandom: function(fullVal) {
            if (!settings.data.onebyone && ordered) {
                var fullQueue = $.jStorage.get(dataset.active).concat($.jStorage.get(dataset.queue));
                var fullLength = fullQueue.length;
                if (settings.data.sortlevels && parseInt(settings.data.typePriorityMode) == 1) {
                    fullQueue = sorter.filterLevel(utilities.highestPriorityLevel(), fullQueue);
                    if (settings.data.sorttypes) {
                        fullQueue = sorter.filterType(utilities.toType(fullQueue[0]), fullQueue);
                    }
                }
                if (settings.data.sorttypes && parseInt(settings.data.typePriorityMode) == 2) {
                    fullQueue = sorter.filterType(utilities.highestPriorityType(), fullQueue);
                    if (settings.data.sortlevels) {
                        fullQueue = sorter.filterLevel(fullQueue[0].level, fullQueue);
                    }
                }
                return Math.floor(window.Math.randomB() * Math.min(10, fullQueue.length)) / (fullVal ? 1 : Math.max(fullLength, 1));
            }
            return settings.data.onebyone ? 0 : window.Math.randomB();
        },
        toType: function(item) {
            return (item && (item.rad !== undefined)) ? 'rad' : (item.kan !== undefined) ? 'kan' : 'voc' || "-1";
        },
        toUID: function(item) {
            return ((item && (item.rad !== undefined)) ? 'r' : (item.kan !== undefined) ? 'k' : 'v') + item.id || "-1";
        },
        settingsValueToClass: function(id, val) {
            val = parseInt(val);
            if (id === "priority") {
                switch (val) {
                    case 0:
                        return "balance";
                    case 1:
                        return "level-heavy";
                    case 2:
                        return "type-heavy";
                }
            } else {
                switch (val) {
                    case 0:
                        return "balance2";
                    case 1:
                        return "reading-heavy";
                    case 2:
                        return "meaning-heavy";
                }
            }
        }
    };
    wkof.include('ItemData');
    var items_ready = wkof.ready('ItemData').then(function() {
        return wkof.ItemData.get_items().then(items => {
            var by_type = wkof.ItemData.get_index(items, 'item_type');
            rad_levels = {};
            kan_levels = {};
            voc_levels = {};
            by_type.radical.forEach(item => (rad_levels[item.data.slug] = item.data.level));
            by_type.kanji.forEach(item => (kan_levels[item.data.slug] = item.data.level));
            by_type.vocabulary.forEach(item => (voc_levels[item.data.slug] = item.data.level));
        });
    });

    $('div[id*="loading"]:visible').on('hide', items_ready.then(function() {
        (function ($) {$.each(['hide', 'addClass'], function (i, ev) { var el = $.fn[ev]; $.fn[ev] = function () { this.trigger(ev); return el.apply(this, arguments); }; }); })(jQuery);
        dataset = (location.pathname.match('review') ? reviewset : lessonset);
        window.Math.randomB = window.Math.random;
        if (dataset.quick === 'r') {
            window.Math.random = utilities.newRandom;
        }
        setup.listeners();
        setup.init();
        sorter.reorder();
    }));

})(window.reorder);

In case you are planning to modify your local code, your script manager will likely disable automatic updates for Reorder Ultimate 2 – you would have to manually re-enable it after the change.

1 Like

Ah, thanks a lot again! Now not to miss next official update…