[Userscript] Media Context Sentences (formerly Anime Context Sentences 2)

That definitely sounds like something is doing too much work on the main thread. When I get time, I’ll look into seeing if I missed anything important that can be converted to asynchronous behavior. Though, I’m sorry I probably won’t be able to give any sort of useful time estimate for that.

No worries and take your time! I appreciate the help :slight_smile:

I tested this out on my windows laptop (with better specs) and it doesn’t lag at all. It’s also worth to note that I disabled some sources like drama and a few animes I don’t like, and set an example limit to 5. Maybe I can try that setting on my macbook and see if it still causes lags.

Is there like a database with all these sentences I can have a look at to study?

I think it is this:
https://www.immersionkit.com/dictionary

Not sure if people still actively use this, but I am the developer and maintainer of the api. The current version of the api will be decommissioned by August. The new version is hosted at the v2 endpoint with breaking changes.

I am getting this error on some pages. How do I fix it?

Hey, so that’s just how it indicates that you haven’t enabled that particular entry in the settings and there are no other sentences available.
I realize it’s not particularly pretty, but I figured it’s better than not realizing there are possible sentences that you (the user) haven’t enabled.
In this case, it looks like it’s 純真.

If you encounter that again and have trouble with the names, you can try enabling debugging in the script via the console:

Object.assign(wkof.settings['media-context-sentences'], {debugging: true});
wkof.Settings.save('media-context-sentences');

It should output both the English and Japanese names for those that have both (though it will also make it so that if there’s even a single entry that is available but hidden, it’ll show that info instead, so I wouldn’t recommend keeping it on permanently). To turn it back off, just change the true to false.

Nice! I love the addition of other media. Where does it get the clips/transcriptions from? I ask because I’ve been looking for Japanese subtitles/transcripts for some of these dramas.

Immersion Kit, which you can also find referenced at the bottom the settings panel.
I’m pretty sure they were made with subs2srs, but other than that, I have no more specific knowledge. This userscript simply embeds the content accessed via their API and adds some additional filtering and settings.

Thank you!

Not sure if I’m the only one with the ‘problem’ or if it even is a problem. I can play the audio for the example sentences only once. I could’ve sworn it was possible to listen to it more than once in the past.

I tried to replicate the issue in both Firefox and Edge, but I don’t have any problems.
Do you have any further information you can provide?

First of all, thank you for the quick response!

I’m using Firefox on both Windows 11 and my Linux laptop, and the issue occurs on both devices. However, I just tested it in Chrome, and it works as expected there. Since I’m using the same userscripts on both browsers, I’m not sure what might be causing the problem.

What additional information would be helpful? I’ve already tried reinstalling it in Firefox, but it didn’t solve it. Could there be an option I overlooked or accidentally enabled that might explain this behavior?

Honestly, I don’t know. Not only would it be difficult to isolate your particular issue without me being able to replicate it, but I also haven’t gotten around to finishing (and thus publishing) the latest updates which include moving to Immersion Kit’s new API version, and let’s just say I feel like I refactored everything :face_with_crossed_out_eyes:.

It’s possible I’ve already fixed whatever issue was causing your audio problem, but the current state of the unpublished script has other problems preventing it from working properly, so my unfortunate suggestion would be to either wait until I get around to finishing that or try using Chrome for a while if you need that feature.

Thanks for this!

I noticed that it is returning incorrect results under 放れる。It’s giving results for 離れる instead.

Thanks for the report, although this is something you’ll probably need to take up with the authors of Immersion Kit, since this script queries data using their API.

You can see how it comes up with the same problem when searching directly on their site as well.
Immersion Kit Dictionary search for 放れる

And unfortunately, using Exact Match and/or Exact Search don’t appear to be able to fix it in this case, for various reasons.

The search engine has changed, and it doesn’t seem to handle certain queries that well.

It’s still possible to find results with an exact search if you remove the final character.

Thank you for your work on this script!

It’s by no means a deal breaker, but I have the exact same symptoms as EroKy. Win10, Firefox. Works as expected in Chrome.

I know you’ve said you refactored everything, but just thought I’d throw my report in as well.

I’ll go ahead and tag @EroKy in this as well, since they mentioned having the Firefox issue as well.

So, you might be happy to hear that I’ve been working profusely on finishing up the necessary changes for version 2 of the Immersion Kit API.

Along with that comes a variety of other enhancements (including caching, and a few more options) and stability checks.

However, I should note that as of the time of writing, the “literature” and “news” decks cannot be queried by the APIv2. Therefore, I have spent a good bit of time to add a configurable setting to choose which API version to use (accessible via Settings > General > Advanced Options > Immersion Kit API Version).

One of the reasons I’ve put off pushing the update to everyone at this point is because there are a lot of breaking changes, which (long story short) among other things means that your settings will be reset.

If none of the above deters you, you can check out the latest version (that hasn’t been pushed to GreasyFork) at my GitHub - WaniKaniMediaContextSentences.user.js.

Edit:

  • 4.0.1: Quick fix to allow the sentences to once again change appropriately during regular browsing.
  • 4.0.3: Another quick fix to get the audio icons to update as expected again (and it probably fixed some other rare related issues).
  • 4.0.4: Fix for settings migration from old versions and minor improvements to URL query generation.