Add css/js classes entry_with_history, _with_tagname_replacements.
This commit is contained in:
parent
295c9b4956
commit
7f48c3e97c
6 changed files with 29 additions and 15 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -108,12 +108,12 @@
|
|||
<div id="right">
|
||||
<div id="toolbox">
|
||||
<div id="add_tag_area">
|
||||
<input type="text" id="add_tag_textbox" list="tag_autocomplete_datalist">
|
||||
<input type="text" id="add_tag_textbox" class="entry_with_history entry_with_tagname_replacements" list="tag_autocomplete_datalist">
|
||||
<button class="add_tag_button green_button" id="add_tag_button" onclick="return add_tag_form();">Add tag</button>
|
||||
</div>
|
||||
|
||||
<div id="remove_tag_area">
|
||||
<input type="text" id="remove_tag_textbox" list="tag_autocomplete_datalist">
|
||||
<input type="text" id="remove_tag_textbox" class="entry_with_history entry_with_tagname_replacements" list="tag_autocomplete_datalist">
|
||||
<button class="red_button" id="remove_tag_button" onclick="return remove_tag_form();">Remove tag</button>
|
||||
</div>
|
||||
|
||||
|
@ -145,12 +145,10 @@ var holder = document.getElementById("photo_card_holder");
|
|||
|
||||
var add_box = document.getElementById("add_tag_textbox");
|
||||
var add_button = document.getElementById("add_tag_button");
|
||||
add_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||
common.bind_box_to_button(add_box, add_button);
|
||||
|
||||
var remove_box = document.getElementById("remove_tag_textbox");
|
||||
var remove_button = document.getElementById("remove_tag_button");
|
||||
remove_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||
common.bind_box_to_button(remove_box, remove_button);
|
||||
|
||||
function recalculate_needed()
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<h4>Tags</h4>
|
||||
<ul id="this_tags">
|
||||
<li>
|
||||
<input id="add_tag_textbox" type="text" list="tag_autocomplete_datalist" autofocus>
|
||||
<input type="text" id="add_tag_textbox" class="entry_with_history entry_with_tagname_replacements" list="tag_autocomplete_datalist" autofocus>
|
||||
<button id="add_tag_button" class="green_button" onclick="return add_photo_tag_form();">add</button>
|
||||
</li>
|
||||
{% set tags = photo.get_tags()|sort_tags %}
|
||||
|
@ -275,8 +275,6 @@ var PHOTO_ID = "{{photo.id}}";
|
|||
|
||||
var add_tag_box = document.getElementById('add_tag_textbox');
|
||||
var add_tag_button = document.getElementById('add_tag_button');
|
||||
add_tag_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||
add_tag_box.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook);
|
||||
common.bind_box_to_button(add_tag_box, add_tag_button, false);
|
||||
|
||||
var message_area = document.getElementById('message_area');
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<li><input id="search_builder_{{tagtype}}_input" type="text" list="tag_autocomplete_datalist"></li>
|
||||
<li><input id="search_builder_{{tagtype}}_input" class="entry_with_tagname_replacements" type="text" list="tag_autocomplete_datalist"></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -672,18 +672,14 @@ var inputted_forbids = [];
|
|||
|
||||
document.getElementById("search_go_button");
|
||||
input_musts.addEventListener("keyup", tag_input_hook_musts);
|
||||
input_musts.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook);
|
||||
common.bind_box_to_button(input_musts, search_go_button, true);
|
||||
|
||||
input_mays.addEventListener("keyup", tag_input_hook_mays);
|
||||
input_mays.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook);
|
||||
common.bind_box_to_button(input_mays, search_go_button, true);
|
||||
|
||||
input_forbids.addEventListener("keyup", tag_input_hook_forbids);
|
||||
input_forbids.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook);
|
||||
common.bind_box_to_button(input_forbids, search_go_button, true);
|
||||
|
||||
|
||||
common.bind_box_to_button(input_expression, search_go_button);
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -97,7 +97,7 @@ h2, h3
|
|||
<div id="content_body" class="sticky_side_right">
|
||||
<div id="right">
|
||||
<div id="editor_area">
|
||||
<input type="text" id="add_tag_textbox" autofocus>
|
||||
<input type="text" id="add_tag_textbox" class="entry_with_history entry_with_tagname_replacements" autofocus>
|
||||
<button class="add_tag_button green_button" id="add_tag_button" onclick="return easybake_form();">bake</button>
|
||||
</div>
|
||||
<div id="message_area">
|
||||
|
@ -230,8 +230,6 @@ h2, h3
|
|||
var add_tag_textbox = document.getElementById('add_tag_textbox');
|
||||
var add_tag_button = document.getElementById('add_tag_button');
|
||||
var message_area = document.getElementById('message_area');
|
||||
add_tag_textbox.addEventListener("keyup", common.entry_with_history_hook);
|
||||
add_tag_textbox.addEventListener("keyup", tag_autocomplete.entry_with_tagname_replacements_hook);
|
||||
common.bind_box_to_button(add_tag_textbox, add_tag_button, false);
|
||||
|
||||
function easybake_form()
|
||||
|
|
Loading…
Reference in a new issue