diff options
-rw-r--r-- | TODOS.org | 2 | ||||
-rw-r--r-- | html/options_main.js | 14 |
2 files changed, 7 insertions, 9 deletions
@@ -39,6 +39,8 @@ TODO: - all solutions to modularize js code SUCK; come up with own simple DSL to manage imports/exports - perform never-ending refactoring of already-written code +- when redirecting to target, make it possible to smartly recognize + and remove previous added target DONE: - make it possible to use wildcard urls in settings -- DONE 2021-05-14 diff --git a/html/options_main.js b/html/options_main.js index f201023..fff0c82 100644 --- a/html/options_main.js +++ b/html/options_main.js @@ -141,9 +141,8 @@ /* Used to reset edited page. */ function reset_work_page_li(ul, item, settings) { - ul.work_name_input.value = item; - if (settings === undefined) - settings = {allow: false, components: undefined}; + ul.work_name_input.value = maybe_string(item); + settings = settings || {allow: false, components: undefined}; page_allow_chbx.checked = !!settings.allow; set_page_components(settings.components); @@ -196,12 +195,9 @@ /* Used to reset edited bag. */ function reset_work_bag_li(ul, item, components) { - if (item === undefined) { - item = ""; - components = []; - }; + components = components || []; - ul.work_name_input.value = item; + ul.work_name_input.value = maybe_string(item); let old_components_ul = bag_components_ul; bag_components_ul = old_components_ul.cloneNode(false); @@ -510,7 +506,7 @@ for (let [components_ul, id_creator] of uls_creators) { let li = by_id(id_creator(change.prefix, change.item)); - components_ul.remove_child(li); + components_ul.removeChild(li); } } |