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