(Obsolete) [UserScript] WaniKani Double Check

Ideally, any script that modifies the existing interface should account for other scripts doing the same thing. For that reason, my script counts the number of buttons that were present before it started, and resizes the buttons to account for the ones it adds. If you can configure your other button-modifying scripts to run before mine, mine would normally automatically resize the remaining ones to fill the space… except I didn’t account for one thing: buttons that are present but not visible. So, the changes below will fix that.

Find this line in my script (around line 314):

var btn_count = $('#additional-content ul').children().length + 2;

Replace that with the following two lines:

$('#option-wrap-up, #option-last-items').css('display','none');
var btn_count = $('#additional-content ul').children(':visible').length + 2;

The first line hides the two unwanted buttons (as @Kumirei noted). The second line makes my script only count the visible buttons when deciding what width to use.

2 Likes