Add namespacing to common.js.
This commit is contained in:
parent
cf9b6d0725
commit
c7cce5a4e5
13 changed files with 64 additions and 51 deletions
|
@ -9,7 +9,7 @@ function on_pageload()
|
||||||
create_child_title_entry = document.getElementById("create_child_title_entry");
|
create_child_title_entry = document.getElementById("create_child_title_entry");
|
||||||
create_child_submit_button = document.getElementById("create_child_submit_button");
|
create_child_submit_button = document.getElementById("create_child_submit_button");
|
||||||
create_child_cancel_button = document.getElementById("create_child_cancel_button");
|
create_child_cancel_button = document.getElementById("create_child_cancel_button");
|
||||||
bind_box_to_button(create_child_title_entry, create_child_submit_button);
|
common.bind_box_to_button(create_child_title_entry, create_child_submit_button);
|
||||||
}
|
}
|
||||||
document.addEventListener("DOMContentLoaded", on_pageload);
|
document.addEventListener("DOMContentLoaded", on_pageload);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ function create_album_and_follow(title, parent)
|
||||||
console.log(response);
|
console.log(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post(url, data, receive_callback);
|
common.post(url, data, receive_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit_create_child(event)
|
function submit_create_child(event)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
var INPUT_TYPES = new Set(["INPUT", "TEXTAREA"]);
|
var common = {};
|
||||||
|
|
||||||
|
common.INPUT_TYPES = new Set(["INPUT", "TEXTAREA"]);
|
||||||
|
|
||||||
|
common.create_message_bubble =
|
||||||
function create_message_bubble(message_area, message_positivity, message_text, lifespan)
|
function create_message_bubble(message_area, message_positivity, message_text, lifespan)
|
||||||
{
|
{
|
||||||
if (lifespan === undefined)
|
if (lifespan === undefined)
|
||||||
|
@ -15,6 +18,7 @@ function create_message_bubble(message_area, message_positivity, message_text, l
|
||||||
setTimeout(function(){message_area.removeChild(message);}, lifespan);
|
setTimeout(function(){message_area.removeChild(message);}, lifespan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common._request =
|
||||||
function _request(method, url, callback)
|
function _request(method, url, callback)
|
||||||
{
|
{
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
@ -39,17 +43,22 @@ function _request(method, url, callback)
|
||||||
request.open(method, url, asynchronous);
|
request.open(method, url, asynchronous);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.get =
|
||||||
function get(url, callback)
|
function get(url, callback)
|
||||||
{
|
{
|
||||||
request = _request("GET", url, callback);
|
request = common._request("GET", url, callback);
|
||||||
request.send();
|
request.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.post =
|
||||||
function post(url, data, callback)
|
function post(url, data, callback)
|
||||||
{
|
{
|
||||||
request = _request("POST", url, callback);
|
request = common._request("POST", url, callback);
|
||||||
request.send(data);
|
request.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.delete_all_children =
|
||||||
function delete_all_children(element)
|
function delete_all_children(element)
|
||||||
{
|
{
|
||||||
while (element.firstChild)
|
while (element.firstChild)
|
||||||
|
@ -58,6 +67,7 @@ function delete_all_children(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.bind_box_to_button =
|
||||||
function bind_box_to_button(box, button, ctrl_enter)
|
function bind_box_to_button(box, button, ctrl_enter)
|
||||||
{
|
{
|
||||||
// Thanks Yaroslav Yakovlev
|
// Thanks Yaroslav Yakovlev
|
||||||
|
@ -77,6 +87,7 @@ function bind_box_to_button(box, button, ctrl_enter)
|
||||||
box.addEventListener("keyup", bound_box_hook);
|
box.addEventListener("keyup", bound_box_hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.entry_with_history_hook =
|
||||||
function entry_with_history_hook(event)
|
function entry_with_history_hook(event)
|
||||||
{
|
{
|
||||||
//console.log(event);
|
//console.log(event);
|
||||||
|
@ -115,6 +126,7 @@ function entry_with_history_hook(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.html_to_element =
|
||||||
function html_to_element(html)
|
function html_to_element(html)
|
||||||
{
|
{
|
||||||
var template = document.createElement("template");
|
var template = document.createElement("template");
|
||||||
|
@ -122,6 +134,7 @@ function html_to_element(html)
|
||||||
return template.content.firstChild;
|
return template.content.firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.normalize_tagname =
|
||||||
function normalize_tagname(tagname)
|
function normalize_tagname(tagname)
|
||||||
{
|
{
|
||||||
tagname = tagname.trim();
|
tagname = tagname.trim();
|
||||||
|
|
|
@ -225,11 +225,11 @@ function Editor(elements, on_open, on_save, on_cancel)
|
||||||
var edit_element = this.edit_elements[index];
|
var edit_element = this.edit_elements[index];
|
||||||
if (edit_element.tagName == "TEXTAREA")
|
if (edit_element.tagName == "TEXTAREA")
|
||||||
{
|
{
|
||||||
bind_box_to_button(edit_element, this.save_button, true);
|
common.bind_box_to_button(edit_element, this.save_button, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bind_box_to_button(edit_element, this.save_button, false);
|
common.bind_box_to_button(edit_element, this.save_button, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function should_prevent_hotkey(event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return INPUT_TYPES.has(event.target.tagName);
|
return common.INPUT_TYPES.has(event.target.tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ function update_clipboard_tray()
|
||||||
var tray_lines = document.getElementById("clipboard_tray_lines");
|
var tray_lines = document.getElementById("clipboard_tray_lines");
|
||||||
if (!clipboard_tray.classList.contains("hidden"))
|
if (!clipboard_tray.classList.contains("hidden"))
|
||||||
{
|
{
|
||||||
delete_all_children(tray_lines);
|
common.delete_all_children(tray_lines);
|
||||||
var photo_ids = Array.from(photo_clipboard);
|
var photo_ids = Array.from(photo_clipboard);
|
||||||
photo_ids.sort();
|
photo_ids.sort();
|
||||||
for (var i = 0; i < photo_ids.length; i += 1)
|
for (var i = 0; i < photo_ids.length; i += 1)
|
||||||
|
|
|
@ -15,7 +15,7 @@ function init_datalist()
|
||||||
document.body.appendChild(datalist);
|
document.body.appendChild(datalist);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_all_children(datalist);
|
common.delete_all_children(datalist);
|
||||||
for (var index = 0; index < tag_autocomplete.tagset["tags"].length; index += 1)
|
for (var index = 0; index < tag_autocomplete.tagset["tags"].length; index += 1)
|
||||||
{
|
{
|
||||||
var option = document.createElement("option");
|
var option = document.createElement("option");
|
||||||
|
@ -33,7 +33,7 @@ function init_datalist()
|
||||||
tag_autocomplete.resolve =
|
tag_autocomplete.resolve =
|
||||||
function resolve(tagname)
|
function resolve(tagname)
|
||||||
{
|
{
|
||||||
tagname = normalize_tagname(tagname);
|
tagname = common.normalize_tagname(tagname);
|
||||||
if (tag_autocomplete.tagset["tags"].indexOf(tagname) != -1)
|
if (tag_autocomplete.tagset["tags"].indexOf(tagname) != -1)
|
||||||
{
|
{
|
||||||
return tagname;
|
return tagname;
|
||||||
|
@ -69,7 +69,7 @@ function update_tagset()
|
||||||
{
|
{
|
||||||
console.log("Updating known tagset.");
|
console.log("Updating known tagset.");
|
||||||
var url = "/all_tags.json";
|
var url = "/all_tags.json";
|
||||||
get(url, tag_autocomplete.update_tagset_callback);
|
common.get(url, tag_autocomplete.update_tagset_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_pageload()
|
function on_pageload()
|
||||||
|
|
|
@ -145,7 +145,7 @@ function _paste_unpaste_photo_clipboard(add_or_remove)
|
||||||
save_photo_clipboard();
|
save_photo_clipboard();
|
||||||
location.reload();
|
location.reload();
|
||||||
};
|
};
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function paste_photo_clipboard()
|
function paste_photo_clipboard()
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,7 @@ function on_save(editor, edit_element_map, display_element_map)
|
||||||
data.append("description", description_editor.value);
|
data.append("description", description_editor.value);
|
||||||
|
|
||||||
editor.show_spinner();
|
editor.show_spinner();
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_cancel(editor, edit_element_map, display_element_map)
|
function on_cancel(editor, edit_element_map, display_element_map)
|
||||||
|
|
|
@ -100,7 +100,7 @@ function create_bookmark(url, title)
|
||||||
data.append("title", title);
|
data.append("title", title);
|
||||||
}
|
}
|
||||||
var callback = function(){location.reload();};
|
var callback = function(){location.reload();};
|
||||||
post(api_url, data, callback);
|
common.post(api_url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ function on_save(editor, edit_element_map)
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("title", title_editor.value);
|
data.append("title", title_editor.value);
|
||||||
data.append("url", url_editor.value);
|
data.append("url", url_editor.value);
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
on_cancel = undefined;
|
on_cancel = undefined;
|
||||||
|
|
|
@ -124,13 +124,13 @@ var holder = document.getElementById("photo_card_holder");
|
||||||
|
|
||||||
var add_box = document.getElementById("add_tag_textbox");
|
var add_box = document.getElementById("add_tag_textbox");
|
||||||
var add_button = document.getElementById("add_tag_button");
|
var add_button = document.getElementById("add_tag_button");
|
||||||
add_box.addEventListener("keyup", entry_with_history_hook);
|
add_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||||
bind_box_to_button(add_box, add_button);
|
common.bind_box_to_button(add_box, add_button);
|
||||||
|
|
||||||
var remove_box = document.getElementById("remove_tag_textbox");
|
var remove_box = document.getElementById("remove_tag_textbox");
|
||||||
var remove_button = document.getElementById("remove_tag_button");
|
var remove_button = document.getElementById("remove_tag_button");
|
||||||
remove_box.addEventListener("keyup", entry_with_history_hook);
|
remove_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||||
bind_box_to_button(remove_box, remove_button);
|
common.bind_box_to_button(remove_box, remove_button);
|
||||||
|
|
||||||
function recalculate_needed()
|
function recalculate_needed()
|
||||||
{
|
{
|
||||||
|
@ -182,14 +182,14 @@ function request_more_divs()
|
||||||
var holder = document.getElementById("photo_card_holder");
|
var holder = document.getElementById("photo_card_holder");
|
||||||
for (photo_id in response)
|
for (photo_id in response)
|
||||||
{
|
{
|
||||||
photo_div = html_to_element(response[photo_id]);
|
photo_div = common.html_to_element(response[photo_id]);
|
||||||
divs[photo_id] = photo_div;
|
divs[photo_id] = photo_div;
|
||||||
needed.delete(photo_id)
|
needed.delete(photo_id)
|
||||||
holder.appendChild(photo_div);
|
holder.appendChild(photo_div);
|
||||||
}
|
}
|
||||||
apply_check_all();
|
apply_check_all();
|
||||||
}
|
}
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function myhook()
|
function myhook()
|
||||||
|
@ -232,7 +232,7 @@ function submit_add_remove_tag(action, tagname, callback)
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("photo_ids", photo_ids);
|
data.append("photo_ids", photo_ids);
|
||||||
data.append("tagname", tagname);
|
data.append("tagname", tagname);
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function add_remove_callback(response)
|
function add_remove_callback(response)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +257,7 @@ function add_remove_callback(response)
|
||||||
else if (action == "remove")
|
else if (action == "remove")
|
||||||
{message_text = "Removed tag " + tagname;}
|
{message_text = "Removed tag " + tagname;}
|
||||||
}
|
}
|
||||||
create_message_bubble(message_area, message_positivity, message_text, 8000);
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var refresh_in_progress = false;
|
var refresh_in_progress = false;
|
||||||
|
@ -274,7 +274,7 @@ function submit_refresh_metadata(callback)
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("photo_ids", photo_ids);
|
data.append("photo_ids", photo_ids);
|
||||||
refresh_in_progress = true;
|
refresh_in_progress = true;
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function refresh_metadata_callback(response)
|
function refresh_metadata_callback(response)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ function refresh_metadata_callback(response)
|
||||||
var message_area = document.getElementById("message_area");
|
var message_area = document.getElementById("message_area");
|
||||||
var message_positivity = "message_negative";
|
var message_positivity = "message_negative";
|
||||||
var message_text = response["error_message"];
|
var message_text = response["error_message"];
|
||||||
create_message_bubble(message_area, message_positivity, message_text, 8000);
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -309,7 +309,7 @@ function searchhidden_callback(response)
|
||||||
message_positivity = "message_positive";
|
message_positivity = "message_positive";
|
||||||
message_text = "Success."
|
message_text = "Success."
|
||||||
}
|
}
|
||||||
create_message_bubble(message_area, message_positivity, message_text, 8000);
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||||
}
|
}
|
||||||
function submit_set_searchhidden(callback)
|
function submit_set_searchhidden(callback)
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ function submit_set_searchhidden(callback)
|
||||||
var photo_ids = Array.from(photo_clipboard).join(",");
|
var photo_ids = Array.from(photo_clipboard).join(",");
|
||||||
|
|
||||||
data.append("photo_ids", photo_ids);
|
data.append("photo_ids", photo_ids);
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function submit_unset_searchhidden(callback)
|
function submit_unset_searchhidden(callback)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +333,7 @@ function submit_unset_searchhidden(callback)
|
||||||
var photo_ids = Array.from(photo_clipboard).join(",");
|
var photo_ids = Array.from(photo_clipboard).join(",");
|
||||||
|
|
||||||
data.append("photo_ids", photo_ids);
|
data.append("photo_ids", photo_ids);
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -101,16 +101,16 @@ button
|
||||||
var login_input_username = document.getElementById("login_input_username");
|
var login_input_username = document.getElementById("login_input_username");
|
||||||
var login_input_password = document.getElementById("login_input_password");
|
var login_input_password = document.getElementById("login_input_password");
|
||||||
var login_submit_button = document.getElementById("login_submit_button");
|
var login_submit_button = document.getElementById("login_submit_button");
|
||||||
bind_box_to_button(login_input_username, login_submit_button);
|
common.bind_box_to_button(login_input_username, login_submit_button);
|
||||||
bind_box_to_button(login_input_password, login_submit_button);
|
common.bind_box_to_button(login_input_password, login_submit_button);
|
||||||
|
|
||||||
var register_input_username = document.getElementById("register_input_username");
|
var register_input_username = document.getElementById("register_input_username");
|
||||||
var register_input_password_1 = document.getElementById("register_input_password_1");
|
var register_input_password_1 = document.getElementById("register_input_password_1");
|
||||||
var register_input_password_2 = document.getElementById("register_input_password_2");
|
var register_input_password_2 = document.getElementById("register_input_password_2");
|
||||||
var register_input_button = document.getElementById("register_input_button");
|
var register_input_button = document.getElementById("register_input_button");
|
||||||
bind_box_to_button(register_input_username, register_input_button);
|
common.bind_box_to_button(register_input_username, register_input_button);
|
||||||
bind_box_to_button(register_input_password_1, register_input_button);
|
common.bind_box_to_button(register_input_password_1, register_input_button);
|
||||||
bind_box_to_button(register_input_password_2, register_input_button);
|
common.bind_box_to_button(register_input_password_2, register_input_button);
|
||||||
|
|
||||||
var message_area = document.getElementById("message_area");
|
var message_area = document.getElementById("message_area");
|
||||||
|
|
||||||
|
@ -120,14 +120,14 @@ function submit_login()
|
||||||
var password = document.getElementById("login_input_password").value;
|
var password = document.getElementById("login_input_password").value;
|
||||||
if (username == "" || password == "")
|
if (username == "" || password == "")
|
||||||
{
|
{
|
||||||
create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
common.create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = "/login";
|
var url = "/login";
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.append("username", username);
|
data.append("username", username);
|
||||||
data.append("password", password);
|
data.append("password", password);
|
||||||
return post(url, data, receive_callback);
|
return common.post(url, data, receive_callback);
|
||||||
}
|
}
|
||||||
function submit_register()
|
function submit_register()
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ function submit_register()
|
||||||
var password_2 = document.getElementById("register_input_password_2").value;
|
var password_2 = document.getElementById("register_input_password_2").value;
|
||||||
if (username == "" || password_1 == "" || password_2 == "")
|
if (username == "" || password_1 == "" || password_2 == "")
|
||||||
{
|
{
|
||||||
create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
common.create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = "/register";
|
var url = "/register";
|
||||||
|
@ -144,14 +144,14 @@ function submit_register()
|
||||||
data.append("username", username);
|
data.append("username", username);
|
||||||
data.append("password_1", password_1);
|
data.append("password_1", password_1);
|
||||||
data.append("password_2", password_2);
|
data.append("password_2", password_2);
|
||||||
return post(url, data, receive_callback);
|
return common.post(url, data, receive_callback);
|
||||||
}
|
}
|
||||||
function receive_callback(response)
|
function receive_callback(response)
|
||||||
{
|
{
|
||||||
response = response["data"];
|
response = response["data"];
|
||||||
if ("error_type" in response)
|
if ("error_type" in response)
|
||||||
{
|
{
|
||||||
create_message_bubble(message_area, "message_negative", response["error_message"], 8000);
|
common.create_message_bubble(message_area, "message_negative", response["error_message"], 8000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,8 +260,8 @@ var content_body = document.getElementById('content_body');
|
||||||
var add_tag_box = document.getElementById('add_tag_textbox');
|
var add_tag_box = document.getElementById('add_tag_textbox');
|
||||||
var add_tag_button = document.getElementById('add_tag_button');
|
var add_tag_button = document.getElementById('add_tag_button');
|
||||||
var message_area = document.getElementById('message_area');
|
var message_area = document.getElementById('message_area');
|
||||||
add_tag_box.addEventListener("keyup", entry_with_history_hook);
|
add_tag_box.addEventListener("keyup", common.entry_with_history_hook);
|
||||||
bind_box_to_button(add_tag_box, add_tag_button, false);
|
common.bind_box_to_button(add_tag_box, add_tag_button, false);
|
||||||
|
|
||||||
photo_img_holder = document.getElementById("photo_img_holder");
|
photo_img_holder = document.getElementById("photo_img_holder");
|
||||||
photo_img = document.getElementById("photo_img");
|
photo_img = document.getElementById("photo_img");
|
||||||
|
@ -272,7 +272,7 @@ function add_photo_tag(photoid, tagname, callback)
|
||||||
var url = "/photo/" + photoid + "/add_tag";
|
var url = "/photo/" + photoid + "/add_tag";
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("tagname", tagname);
|
data.append("tagname", tagname);
|
||||||
return post(url, data, callback);
|
return common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function remove_photo_tag(photoid, tagname, callback)
|
function remove_photo_tag(photoid, tagname, callback)
|
||||||
{
|
{
|
||||||
|
@ -280,7 +280,7 @@ function remove_photo_tag(photoid, tagname, callback)
|
||||||
var url = "/photo/" + photoid + "/remove_tag";
|
var url = "/photo/" + photoid + "/remove_tag";
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("tagname", tagname);
|
data.append("tagname", tagname);
|
||||||
return post(url, data, callback);
|
return common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function submit_tag(callback)
|
function submit_tag(callback)
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ function receive_callback(response)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create_message_bubble(message_area, message_positivity, message_text, 8000);
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh_metadata(photoid)
|
function refresh_metadata(photoid)
|
||||||
|
@ -322,7 +322,7 @@ function refresh_metadata(photoid)
|
||||||
var url= "/photo/" + photoid + "/refresh_metadata";
|
var url= "/photo/" + photoid + "/refresh_metadata";
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
var callback = function(){location.reload();};
|
var callback = function(){location.reload();};
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ZOOM_BG_URL = "url('{{photo|file_link}}')";
|
var ZOOM_BG_URL = "url('{{photo|file_link}}')";
|
||||||
|
|
|
@ -598,6 +598,6 @@ for (var index = 0; index < found_on_page.length; index += 1)
|
||||||
input_musts.addEventListener("keyup", function(){tag_input_hook(this, inputted_musts, "search_builder_musts_inputted")});
|
input_musts.addEventListener("keyup", function(){tag_input_hook(this, inputted_musts, "search_builder_musts_inputted")});
|
||||||
input_mays.addEventListener("keyup", function(){tag_input_hook(this, inputted_mays, "search_builder_mays_inputted")});
|
input_mays.addEventListener("keyup", function(){tag_input_hook(this, inputted_mays, "search_builder_mays_inputted")});
|
||||||
input_forbids.addEventListener("keyup", function(){tag_input_hook(this, inputted_forbids, "search_builder_forbids_inputted")});
|
input_forbids.addEventListener("keyup", function(){tag_input_hook(this, inputted_forbids, "search_builder_forbids_inputted")});
|
||||||
bind_box_to_button(input_expression, document.getElementById("search_go_button"));
|
common.bind_box_to_button(input_expression, document.getElementById("search_go_button"));
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -162,8 +162,8 @@ body
|
||||||
var box = document.getElementById('add_tag_textbox');
|
var box = document.getElementById('add_tag_textbox');
|
||||||
var button = document.getElementById('add_tag_button');
|
var button = document.getElementById('add_tag_button');
|
||||||
var message_area = document.getElementById('message_area');
|
var message_area = document.getElementById('message_area');
|
||||||
box.addEventListener("keyup", entry_with_history_hook);
|
box.addEventListener("keyup", common.entry_with_history_hook);
|
||||||
bind_box_to_button(box, button, false);
|
common.bind_box_to_button(box, button, false);
|
||||||
|
|
||||||
function submit_tag(callback)
|
function submit_tag(callback)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ function edit_tags(action, tagname, callback)
|
||||||
var url = "/tags/" + action;
|
var url = "/tags/" + action;
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.append("tagname", tagname);
|
data.append("tagname", tagname);
|
||||||
return post(url, data, callback);
|
return common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
function delete_tag_synonym(tagname, callback)
|
function delete_tag_synonym(tagname, callback)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +236,7 @@ function receive_callback(response)
|
||||||
{message_text = "Unlinked tags " + tagname;}
|
{message_text = "Unlinked tags " + tagname;}
|
||||||
|
|
||||||
}
|
}
|
||||||
create_message_bubble(message_area, message_positivity, message_text, 8000);
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ function on_save(editor, edit_element_map, display_element_map)
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("name", name_editor.value);
|
data.append("name", name_editor.value);
|
||||||
data.append("description", description_editor.value);
|
data.append("description", description_editor.value);
|
||||||
post(url, data, callback);
|
common.post(url, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_cancel(editor, edit_element_map, display_element_map)
|
function on_cancel(editor, edit_element_map, display_element_map)
|
||||||
|
|
Loading…
Reference in a new issue