[Userscript]: Anime Context Sentences

ohhh, is that why? i live in the philippines u-u

Does this only work during lessons?

Edit: Found it, under the “show all”.

This can be done be editing Line 268 to

<audio ${!i && ['lesson', 'review'].includes(state.item.on) ? 'autoplay' : ''} src="${example.sound_url}"></audio>

Small usability criticism: I’m ashamed to say it took me many months to actually view the plugin settings and realize I could enable more works than just the default set. As a result I rarely got many useful examples from it. I would’ve found this plugin a lot more useful if it had defaulted either to enabling everything, or had at least forced me to choose the works I wanted when I first used it. I’m much more excited about using it now, thank you for creating this!

2 Likes

One small bug: I see on the vocabulary pages such as WaniKani / Vocabulary / 性äșș the English text is visible all the time by default and there is no way to fix this:

Edit: I think this is occurring because something in the WK stylesheet is forcing the text color to white. I was able to temporarily work around this issue by hacking the script to change the colors from ccc to fff:

        .anime-example-text .show-on-hover, .anime-example-text .show-on-click {
            background: #fff;
            color: #fff;
        }
4 Likes

The script is no longer working on vocabulary pages, the Item Info Injector script just published an update for them (Version 2.0), need to update to use it. [For Userscript Authors] WK Item Info Injector - #24 by Sinyaven

I tried to workaround this by editing the script to change this line:

// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1024045

to this:

// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1107823

But still doesn’t seem to be working. Now getting a different error:

function getLevel() {
    wkof.Apiv2.fetch_endpoint('level_progressions', options).then((response) => {
        state.userLevel = response.data[response.data.length - 1].data.level
    });
}

userscript.html?name=Wanikani%2520Anime%2520Sentences.user.js&id=f3683af5-2ae4-4403-aba5-735db3f279e0:1112 Uncaught (in promise)
ReferenceError: options is not defined
at getLevel (userscript.html?name=Wanikani%2520Anime%2520Sentences.user.js&id=f3683af5-2ae4-4403-aba5-735db3f279e0:1112:57)
at nrWrapper (äșșć·„:6:29851)

Seems like a separate issue.

You can fix it by replacing options with window.options ?? analyticsOptions. WaniKani has renamed this variable. But the audio icons have also changed. I will definitely update my pull request for this script but considering that the pull request is already pending for five months, I’m not sure if it will ever be accepted.

1 Like

Can confirm, with this fix (replacing options in fetch_endpoint(‘level_progressions’, options) with window.options ?? analyticsOptions) and the updated Item Info script, the script is working again.

The only remaining issue I see is the play button is rendering as a small rectangle.

1 Like

I have updated the pull request. I don’t know if the script author will accept it (or update the script on their own) anytime soon, so here is an installation link for the fixed version.

3 Likes

Hello!

Thank you so much for this script. It has been by far my favorite and it motivates me to use WaniKani everyday :smiley:

However, I was wondering if any more shows will be added to the list in the future? Personally Attack on Titan made me want to learn Japanese in the first place, and it would be awesome if it was part of the anime sentences roster. If this is too complicated to achieve or sucks too much time I totally understand otherwise! Thanks!

3 Likes

I’m sorry for being the nth person for whom it doesn’t work. I read through the thread and pre-emptively checked for the open framework, which I have and is loaded first:

image

As far as I understood, it should appear between context and composition:

When I load the vocabulary page and check the browser console, I get the following (to me cryptic) error:

image

Thanks for the help!

1 Like

This might be the fix for your problem.

Edit: this would be because, as the console says, ‘options’ is not defined. This is because, apparently, Wanikani has changed the name of that variable. See the comment I’ve quoted above and the comments that led to it.

3 Likes

Actually it was one of the first anime that I decided not to add because of certain violent and gore scenes. (There are mildly violent scenes in some other shows that have been added, especially drama).

2 Likes

v1.1.3 released. Massive thank you to @Sinyaven for adding support for the new lesson/review/extra study pages (Turbo) and fixing the options bug.

12 Likes

Thank you so much! I enjoy this script a lot and I was very upset when it was broken by this stupid recent update. Very glad that it works now! Really appreciate your effort!

I have edited the code to make filtering by words / Kanji, as well as by English, possible. Also, no limit (from 50) plus endless scroll – https://github.com/patarapolw/wanikani-userscript/raw/master/userscripts/anime-context.user.js

Now, searching for æŒ™ăŒă‚‹ becomes more accurate, via manually type æŒ™ăŒ as the filter.

Well, another reason I edit is to remove hard-coded filters, and add more filtering options (inside the script, at state.filter*).

5 Likes

Just want to point out a bug I’ve noticed (I believe it’s a new bug since the new update). So the script works fine when I do a single set of new lessons, but if I choose the “Continue with new lessons” button, then on the next set it will only load correctly on the first word, and then be stuck on loading the context for that first word for the rest of that set of words.

Here’s an image showing me being on the 4th new word, but the context sentences still showing context for the first word. If I go back to the dashboard between lessons then it isn’t an issue, so it’s not a big deal, just thought I would mention it.

2 Likes

Thanks for reporting. I will look into it this week.

1 Like

Hi @polv, filtering is awesome and infinite scroll is a great addition! If you’re okay with it, I would like to release these changes as an update?

2 Likes

OK, please do. After all, I don’t plan to maintain my edit although I might update for my purpose.