[Obsolete] WaniKani DotDotDot Expander (see last post for new thread)


#1
expand *... english text to full length
https://greasyfork.org/scripts/5584-wanikani-dotdotdot-expander



Must-have scripts/extensions/apps for beginner
The New And Improved List Of API and Third Party Apps
[Userscript] Burn Manager (Review / Resurrect / Retire)
#2

Nifty!


#3

And why doesn’t WK have this by default?


#4

LOL, glad I waited… I was just about to write a similar script. :slight_smile:

EDIT:  Are you interested in also doing the Kanji, not just vocab?  E.g. 'Younger Br…'
Since the Kanji are in tiles instead of rows, I was going to use tooltips (e.g. <li title=“Younger Brother”> ), so hovering would bring up the full meaning.


#5

I have posted a new version.
It should now add tooltips for kanji and radical tiles.


#6
kobayashi said... I have posted a new version.
It should now add tooltips for kanji and radical tiles.
Tested on Chrome.... Looks great!


#7

Indispensable!


#8

Guys, I feel like this is a stupid question - but chrome won’t let me install it. I get a message saying ‘Apps, extensions and user scripts cannot be added from this website’ and some really perfunctory google-fu tells me that you can no longer add scripts from outside of the chrome app-store (or whatever it’s called)??

What am I doing wrong?

Thank you.


#9

Chalky, instead of clicking “Install this script,” try this:

- Right click on “Install this script” and select “Save Link As…”
- Save the .js file where you can find it again
- In the Chrome address bar, go to chrome://extensions
- Drag and drop the user script you saved onto the window

It should ask you for confirmation and then you’ll be good to go!


#10

Breadstickninja, thank you so much for that! Really appreciate you taking the time to spell out the steps for me. Working brilliantly! 
All the best.


#11

I’m a bit concerned about this script.
A cursory glance at this script looks like this script doesn’t dynamically expand the items on the fly.
So if the list changes the script won’t work properly or only work on some of the items.
Like if there’s more levels or new items added.

Any insights?


#12
aragonsr said...I'm a bit concerned about this script.
A cursory glance at this script looks like this script doesn't dynamically expand the items on the fly.
So if the list changes the script won't work properly or only work on some of the items.
Like if there's more levels or new items added.

Any insights?
Side note...   It seems WaniKani has removed the "..." from vocabulary, except in search results.
But they didn't add the hover tooltips to radicals and kanji like this script does.

#13
aragonsr said... I'm a bit concerned about this script.
A cursory glance at this script looks like this script doesn't dynamically expand the items on the fly.
So if the list changes the script won't work properly or only work on some of the items.
Like if there's more levels or new items added.

Any insights?
 Just updated it.
~10 items had changed since my last update ~7-months ago.

The possibility (certainty) of changing items is indeed an issue with this script.
It requires database updates.

If new items are added or old items are changed it will not work on those items.
It expands items only if both the Japanese full-text and the English partial-text match the database, so it has with previous WK-content updates only very rarely displayed incorrect expansion.
Usually it will just not work for new items or changes and leave their ...'s alone.

rfindley said...Side note...   It seems WaniKani has removed the "..." from vocabulary, except in search results.
But they didn't add the hover tooltips to radicals and kanji like this script does.
That's nice.
I just checked and that does seem to be the case.
Now if they could remove the ...'s on search results and maybe add those tooltips, this script would no longer be needed.
If they really want ...'s for small screens, maybe they could use CSS 'text-overflow: ellipsis' to trim locally.


#14
kobayashi said...If they really want ...'s for small screens, maybe they could use CSS 'text-overflow: ellipsis' to trim locally.
 That would be nice!

#15

As of a week or so ago, I started seeing ‘…’ again on /level/ pages and /vocabulary pages (such as the L1-10 vocabulary page).

Adding some logging to the dot dot expander script (via tampermonkey, if that matters) suggests that the contents of ‘item’ (such as in dotExpandMulti) aren’t matching anything in the dotItem list (or hash, or whatever you call them in JS).

I tried adding an entry to dotItem (which apparently wasn’t already in the list) where I copied/pasted the kanji from the /vocabulary page, but some logging showed that, despite being an entry that matched the … regex, the dotItem[item] was returning something undefined. (Or, at least, ‘undefined’ is what was being logged.)

Specifically…

I added this line to the top of dotItem:
‘下さい’ : ‘Please Give Me’,

Then added some logging to dotExpandMulti:

       if (en.match('[\\.]{3}$')) {   //Added it inside this block
        ...
        item = $(elem).find('span').html();
        console.log('current item: ' + item);  //added line
        ...
        enFull = dotItem[item];
        console.log('enFull: ' + enFull);  //another added line

So, when I refresh the page and look at the console, I see:
current item:
下さい
enFull: undefined

When I reload the L1-10 vocabulary page, there’s 110 or so entries just like this. enFull is always ‘undefined.’ Now that I think about it, I didn’t actually check to see if the entries that appear to have a ‘…’ on the page are in dotItem or not. (I suppose that changes to WK’s vocabulary may introduce undefined entries as well…although that wouldn’t explain why 下さい’s enFull is undefined, as far as I know.)

You’ll have to forgive me if I’m talking about this incorrectly – I’m no programmer…or so I’m told. (But seriously, I’ve done very little with JS and the like.)

Anyhow, my uninformed conjecture is ‘unicode problem.’ If I’m not mistaken, I started seeing this when the fix to the “one review” bug was rolled out last week.


#16

@stevebrown0804,
Notice 下さい is down on the next line in your console output. It looks like you’re picking up a newline character when calling html(), so item is probably ‘\n下さい’ instead of ‘下さい’, and it’s not finding it in dotItem. You’d need to trim any whitespace and newline characters.

For starters, I’d use text() instead of html(), then filter item:

item = $(elem).find('span').text().replace(/[\n ]+/g,'');

#17

Hello,

Does this script still work? I installed it but nothing changed.


#18

I’m guessing it’s related to @stevebrown0804’s reported problem a few posts up. I don’t think the script’s owner integrated the changes.

If I get some time later, I’ll see if I can patch it and rehost.


#19

Ah ok, thanks. Yeah, on the chrome extension page it says it may be corrupted.


#20

Chrome extension page?
A lot of scripts don’t work without a script host plugin like TamperMonkey. I don’t know if this is one of them. I’ve personally never learned what features are different in order to support installation directly as a browser extensions.