diff --git a/background-script.js b/background-script.js index 955f5c2..e79b456 100644 --- a/background-script.js +++ b/background-script.js @@ -84,7 +84,7 @@ async function get_storage_or_default(name, fallback) async function refresh_json() { let custom_dicts = (await get_storage_or_default("custom_dicts", [])); - json_dicts = []; + let new_json_dicts = []; for(let stored_dict of custom_dicts) { if(!stored_dict.enabled) @@ -103,8 +103,9 @@ async function refresh_json() add_json_spelling(dict, spelling, i); } } catch(e){} - json_dicts.push(dict); + new_json_dicts.push(dict); } + json_dicts = new_json_dicts; } async function migrate_legacy_then_refresh() diff --git a/json_config.html b/json_config.html index 1e5ea6e..7f96346 100644 --- a/json_config.html +++ b/json_config.html @@ -22,34 +22,104 @@ option.disabled div.buttons { display:flex; - width: 200px; + width: 300px; flex-direction: row; flex-wrap: wrap; justify-content: center; } div.buttons * { - width: 33%; + width: 33.3%; +} +div.buttons button.double +{ + width: 50%; } #delete { margin-top: 20px; } +div.closed +{ + display: none; +}
- - +
+Format (copy-paste-able):
+[
+ {
+ "r": "つるぎ",
+ "s": [
+ ""
+ ],
+ "l": [
+ "line one of a definition",
+ "line two of a definition",
+ "etc",
+ "last line of a definition"
+ ]
+ },
+ {
+ "r": "こだいしゅ",
+ "s": [
+ "古代種",
+ "古代しゅ"
+ ],
+ "l": [
+ "the ancients"
+ ]
+ }
+]
+Format (with comments, which break JSON parsing):
+[
+ { // entry one
+ "r": "つるぎ",
+ "s": [
+ "" // entries with no "spellings" still have a single, blank spelling
+ ], // comma
+ "l": [
+ "line one of a definition",
+ "line two of a definition",
+ "etc",
+ "last line of a definition" // no comma
+ ]
+ }, // comma
+ { // entry two
+ "r": "こだいしゅ",
+ "s": [
+ "古代種",
+ "古代しゅ" // no comma
+ ], // comma
+ "l": [
+ "the ancients" // no comma
+ ]
+ } // last entry, so no comma
+]
+
+