Replace non-global uses of var with let.
This commit is contained in:
parent
1849c2e58b
commit
8af340e442
14 changed files with 277 additions and 279 deletions
|
@ -6,7 +6,7 @@ api.albums = {};
|
|||
api.albums._add_remove_photos =
|
||||
function _add_remove_photos(album_id, photo_ids, add_or_remove, callback)
|
||||
{
|
||||
var url;
|
||||
let url;
|
||||
if (add_or_remove === "add")
|
||||
{ url = `/album/${album_id}/add_photo`; }
|
||||
else if (add_or_remove === "remove")
|
||||
|
@ -14,7 +14,7 @@ function _add_remove_photos(album_id, photo_ids, add_or_remove, callback)
|
|||
else
|
||||
{ throw `should be 'add' or 'remove', not ${add_or_remove}.`; }
|
||||
|
||||
var data = new FormData();
|
||||
let data = new FormData();
|
||||
|
||||
if (Array.isArray(photo_ids))
|
||||
{ photo_ids = photo_ids.join(","); }
|
||||
|
@ -26,8 +26,8 @@ function _add_remove_photos(album_id, photo_ids, add_or_remove, callback)
|
|||
api.albums.add_child =
|
||||
function add_child(album_id, child_id, callback)
|
||||
{
|
||||
var url = `/album/${album_id}/add_child`;
|
||||
var data = new FormData();
|
||||
let url = `/album/${album_id}/add_child`;
|
||||
let data = new FormData();
|
||||
data.append("child_id", child_id);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ function add_photos(album_id, photo_ids, callback)
|
|||
api.albums.create =
|
||||
function create(title, parent_id, callback)
|
||||
{
|
||||
var url = "/albums/create_album";
|
||||
var data = new FormData();
|
||||
let url = "/albums/create_album";
|
||||
let data = new FormData();
|
||||
if (title !== undefined)
|
||||
{
|
||||
data.append("title", title);
|
||||
|
@ -57,15 +57,15 @@ function create(title, parent_id, callback)
|
|||
api.albums.delete =
|
||||
function _delete(album_id, callback)
|
||||
{
|
||||
var url = `/album/${album_id}/delete`;
|
||||
let url = `/album/${album_id}/delete`;
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.albums.edit =
|
||||
function edit(album_id, title, description, callback)
|
||||
{
|
||||
var url = `/album/${album_id}/edit`;
|
||||
var data = new FormData();
|
||||
let url = `/album/${album_id}/edit`;
|
||||
let data = new FormData();
|
||||
data.append("title", title);
|
||||
data.append("description", description);
|
||||
common.post(url, data, callback);
|
||||
|
@ -74,15 +74,15 @@ function edit(album_id, title, description, callback)
|
|||
api.albums.refresh_directories =
|
||||
function refresh_directories(album_id, callback)
|
||||
{
|
||||
var url = `/album/${album_id}/refresh_directories`;
|
||||
let url = `/album/${album_id}/refresh_directories`;
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.albums.remove_child =
|
||||
function remove_child(album_id, child_id, callback)
|
||||
{
|
||||
var url = `/album/${album_id}/remove_child`;
|
||||
var data = new FormData();
|
||||
let url = `/album/${album_id}/remove_child`;
|
||||
let data = new FormData();
|
||||
data.append("child_id", child_id);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ api.bookmarks = {};
|
|||
api.bookmarks.create =
|
||||
function create(b_url, title, callback)
|
||||
{
|
||||
var url = "/bookmarks/create_bookmark";
|
||||
var data = new FormData();
|
||||
let url = "/bookmarks/create_bookmark";
|
||||
let data = new FormData();
|
||||
data.append("url", b_url.trim());
|
||||
title = title.trim();
|
||||
if (title)
|
||||
|
@ -139,15 +139,15 @@ function create(b_url, title, callback)
|
|||
api.bookmarks.delete =
|
||||
function _delete(bookmark_id, callback)
|
||||
{
|
||||
var url = `/bookmark/${bookmark_id}/delete`;
|
||||
let url = `/bookmark/${bookmark_id}/delete`;
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.bookmarks.edit =
|
||||
function edit(bookmark_id, title, b_url, callback)
|
||||
{
|
||||
var url = `/bookmark/${bookmark_id}/edit`;
|
||||
var data = new FormData();
|
||||
let url = `/bookmark/${bookmark_id}/edit`;
|
||||
let data = new FormData();
|
||||
data.append("title", title.trim());
|
||||
data.append("url", b_url.trim());
|
||||
common.post(url, data, callback);
|
||||
|
@ -159,8 +159,8 @@ api.photos = {};
|
|||
api.photos.add_tag =
|
||||
function add_tag(photo_id, tagname, callback)
|
||||
{
|
||||
var url = `/photo/${photo_id}/add_tag`;
|
||||
var data = new FormData();
|
||||
let url = `/photo/${photo_id}/add_tag`;
|
||||
let data = new FormData();
|
||||
data.append("tagname", tagname);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -168,8 +168,8 @@ function add_tag(photo_id, tagname, callback)
|
|||
api.photos.batch_add_tag =
|
||||
function batch_add_tag(photo_ids, tagname, callback)
|
||||
{
|
||||
var url = "/batch/photos/add_tag";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/add_tag";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
data.append("tagname", tagname);
|
||||
common.post(url, data, add_remove_tag_callback);
|
||||
|
@ -178,8 +178,8 @@ function batch_add_tag(photo_ids, tagname, callback)
|
|||
api.photos.batch_refresh_metadata =
|
||||
function batch_refresh_metadata(photo_ids, callback)
|
||||
{
|
||||
var url = "/batch/photos/refresh_metadata";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/refresh_metadata";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -187,8 +187,8 @@ function batch_refresh_metadata(photo_ids, callback)
|
|||
api.photos.batch_remove_tag =
|
||||
function batch_remove_tag(photo_ids, tagname, callback)
|
||||
{
|
||||
var url = "/batch/photos/remove_tag";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/remove_tag";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
data.append("tagname", tagname);
|
||||
common.post(url, data, add_remove_tag_callback);
|
||||
|
@ -197,8 +197,8 @@ function batch_remove_tag(photo_ids, tagname, callback)
|
|||
api.photos.batch_set_searchhidden =
|
||||
function batch_set_searchhidden(photo_ids, callback)
|
||||
{
|
||||
var url = "/batch/photos/set_searchhidden";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/set_searchhidden";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ function batch_set_searchhidden(photo_ids, callback)
|
|||
api.photos.batch_unset_searchhidden =
|
||||
function batch_unset_searchhidden(photo_ids, callback)
|
||||
{
|
||||
var url = "/batch/photos/unset_searchhidden";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/unset_searchhidden";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ function batch_unset_searchhidden(photo_ids, callback)
|
|||
api.photos.delete =
|
||||
function _delete(photo_id, delete_file, callback)
|
||||
{
|
||||
var url = `/photo/${photo_id}/delete`;
|
||||
var data = new FormData();
|
||||
let url = `/photo/${photo_id}/delete`;
|
||||
let data = new FormData();
|
||||
data.append("delete_file", delete_file);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -224,8 +224,8 @@ function _delete(photo_id, delete_file, callback)
|
|||
api.photos.generate_thumbnail =
|
||||
function generate_thumbnail(photo_id, special, callback)
|
||||
{
|
||||
var url = `/photo/${photo_id}/generate_thumbnail`
|
||||
var data = new FormData();
|
||||
let url = `/photo/${photo_id}/generate_thumbnail`
|
||||
let data = new FormData();
|
||||
for (x in special)
|
||||
{
|
||||
data.append(x, special[x]);
|
||||
|
@ -236,8 +236,8 @@ function generate_thumbnail(photo_id, special, callback)
|
|||
api.photos.get_download_zip_token =
|
||||
function get_download_zip_token(photo_ids, callback)
|
||||
{
|
||||
var url = "/batch/photos/download_zip";
|
||||
var data = new FormData();
|
||||
let url = "/batch/photos/download_zip";
|
||||
let data = new FormData();
|
||||
data.append("photo_ids", photo_ids.join(","));
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -245,29 +245,29 @@ function get_download_zip_token(photo_ids, callback)
|
|||
api.photos.download_zip =
|
||||
function download_zip(zip_token)
|
||||
{
|
||||
var url = `/batch/photos/download_zip/${zip_token}.zip`;
|
||||
let url = `/batch/photos/download_zip/${zip_token}.zip`;
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
api.photos.callback_download_zip =
|
||||
function callback_download_zip(response)
|
||||
{
|
||||
var zip_token = response.data.zip_token;
|
||||
let zip_token = response.data.zip_token;
|
||||
api.photos.download_zip(zip_token);
|
||||
}
|
||||
|
||||
api.photos.refresh_metadata =
|
||||
function refresh_metadata(photo_id, callback)
|
||||
{
|
||||
var url = `/photo/${photo_id}/refresh_metadata`;
|
||||
let url = `/photo/${photo_id}/refresh_metadata`;
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.photos.remove_tag =
|
||||
function remove_tag(photo_id, tagname, callback)
|
||||
{
|
||||
var url = `/photo/${photo_id}/remove_tag`;
|
||||
var data = new FormData();
|
||||
let url = `/photo/${photo_id}/remove_tag`;
|
||||
let data = new FormData();
|
||||
data.append("tagname", tagname);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -291,8 +291,8 @@ api.tags = {};
|
|||
api.tags.add_child =
|
||||
function add_child(tag_name, child_name, callback)
|
||||
{
|
||||
var url = `/tag/${tag_name}/add_child`;
|
||||
var data = new FormData();
|
||||
let url = `/tag/${tag_name}/add_child`;
|
||||
let data = new FormData();
|
||||
data.append("child_name", child_name);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -300,8 +300,8 @@ function add_child(tag_name, child_name, callback)
|
|||
api.tags.create =
|
||||
function create(name, description, callback)
|
||||
{
|
||||
var url = `/tags/create_tag`;
|
||||
var data = new FormData();
|
||||
let url = `/tags/create_tag`;
|
||||
let data = new FormData();
|
||||
data.append("name", name);
|
||||
data.append("description", description);
|
||||
common.post(url, data, callback);
|
||||
|
@ -310,15 +310,15 @@ function create(name, description, callback)
|
|||
api.tags.delete =
|
||||
function _delete(tag_name, callback)
|
||||
{
|
||||
var url = `/tag/${tag_name}/delete`;
|
||||
let url = `/tag/${tag_name}/delete`;
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.tags.easybake =
|
||||
function easybake(easybake_string, callback)
|
||||
{
|
||||
var url = "/tags/easybake";
|
||||
var data = new FormData();
|
||||
let url = "/tags/easybake";
|
||||
let data = new FormData();
|
||||
data.append("easybake_string", easybake_string);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -326,8 +326,8 @@ function easybake(easybake_string, callback)
|
|||
api.tags.edit =
|
||||
function edit(tag_name, name, description, callback)
|
||||
{
|
||||
var url = `/tag/${tag_name}/edit`;
|
||||
var data = new FormData();
|
||||
let url = `/tag/${tag_name}/edit`;
|
||||
let data = new FormData();
|
||||
data.append("name", name);
|
||||
data.append("description", description);
|
||||
common.post(url, data, callback);
|
||||
|
@ -336,8 +336,8 @@ function edit(tag_name, name, description, callback)
|
|||
api.tags.remove_child =
|
||||
function remove_child(tag_name, child_name, callback)
|
||||
{
|
||||
var url = `/tag/${tag_name}/remove_child`;
|
||||
var data = new FormData();
|
||||
let url = `/tag/${tag_name}/remove_child`;
|
||||
let data = new FormData();
|
||||
data.append("child_name", child_name);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -345,8 +345,8 @@ function remove_child(tag_name, child_name, callback)
|
|||
api.tags.remove_synonym =
|
||||
function remove_synonym(tag_name, syn_name, callback)
|
||||
{
|
||||
var url = `/tag/${tag_name}/remove_synonym`;
|
||||
var data = new FormData();
|
||||
let url = `/tag/${tag_name}/remove_synonym`;
|
||||
let data = new FormData();
|
||||
data.append("syn_name", syn_name);
|
||||
common.post(url, data, callback);
|
||||
}
|
||||
|
@ -370,8 +370,8 @@ api.users = {};
|
|||
api.users.login =
|
||||
function login(username, password, callback)
|
||||
{
|
||||
var url = "/login";
|
||||
data = new FormData();
|
||||
let url = "/login";
|
||||
let data = new FormData();
|
||||
data.append("username", username);
|
||||
data.append("password", password);
|
||||
common.post(url, data, callback);
|
||||
|
@ -380,15 +380,15 @@ function login(username, password, callback)
|
|||
api.users.logout =
|
||||
function logout(callback)
|
||||
{
|
||||
var url = "/logout";
|
||||
let url = "/logout";
|
||||
common.post(url, null, callback);
|
||||
}
|
||||
|
||||
api.users.register =
|
||||
function register(username, display_name, password_1, password_2, callback)
|
||||
{
|
||||
var url = "/register";
|
||||
data = new FormData();
|
||||
let url = "/register";
|
||||
let data = new FormData();
|
||||
data.append("username", username);
|
||||
data.append("display_name", display_name);
|
||||
data.append("password_1", password_1);
|
||||
|
|
|
@ -5,8 +5,8 @@ common.INPUT_TYPES = new Set(["INPUT", "TEXTAREA"]);
|
|||
common._request =
|
||||
function _request(method, url, callback)
|
||||
{
|
||||
var request = new XMLHttpRequest();
|
||||
var response = {
|
||||
let request = new XMLHttpRequest();
|
||||
let response = {
|
||||
"completed": false,
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ function _request(method, url, callback)
|
|||
}
|
||||
callback(response);
|
||||
};
|
||||
var asynchronous = true;
|
||||
let asynchronous = true;
|
||||
request.open(method, url, asynchronous);
|
||||
return request;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ function bind_box_to_button(box, button, ctrl_enter)
|
|||
Thanks Yaroslav Yakovlev
|
||||
http://stackoverflow.com/a/9343095
|
||||
*/
|
||||
var bound_box_hook = function(event)
|
||||
let bound_box_hook = function(event)
|
||||
{
|
||||
if (event.key !== "Enter")
|
||||
{return;}
|
||||
|
@ -83,9 +83,9 @@ function create_message_bubble(message_area, message_positivity, message_text, l
|
|||
{
|
||||
lifespan = 8000;
|
||||
}
|
||||
var message = document.createElement("div");
|
||||
let message = document.createElement("div");
|
||||
message.className = "message_bubble " + message_positivity;
|
||||
var span = document.createElement("span");
|
||||
let span = document.createElement("span");
|
||||
span.innerHTML = message_text;
|
||||
message.appendChild(span);
|
||||
message_area.appendChild(message);
|
||||
|
@ -105,7 +105,7 @@ common.entry_with_history_hook =
|
|||
function entry_with_history_hook(event)
|
||||
{
|
||||
//console.log(event);
|
||||
var box = event.target;
|
||||
let box = event.target;
|
||||
|
||||
if (box.entry_history === undefined)
|
||||
{box.entry_history = [];}
|
||||
|
@ -143,7 +143,7 @@ function entry_with_history_hook(event)
|
|||
common.html_to_element =
|
||||
function html_to_element(html)
|
||||
{
|
||||
var template = document.createElement("template");
|
||||
let template = document.createElement("template");
|
||||
template.innerHTML = html;
|
||||
return template.content.firstChild;
|
||||
}
|
||||
|
@ -163,11 +163,11 @@ function init_atag_merge_params()
|
|||
Result: "?filter=hello&orderby=date"
|
||||
*/
|
||||
page_params = new URLSearchParams(window.location.search);
|
||||
var as = Array.from(document.getElementsByClassName("merge_params"));
|
||||
let as = Array.from(document.getElementsByClassName("merge_params"));
|
||||
for (let a of as)
|
||||
{
|
||||
var a_params = new URLSearchParams(a.search);
|
||||
var new_params = new URLSearchParams();
|
||||
let a_params = new URLSearchParams(a.search);
|
||||
let new_params = new URLSearchParams();
|
||||
page_params.forEach(function(value, key) {new_params.set(key, value); });
|
||||
a_params.forEach(function(value, key) {new_params.set(key, value); });
|
||||
a.search = new_params.toString();
|
||||
|
@ -205,29 +205,29 @@ function init_button_with_confirm()
|
|||
|
||||
data-holder-class: CSS class for the new span that holds the menu.
|
||||
*/
|
||||
var buttons = Array.from(document.getElementsByClassName("button_with_confirm"));
|
||||
let buttons = Array.from(document.getElementsByClassName("button_with_confirm"));
|
||||
for (let button of buttons)
|
||||
{
|
||||
button.classList.remove("button_with_confirm");
|
||||
|
||||
var holder = document.createElement("span");
|
||||
let holder = document.createElement("span");
|
||||
holder.classList.add("confirm_holder");
|
||||
holder.classList.add(button.dataset.holderClass || "confirm_holder");
|
||||
button.parentElement.insertBefore(holder, button);
|
||||
button.parentElement.removeChild(button);
|
||||
|
||||
var holder_stage1 = document.createElement("span");
|
||||
let holder_stage1 = document.createElement("span");
|
||||
holder_stage1.classList.add("confirm_holder_stage1");
|
||||
holder_stage1.appendChild(button);
|
||||
holder.appendChild(holder_stage1);
|
||||
|
||||
var holder_stage2 = document.createElement("span");
|
||||
let holder_stage2 = document.createElement("span");
|
||||
holder_stage2.classList.add("confirm_holder_stage2");
|
||||
holder_stage2.classList.add("hidden");
|
||||
holder.appendChild(holder_stage2);
|
||||
|
||||
var prompt;
|
||||
var input_source;
|
||||
let prompt;
|
||||
let input_source;
|
||||
if (button.dataset.isInput)
|
||||
{
|
||||
prompt = document.createElement("input");
|
||||
|
@ -245,7 +245,7 @@ function init_button_with_confirm()
|
|||
delete button.dataset.prompt;
|
||||
delete button.dataset.promptClass;
|
||||
|
||||
var button_confirm = document.createElement("button");
|
||||
let button_confirm = document.createElement("button");
|
||||
button_confirm.innerText = (button.dataset.confirm || button.innerText).trim();
|
||||
if (button.dataset.confirmClass === undefined)
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ function init_button_with_confirm()
|
|||
delete button.dataset.confirmClass;
|
||||
delete button.dataset.isInput;
|
||||
|
||||
var button_cancel = document.createElement("button");
|
||||
let button_cancel = document.createElement("button");
|
||||
button_cancel.innerText = button.dataset.cancel || "Cancel";
|
||||
button_cancel.className = button.dataset.cancelClass || "";
|
||||
holder_stage2.appendChild(button_cancel);
|
||||
|
@ -275,9 +275,9 @@ function init_button_with_confirm()
|
|||
delete button.dataset.cancelClass;
|
||||
|
||||
// If this is stupid, let me know.
|
||||
var confirm_onclick = button.dataset.onclick + `
|
||||
let confirm_onclick = button.dataset.onclick + `
|
||||
;
|
||||
var holder = event.target.parentElement.parentElement;
|
||||
let holder = event.target.parentElement.parentElement;
|
||||
holder.getElementsByClassName("confirm_holder_stage1")[0].classList.remove("hidden");
|
||||
holder.getElementsByClassName("confirm_holder_stage2")[0].classList.add("hidden");
|
||||
`
|
||||
|
@ -285,10 +285,10 @@ function init_button_with_confirm()
|
|||
button.removeAttribute("onclick");
|
||||
button.onclick = function(event)
|
||||
{
|
||||
var holder = event.target.parentElement.parentElement;
|
||||
let holder = event.target.parentElement.parentElement;
|
||||
holder.getElementsByClassName("confirm_holder_stage1")[0].classList.add("hidden");
|
||||
holder.getElementsByClassName("confirm_holder_stage2")[0].classList.remove("hidden");
|
||||
var input = holder.getElementsByTagName("input")[0];
|
||||
let input = holder.getElementsByTagName("input")[0];
|
||||
if (input)
|
||||
{
|
||||
input.focus();
|
||||
|
@ -297,7 +297,7 @@ function init_button_with_confirm()
|
|||
|
||||
button_cancel.onclick = function(event)
|
||||
{
|
||||
var holder = event.target.parentElement.parentElement;
|
||||
let holder = event.target.parentElement.parentElement;
|
||||
holder.getElementsByClassName("confirm_holder_stage1")[0].classList.remove("hidden");
|
||||
holder.getElementsByClassName("confirm_holder_stage2")[0].classList.add("hidden");
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ function init_enable_on_pageload()
|
|||
the DOM has completed loading, give it the disabled attribute and the
|
||||
class "enable_on_pageload".
|
||||
*/
|
||||
var elements = Array.from(document.getElementsByClassName("enable_on_pageload"));
|
||||
let elements = Array.from(document.getElementsByClassName("enable_on_pageload"));
|
||||
for (let element of elements)
|
||||
{
|
||||
element.disabled = false;
|
||||
|
@ -324,16 +324,16 @@ function init_enable_on_pageload()
|
|||
common.init_tabbed_container =
|
||||
function init_tabbed_container()
|
||||
{
|
||||
var switch_tab =
|
||||
let switch_tab =
|
||||
function switch_tab(event)
|
||||
{
|
||||
var tab_button = event.target;
|
||||
let tab_button = event.target;
|
||||
if (tab_button.classList.contains("tab_button_active"))
|
||||
{ return; }
|
||||
|
||||
var tab_id = tab_button.dataset.tabId;
|
||||
var tab_buttons = tab_button.parentElement.getElementsByClassName("tab_button");
|
||||
var tabs = tab_button.parentElement.parentElement.getElementsByClassName("tab");
|
||||
let tab_id = tab_button.dataset.tabId;
|
||||
let tab_buttons = tab_button.parentElement.getElementsByClassName("tab_button");
|
||||
let tabs = tab_button.parentElement.parentElement.getElementsByClassName("tab");
|
||||
for (let tab_button of tab_buttons)
|
||||
{
|
||||
if (tab_button.dataset.tabId === tab_id)
|
||||
|
@ -356,21 +356,21 @@ function init_tabbed_container()
|
|||
}
|
||||
}
|
||||
|
||||
var tabbed_containers = Array.from(document.getElementsByClassName("tabbed_container"));
|
||||
let tabbed_containers = Array.from(document.getElementsByClassName("tabbed_container"));
|
||||
for (let tabbed_container of tabbed_containers)
|
||||
{
|
||||
var button_container = document.createElement("div");
|
||||
let button_container = document.createElement("div");
|
||||
button_container.className = "tab_buttons";
|
||||
tabbed_container.prepend(button_container);
|
||||
var tabs = Array.from(tabbed_container.getElementsByClassName("tab"));
|
||||
let tabs = Array.from(tabbed_container.getElementsByClassName("tab"));
|
||||
for (let tab of tabs)
|
||||
{
|
||||
tab.classList.add("hidden");
|
||||
var tab_id = tab.dataset.tabId || tab.dataset.tabTitle;
|
||||
let tab_id = tab.dataset.tabId || tab.dataset.tabTitle;
|
||||
tab.dataset.tabId = tab_id;
|
||||
tab.style.borderTopColor = "transparent";
|
||||
|
||||
var button = document.createElement("button");
|
||||
let button = document.createElement("button");
|
||||
button.className = "tab_button tab_button_inactive";
|
||||
button.onclick = switch_tab;
|
||||
button.innerText = tab.dataset.tabTitle;
|
||||
|
|
|
@ -67,13 +67,13 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
{
|
||||
for (var index = 0; index < this.display_elements.length; index += 1)
|
||||
{
|
||||
var display_element = this.display_elements[index];
|
||||
var edit_element = this.edit_elements[index];
|
||||
let display_element = this.display_elements[index];
|
||||
let edit_element = this.edit_elements[index];
|
||||
|
||||
display_element.classList.add("hidden");
|
||||
edit_element.classList.remove("hidden");
|
||||
|
||||
var empty_text = display_element.dataset.editorEmptyText;
|
||||
let empty_text = display_element.dataset.editorEmptyText;
|
||||
if (empty_text !== undefined && display_element.innerText == empty_text)
|
||||
{
|
||||
edit_element.value = "";
|
||||
|
@ -92,8 +92,8 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
{
|
||||
for (var index = 0; index < this.display_elements.length; index += 1)
|
||||
{
|
||||
var display_element = this.display_elements[index];
|
||||
var edit_element = this.edit_elements[index];
|
||||
let display_element = this.display_elements[index];
|
||||
let edit_element = this.edit_elements[index];
|
||||
|
||||
if (display_element.dataset.editorEmptyText !== undefined && edit_element.value == "")
|
||||
{
|
||||
|
@ -132,8 +132,8 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
|
||||
for (var index = 0; index < elements.length; index += 1)
|
||||
{
|
||||
var display_element = elements[index];
|
||||
var edit_element;
|
||||
let display_element = elements[index];
|
||||
let edit_element;
|
||||
if (editor.PARAGRAPH_TYPES.has(display_element.tagName))
|
||||
{
|
||||
edit_element = document.createElement("textarea");
|
||||
|
@ -188,7 +188,7 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
return fallback.bind(this);
|
||||
}
|
||||
|
||||
var bindable = function()
|
||||
let bindable = function()
|
||||
{
|
||||
if (this.can_use_element_map)
|
||||
{
|
||||
|
@ -202,14 +202,14 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
return bindable.bind(this);
|
||||
}
|
||||
|
||||
var placeholders = document.getElementsByClassName("editor_toolbox_placeholder");
|
||||
let placeholders = document.getElementsByClassName("editor_toolbox_placeholder");
|
||||
for (var index = 0; index < placeholders.length; index += 1)
|
||||
{
|
||||
placeholders[index].parentElement.removeChild(placeholders[index]);
|
||||
}
|
||||
|
||||
var last_element = this.edit_elements[this.edit_elements.length - 1];
|
||||
var toolbox = document.createElement("div");
|
||||
let last_element = this.edit_elements[this.edit_elements.length - 1];
|
||||
let toolbox = document.createElement("div");
|
||||
toolbox.classList.add("editor_toolbox");
|
||||
last_element.parentElement.insertBefore(toolbox, last_element.nextSibling);
|
||||
|
||||
|
@ -254,7 +254,7 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
|
||||
for (var index = 0; index < this.edit_elements.length; index += 1)
|
||||
{
|
||||
var edit_element = this.edit_elements[index];
|
||||
let edit_element = this.edit_elements[index];
|
||||
if (edit_element.tagName == "TEXTAREA")
|
||||
{
|
||||
common.bind_box_to_button(edit_element, this.save_button, true);
|
||||
|
|
|
@ -13,7 +13,7 @@ hotkeys.hotkey_human =
|
|||
function hotkey_human(key, ctrlKey, shiftKey, altKey)
|
||||
{
|
||||
// Return the string that will be displayed to the user to represent this hotkey.
|
||||
var mods = [];
|
||||
let mods = [];
|
||||
if (ctrlKey) { mods.push("Ctrl"); }
|
||||
if (shiftKey) { mods.push("Shift"); }
|
||||
if (altKey) { mods.push("Alt"); }
|
||||
|
@ -30,14 +30,14 @@ function register_hotkey(hotkey, action, description)
|
|||
hotkey = hotkey.split(/\s+/g);
|
||||
}
|
||||
|
||||
var key = hotkey.pop();
|
||||
let key = hotkey.pop();
|
||||
modifiers = hotkey.map(word => word.toLocaleLowerCase());
|
||||
var ctrlKey = modifiers.includes("control") || modifiers.includes("ctrl");
|
||||
var shiftKey = modifiers.includes("shift");
|
||||
var altKey = modifiers.includes("alt");
|
||||
let ctrlKey = modifiers.includes("control") || modifiers.includes("ctrl");
|
||||
let shiftKey = modifiers.includes("shift");
|
||||
let altKey = modifiers.includes("alt");
|
||||
|
||||
var identifier = hotkeys.hotkey_identifier(key, ctrlKey, shiftKey, altKey);
|
||||
var human = hotkeys.hotkey_human(key, ctrlKey, shiftKey, altKey);
|
||||
let identifier = hotkeys.hotkey_identifier(key, ctrlKey, shiftKey, altKey);
|
||||
let human = hotkeys.hotkey_human(key, ctrlKey, shiftKey, altKey);
|
||||
hotkeys.HOTKEYS[identifier] = {"action": action, "human": human, "description": description}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,10 @@ hotkeys.show_all_hotkeys =
|
|||
function show_all_hotkeys()
|
||||
{
|
||||
// Display an Alert with a list of all the hotkeys.
|
||||
var lines = [];
|
||||
let lines = [];
|
||||
for (var identifier in hotkeys.HOTKEYS)
|
||||
{
|
||||
var line = hotkeys.HOTKEYS[identifier]["human"] + " : " + hotkeys.HOTKEYS[identifier]["description"];
|
||||
let line = hotkeys.HOTKEYS[identifier]["human"] + " : " + hotkeys.HOTKEYS[identifier]["description"];
|
||||
lines.push(line);
|
||||
}
|
||||
lines = lines.join("\n");
|
||||
|
|
|
@ -17,7 +17,7 @@ photo_clipboard.load_clipboard =
|
|||
function load_clipboard(event)
|
||||
{
|
||||
console.log("Loading photo clipboard from localstorage.");
|
||||
var stored = localStorage.getItem("photo_clipboard");
|
||||
let stored = localStorage.getItem("photo_clipboard");
|
||||
if (stored === null)
|
||||
{
|
||||
if (photo_clipboard.clipboard.size != 0)
|
||||
|
@ -42,7 +42,7 @@ photo_clipboard.save_clipboard =
|
|||
function save_clipboard()
|
||||
{
|
||||
console.log("Saving photo clipboard to localstorage.");
|
||||
var serialized = JSON.stringify(Array.from(photo_clipboard.clipboard));
|
||||
let serialized = JSON.stringify(Array.from(photo_clipboard.clipboard));
|
||||
localStorage.setItem("photo_clipboard", serialized);
|
||||
photo_clipboard.update_pagestate();
|
||||
|
||||
|
@ -61,7 +61,7 @@ function apply_check(photo_card)
|
|||
Given a photo card div, set its checkbox to the correct value based on
|
||||
whether the clipboard contains this card's ID.
|
||||
*/
|
||||
var checkbox = photo_card.getElementsByClassName("photo_card_selector_checkbox")[0];
|
||||
let checkbox = photo_card.getElementsByClassName("photo_card_selector_checkbox")[0];
|
||||
checkbox.checked = photo_clipboard.clipboard.has(photo_card.dataset.id);
|
||||
if (checkbox.checked)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ function apply_check_all()
|
|||
Run through all the photo cards on the page and set their checkbox to the
|
||||
correct value.
|
||||
*/
|
||||
var photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
let photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
photo_divs.forEach(photo_clipboard.apply_check);
|
||||
}
|
||||
|
||||
|
@ -115,22 +115,22 @@ function on_photo_select(event)
|
|||
|
||||
if (event.shiftKey && photo_clipboard.previous_photo_select)
|
||||
{
|
||||
var current_photo_div = event.target.parentElement;
|
||||
var previous_photo_div = photo_clipboard.previous_photo_select.target.parentElement;
|
||||
var photo_divs = Array.from(current_photo_div.parentElement.children);
|
||||
let current_photo_div = event.target.parentElement;
|
||||
let previous_photo_div = photo_clipboard.previous_photo_select.target.parentElement;
|
||||
let photo_divs = Array.from(current_photo_div.parentElement.children);
|
||||
|
||||
var current_index = photo_divs.indexOf(current_photo_div);
|
||||
var previous_index = photo_divs.indexOf(previous_photo_div);
|
||||
let current_index = photo_divs.indexOf(current_photo_div);
|
||||
let previous_index = photo_divs.indexOf(previous_photo_div);
|
||||
|
||||
var slice;
|
||||
let slice;
|
||||
if (current_index == previous_index)
|
||||
{
|
||||
slice = [current_photo_div];
|
||||
}
|
||||
else
|
||||
{
|
||||
var left = Math.min(previous_index, current_index);
|
||||
var right = Math.max(previous_index, current_index);
|
||||
let left = Math.min(previous_index, current_index);
|
||||
let right = Math.max(previous_index, current_index);
|
||||
slice = photo_divs.slice(left, right + 1);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ function on_photo_select(event)
|
|||
}
|
||||
else
|
||||
{
|
||||
var photo_div = event.target.parentElement;
|
||||
let photo_div = event.target.parentElement;
|
||||
action(photo_div);
|
||||
}
|
||||
photo_clipboard.previous_photo_select = event;
|
||||
|
@ -148,7 +148,7 @@ function on_photo_select(event)
|
|||
photo_clipboard.select_all_photos =
|
||||
function select_all_photos()
|
||||
{
|
||||
var photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
let photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
photo_divs.forEach(photo_clipboard._action_select);
|
||||
photo_clipboard.apply_check_all();
|
||||
photo_clipboard.save_clipboard();
|
||||
|
@ -157,7 +157,7 @@ function select_all_photos()
|
|||
photo_clipboard.unselect_all_photos =
|
||||
function unselect_all_photos()
|
||||
{
|
||||
var photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
let photo_divs = Array.from(document.getElementsByClassName("photo_card"));
|
||||
photo_divs.forEach(photo_clipboard._action_unselect);
|
||||
photo_clipboard.apply_check_all()
|
||||
photo_clipboard.previous_photo_select = null;
|
||||
|
@ -169,14 +169,14 @@ function unselect_all_photos()
|
|||
photo_clipboard.clipboard_tray_collapse =
|
||||
function clipboard_tray_collapse()
|
||||
{
|
||||
var tray_body = document.getElementById("clipboard_tray_body");
|
||||
let tray_body = document.getElementById("clipboard_tray_body");
|
||||
tray_body.classList.add("hidden");
|
||||
}
|
||||
|
||||
photo_clipboard.clipboard_tray_uncollapse =
|
||||
function clipboard_tray_uncollapse()
|
||||
{
|
||||
var tray_body = document.getElementById("clipboard_tray_body");
|
||||
let tray_body = document.getElementById("clipboard_tray_body");
|
||||
tray_body.classList.remove("hidden");
|
||||
photo_clipboard.update_clipboard_tray();
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ function clipboard_tray_collapse_toggle()
|
|||
/*
|
||||
Show or hide the clipboard.
|
||||
*/
|
||||
var tray_body = document.getElementById("clipboard_tray_body");
|
||||
let tray_body = document.getElementById("clipboard_tray_body");
|
||||
if (!tray_body)
|
||||
{
|
||||
return;
|
||||
|
@ -210,11 +210,11 @@ function ingest_toolbox_items()
|
|||
The page may provide divs with the class "my_clipboard_tray_toolbox", and
|
||||
we will migrate all the elements into the real clipboard tray toolbox.
|
||||
*/
|
||||
var toolbox = document.getElementById("clipboard_tray_toolbox");
|
||||
var moreboxes = document.getElementsByClassName("my_clipboard_tray_toolbox");
|
||||
let toolbox = document.getElementById("clipboard_tray_toolbox");
|
||||
let moreboxes = document.getElementsByClassName("my_clipboard_tray_toolbox");
|
||||
for (var i = 0; i < moreboxes.length; i += 1)
|
||||
{
|
||||
var box = moreboxes[i];
|
||||
let box = moreboxes[i];
|
||||
while (box.firstElementChild)
|
||||
{
|
||||
toolbox.appendChild(box.firstElementChild);
|
||||
|
@ -229,8 +229,8 @@ function on_tray_delete_button(event)
|
|||
/*
|
||||
Remove the clicked row from the clipboard.
|
||||
*/
|
||||
var clipboard_line = event.target.parentElement;
|
||||
var photo_id = clipboard_line.dataset.id;
|
||||
let clipboard_line = event.target.parentElement;
|
||||
let photo_id = clipboard_line.dataset.id;
|
||||
photo_clipboard.clipboard.delete(photo_id);
|
||||
photo_clipboard.save_clipboard();
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ function update_clipboard_tray()
|
|||
/*
|
||||
Rebuild the rows if the tray is open.
|
||||
*/
|
||||
var clipboard_tray = document.getElementById("clipboard_tray");
|
||||
let clipboard_tray = document.getElementById("clipboard_tray");
|
||||
if (clipboard_tray === null)
|
||||
{
|
||||
return;
|
||||
|
@ -252,24 +252,24 @@ function update_clipboard_tray()
|
|||
photo_clipboard.clipboard_tray_collapse();
|
||||
}
|
||||
|
||||
var tray_lines = document.getElementById("clipboard_tray_lines");
|
||||
let tray_lines = document.getElementById("clipboard_tray_lines");
|
||||
if (!clipboard_tray.classList.contains("hidden"))
|
||||
{
|
||||
common.delete_all_children(tray_lines);
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
photo_ids.sort();
|
||||
for (var i = 0; i < photo_ids.length; i += 1)
|
||||
{
|
||||
var clipboard_line = document.createElement("div");
|
||||
let clipboard_line = document.createElement("div");
|
||||
clipboard_line.classList.add("clipboard_tray_line");
|
||||
clipboard_line.dataset.id = photo_ids[i];
|
||||
|
||||
var clipboard_line_delete_button = document.createElement("button");
|
||||
let clipboard_line_delete_button = document.createElement("button");
|
||||
clipboard_line_delete_button.classList.add("remove_tag_button_perm");
|
||||
clipboard_line_delete_button.classList.add("red_button");
|
||||
clipboard_line_delete_button.onclick = photo_clipboard.on_tray_delete_button;
|
||||
|
||||
var clipboard_line_link = document.createElement("a");
|
||||
let clipboard_line_link = document.createElement("a");
|
||||
clipboard_line_link.target = "_blank";
|
||||
clipboard_line_link.href = "/photo/" + photo_ids[i];
|
||||
clipboard_line_link.innerText = photo_ids[i];
|
||||
|
@ -292,7 +292,7 @@ function open_full_clipboard_tab()
|
|||
photo_clipboard.update_clipboard_count =
|
||||
function update_clipboard_count()
|
||||
{
|
||||
var elements = document.getElementsByClassName("clipboard_count");
|
||||
let elements = document.getElementsByClassName("clipboard_count");
|
||||
for (var index = 0; index < elements.length; index += 1)
|
||||
{
|
||||
elements[index].innerText = photo_clipboard.clipboard.size;
|
||||
|
|
|
@ -98,20 +98,19 @@ function init_button_with_spinner()
|
|||
page, or two buttons which do opposite things and you only want one
|
||||
to run at a time.
|
||||
*/
|
||||
var buttons = Array.from(document.getElementsByClassName("button_with_spinner"));
|
||||
let buttons = Array.from(document.getElementsByClassName("button_with_spinner"));
|
||||
for (const button of buttons)
|
||||
{
|
||||
button.classList.remove("button_with_spinner");
|
||||
button.innerHTML = button.innerHTML.trim();
|
||||
|
||||
var holder = document.createElement("span");
|
||||
let holder = document.createElement("span");
|
||||
holder.classList.add("spinner_holder");
|
||||
holder.classList.add(button.dataset.holderClass || "spinner_holder");
|
||||
button.parentElement.insertBefore(holder, button);
|
||||
button.parentElement.removeChild(button);
|
||||
holder.appendChild(button);
|
||||
|
||||
var spinner_element;
|
||||
let spinner_element;
|
||||
if (button.dataset.spinnerId)
|
||||
{
|
||||
spinner_element = document.getElementById(button.dataset.spinnerId);
|
||||
|
@ -129,8 +128,8 @@ function init_button_with_spinner()
|
|||
spinner.add_to_spinner_group(button.dataset.spinnerGroup, button);
|
||||
}
|
||||
|
||||
var spin = new spinner.Spinner(spinner_element);
|
||||
var spin_delay = parseFloat(button.dataset.spinnerDelay) || 0;
|
||||
let spin = new spinner.Spinner(spinner_element);
|
||||
let spin_delay = parseFloat(button.dataset.spinnerDelay) || 0;
|
||||
|
||||
button.dataset.spinnerOpener = "spinner_opener_" + spinner.spinner_button_index;
|
||||
window[button.dataset.spinnerOpener] = function spinner_opener()
|
||||
|
@ -149,7 +148,7 @@ function init_button_with_spinner()
|
|||
button.disabled = false;
|
||||
}
|
||||
|
||||
var wrapped_onclick = button.onclick;
|
||||
let wrapped_onclick = button.onclick;
|
||||
button.removeAttribute('onclick');
|
||||
button.onclick = function()
|
||||
{
|
||||
|
|
|
@ -7,11 +7,11 @@ tag_autocomplete.DATALIST_ID = "tag_autocomplete_datalist";
|
|||
tag_autocomplete.init_datalist =
|
||||
function init_datalist()
|
||||
{
|
||||
var datalist;
|
||||
let datalist;
|
||||
datalist = document.getElementById(tag_autocomplete.DATALIST_ID);
|
||||
if (!datalist)
|
||||
{
|
||||
var datalist = document.createElement("datalist");
|
||||
datalist = document.createElement("datalist");
|
||||
datalist.id = tag_autocomplete.DATALIST_ID;
|
||||
document.body.appendChild(datalist);
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ function init_datalist()
|
|||
common.delete_all_children(datalist);
|
||||
for (var index = 0; index < tag_autocomplete.tagset["tags"].length; index += 1)
|
||||
{
|
||||
var option = document.createElement("option");
|
||||
let option = document.createElement("option");
|
||||
option.value = tag_autocomplete.tagset["tags"][index];
|
||||
datalist.appendChild(option);
|
||||
}
|
||||
for (var synonym in tag_autocomplete.tagset["synonyms"])
|
||||
{
|
||||
var option = document.createElement("option");
|
||||
let option = document.createElement("option");
|
||||
option.value = tag_autocomplete.tagset["synonyms"][synonym] + "+" + synonym;
|
||||
datalist.appendChild(option);
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ function tagname_replacements(tagname)
|
|||
tag_autocomplete.entry_with_tagname_replacements_hook =
|
||||
function entry_with_tagname_replacements_hook(event)
|
||||
{
|
||||
var cursor_position = event.target.selectionStart;
|
||||
var new_value = tag_autocomplete.tagname_replacements(event.target.value);
|
||||
let cursor_position = event.target.selectionStart;
|
||||
let new_value = tag_autocomplete.tagname_replacements(event.target.value);
|
||||
if (new_value != event.target.value)
|
||||
{
|
||||
event.target.value = new_value;
|
||||
|
@ -103,7 +103,7 @@ tag_autocomplete.update_tagset =
|
|||
function update_tagset()
|
||||
{
|
||||
console.log("Updating known tagset.");
|
||||
var url = "/all_tags.json";
|
||||
let url = "/all_tags.json";
|
||||
common.get(url, tag_autocomplete.update_tagset_callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -321,12 +321,12 @@ function add_child(child_id)
|
|||
|
||||
function paste_photo_clipboard()
|
||||
{
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.albums.add_photos(ALBUM_ID, photo_ids, common.refresh);
|
||||
}
|
||||
function unpaste_photo_clipboard()
|
||||
{
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.albums.remove_photos(ALBUM_ID, photo_ids, common.refresh);
|
||||
}
|
||||
|
||||
|
@ -348,8 +348,8 @@ function on_save(ed, edit_element_map, display_element_map)
|
|||
|
||||
ed.save();
|
||||
|
||||
var title_display = display_element_map["title"];
|
||||
var description_display = display_element_map["description"];
|
||||
let title_display = display_element_map["title"];
|
||||
let description_display = display_element_map["description"];
|
||||
|
||||
document.title = title_display.innerText + " | Albums";
|
||||
|
||||
|
@ -360,8 +360,8 @@ function on_save(ed, edit_element_map, display_element_map)
|
|||
}
|
||||
|
||||
edit_element_map["title"].value = edit_element_map["title"].value.trim();
|
||||
var title = edit_element_map["title"].value;
|
||||
var description = edit_element_map["description"].value;
|
||||
let title = edit_element_map["title"].value;
|
||||
let description = edit_element_map["description"].value;
|
||||
|
||||
ed.show_spinner();
|
||||
api.albums.edit(ALBUM_ID, title, description, callback);
|
||||
|
@ -391,7 +391,7 @@ function create_child(title)
|
|||
{
|
||||
title = undefined;
|
||||
}
|
||||
var parent_id = ALBUM_ID;
|
||||
let parent_id = ALBUM_ID;
|
||||
api.albums.create(title, parent_id, api.albums.callback_follow);
|
||||
}
|
||||
|
||||
|
@ -408,11 +408,11 @@ function on_album_drag_over(event)
|
|||
}
|
||||
function on_album_drag_drop(event)
|
||||
{
|
||||
var child_id = event.dataTransfer.getData("text");
|
||||
var child = document.getElementById(child_id);
|
||||
let child_id = event.dataTransfer.getData("text");
|
||||
let child = document.getElementById(child_id);
|
||||
child_id = child.dataset.id;
|
||||
var parent = event.currentTarget;
|
||||
var parent_id = parent.dataset.id;
|
||||
let parent = event.currentTarget;
|
||||
let parent_id = parent.dataset.id;
|
||||
event.dataTransfer.clearData();
|
||||
|
||||
if (child_id == parent_id)
|
||||
|
@ -420,8 +420,8 @@ function on_album_drag_drop(event)
|
|||
return;
|
||||
}
|
||||
|
||||
var child_title = child.querySelector('.album_card_title').textContent.trim();
|
||||
var parent_title = parent.querySelector('.album_card_title').textContent.trim();
|
||||
let child_title = child.querySelector('.album_card_title').textContent.trim();
|
||||
let parent_title = parent.querySelector('.album_card_title').textContent.trim();
|
||||
if (confirm(`Move\n${child_title}\ninto\n${parent_title}?`))
|
||||
{
|
||||
if (ALBUM_ID)
|
||||
|
|
|
@ -99,8 +99,8 @@
|
|||
<script type="text/javascript">
|
||||
function create_bookmark_form()
|
||||
{
|
||||
var url = document.getElementById("new_bookmark_url").value.trim();
|
||||
var title = document.getElementById("new_bookmark_title").value.trim();
|
||||
let url = document.getElementById("new_bookmark_url").value.trim();
|
||||
let title = document.getElementById("new_bookmark_title").value.trim();
|
||||
if (!url)
|
||||
{
|
||||
return;
|
||||
|
@ -135,9 +135,9 @@ function on_save(ed, edit_element_map, display_element_map)
|
|||
return;
|
||||
}
|
||||
|
||||
var bookmark_id = ed.misc_data["bookmark_id"];
|
||||
var title = edit_element_map["title"].value;
|
||||
var url = edit_element_map["url"].value;
|
||||
let bookmark_id = ed.misc_data["bookmark_id"];
|
||||
let title = edit_element_map["title"].value;
|
||||
let url = edit_element_map["url"].value;
|
||||
|
||||
ed.show_spinner();
|
||||
api.bookmarks.edit(bookmark_id, title, url, callback);
|
||||
|
@ -147,12 +147,12 @@ on_cancel = undefined;
|
|||
|
||||
function create_editors()
|
||||
{
|
||||
var cards = document.getElementsByClassName("bookmark_card");
|
||||
let cards = document.getElementsByClassName("bookmark_card");
|
||||
for (var index = 0; index < cards.length; index += 1)
|
||||
{
|
||||
var card = cards[index];
|
||||
var title_div = card.getElementsByClassName("bookmark_title")[0];
|
||||
var url_div = card.getElementsByClassName("bookmark_url")[0];
|
||||
let card = cards[index];
|
||||
let title_div = card.getElementsByClassName("bookmark_title")[0];
|
||||
let url_div = card.getElementsByClassName("bookmark_url")[0];
|
||||
ed = new editor.Editor([title_div, url_div], on_open, on_save, on_cancel);
|
||||
ed.misc_data["bookmark_id"] = card.dataset.bookmarkId;
|
||||
}
|
||||
|
|
|
@ -180,11 +180,11 @@ function refresh_divs()
|
|||
Add new divs to the page, and remove divs which the user has removed from
|
||||
their clipboard.
|
||||
*/
|
||||
for (var photo_id in divs)
|
||||
for (let photo_id of divs)
|
||||
{
|
||||
var photo_div = divs[photo_id];
|
||||
var should_keep = photo_clipboard.clipboard.has(photo_id);
|
||||
var on_page = holder.contains(photo_div);
|
||||
let photo_div = divs[photo_id];
|
||||
let should_keep = photo_clipboard.clipboard.has(photo_id);
|
||||
let on_page = holder.contains(photo_div);
|
||||
if (on_page && !should_keep)
|
||||
{
|
||||
holder.removeChild(photo_div)
|
||||
|
@ -206,9 +206,9 @@ function request_more_divs()
|
|||
{
|
||||
return;
|
||||
}
|
||||
var url = "/batch/photos/photo_card";
|
||||
var data = new FormData();
|
||||
var photo_ids = Array.from(needed).join(",");
|
||||
let url = "/batch/photos/photo_card";
|
||||
let data = new FormData();
|
||||
let photo_ids = Array.from(needed).join(",");
|
||||
data.append("photo_ids", photo_ids);
|
||||
function callback(response)
|
||||
{
|
||||
|
@ -244,10 +244,10 @@ photo_clipboard.on_save_hooks.push(my_clipboard_load_save_hook);
|
|||
|
||||
function add_remove_tag_callback(response)
|
||||
{
|
||||
var tagname = response.data.tagname;
|
||||
var message_area = document.getElementById("message_area");
|
||||
var message_positivity;
|
||||
var message_text;
|
||||
let tagname = response.data.tagname;
|
||||
let message_area = document.getElementById("message_area");
|
||||
let message_positivity;
|
||||
let message_text;
|
||||
|
||||
if ("error_type" in response.data)
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ function add_remove_tag_callback(response)
|
|||
}
|
||||
else if ("action" in response.data)
|
||||
{
|
||||
var action = response.data.action;
|
||||
let action = response.data.action;
|
||||
message_positivity = "message_positive";
|
||||
if (action == "add")
|
||||
{message_text = "Added tag " + tagname;}
|
||||
|
@ -272,13 +272,13 @@ function add_tag_form()
|
|||
if (photo_clipboard.clipboard.size == 0)
|
||||
{return;}
|
||||
|
||||
var box = document.getElementById("add_tag_textbox");
|
||||
var tagname = box.value.trim();
|
||||
let box = document.getElementById("add_tag_textbox");
|
||||
let tagname = box.value.trim();
|
||||
if (! tagname)
|
||||
{return}
|
||||
|
||||
box.value = "";
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.batch_add_tag(photo_ids, tagname, add_remove_tag_callback);
|
||||
}
|
||||
|
||||
|
@ -287,13 +287,13 @@ function remove_tag_form()
|
|||
if (photo_clipboard.clipboard.size == 0)
|
||||
{return;}
|
||||
|
||||
var box = document.getElementById("remove_tag_textbox");
|
||||
var tagname = box.value.trim();
|
||||
let box = document.getElementById("remove_tag_textbox");
|
||||
let tagname = box.value.trim();
|
||||
if (! tagname)
|
||||
{return}
|
||||
|
||||
box.value = "";
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.batch_remove_tag(photo_ids, tagname, add_remove_tag_callback);
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ function download_zip_form()
|
|||
if (photo_clipboard.clipboard.size == 0)
|
||||
{return;}
|
||||
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.get_download_zip_token(photo_ids, api.photos.callback_download_zip);
|
||||
}
|
||||
|
||||
|
@ -317,9 +317,9 @@ function refresh_metadata_callback(response)
|
|||
window[refresh_metadata_button.dataset.spinnerCloser]();
|
||||
if ("error_type" in response.data)
|
||||
{
|
||||
var message_area = document.getElementById("message_area");
|
||||
var message_positivity = "message_negative";
|
||||
var message_text = response.data.error_message;
|
||||
let message_area = document.getElementById("message_area");
|
||||
let message_positivity = "message_negative";
|
||||
let message_text = response.data.error_message;
|
||||
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||
}
|
||||
else
|
||||
|
@ -336,7 +336,7 @@ function refresh_metadata_form()
|
|||
return;
|
||||
}
|
||||
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.batch_refresh_metadata(photo_ids, refresh_metadata_callback);
|
||||
}
|
||||
|
||||
|
@ -344,9 +344,9 @@ function refresh_metadata_form()
|
|||
|
||||
function set_unset_searchhidden_callback(response)
|
||||
{
|
||||
var message_area = document.getElementById("message_area");
|
||||
var message_positivity;
|
||||
var message_text;
|
||||
let message_area = document.getElementById("message_area");
|
||||
let message_positivity;
|
||||
let message_text;
|
||||
if ("error_type" in response.data)
|
||||
{
|
||||
message_positivity = "message_negative";
|
||||
|
@ -364,7 +364,7 @@ function set_searchhidden_form()
|
|||
if (photo_clipboard.clipboard.size == 0)
|
||||
{return;}
|
||||
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.batch_set_searchhidden(photo_ids, set_unset_searchhidden_callback);
|
||||
}
|
||||
function unset_searchhidden_form()
|
||||
|
@ -372,7 +372,7 @@ function unset_searchhidden_form()
|
|||
if (photo_clipboard.clipboard.size == 0)
|
||||
{return;}
|
||||
|
||||
var photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
let photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
api.photos.batch_unset_searchhidden(photo_ids, set_unset_searchhidden_callback);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -92,8 +92,8 @@ var message_area = document.getElementById("message_area");
|
|||
function login_form(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
var username = document.getElementById("login_input_username").value;
|
||||
var password = document.getElementById("login_input_password").value;
|
||||
let username = document.getElementById("login_input_username").value;
|
||||
let password = document.getElementById("login_input_password").value;
|
||||
if (username == "" || password == "")
|
||||
{
|
||||
common.create_message_bubble(message_area, "message_negative", "Fill out the form, yo.");
|
||||
|
@ -105,10 +105,10 @@ function login_form(event)
|
|||
function register_form(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
var username = document.getElementById("register_input_username").value;
|
||||
var display_name = document.getElementById("register_input_display_name").value;
|
||||
var password_1 = document.getElementById("register_input_password_1").value;
|
||||
var password_2 = document.getElementById("register_input_password_2").value;
|
||||
let username = document.getElementById("register_input_username").value;
|
||||
let display_name = document.getElementById("register_input_display_name").value;
|
||||
let password_1 = document.getElementById("register_input_password_1").value;
|
||||
let password_2 = document.getElementById("register_input_password_2").value;
|
||||
if (username == "" || password_1 == "" || password_2 == "")
|
||||
{
|
||||
common.create_message_bubble(message_area, "message_negative", "Fill out the form, yo.");
|
||||
|
|
|
@ -283,7 +283,7 @@ var message_area = document.getElementById('message_area');
|
|||
|
||||
function add_photo_tag_form()
|
||||
{
|
||||
var tagname = document.getElementById("add_tag_textbox").value;
|
||||
let tagname = document.getElementById("add_tag_textbox").value;
|
||||
if (tagname == "")
|
||||
{
|
||||
return;
|
||||
|
@ -299,9 +299,9 @@ function remove_photo_tag_form(photo_id, tagname)
|
|||
|
||||
function add_remove_photo_tag_callback(response)
|
||||
{
|
||||
var message_text;
|
||||
var message_positivity;
|
||||
var tagname = response.data.tagname;
|
||||
let message_text;
|
||||
let message_positivity;
|
||||
let tagname = response.data.tagname;
|
||||
if ("error_type" in response.data)
|
||||
{
|
||||
message_positivity = "message_negative";
|
||||
|
@ -309,7 +309,7 @@ function add_remove_photo_tag_callback(response)
|
|||
}
|
||||
else
|
||||
{
|
||||
var action;
|
||||
let action;
|
||||
message_positivity = "message_positive";
|
||||
if (response.meta.request_url.includes("add_tag"))
|
||||
{
|
||||
|
@ -343,8 +343,8 @@ function generate_thumbnail_callback(response)
|
|||
|
||||
function generate_thumbnail_for_video(event)
|
||||
{
|
||||
var timestamp = document.querySelector("#right video").currentTime;
|
||||
var special = {"timestamp": timestamp};
|
||||
let timestamp = document.querySelector("#right video").currentTime;
|
||||
let special = {"timestamp": timestamp};
|
||||
api.photos.generate_thumbnail(PHOTO_ID, special, generate_thumbnail_callback)
|
||||
}
|
||||
|
||||
|
@ -352,8 +352,8 @@ var ZOOM_BG_URL = "url('{{photo|file_link}}')";
|
|||
function enable_hoverzoom(event)
|
||||
{
|
||||
//console.log("enable zoom");
|
||||
var photo_viewer = document.getElementById("photo_viewer");
|
||||
var photo_img = photo_viewer.children[0];
|
||||
let photo_viewer = document.getElementById("photo_viewer");
|
||||
let photo_img = photo_viewer.children[0];
|
||||
if (
|
||||
photo_img.naturalWidth < photo_viewer.offsetWidth &&
|
||||
photo_img.naturalHeight < photo_viewer.offsetHeight
|
||||
|
@ -372,8 +372,8 @@ function enable_hoverzoom(event)
|
|||
function disable_hoverzoom()
|
||||
{
|
||||
//console.log("disable zoom");
|
||||
var photo_viewer = document.getElementById("photo_viewer");
|
||||
var photo_img = photo_viewer.children[0];
|
||||
let photo_viewer = document.getElementById("photo_viewer");
|
||||
let photo_img = photo_viewer.children[0];
|
||||
|
||||
photo_img.style.opacity = "100";
|
||||
photo_viewer.style.cursor = "";
|
||||
|
@ -383,7 +383,7 @@ function disable_hoverzoom()
|
|||
}
|
||||
function toggle_hoverzoom(event)
|
||||
{
|
||||
var photo_img = document.getElementById("photo_viewer").children[0];
|
||||
let photo_img = document.getElementById("photo_viewer").children[0];
|
||||
if (photo_img.style.opacity === "0")
|
||||
{
|
||||
disable_hoverzoom();
|
||||
|
@ -392,7 +392,7 @@ function toggle_hoverzoom(event)
|
|||
{
|
||||
enable_hoverzoom(event);
|
||||
}
|
||||
var content_body = document.getElementById('content_body');
|
||||
let content_body = document.getElementById('content_body');
|
||||
if (getComputedStyle(content_body).getPropertyValue("--narrow") == 0)
|
||||
{
|
||||
add_tag_box.focus();
|
||||
|
@ -401,10 +401,10 @@ function toggle_hoverzoom(event)
|
|||
|
||||
function move_hoverzoom(event)
|
||||
{
|
||||
var photo_viewer = document.getElementById("photo_viewer");
|
||||
var photo_img = photo_viewer.children[0];
|
||||
var x;
|
||||
var y;
|
||||
let photo_viewer = document.getElementById("photo_viewer");
|
||||
let photo_img = photo_viewer.children[0];
|
||||
let x;
|
||||
let y;
|
||||
|
||||
/*
|
||||
When clicking on the image, the event handler takes the image as the event
|
||||
|
@ -415,8 +415,8 @@ function move_hoverzoom(event)
|
|||
the event triggers on the holder, the event X is based on its bounding box,
|
||||
but when it triggers on the image it's based on the viewport.
|
||||
*/
|
||||
var mouse_x = event.offsetX;
|
||||
var mouse_y = event.offsetY;
|
||||
let mouse_x = event.offsetX;
|
||||
let mouse_y = event.offsetY;
|
||||
if (event.target !== photo_viewer)
|
||||
{
|
||||
mouse_x -= photo_viewer.offsetLeft;
|
||||
|
@ -472,7 +472,7 @@ setTimeout(
|
|||
*/
|
||||
function()
|
||||
{
|
||||
var content_body = document.getElementById("content_body");
|
||||
let content_body = document.getElementById("content_body");
|
||||
if (getComputedStyle(content_body).getPropertyValue("--narrow") == 1)
|
||||
{
|
||||
add_tag_box.autofocus = false;
|
||||
|
|
|
@ -378,19 +378,19 @@ PARAM_DEFAULTS = {
|
|||
function add_searchtag(ul, value, inputted_list, li_class)
|
||||
{
|
||||
console.log("adding " + value);
|
||||
var already_have = inputted_list.indexOf(value) !== -1;
|
||||
let already_have = inputted_list.indexOf(value) !== -1;
|
||||
if (already_have)
|
||||
{return;}
|
||||
|
||||
inputted_list.push(value);
|
||||
var new_li = document.createElement("li");
|
||||
let new_li = document.createElement("li");
|
||||
new_li.className = li_class;
|
||||
|
||||
var new_span = document.createElement("span");
|
||||
let new_span = document.createElement("span");
|
||||
new_span.className = "tag_object";
|
||||
new_span.innerHTML = value;
|
||||
|
||||
var new_delbutton = document.createElement("button")
|
||||
let new_delbutton = document.createElement("button")
|
||||
new_delbutton.classList.add("remove_tag_button");
|
||||
new_delbutton.classList.add("red_button");
|
||||
new_delbutton.onclick = function(){remove_searchtag(ul, value, inputted_list)};
|
||||
|
@ -411,7 +411,7 @@ function add_searchtag_from_box(box, inputted_list, li_class)
|
|||
if (!box.value)
|
||||
{return;}
|
||||
|
||||
var value = box.value;
|
||||
let value = box.value;
|
||||
value = tag_autocomplete.resolve(value);
|
||||
if (value === null)
|
||||
{return;}
|
||||
|
@ -431,16 +431,16 @@ function add_searchtag_from_box(box, inputted_list, li_class)
|
|||
function remove_searchtag(ul, value, inputted_list)
|
||||
{
|
||||
console.log("removing " + value);
|
||||
var lis = ul.children;
|
||||
let lis = ul.children;
|
||||
//console.log(lis);
|
||||
for (var index = 0; index < lis.length; index += 1)
|
||||
{
|
||||
var li = lis[index];
|
||||
var tag_object = li.children[0];
|
||||
let li = lis[index];
|
||||
let tag_object = li.children[0];
|
||||
if (! tag_object.classList.contains("tag_object"))
|
||||
{continue}
|
||||
|
||||
var tagname = tag_object.innerHTML;
|
||||
let tagname = tag_object.innerHTML;
|
||||
if (tagname != value)
|
||||
{continue}
|
||||
|
||||
|
@ -456,23 +456,23 @@ function remove_searchtag(ul, value, inputted_list)
|
|||
function add_new_orderby()
|
||||
{
|
||||
/* Called by the green + button */
|
||||
var ul = document.getElementById("search_builder_orderby_ul");
|
||||
var lis = ul.children;
|
||||
let ul = document.getElementById("search_builder_orderby_ul");
|
||||
let lis = ul.children;
|
||||
if (lis.length >= 9)
|
||||
{
|
||||
/* 9 because there are only 9 sortable properties */
|
||||
return;
|
||||
}
|
||||
prev_li = lis[lis.length - 2];
|
||||
var new_li = prev_li.cloneNode(true);
|
||||
let new_li = prev_li.cloneNode(true);
|
||||
ul.insertBefore(new_li, prev_li.nextSibling);
|
||||
}
|
||||
|
||||
function orderby_remove_hook(button)
|
||||
{
|
||||
/* Called by the red button next to orderby dropdowns */
|
||||
var li = button.parentElement;
|
||||
var ul = li.parentElement;
|
||||
let li = button.parentElement;
|
||||
let ul = li.parentElement;
|
||||
// 2 because keep 1 row and the adder button
|
||||
if (ul.children.length>2)
|
||||
{
|
||||
|
@ -495,10 +495,10 @@ function orderby_hide_direction_hook(event)
|
|||
|
||||
function simplify_tagnames(tags)
|
||||
{
|
||||
var new_tags = [];
|
||||
let new_tags = [];
|
||||
for (var index = 0; index < tags.length; index += 1)
|
||||
{
|
||||
var tag = tags[index];
|
||||
let tag = tags[index];
|
||||
tag = tag.split(".");
|
||||
tag = tag[tag.length - 1];
|
||||
new_tags.push(tag);
|
||||
|
@ -511,8 +511,8 @@ function submit_search()
|
|||
/*
|
||||
Gather up all the form data and tags and compose the search URL
|
||||
*/
|
||||
var url = window.location.origin + "/search";
|
||||
var parameters = [];
|
||||
let url = window.location.origin + "/search";
|
||||
let parameters = [];
|
||||
|
||||
// If the user has left any text in the tag boxes, but not hit Enter on
|
||||
// them, then they will not be in the `inputted_` lists and would get
|
||||
|
@ -521,17 +521,17 @@ function submit_search()
|
|||
add_searchtag_from_box(input_mays, inputted_mays, "search_builder_mays_inputted");
|
||||
add_searchtag_from_box(input_forbids, inputted_forbids, "search_builder_forbids_inputted");
|
||||
|
||||
var has_tag_params = false;
|
||||
var musts = simplify_tagnames(inputted_musts).join(",");
|
||||
let has_tag_params = false;
|
||||
let musts = simplify_tagnames(inputted_musts).join(",");
|
||||
if (musts) {parameters.push("tag_musts=" + musts); has_tag_params=true;}
|
||||
|
||||
var mays = simplify_tagnames(inputted_mays).join(",");
|
||||
let mays = simplify_tagnames(inputted_mays).join(",");
|
||||
if (mays) {parameters.push("tag_mays=" + mays); has_tag_params=true;}
|
||||
|
||||
var forbids = simplify_tagnames(inputted_forbids).join(",");
|
||||
let forbids = simplify_tagnames(inputted_forbids).join(",");
|
||||
if (forbids) {parameters.push("tag_forbids=" + forbids); has_tag_params=true;}
|
||||
|
||||
var expression = document.getElementsByName("tag_expression")[0].value;
|
||||
let expression = document.getElementsByName("tag_expression")[0].value;
|
||||
if (expression)
|
||||
{
|
||||
//expression = expression.replace(new RegExp(" ", 'g'), "-");
|
||||
|
@ -539,12 +539,12 @@ function submit_search()
|
|||
has_tag_params=true;
|
||||
}
|
||||
|
||||
var basic_inputs = document.getElementsByClassName("basic_param");
|
||||
let basic_inputs = document.getElementsByClassName("basic_param");
|
||||
for (var index = 0; index < basic_inputs.length; index += 1)
|
||||
{
|
||||
var boxname = basic_inputs[index].name;
|
||||
var box = document.getElementsByName(boxname)[0];
|
||||
var value = box.value;
|
||||
let boxname = basic_inputs[index].name;
|
||||
let box = document.getElementsByName(boxname)[0];
|
||||
let value = box.value;
|
||||
value = value.split("&").join("%26");
|
||||
console.log(value);
|
||||
if (PARAM_DEFAULTS[boxname] == value)
|
||||
|
@ -563,15 +563,15 @@ function submit_search()
|
|||
orderby_params = [];
|
||||
for (var index = 0; index < orderby_rows.length; index += 1)
|
||||
{
|
||||
var row = orderby_rows[index];
|
||||
var column = row.children[0].value;
|
||||
let row = orderby_rows[index];
|
||||
let column = row.children[0].value;
|
||||
if (column == "random")
|
||||
{
|
||||
orderby_params.push(column);
|
||||
}
|
||||
else
|
||||
{
|
||||
var sorter = row.children[1].value;
|
||||
let sorter = row.children[1].value;
|
||||
orderby_params.push(column + "-" + sorter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ common.bind_box_to_button(add_tag_textbox, add_tag_button, false);
|
|||
|
||||
function easybake_form()
|
||||
{
|
||||
var easybake_string = add_tag_textbox.value;
|
||||
let easybake_string = add_tag_textbox.value;
|
||||
if (easybake_string === "")
|
||||
{
|
||||
add_tag_textbox.focus();
|
||||
|
@ -255,10 +255,9 @@ function tag_action_callback(response)
|
|||
}
|
||||
for (var index = 0; index < datas.length; index += 1)
|
||||
{
|
||||
var data = datas[index];
|
||||
var tagname = data.tagname;
|
||||
var message_positivity;
|
||||
var message_text;
|
||||
let tagname = data.tagname;
|
||||
let message_positivity;
|
||||
let message_text;
|
||||
if ("error_type" in data)
|
||||
{
|
||||
message_positivity = "message_negative";
|
||||
|
@ -266,7 +265,7 @@ function tag_action_callback(response)
|
|||
}
|
||||
else if ("action" in data)
|
||||
{
|
||||
var action = data.action;
|
||||
let action = data.action;
|
||||
message_positivity = "message_positive";
|
||||
if (action == "new_tag")
|
||||
{message_text = `Created tag ${tagname}`;}
|
||||
|
@ -312,8 +311,8 @@ function on_save(ed, edit_element_map, display_element_map)
|
|||
ed.hide_spinner();
|
||||
if (response.meta.status == 200)
|
||||
{
|
||||
var new_name = response.data.name;
|
||||
var new_description = response.data.description;
|
||||
let new_name = response.data.name;
|
||||
let new_description = response.data.description;
|
||||
document.title = new_name + " | Tags";
|
||||
window.history.replaceState(null, null, "/tag/" + new_name);
|
||||
name_editor.value = new_name;
|
||||
|
@ -327,14 +326,14 @@ function on_save(ed, edit_element_map, display_element_map)
|
|||
}
|
||||
}
|
||||
|
||||
var name_display = display_element_map["name"];
|
||||
var name_editor = edit_element_map["name"];
|
||||
var description_display = display_element_map["description"];
|
||||
var description_editor = edit_element_map["description"];
|
||||
let name_display = display_element_map["name"];
|
||||
let name_editor = edit_element_map["name"];
|
||||
let description_display = display_element_map["description"];
|
||||
let description_editor = edit_element_map["description"];
|
||||
|
||||
var tag_name = name_display.innerText;
|
||||
var name = name_editor.value;
|
||||
var description = description_editor.value;
|
||||
let tag_name = name_display.innerText;
|
||||
let name = name_editor.value;
|
||||
let description = description_editor.value;
|
||||
|
||||
ed.show_spinner();
|
||||
api.tags.edit(tag_name, name, description, callback)
|
||||
|
|
Loading…
Reference in a new issue