2021-06-22 20:38:08 +00:00
|
|
|
<!DOCTYPE html>
|
2018-02-18 03:12:34 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{% import "header.html" as header %}
|
|
|
|
{% import "clipboard_tray.html" as clipboard_tray %}
|
|
|
|
<title>Clipboard</title>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
2022-05-28 23:21:23 +00:00
|
|
|
<link rel="icon" href="/favicon.png" type="image/png"/>
|
2018-02-24 20:51:36 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/common.css">
|
2020-09-03 18:50:16 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/etiquette.css">
|
2021-01-08 21:40:34 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/cards.css">
|
2018-02-24 09:06:27 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/clipboard_tray.css">
|
2019-08-14 20:43:35 +00:00
|
|
|
{% if theme %}<link rel="stylesheet" href="/static/css/theme_{{theme}}.css">{% endif %}
|
2018-02-24 20:51:36 +00:00
|
|
|
<script src="/static/js/common.js"></script>
|
2018-09-23 23:53:49 +00:00
|
|
|
<script src="/static/js/api.js"></script>
|
2021-05-29 15:46:25 +00:00
|
|
|
<script src="/static/js/cards.js"></script>
|
2018-07-14 21:19:13 +00:00
|
|
|
<script src="/static/js/hotkeys.js"></script>
|
2022-09-30 00:34:35 +00:00
|
|
|
<script src="/static/js/http.js"></script>
|
2018-09-23 22:17:31 +00:00
|
|
|
<script src="/static/js/photo_clipboard.js"></script>
|
2022-03-15 20:49:20 +00:00
|
|
|
<script src="/static/js/spinners.js"></script>
|
2018-07-23 03:45:16 +00:00
|
|
|
<script src="/static/js/tag_autocomplete.js"></script>
|
2018-02-18 03:12:34 +00:00
|
|
|
|
|
|
|
<style>
|
2020-11-05 00:57:41 +00:00
|
|
|
#left
|
|
|
|
{
|
|
|
|
display: grid;
|
|
|
|
grid-row-gap: 8px;
|
|
|
|
grid-auto-rows: max-content;
|
|
|
|
}
|
2018-02-22 23:23:57 +00:00
|
|
|
#right
|
|
|
|
{
|
2020-09-19 02:58:22 +00:00
|
|
|
display: grid;
|
2019-08-26 22:15:02 +00:00
|
|
|
grid-row-gap: 8px;
|
2020-09-19 02:58:22 +00:00
|
|
|
padding: 8px;
|
|
|
|
background-color: var(--color_transparency);
|
2019-08-26 22:15:02 +00:00
|
|
|
}
|
|
|
|
#toolbox
|
|
|
|
{
|
|
|
|
display: grid;
|
|
|
|
grid-auto-rows: min-content;
|
2019-08-14 20:49:08 +00:00
|
|
|
grid-row-gap: 8px;
|
2018-02-22 23:23:57 +00:00
|
|
|
}
|
2019-08-26 22:15:02 +00:00
|
|
|
#toolbox > *
|
2018-10-22 01:46:27 +00:00
|
|
|
{
|
|
|
|
display: flex;
|
2022-11-06 06:25:06 +00:00
|
|
|
gap: 4px;
|
2018-10-22 01:46:27 +00:00
|
|
|
}
|
2019-08-26 22:15:02 +00:00
|
|
|
#toolbox input
|
2019-08-26 00:36:05 +00:00
|
|
|
{
|
|
|
|
margin: 0;
|
|
|
|
}
|
2019-08-26 22:15:02 +00:00
|
|
|
#toolbox .spinner_holder
|
2019-06-15 23:04:06 +00:00
|
|
|
{
|
|
|
|
display: flex;
|
|
|
|
flex: 1;
|
|
|
|
}
|
2019-08-26 22:15:02 +00:00
|
|
|
#toolbox button
|
2018-10-22 01:46:27 +00:00
|
|
|
{
|
|
|
|
flex: 1;
|
|
|
|
}
|
2019-08-26 22:15:02 +00:00
|
|
|
#toolbox { grid-area: toolbox; }
|
|
|
|
#message_area { grid-area: message_area; }
|
2018-10-22 01:46:27 +00:00
|
|
|
#add_tag_area input,
|
|
|
|
#remove_tag_area input
|
|
|
|
{
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
#add_tag_area button,
|
|
|
|
#remove_tag_area button
|
|
|
|
{
|
|
|
|
flex: initial;
|
2018-02-22 23:23:57 +00:00
|
|
|
}
|
2018-11-05 02:36:17 +00:00
|
|
|
|
2020-09-19 04:12:28 +00:00
|
|
|
@media screen and (min-width: 800px)
|
|
|
|
{
|
|
|
|
#right
|
|
|
|
{
|
|
|
|
grid-template:
|
|
|
|
"toolbox" auto
|
|
|
|
"message_area" 1fr
|
|
|
|
/ 1fr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-22 01:46:27 +00:00
|
|
|
@media screen and (max-width: 800px)
|
|
|
|
{
|
|
|
|
#right
|
|
|
|
{
|
|
|
|
grid-template:
|
2019-08-26 22:15:02 +00:00
|
|
|
"toolbox message_area" 1fr
|
|
|
|
/1fr minmax(50px, 200px);
|
2018-10-22 01:46:27 +00:00
|
|
|
}
|
|
|
|
}
|
2018-02-18 03:12:34 +00:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2023-02-02 06:04:44 +00:00
|
|
|
{{header.make_header(session=request.session)}}
|
2020-09-19 02:58:22 +00:00
|
|
|
<div id="content_body" class="sticky_side_right sticky_bottom_right">
|
2018-02-22 23:23:57 +00:00
|
|
|
<div id="left">
|
2019-08-14 20:49:08 +00:00
|
|
|
|
2020-11-05 00:57:41 +00:00
|
|
|
<div id="clipboard_photos_holder" class="photos_holder panel">
|
2018-02-22 23:23:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-11-13 06:15:59 +00:00
|
|
|
<div id="right">
|
2019-08-26 22:15:02 +00:00
|
|
|
<div id="toolbox">
|
2022-11-06 06:25:06 +00:00
|
|
|
<div id="count_clear_area">The clipboard contains <span class="dynamic_clipboard_count">0</span> items.
|
|
|
|
<button id="clear_clipboard_button" class="red_button" onclick="return photo_clipboard.clear_clipboard();">Clear it.</button>
|
|
|
|
</div>
|
2019-08-26 22:15:02 +00:00
|
|
|
<div id="add_tag_area">
|
2020-09-04 18:20:51 +00:00
|
|
|
<input type="text" id="add_tag_textbox" class="entry_with_history entry_with_tagname_replacements" list="tag_autocomplete_datalist">
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="add_tag_button green_button" id="add_tag_button" onclick="return add_tag_form();">Add tag</button>
|
2019-08-26 22:15:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="remove_tag_area">
|
2020-09-04 18:20:51 +00:00
|
|
|
<input type="text" id="remove_tag_textbox" class="entry_with_history entry_with_tagname_replacements" list="tag_autocomplete_datalist">
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="red_button" id="remove_tag_button" onclick="return remove_tag_form();">Remove tag</button>
|
2019-08-26 22:15:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="refresh_metadata_area">
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="green_button button_with_spinner" id="refresh_metadata_button" data-spinner-delay="500" onclick="return refresh_metadata_form();">Refresh metadata</button>
|
2019-08-26 22:15:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="searchhidden_area">
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="yellow_button" id="set_searchhidden_button" onclick="return set_searchhidden_form();">Searchhide</button>
|
|
|
|
<button class="yellow_button" id="unset_searchhidden_button" onclick="return unset_searchhidden_form();">Unhide</button>
|
2019-08-26 22:15:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="download_zip_area">
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="yellow_button" id="download_zip_button" onclick="return download_zip_form();">Download .zip</button>
|
2019-08-26 22:15:02 +00:00
|
|
|
</div>
|
2018-08-15 06:02:06 +00:00
|
|
|
</div>
|
|
|
|
|
2018-02-22 23:23:57 +00:00
|
|
|
<div id="message_area">
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-22 01:46:27 +00:00
|
|
|
</div>
|
2018-02-18 03:12:34 +00:00
|
|
|
</body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2020-12-26 20:14:42 +00:00
|
|
|
// divs maps photo IDs to the photo card div which will be shown in the holder.
|
|
|
|
// They are stored in this map so we can update them from API data without
|
|
|
|
// navigating the dom for them.
|
2020-09-15 01:33:53 +00:00
|
|
|
const divs = {};
|
|
|
|
const needed = new Set();
|
2020-11-05 00:57:41 +00:00
|
|
|
const holder = document.getElementById("clipboard_photos_holder");
|
2018-02-18 03:12:34 +00:00
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const add_box = document.getElementById("add_tag_textbox");
|
|
|
|
const add_button = document.getElementById("add_tag_button");
|
2018-07-23 02:12:08 +00:00
|
|
|
common.bind_box_to_button(add_box, add_button);
|
2018-02-24 21:23:35 +00:00
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const remove_box = document.getElementById("remove_tag_textbox");
|
|
|
|
const remove_button = document.getElementById("remove_tag_button");
|
2018-07-23 02:12:08 +00:00
|
|
|
common.bind_box_to_button(remove_box, remove_button);
|
2018-02-22 23:23:57 +00:00
|
|
|
|
2018-02-18 03:12:34 +00:00
|
|
|
function recalculate_needed()
|
|
|
|
{
|
2020-09-03 18:46:26 +00:00
|
|
|
/*
|
|
|
|
Populate the global `needed` set with all photo ids which are on the
|
|
|
|
clipboard but not on the page yet. When this page is first loaded, that
|
|
|
|
will be all ids. If the user adds more photos to their clipboard in a
|
|
|
|
different tab and returns to this tab, then the new ids will be needed.
|
|
|
|
|
|
|
|
This function only calculates which ids are needed. The actual fetching of
|
|
|
|
divs is in `request_more_divs`.
|
|
|
|
*/
|
2020-09-15 01:33:53 +00:00
|
|
|
needed.clear();
|
2020-09-03 22:33:37 +00:00
|
|
|
for (const photo_id of photo_clipboard.clipboard)
|
2018-02-18 03:12:34 +00:00
|
|
|
{
|
|
|
|
if (!(photo_id in divs))
|
|
|
|
{
|
|
|
|
needed.add(photo_id);
|
|
|
|
}
|
2020-09-03 21:18:05 +00:00
|
|
|
}
|
2018-02-18 03:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function refresh_divs()
|
|
|
|
{
|
2020-09-03 18:46:26 +00:00
|
|
|
/*
|
|
|
|
Add new divs to the page, and remove divs which the user has removed from
|
|
|
|
their clipboard.
|
|
|
|
*/
|
2020-09-15 01:33:53 +00:00
|
|
|
// 'in' instead of 'of' is intentional here because divs is a dict.
|
2020-09-03 22:33:37 +00:00
|
|
|
for (const photo_id in divs)
|
2018-02-18 03:12:34 +00:00
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_div = divs[photo_id];
|
|
|
|
const should_keep = photo_clipboard.clipboard.has(photo_id);
|
|
|
|
const on_page = holder.contains(photo_div);
|
2018-02-18 03:12:34 +00:00
|
|
|
if (on_page && !should_keep)
|
|
|
|
{
|
|
|
|
holder.removeChild(photo_div)
|
|
|
|
}
|
|
|
|
if (!on_page && should_keep)
|
|
|
|
{
|
|
|
|
holder.appendChild(photo_div)
|
|
|
|
}
|
|
|
|
}
|
2021-01-03 08:17:36 +00:00
|
|
|
photo_clipboard.apply_check_all();
|
2020-12-26 20:14:42 +00:00
|
|
|
if (holder.childElementCount == 0)
|
|
|
|
{
|
|
|
|
holder.classList.add("hidden");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
holder.classList.remove("hidden");
|
|
|
|
}
|
2018-02-18 03:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function request_more_divs()
|
|
|
|
{
|
2020-09-03 18:46:26 +00:00
|
|
|
/*
|
|
|
|
Using the ids in `needed`, download more photo card divs and place them
|
|
|
|
into `divs`, so that `refresh_divs` can then add them to the page.
|
|
|
|
*/
|
2018-02-18 03:12:34 +00:00
|
|
|
if (needed.size == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2021-05-29 15:46:25 +00:00
|
|
|
const url = "/batch/photos";
|
2020-09-15 01:33:53 +00:00
|
|
|
const data = new FormData();
|
|
|
|
const photo_ids = Array.from(needed).join(",");
|
2018-02-18 03:12:34 +00:00
|
|
|
data.append("photo_ids", photo_ids);
|
|
|
|
function callback(response)
|
|
|
|
{
|
2020-06-29 00:54:16 +00:00
|
|
|
if (response.meta.status !== 200)
|
2018-02-18 03:12:34 +00:00
|
|
|
{
|
2020-11-07 06:50:05 +00:00
|
|
|
alert(JSON.stringify(response));
|
2018-02-18 03:12:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-05-29 15:46:25 +00:00
|
|
|
for (const photo of response.data)
|
2018-02-18 03:12:34 +00:00
|
|
|
{
|
2021-05-29 15:46:25 +00:00
|
|
|
photo_div = cards.photos.create(photo);
|
|
|
|
divs[photo.id] = photo_div;
|
|
|
|
needed.delete(photo.id)
|
2018-02-18 03:12:34 +00:00
|
|
|
}
|
2018-07-23 02:43:07 +00:00
|
|
|
photo_clipboard.apply_check_all();
|
2020-12-26 20:13:54 +00:00
|
|
|
if (needed.size > 0)
|
|
|
|
{
|
|
|
|
console.log("Needed but not received: " + Array.from(needed));
|
|
|
|
}
|
2020-12-26 20:14:42 +00:00
|
|
|
refresh_divs();
|
2018-02-18 03:12:34 +00:00
|
|
|
}
|
2022-09-30 00:34:35 +00:00
|
|
|
http.post({
|
|
|
|
url: url,
|
|
|
|
data: data,
|
|
|
|
callback: callback,
|
|
|
|
});
|
2018-02-18 03:12:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function my_clipboard_load_save_hook()
|
2018-02-18 03:12:34 +00:00
|
|
|
{
|
|
|
|
recalculate_needed();
|
|
|
|
request_more_divs();
|
|
|
|
refresh_divs();
|
|
|
|
}
|
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
photo_clipboard.on_load_hooks.push(my_clipboard_load_save_hook);
|
|
|
|
photo_clipboard.on_save_hooks.push(my_clipboard_load_save_hook);
|
2018-02-22 23:23:57 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2018-02-22 23:23:57 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function add_remove_tag_callback(response)
|
2018-02-22 23:23:57 +00:00
|
|
|
{
|
2020-11-07 06:50:05 +00:00
|
|
|
if (! response.meta.json_ok)
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
return;
|
|
|
|
}
|
2020-09-15 01:33:53 +00:00
|
|
|
const tagname = response.data.tagname;
|
|
|
|
const message_area = document.getElementById("message_area");
|
2020-09-03 22:02:37 +00:00
|
|
|
let message_positivity;
|
|
|
|
let message_text;
|
2018-02-22 23:23:57 +00:00
|
|
|
|
2020-06-29 00:54:16 +00:00
|
|
|
if ("error_type" in response.data)
|
2018-02-22 23:23:57 +00:00
|
|
|
{
|
|
|
|
message_positivity = "message_negative";
|
2020-06-29 00:54:16 +00:00
|
|
|
message_text = response.data.error_message;
|
2018-02-22 23:23:57 +00:00
|
|
|
}
|
2020-06-29 00:54:16 +00:00
|
|
|
else if ("action" in response.data)
|
2018-02-22 23:23:57 +00:00
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const action = response.data.action;
|
2018-02-22 23:23:57 +00:00
|
|
|
message_positivity = "message_positive";
|
|
|
|
if (action == "add")
|
|
|
|
{message_text = "Added tag " + tagname;}
|
|
|
|
|
|
|
|
else if (action == "remove")
|
|
|
|
{message_text = "Removed tag " + tagname;}
|
|
|
|
}
|
2018-07-23 02:12:08 +00:00
|
|
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
2018-02-22 23:23:57 +00:00
|
|
|
}
|
2020-08-31 02:18:06 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function add_tag_form()
|
|
|
|
{
|
2020-08-31 02:18:06 +00:00
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
|
|
|
{return;}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const box = document.getElementById("add_tag_textbox");
|
|
|
|
const tagname = box.value.trim();
|
2018-08-15 06:24:12 +00:00
|
|
|
if (! tagname)
|
|
|
|
{return}
|
2018-02-24 21:23:35 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
box.value = "";
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.batch_add_tag(photo_ids, tagname, add_remove_tag_callback);
|
2018-08-15 06:24:12 +00:00
|
|
|
}
|
2020-08-31 02:18:06 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function remove_tag_form()
|
2018-08-15 06:02:06 +00:00
|
|
|
{
|
2020-08-31 02:18:06 +00:00
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
|
|
|
{return;}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const box = document.getElementById("remove_tag_textbox");
|
|
|
|
const tagname = box.value.trim();
|
2018-08-15 06:24:12 +00:00
|
|
|
if (! tagname)
|
|
|
|
{return}
|
2018-08-15 06:02:06 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
box.value = "";
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.batch_remove_tag(photo_ids, tagname, add_remove_tag_callback);
|
2018-08-15 06:02:06 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 23:55:47 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function download_zip_form()
|
2018-02-24 21:23:35 +00:00
|
|
|
{
|
2018-07-23 02:43:07 +00:00
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
2018-02-24 21:23:35 +00:00
|
|
|
{return;}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.get_download_zip_token(photo_ids, api.photos.callback_download_zip);
|
2018-02-24 21:23:35 +00:00
|
|
|
}
|
2018-08-15 06:24:12 +00:00
|
|
|
|
2019-04-27 23:55:47 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const refresh_metadata_button = document.getElementById("refresh_metadata_button");
|
2019-04-27 23:55:26 +00:00
|
|
|
|
2018-02-24 21:23:35 +00:00
|
|
|
function refresh_metadata_callback(response)
|
|
|
|
{
|
2019-06-15 23:04:06 +00:00
|
|
|
window[refresh_metadata_button.dataset.spinnerCloser]();
|
2020-11-07 06:50:05 +00:00
|
|
|
if (! response.meta.json_ok)
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
return;
|
|
|
|
}
|
2020-06-29 00:54:16 +00:00
|
|
|
if ("error_type" in response.data)
|
2018-02-24 21:23:35 +00:00
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const message_area = document.getElementById("message_area");
|
|
|
|
const message_positivity = "message_negative";
|
|
|
|
const message_text = response.data.error_message;
|
2018-07-23 02:12:08 +00:00
|
|
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
2018-02-24 21:23:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-07-29 08:25:53 +00:00
|
|
|
common.refresh();
|
2018-02-24 21:23:35 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-27 23:55:26 +00:00
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function refresh_metadata_form()
|
|
|
|
{
|
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
2020-05-29 02:02:07 +00:00
|
|
|
{
|
2022-03-15 20:49:20 +00:00
|
|
|
return spinners.BAIL;
|
2020-05-29 02:02:07 +00:00
|
|
|
}
|
2018-03-10 01:10:27 +00:00
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.batch_refresh_metadata(photo_ids, refresh_metadata_callback);
|
2018-08-15 06:24:12 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 23:55:47 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-08-15 06:24:12 +00:00
|
|
|
function set_unset_searchhidden_callback(response)
|
2018-03-10 01:10:27 +00:00
|
|
|
{
|
2020-11-07 06:50:05 +00:00
|
|
|
if (! response.meta.json_ok)
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
return;
|
|
|
|
}
|
2020-09-15 01:33:53 +00:00
|
|
|
const message_area = document.getElementById("message_area");
|
2020-09-03 22:02:37 +00:00
|
|
|
let message_positivity;
|
|
|
|
let message_text;
|
2020-06-29 00:54:16 +00:00
|
|
|
if ("error_type" in response.data)
|
2018-03-10 01:10:27 +00:00
|
|
|
{
|
|
|
|
message_positivity = "message_negative";
|
2020-06-29 00:54:16 +00:00
|
|
|
message_text = response.data.error_message;
|
2018-03-10 01:10:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
message_positivity = "message_positive";
|
2020-11-07 06:22:41 +00:00
|
|
|
message_text = "Success.";
|
2018-03-10 01:10:27 +00:00
|
|
|
}
|
2018-07-23 02:12:08 +00:00
|
|
|
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
2018-03-10 01:10:27 +00:00
|
|
|
}
|
2018-08-15 06:24:12 +00:00
|
|
|
function set_searchhidden_form()
|
2018-03-10 01:10:27 +00:00
|
|
|
{
|
2018-07-23 02:43:07 +00:00
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
2018-07-20 05:42:21 +00:00
|
|
|
{return;}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.batch_set_searchhidden(photo_ids, set_unset_searchhidden_callback);
|
2018-03-10 01:10:27 +00:00
|
|
|
}
|
2018-08-15 06:24:12 +00:00
|
|
|
function unset_searchhidden_form()
|
2018-03-10 01:10:27 +00:00
|
|
|
{
|
2018-07-23 02:43:07 +00:00
|
|
|
if (photo_clipboard.clipboard.size == 0)
|
2018-07-20 05:42:21 +00:00
|
|
|
{return;}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const photo_ids = Array.from(photo_clipboard.clipboard);
|
2020-08-31 02:18:06 +00:00
|
|
|
api.photos.batch_unset_searchhidden(photo_ids, set_unset_searchhidden_callback);
|
2018-03-10 01:10:27 +00:00
|
|
|
}
|
2021-06-04 00:42:46 +00:00
|
|
|
|
|
|
|
function on_pageload()
|
|
|
|
{
|
|
|
|
photo_clipboard.register_hotkeys();
|
|
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", on_pageload);
|
2018-02-18 03:12:34 +00:00
|
|
|
</script>
|
|
|
|
</html>
|