[Userscript] Wanikani Item Inspector

Yes please, I want it :smiley:

1 Like

Here is the promised procedure.

  • First you must make sure you have Item Inspector version 1.23.0, the latest. The version of scripts is displayed in the Tampermonkey dashboard.

  • In the Settings tab go to the Items Export Options. Make sure the Comma Separated checkbox is checked. This is required because the Explicit List filter wants items to be separated by commas.

CommaSeparated

Then you create a table called PreSelection or whatever name you like. This table is used to selects the items you want to bring in the Explicit List filter.

Then you need to setup filters to match which items you want to export. For the sake of making an example I will export all kanji and vocabulary that have been learned at the current level. This requires two exports. One for the kanji and one for the vocabulary. The reason is that the Explicit list filter can’t tell kanji apart from vocabulary unless they are typed in separate text area. You will need one export for each text area.

  • Make sure you select the PreSelection table.
  • Enable the Item Type filter. Select the Kanji item type.
  • Enable the Level filter. Type in +0. A value of zero preceded by a + sign always refers to you current level no matter which level it is. Then you don’t need to change the filter when you level up.
  • Enable the SRS Level filter. Click on all SRS levels except Unlocked and Initiate. This will select all items which have been learned, That excludes locks items and those items that are unlocked but their lesson has not been taken yet.

Enabling multiple filters requires an item to pass all filters to be displayed. This collection of filters will select (1) all kanji (2) of the current level (3) that have been learned. This is only an example of what you can do. Feel free to explore the filters available.

filters1
filters2

  • Save your settings and exit the settings menu
  • On the Item Inspector toolbar click on the Export Items button, the one with a cloud icon.

export

  • Three buttons are dropping down the toolbar. Click on Download.

export2

  • Open the downloaded file in Notepad.

  • Copy and Paste the items in the Explicit List filter. You have the choice of copying the whole thing or copying a small set of items to keep the size of your studies manageable. Then you may copy paste another set of items the next day and so on so forth.

  • To copy vocabulary items change the Item Type filter select to vocabulary and repeat the export part of the procedure.

Of course you may export radicals as well, but for your purpose there is no point because there is no visually similar data for radicals.

1 Like

Wow thanks a lot! I love following those procedures, I really learn a lot about what the Item Inspector can do.
Pretty cool with the level options too.
You should consider copying those procedure in the first post or link to them? Probably very useful for other than me too.

And now, it wouldn’t really be me posting if I wasn’t saying that something is off again :wink:
So here it is. I applied the filters as you mentionned (I upgraded first to version 1.23 and refreshed and restarted the browser), but the result items are not the kanjis of my current level (13):

Any idea why?

1 Like

I made an error in the procedure. You should use +0 for the current level. A plain 0 without the + sign won’t do. Sorry about that.

1 Like

Ah, mystery solved, thanks:D

1 Like

I wonder if anyone knows how to get this working on iPad? I’m running other WaniKani userscripts (like Re-Order Omega, Katakana for On’Yomi and Self Study) just fine.

I installed the Open Framework Additional Filters script, and I’ve installed the Kanji Stroke Order Font and verified Safari can use it by trying it on a CodePen.

Yet when I load the Dashboard, I still get the popup saying I have to install the Kanji Stroke Order Font to continue. Is there a trick to tell the script to re-examine its font cache or something?

(Alternatively, is there a way to use other features even without the font?)

Item Inspector relies heavily on mouse over popups. There is no way to get this to work on a tablet because there is no mouse and no mouse over equivalent UI feature.

I see… but iPad Pro has mouse and trackpad compatibility and some sites support hover. It may be impossible on WaniKani if their stylesheets disable hover on mobile.

1 Like

I don’t know about WK stylesheet but if Ipad Pro supports hover it may work with Item Inspector. Please try it and let me know whether it works.

How would I try? As I mentioned the modal telling me to install the font doesn’t let me go farther.

1 Like

This modal gives you two options. One that directs you to the font web site for installing the font, the other ignores the lack of font and lets you proceed to Item Inspector. Have you tried both options?

Item Inspector works fine without the font. You just lack some stroke Order data in some popups. Everything else works as intended. If you want Item Inspector without the font the top post of this thread contains instructions on how to disable the lack of font warning under the heading “What If You Don’t Install the Prerequisites?”.

If you want the font I can’t help you much because I don’t have an iPad. From a google search I have found that Apple wants the fonts to be installed through some App Store provided application. This could be the problem. This page gives a procedure to install fonts without getting them through the App Store.

Thanks for the help!

I fell into a rabbit hole here and have learned the reason I couldn’t use the fonts—but now it makes me wonder how anyone on any Apple device, including a Mac uses it… Anyway, here goes:

Since learning a precise list of extra installed fonts could be used to track someone across websites—so-called “font fingerprinting attacks”—Safari was modified ~6 years ago. (Not specifically mobile WebKit, just, Safari/WebKit.)

Apple changed it to always return true whenever a script asked if a font existed—regardless of whether the font being queried about was installed or not (or even existed or not). It also made it so that if you tried to determine if you could display a particular glyph (kanji, kana, letter, punctuation mark, etc.) with FontSet.check() or similar, you could only ask about a list of fonts—and would always get a return of true when no font listed supported the requested glyph. (Other browsers adopted these privacy measures, and this behavior is what is documented at this moment on MDN.)

So all was well in the world… well, no, of course not. If you had a big database of glyphs and were willing to try every permutation of font list you needed to create a fingerprint, you could still generate one.

So Safari changed it so that it answered true about system-standard fonts and false to all others—installed or not. (The system-standard fonts differed between localizations, so it could still be used to see if someone had any font capable of displaying Japanese or not.)

Then, the next attack came in the form of malware sites creating long lists of fallback fonts in every possible permutation, displaying text in a block element with those lists, and then inspecting what size the element rendered was, which if chosen correctly could again get you the list of installed fonts—and voilà, font fingerprinting was back!

So now, Safari will only use system-standard fonts and remotely-served webfonts. (I guess that explains why, if you’ve bought any webfonts from Adobe lately, you don’t even get the option of downloading them in TrueType/OpenType format anymore.)

On a Mac, there’s a defaults key you can change to allow the old behavior and make local fonts available to webpages again; and apparently, if you upgraded into a current macOS with custom fonts that Safari could use already installed, you got grandfathered in. So maybe the set of Mac users who had never installed a font before this restriction was put in place is relatively small? I dunno. Otherwise, I can’t explain why Mac users aren’t complaining all over this and other KSOF threads for the past couple years. (And indeed, checking my Mac, that font-fingerprinting checker I linked to above can see my Japanese fonts I’d installed years back—but not KSOF.)

Anyway, end of rabbit-hole—since userscripts so often rely on local font tricks, I figured it was worth documenting what I found over the past several hours.

I wish I had an answer, besides “use free webfonts, not locally-installed fonts”, since It seems this is supposed to soon be the default behavior on Windows and other cross-platform browsers, too? But a heads-up that this will soon be trouble seems worthwhile… ¯_(ツ)_/¯

5 Likes

That was a wonderful story

1 Like

Interesting story. I wonder how it effects Item Inspector. I surmise that Safari lets you install the font. It just messes with the font detection call. But Item Inspector does not use this to detect the font. It writes some test text in a canvas twice.

  • Once with the stroke order font with a fallback font for use when the stroke order font is absent.
  • Once with the fallback font alone.

Item Inspector compares the size (in pixels) of the space occupied by the two texts in the canvas. If they are different then the stroke order font is present because different fonts were used. If the sizes are the same then the stroke order font is absent because the same font was used twice.

I also wonder. Can you hover over the items and reveal the popups in a iPad pro?

I haven’t seen screenshots so I’m not 100% sure which userscript is doing this:

Is this Item Inspector?

But also the Ultimate Timeline has hovers that work:

I’m totally befuddled as to why some hovers work perfectly and others don’t trigger at all.

Ah—I just realized I had Item Inspector disabled because I was tired of the KSOF warning, so both screenshots come from other sources. Turning it back on, I don’t see anything, but I’m still not sure what, exactly, I should hover on.

Try hovering over the items in the table. The top post of this thread has screenshots.

Do you or anyone you know have an in with the KSOF creator/maintainer? If it could get uploaded to a web font repository like Google Fonts, this issue would just go away…

1 Like

I don’t have have an in with the KSOF maintainer.

This page gives a procedure to install fonts without getting them through the App Store. It relies on an font installer app. Do you see any reason it wouldn’t work?

I use FontCase to install apps just fine—I’m using KSOF already in my notes app.

The issue is that while you can use them in local apps (even WebKit-based apps, like Electron-ported apps), you can’t use them in Safari/WebKit (or any other browser, I’d guess, since Apple doesn’t allow other webpage renderers on their devices, so Chrome, etc., are skins over the same WebKit as Safari).

1 Like