<commit_before>// ==UserScript==
// @name        Wanikani for Vimperator
// @namespace   <EMAIL>
// @description Improves Wanikani navigation on Vimperator
// @include     https://www.wanikani.com/review/session
// @include     https://www.wanikani.com/lesson/session
// @version     1
// @grant       none
// ==/UserScript==

function convertLinks($targetItems, innerSelector)
{
    $targetItems.each(function(i, item)
    {
        var $item = $(item);

        // link already added?
        if ($item.find('a').length > 0)
            return;

        var $target = $item;
        if (typeof(innerSelector) !== 'undefined')
            $target = $target.find(innerSelector);

        $target.wrapInner(
            $('<a/>')
                .css({color: $target.css('color')})
                .click(function(e)
                {
                    $item.click();

                    // prevent firing event listeners that Wanikani might attach
                    // at later point in time
                    e.stopPropagation();
                    e.preventDefault();
                }));
    });
}

$(function()
{
    $('body').bind('DOMSubtreeModified', function()
    {
        // buttons under the main input
        convertLinks($('#additional-content li'), 'span');

        // top tabs
        convertLinks($('#supplement-nav li'));

        // bottom kanji buttons
        convertLinks($('#batch-items li'));

        // big left/right arrows
        convertLinks($('#prev-btn, #next-btn'));

        // summary links
        convertLinks($('#screen-quiz-ready li'));
        convertLinks($('#screen-lesson-ready li'));

        // add hidden text to arrows so that they're accessible with standard
        // names
        $('i.icon-chevron-right').each(function(i, item)
        {
            var $item = $(item);
            if ($item.find('span').length > 0)
                return;
            $item.wrapInner($('<span>Next</span>').hide());
        });
        $('i.icon-chevron-left').each(function(i, item)
        {
            var $item = $(item);
            if ($item.find('span').length > 0)
                return;
            $item.wrapInner($('<span>Previous</span>').hide());
        });
    });
});
<commit_msg>Fix arrow text trick missing from lessons<commit_after>// ==UserScript==
// @name        Wanikani for Vimperator
// @namespace   <EMAIL>
// @description Improves Wanikani navigation on Vimperator
// @include     https://www.wanikani.com/review/session
// @include     https://www.wanikani.com/lesson/session
// @version     1
// @grant       none
// ==/UserScript==

function convertLinks($targetItems, innerSelector)
{
    $targetItems.each(function(i, item)
    {
        var $item = $(item);

        // link already added?
        if ($item.find('a').length > 0)
            return;

        var $target = $item;
        if (typeof(innerSelector) !== 'undefined')
            $target = $target.find(innerSelector);

        $target.wrapInner(
            $('<a/>')
                .css({color: $target.css('color')})
                .click(function(e)
                {
                    $item.click();

                    // prevent firing event listeners that Wanikani might attach
                    // at later point in time
                    e.stopPropagation();
                    e.preventDefault();
                }));
    });
}

$(function()
{
    $('body').bind('DOMSubtreeModified', function()
    {
        // buttons under the main input
        convertLinks($('#additional-content li'), 'span');

        // top tabs
        convertLinks($('#supplement-nav li'));

        // bottom kanji buttons
        convertLinks($('#batch-items li'));

        // big left/right arrows
        convertLinks($('#prev-btn, #next-btn'));

        // summary links
        convertLinks($('#screen-quiz-ready li'));
        convertLinks($('#screen-lesson-ready li'));

        // add hidden text to arrows so that they're accessible with standard
        // names
        $('#next-btn a, i.icon-chevron-right').each(function(i, item)
        {
            var $item = $(item);
            if ($item.find('span').length > 0)
                return;
            $item.wrapInner($('<span>Next</span>').hide());
        });
        $('#prev-btn a, i.icon-chevron-left').each(function(i, item)
        {
            var $item = $(item);
            if ($item.find('span').length > 0)
                return;
            $item.wrapInner($('<span>Previous</span>').hide());
        });
    });
});

{'fraction_non_alphanumeric': 0.16402814423922604, 'fraction_numerical': 0.001759014951627089, 'mean_word_length': 1.7223219628964692, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '339041', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1236, 'n_words': 270}