diff options
author | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-14 18:57:51 +0200 |
---|---|---|
committer | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-14 18:57:51 +0200 |
commit | 0c362e6c713b29680d83f8bbdca190540cbc9424 (patch) | |
tree | 4c10e3c3f313ff60bc86f7c41bd8b5f3f2bc5c8c | |
parent | 68d557db3eb0c050ff0027429922202ef97c1fe1 (diff) | |
download | browser-extension-0c362e6c713b29680d83f8bbdca190540cbc9424.tar.gz browser-extension-0c362e6c713b29680d83f8bbdca190540cbc9424.zip |
react to few bugs
-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); } } |