From 7f48c3e97cf0a493c8b85ca1b083a48fc0e5c5f2 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 4 Sep 2020 11:20:51 -0700 Subject: [PATCH] Add css/js classes entry_with_history, _with_tagname_replacements. --- frontends/etiquette_flask/static/js/common.js | 12 ++++++++++++ .../etiquette_flask/static/js/tag_autocomplete.js | 12 ++++++++++++ frontends/etiquette_flask/templates/clipboard.html | 6 ++---- frontends/etiquette_flask/templates/photo.html | 4 +--- frontends/etiquette_flask/templates/search.html | 6 +----- frontends/etiquette_flask/templates/tags.html | 4 +--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/frontends/etiquette_flask/static/js/common.js b/frontends/etiquette_flask/static/js/common.js index 9f425d7..8226200 100644 --- a/frontends/etiquette_flask/static/js/common.js +++ b/frontends/etiquette_flask/static/js/common.js @@ -321,6 +321,17 @@ function init_enable_on_pageload() } } +common.init_entry_with_history = +function init_entry_with_history() +{ + const inputs = Array.from(document.getElementsByClassName("entry_with_history")); + for (const input of inputs) + { + input.addEventListener("keyup", common.entry_with_history_hook); + input.classList.remove("entry_with_history"); + } +} + common.init_tabbed_container = function init_tabbed_container() { @@ -395,6 +406,7 @@ function on_pageload() common.init_atag_merge_params(); common.init_button_with_confirm(); common.init_enable_on_pageload(); + common.init_entry_with_history(); common.init_tabbed_container(); } document.addEventListener("DOMContentLoaded", common.on_pageload); diff --git a/frontends/etiquette_flask/static/js/tag_autocomplete.js b/frontends/etiquette_flask/static/js/tag_autocomplete.js index 29b61e9..9b7a6cd 100644 --- a/frontends/etiquette_flask/static/js/tag_autocomplete.js +++ b/frontends/etiquette_flask/static/js/tag_autocomplete.js @@ -64,6 +64,17 @@ function entry_with_tagname_replacements_hook(event) } } +tag_autocomplete.init_entry_with_tagname_replacements = +function init_entry_with_tagname_replacements() +{ + const inputs = Array.from(document.getElementsByClassName("entry_with_tagname_replacements")); + for (const input of inputs) + { + input.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook); + input.classList.remove("entry_with_tagname_replacements"); + } +} + tag_autocomplete.resolve = function resolve(tagname) { @@ -111,5 +122,6 @@ tag_autocomplete.on_pageload = function on_pageload() { tag_autocomplete.update_tagset(); + tag_autocomplete.init_entry_with_tagname_replacements(); } document.addEventListener("DOMContentLoaded", tag_autocomplete.on_pageload); diff --git a/frontends/etiquette_flask/templates/clipboard.html b/frontends/etiquette_flask/templates/clipboard.html index 8a2ac7a..62ac71b 100644 --- a/frontends/etiquette_flask/templates/clipboard.html +++ b/frontends/etiquette_flask/templates/clipboard.html @@ -108,12 +108,12 @@