Userscripts suddenly and repeatedly reverting to default settings?

I just restarted my computer and Chrome, but the timeline script and the fast abridged multiple/wrong answers script refuse to remember any modified settings as soon as I navigate to a different page.

How do I fix this?

1 Like

Sounds like settings either aren’t getting saved to localstorage, or localstorage is being cleared somehow.
If you open Dev console (F12), and are on the ‘console’ tab, do you receive any errors when saving settings?

1 Like

It says it saved, but before that it says “Cannot read property ‘startContainer’ of null”

 

Edit: Just realized you’re the person who made the abridged script, thanks so much for it! It’s actually maddening now, to see it say “DiD yOu kNoW tHeRE aRe oThER AnSwERs?” instead of just… showing me those answers, haha.

Sounding like a database issue.

I’m just assuming you’re using Chrome, as its what I use. Not entirely sure where in F12 this sits in IE/Edge/Firefox, but, do you find something similar:

Maybe @rfindley has some good insight. I seem to remember someone having an issue with a script recently that required clearing the db? I hate to jump to offering that advice if its not needed though.

Open Framework stores its settings in indexedDB. I haven’t seen Chrome have any problems with it yet, but there’s always a first time for everything.

If you look in the Application tab of the Dev Tools (by pressing F12), you’ll see indexedDB in the left tab, and should be able to browse the “files” in the database. If there’s anything wrong (like, you can’t see any content in the database, or it reports an error), you could try deleting the database (there’s a button for that) and refresh the page.

@DaisukeJigen @rfindley

Well, I deleted the database, but instead of a new one being created, it seems I’m just running without one at all now? (I did refresh the page)

I guess for the time being, maybe I can alter the values I want changed in the TamperMonkey interface.

Sometimes Chrome’s database info in the Dev Tools doesn’t refresh properly (in my experience, anyway).

You can see whats in the cache by typing the following in the Javascript console:

wkof.file_cache.dir

then explore the result.
Your settings (for all wkof-based scripts) should be located at:

wkof.settings

And you can try manually loading/saving settings by:

wkof.Settings.load('timeline');
wkof.Settings.save('timeline');

I only describe all of this for troubleshooting purposes if you want to explore a bit.

I’m game for poking around a bit to solve this, I just don’t know how to interpret anything here :frowning:

I took a look at the Abridged script to see if I could hard-code the settings I wanted, when I noticed a lot of error flags. There are even errors in WK Open Framework (which is #1 at the top of the load order):

Is that… normal?

After typing wkof.file_cache.dir, you can click on the expand arrow to see the list of files (which includes settings) that wkof has stored in indexedDB.

The warnings you’re seeing in your screenshot are normal. TamperMonkey uses a code analysis tool to point out things that could be signs of an error, but a lot of the warnings are triggered by coding styles that differ from their assumed style. (like adding { } where it’s not required).

Try turning off Timeline, refresh the page, and confirm that wkof.settings.timeline doesn’t return any settings. Then enter wkof.Settings.load('timeline') in the Javascript console, and check again if wkof.settings.timeline returns some settings (you’ll want to click on the expansion arrow on the returned results to see the actual settings… assuming it does return something). If it does, then loading is working, so next we’d check saving by making a change to the settings.

Do you happen to be running the Rikaikun Chrome extension or anything? Not sure what that rikaicontent.js is.
@rfindley WKOF use it somewhere down the line? Not seeing it in my list of sources anywhere.

No, wkof only makes calls to WK’s copy of jquery… no other 3rd-party stuff.

I’m having this exact same problem, whenever I change a setting in any user script I can see the changes applied, but whenever I refresh or open a new wanikani tab the settings are back to default.

After finding this thread I have gone through the suggestions made, have inspected for errors, tried deleting the database…but with no success.

In the Chrome console I can see the files associated with each script under IndexedDB / wkof.file_cache, and I’ve checked that after making a change in a particular setting, the corresponding entry is being updated.

So the problem seem to be that the scripts are not using those values when loading the website, although I don’t get any error in the Console related to that (just one about gravatar…)

@Kai_973 Where you able to solve this problem? Or does someone have an idea or what else could I try?

IIRC the problem went away after a day or two, but I don’t remember if it was because of anything I did, or if Tampermonkey or my browser just needed an update, or if restarting my computer did it… :confused:

I think if I’d solved it through something I did, I would’ve mentioned it here. Sorry :frowning:

No problem, thank you for replying :slight_smile: As a workaround, I’ve found that since the changes I make are stored, I can just open the different Settings menus and “Save” them each time I open the website for them to be applied.

1 Like