Not sure if this is an issue, but when you use path overrides for settings the elements in the settings dialogue still have IDs. I’m using identical layouts for two tabs of settings, and it makes sense for me to name the settings objects the same way when I’m using path overrides already. As such I get identical IDs on the settings in the two tabs.
Not an issue for me, I just noticed that there were two elements with the same ID.
edit:
Also noticed in Settings.js
that you used the Open the settings dialog.
comment twice where it does not belong.
//------------------------------
// Open the settings dialog.
//------------------------------
function save_settings(context) {
var script_id = (typeof context === 'string' ? context : context.cfg.script_id);
var settings = wkof.settings[script_id];
if (!settings) return Promise.resolve();
return wkof.file_cache.save('wkof.settings.'+script_id, settings);
}
//------------------------------
// Open the settings dialog.
//------------------------------
function load_settings(context, defaults) {
var script_id = (typeof context === 'string' ? context : context.cfg.script_id);
return wkof.file_cache.load('wkof.settings.'+script_id)
.then(finish, finish.bind(null,{}));
function finish(settings) {
if (defaults)
wkof.settings[script_id] = $.extend(true, {}, defaults, settings);
else
wkof.settings[script_id] = settings;
return wkof.settings[script_id];
}
}
edit2: Would it make sense for a button in the settings dialogue to send the dialogue object to the callback function? I want to change some settings once a button is pressed, then refresh, but for that I need the dialog object. I’ll find a way around it, but it would be neater to just get the dialog in the callback.
edit3: @rfindley I saw that you were here. I am having trouble getting dialog.refresh()
to work. I can get the dialog just fine, but whatever I do it doesn’t change anything. I am changing the data in wkof.settings.wanikani_heatmap
then calling the refresh method, but nothing changes. Any idea of what I’m doing wrong?
The settings don’t need to be saved before the user presses the save button, so if there’s some other way to make sure it saves when they do, then I can just change the dialog directly.
edit4: Ah. I see that you can’t have settings with the same names anyway because then the defaults won’t load. Guess I’ll prepend “lesson_” and “review_” to the setting names again.