summaryrefslogtreecommitdiff
path: root/html/display-panel.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/display-panel.js')
-rw-r--r--html/display-panel.js28
1 files changed, 6 insertions, 22 deletions
diff --git a/html/display-panel.js b/html/display-panel.js
index 623ff36..84c922f 100644
--- a/html/display-panel.js
+++ b/html/display-panel.js
@@ -21,7 +21,6 @@
* IMPORT TYPE_PREFIX
* IMPORT nice_name
* IMPORT open_in_settings
- * IMPORT url_matches
* IMPORT each_url_pattern
* IMPORT by_id
* IMPORT clone_template
@@ -114,36 +113,21 @@ function add_pattern_to_list(pattern)
return template;
}
-function ensure_pattern_exists(pattern)
-{
- let entry_object = known_patterns.get(pattern);
- /*
- * As long as pattern computation works well, we should never get into this
- * conditional block. This is just a safety measure. To be removed as part
- * of a bigger rework when we start taking iframes into account.
- */
- if (entry_object === undefined) {
- console.log(`unknown pattern: ${pattern}`);
- entry_object = add_pattern_to_list(pattern);
- }
-
- return entry_object;
-}
-
function style_possible_pattern_entry(pattern, exists_in_settings)
{
const [text, class_action] = exists_in_settings ?
["Edit", "add"] : ["Add", "remove"];
- const entry_object = ensure_pattern_exists(pattern);
+ const entry_object = known_patterns.get(pattern);
- entry_object.button.textContent = `${text} setting`;
- entry_object.entry.classList[class_action]("matched_pattern");
+ if (entry_object) {
+ entry_object.button.textContent = `${text} setting`;
+ entry_object.entry.classList[class_action]("matched_pattern");
+ }
}
function handle_page_change(change)
{
- if (url_matches(tab_url, change.item))
- style_possible_pattern_entry(change.item, change.new_val !== undefined);
+ style_possible_pattern_entry(change.item, change.new_val !== undefined);
}
function populate_possible_patterns_list(url)