2021-06-22 20:38:08 +00:00
|
|
|
<!DOCTYPE html>
|
2016-09-18 08:33:46 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{% import "header.html" as header %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{% import "cards.html" as cards %}
|
2017-12-16 11:47:54 +00:00
|
|
|
{% import "clipboard_tray.html" as clipboard_tray %}
|
2016-09-18 08:33:46 +00:00
|
|
|
<title>Search</title>
|
|
|
|
<meta charset="UTF-8">
|
2017-07-21 06:10:48 +00:00
|
|
|
<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>
|
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>
|
2018-07-23 01:17:39 +00:00
|
|
|
<script src="/static/js/tag_autocomplete.js"></script>
|
2016-11-27 09:06:11 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
<style>
|
2018-11-05 02:36:17 +00:00
|
|
|
#search_builder_form
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
2018-11-05 02:36:17 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
#error_message_area
|
|
|
|
{
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
2016-12-21 09:11:50 +00:00
|
|
|
align-items: center;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
2019-08-14 20:47:59 +00:00
|
|
|
#happy_message_area
|
|
|
|
{
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2018-09-23 22:08:39 +00:00
|
|
|
.error_message
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
align-self: center;
|
2017-03-31 02:34:39 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
padding: 2px;
|
2017-03-31 02:34:39 +00:00
|
|
|
|
|
|
|
background-color: #f00;
|
|
|
|
|
|
|
|
color: #fff;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
#left
|
|
|
|
{
|
2017-03-31 02:34:39 +00:00
|
|
|
flex: 1;
|
|
|
|
|
2020-09-30 00:49:03 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
2017-03-04 06:30:57 +00:00
|
|
|
word-wrap: break-word;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
2020-09-30 00:49:03 +00:00
|
|
|
#tags_on_this_page_holder
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
This allows the search results to dominate the height of the page, and
|
|
|
|
left will simply match that height then scroll the rest of
|
|
|
|
tags_on_this_page.
|
|
|
|
*/
|
|
|
|
position: relative;
|
|
|
|
flex: 1;
|
|
|
|
min-height: 200px;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
2020-01-15 00:44:12 +00:00
|
|
|
#tags_on_this_page_list
|
|
|
|
{
|
|
|
|
list-style-type: none;
|
2020-11-04 00:38:33 +00:00
|
|
|
margin: 0;
|
2020-01-15 00:44:12 +00:00
|
|
|
padding: 0;
|
2020-09-30 00:49:03 +00:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
2020-01-15 00:44:12 +00:00
|
|
|
}
|
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
#right
|
|
|
|
{
|
|
|
|
flex: 1;
|
|
|
|
}
|
2020-09-19 04:12:28 +00:00
|
|
|
|
|
|
|
@media screen and (min-width: 800px)
|
|
|
|
{
|
2017-02-25 06:07:59 +00:00
|
|
|
#content_body
|
|
|
|
{
|
2018-09-23 22:08:39 +00:00
|
|
|
grid-template:
|
2020-09-19 04:12:28 +00:00
|
|
|
"left right" 1fr
|
|
|
|
/ 310px 1fr;
|
2017-02-25 06:07:59 +00:00
|
|
|
}
|
2020-09-19 04:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and (max-width: 800px)
|
|
|
|
{
|
|
|
|
#content_body
|
2017-02-25 06:07:59 +00:00
|
|
|
{
|
2020-09-19 04:12:28 +00:00
|
|
|
grid-template:
|
|
|
|
"right" auto
|
|
|
|
"left" auto
|
|
|
|
/ auto;
|
2017-02-25 06:07:59 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-19 04:12:28 +00:00
|
|
|
|
2016-11-07 02:00:30 +00:00
|
|
|
.prev_next_holder
|
|
|
|
{
|
2016-12-24 03:49:51 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2016-11-07 02:00:30 +00:00
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
.prev_page
|
|
|
|
{
|
2016-12-24 03:49:51 +00:00
|
|
|
margin-right: 10px;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
.next_page
|
|
|
|
{
|
2016-12-24 03:49:51 +00:00
|
|
|
margin-left: 10px;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
.prev_page, .next_page
|
|
|
|
{
|
2016-12-24 03:49:51 +00:00
|
|
|
display: flex;
|
2017-03-31 02:34:39 +00:00
|
|
|
flex: 1;
|
2016-12-24 03:49:51 +00:00
|
|
|
justify-content: center;
|
2017-03-31 02:34:39 +00:00
|
|
|
|
|
|
|
border: 1px solid black;
|
|
|
|
|
2020-06-25 17:03:50 +00:00
|
|
|
background-color: var(--color_secondary);
|
2017-03-31 02:34:39 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
font-size: 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search_builder_tagger,
|
|
|
|
#search_builder_orderby_ul
|
|
|
|
{
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
{% macro prev_next_buttons() %}
|
|
|
|
{% if prev_page_url or next_page_url %}
|
|
|
|
<div class="prev_next_holder">
|
|
|
|
{% if prev_page_url %}
|
|
|
|
<a class="prev_page" href="{{prev_page_url}}">Previous</a>
|
|
|
|
{% else %}
|
|
|
|
<a class="prev_page"><br></a>
|
|
|
|
{% endif %}
|
|
|
|
{% if next_page_url %}
|
|
|
|
<a class="next_page" href="{{next_page_url}}">Next</a>
|
|
|
|
{% else %}
|
|
|
|
<a class="next_page"><br></a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro create_orderby_li(selected_column, selected_sorter) %}
|
|
|
|
<li class="search_builder_orderby_li">
|
2021-06-01 21:12:09 +00:00
|
|
|
<select class="select_orderby_column" onchange="return orderby_hide_direction_hook(event);">
|
2020-10-13 05:30:06 +00:00
|
|
|
<option value="created" {{"selected" if selected_column=="created" else ""}}>Creation date</option>
|
2021-01-01 21:39:44 +00:00
|
|
|
<option value="basename" {{"selected" if selected_column=="basename" else ""}}>Filename</option>
|
2021-01-01 21:37:17 +00:00
|
|
|
<option value="area" {{"selected" if selected_column=="area" else ""}}>Area</option>
|
2020-10-13 05:30:06 +00:00
|
|
|
<option value="width" {{"selected" if selected_column=="width" else ""}}>Width</option>
|
|
|
|
<option value="height" {{"selected" if selected_column=="height" else ""}}>Height</option>
|
2022-08-14 01:08:45 +00:00
|
|
|
<option value="aspectratio" {{"selected" if selected_column=="aspectratio" else ""}}>Aspect Ratio</option>
|
2020-10-13 05:30:06 +00:00
|
|
|
<option value="bytes" {{"selected" if selected_column=="bytes" else ""}}>File size</option>
|
|
|
|
<option value="duration" {{"selected" if selected_column=="duration" else ""}}>Duration</option>
|
2021-01-01 21:37:17 +00:00
|
|
|
<option value="bitrate" {{"selected" if selected_column=="bitrate" else ""}}>Bitrate</option>
|
2020-10-13 05:30:06 +00:00
|
|
|
<option value="tagged_at" {{"selected" if selected_column=="tagged_at" else ""}}>Recently tagged</option>
|
|
|
|
<option value="random" {{"selected" if selected_column=="random" else ""}}>Random</option>
|
2016-09-18 08:33:46 +00:00
|
|
|
</select>
|
2021-06-01 21:12:09 +00:00
|
|
|
<select class="select_orderby_direction" {% if selected_column=="random" %}class="hidden"{% endif %}>
|
2018-10-22 01:46:27 +00:00
|
|
|
<option value="desc" {{"selected" if selected_sorter=="desc" else ""}} >Descending</option>
|
|
|
|
<option value="asc" {{"selected" if selected_sorter=="asc" else ""}} >Ascending</option>
|
2016-09-18 08:33:46 +00:00
|
|
|
</select>
|
2020-09-04 17:37:04 +00:00
|
|
|
<button class="remove_tag_button_perm red_button" onclick="return orderby_remove_hook(this);"></button>
|
2016-09-18 08:33:46 +00:00
|
|
|
</li>
|
|
|
|
{% endmacro %}
|
2016-11-27 09:06:11 +00:00
|
|
|
</head>
|
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
<body>
|
2018-02-18 02:19:47 +00:00
|
|
|
{{header.make_header(session=session)}}
|
|
|
|
<div id="content_body">
|
2020-11-04 00:25:04 +00:00
|
|
|
<div id="left" class="panel">
|
2016-09-18 08:33:46 +00:00
|
|
|
{% for tagtype in ["musts", "mays", "forbids"] %}
|
2022-11-10 03:40:28 +00:00
|
|
|
<div id="search_builder_{{tagtype}}" {% if search_kwargs.tag_expression%}class="hidden"{%endif%}>
|
2016-09-18 08:33:46 +00:00
|
|
|
<span>Tag {{tagtype}}:</span>
|
|
|
|
<ul class="search_builder_tagger">
|
|
|
|
{% set key="tag_" + tagtype %}
|
2022-11-10 03:40:28 +00:00
|
|
|
{% if search_kwargs|attr(key) %}
|
|
|
|
{% for tag in search_kwargs|attr(key) %}
|
2018-02-18 02:19:47 +00:00
|
|
|
<li class="search_builder_{{tagtype}}_inputted">
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(tag, link='info', with_alt_description=True)}}<!--
|
2020-09-09 20:09:48 +00:00
|
|
|
--><button class="remove_tag_button red_button"
|
|
|
|
onclick="return remove_searchtag(ul_{{tagtype}}, '{{tag.name}}', inputted_{{tagtype}});"></button>
|
2018-02-18 02:19:47 +00:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
2016-12-25 01:13:45 +00:00
|
|
|
{% endif %}
|
2020-09-04 18:20:51 +00:00
|
|
|
<li><input id="search_builder_{{tagtype}}_input" class="entry_with_tagname_replacements" type="text" list="tag_autocomplete_datalist"></li>
|
2016-09-18 08:33:46 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2022-11-10 03:40:28 +00:00
|
|
|
<div id="search_builder_expression" {% if not search_kwargs.tag_expression%}class="hidden"{%endif%}>
|
2016-09-18 08:33:46 +00:00
|
|
|
<span>Tag Expression:</span>
|
|
|
|
<input id="search_builder_expression_input" name="tag_expression" type="text"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.tag_expression or ''}}"
|
2016-09-18 08:33:46 +00:00
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<div id="search_builder_orderby">
|
|
|
|
<span>Order by</span>
|
|
|
|
<ul id="search_builder_orderby_ul">
|
2022-11-10 03:40:28 +00:00
|
|
|
{% if search_kwargs.orderby %}
|
|
|
|
{% for orderby in search_kwargs.orderby %}
|
2018-02-18 02:19:47 +00:00
|
|
|
{% set column, sorter=orderby.split("-") %}
|
|
|
|
{{ create_orderby_li(selected_column=column, selected_sorter=sorter) }}
|
|
|
|
{% endfor %}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% else %}
|
2018-02-18 02:19:47 +00:00
|
|
|
{{ create_orderby_li(selected_column=0, selected_sorter=0) }}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endif %}
|
2020-09-04 17:37:04 +00:00
|
|
|
<li id="search_builder_orderby_newrow"><button class="green_button" onclick="return add_new_orderby();">+</button></li>
|
2016-09-18 08:33:46 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<form id="search_builder_form" action="" onsubmit="return submit_search();">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<span>Min-max values</span>
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.area%} value="{{search_kwargs.area}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="area" placeholder="Area: 1m..2m">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.width%} value="{{search_kwargs.width}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="width" placeholder="Width: 1k..2k">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.height%} value="{{search_kwargs.height}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="height" placeholder="Height: 1k..2k">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.aspectratio%} value="{{search_kwargs.aspectratio}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="aspectratio" placeholder="Aspect Ratio: 1.7..2">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.bytes%} value="{{search_kwargs.bytes}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="bytes" placeholder="File Size: 1mb..2mb">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.duration%} value="{{search_kwargs.duration}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="duration" placeholder="Duration: 10:00..20:00">
|
2016-10-10 03:50:13 +00:00
|
|
|
|
2018-01-14 04:02:12 +00:00
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
{%if search_kwargs.created%} value="{{search_kwargs.created}}" {%endif%}
|
2022-08-14 01:09:21 +00:00
|
|
|
name="created" placeholder="Created: 1483228800..1514764800">
|
2018-01-14 04:02:12 +00:00
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
<br>
|
|
|
|
|
|
|
|
<span>Other filters</span>
|
2016-10-30 01:46:23 +00:00
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.filename or ''}}"
|
2016-10-30 01:46:23 +00:00
|
|
|
name="filename" placeholder="Filename">
|
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.mimetype|comma_join}}"
|
2022-10-30 05:19:49 +00:00
|
|
|
name="mimetype" placeholder="Mimetype (archive, audio, image, text, video)">
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.extension|comma_join}}"
|
2016-09-18 08:33:46 +00:00
|
|
|
name="extension" placeholder="Extension(s)">
|
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.extension_not|comma_join}}"
|
2016-09-18 08:33:46 +00:00
|
|
|
name="extension_not" placeholder="Forbid extension(s)">
|
2018-03-23 04:09:21 +00:00
|
|
|
|
|
|
|
<input type="text" class="basic_param"
|
2022-11-10 03:40:28 +00:00
|
|
|
value="{{search_kwargs.author|users_to_usernames|comma_join}}"
|
2018-03-23 04:09:21 +00:00
|
|
|
name="author" placeholder="Author">
|
2020-01-15 00:44:12 +00:00
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
<select name="limit" class="basic_param">
|
2020-09-24 21:28:38 +00:00
|
|
|
{% set limit_options = [20, 50, 100, 200, 500, 1000] %}
|
2022-11-10 03:40:28 +00:00
|
|
|
{% if search_kwargs.limit not in limit_options %}
|
|
|
|
{% do limit_options.append(search_kwargs.limit) %}
|
2017-03-04 05:56:29 +00:00
|
|
|
{% do limit_options.sort() %}
|
|
|
|
{% endif %}
|
|
|
|
{% for limit_option in limit_options %}
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="{{limit_option}}" {{"selected" if search_kwargs.limit == limit_option else ""}}>
|
2018-10-22 01:46:27 +00:00
|
|
|
{{- limit_option }} items{{''-}}
|
|
|
|
</option>
|
2017-03-04 05:56:29 +00:00
|
|
|
{% endfor %}
|
2016-09-18 08:33:46 +00:00
|
|
|
</select>
|
2022-10-28 04:16:32 +00:00
|
|
|
<select name="has_albums" class="basic_param" onchange="return disable_yield_albums_if_not_has_albums();">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="" {{"selected" if search_kwargs.has_albums==None else ""}}>Album or no album</option>
|
|
|
|
<option value="yes" {{"selected" if search_kwargs.has_albums==True else ""}}>Photos contained in albums</option>
|
|
|
|
<option value="no" {{"selected" if search_kwargs.has_albums==False else ""}}>Photos not in albums</option>
|
2022-09-29 02:49:01 +00:00
|
|
|
</select>
|
2016-10-10 03:50:13 +00:00
|
|
|
<select name="has_tags" class="basic_param">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="" {{"selected" if search_kwargs.has_tags==None else ""}}>Tagged or untagged</option>
|
|
|
|
<option value="yes" {{"selected" if search_kwargs.has_tags==True else ""}}>Tagged only</option>
|
|
|
|
<option value="no" {{"selected" if search_kwargs.has_tags==False else ""}}>Untagged only</option>
|
2016-09-18 08:33:46 +00:00
|
|
|
</select>
|
2018-02-25 07:06:25 +00:00
|
|
|
<select name="has_thumbnail" class="basic_param">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="" {{"selected" if search_kwargs.has_thumbnail==None else ""}}>Thumbnail or no thumbnail</option>
|
|
|
|
<option value="yes" {{"selected" if search_kwargs.has_thumbnail==True else ""}}>Has thumbnail</option>
|
|
|
|
<option value="no" {{"selected" if search_kwargs.has_thumbnail==False else ""}}>No thumbnail</option>
|
2018-02-25 07:06:25 +00:00
|
|
|
</select>
|
2020-09-24 21:26:51 +00:00
|
|
|
<select name="yield_albums" class="basic_param">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="yes" {{"selected" if search_kwargs.yield_albums==True else ""}}>Include albums</option>
|
|
|
|
<option value="no" {{"selected" if search_kwargs.yield_albums==False else ""}}>Don't include albums</option>
|
2020-09-24 21:26:51 +00:00
|
|
|
</select>
|
2020-09-28 06:38:49 +00:00
|
|
|
<select name="yield_photos" class="basic_param">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="yes" {{"selected" if search_kwargs.yield_photos==True else ""}}>Include photos</option>
|
|
|
|
<option value="no" {{"selected" if search_kwargs.yield_photos==False else ""}}>Don't include photos</option>
|
2020-09-28 06:38:49 +00:00
|
|
|
</select>
|
2016-11-07 02:00:30 +00:00
|
|
|
<select name="view" class="basic_param">
|
2022-11-10 03:40:28 +00:00
|
|
|
<option value="grid" {{"selected" if search_kwargs.view=="grid" else ""}}>Grid view</option>
|
|
|
|
<option value="list" {{"selected" if search_kwargs.view=="list" else ""}}>List view</option>
|
2016-11-07 02:00:30 +00:00
|
|
|
</select>
|
2017-12-16 22:13:02 +00:00
|
|
|
<button type="submit" id="search_go_button" class="green_button" value="">Search</button>
|
2021-06-04 04:28:05 +00:00
|
|
|
<button type="button" id="swipe_go_button" class="green_button" value="" onclick="return submit_swipe();">Swipe UI</button>
|
2022-11-10 03:40:28 +00:00
|
|
|
<div style="text-align:center"><a href="/search.atom" class="merge_params">Atom</a></div>
|
2016-09-18 08:33:46 +00:00
|
|
|
</form>
|
|
|
|
{% if total_tags %}
|
2020-01-15 00:44:12 +00:00
|
|
|
<h4>Tags on this page:</h4>
|
2020-09-30 00:49:03 +00:00
|
|
|
<div id="tags_on_this_page_holder">
|
2020-01-15 00:44:12 +00:00
|
|
|
<ul id="tags_on_this_page_list">
|
2016-09-18 08:33:46 +00:00
|
|
|
{% for tag in total_tags %}
|
2020-01-15 00:44:12 +00:00
|
|
|
<li>
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(
|
2020-01-15 00:44:12 +00:00
|
|
|
tag,
|
|
|
|
link=None,
|
2020-09-04 17:37:04 +00:00
|
|
|
onclick="return tags_on_this_page_add_must(event, '" + tag.name + "');",
|
2020-01-15 00:44:12 +00:00
|
|
|
innertext="(+)",
|
|
|
|
)}}
|
|
|
|
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(
|
2020-01-15 00:44:12 +00:00
|
|
|
tag,
|
|
|
|
link=None,
|
2020-09-04 17:37:04 +00:00
|
|
|
onclick="return tags_on_this_page_add_may(event, '" + tag.name + "');",
|
2020-01-15 00:44:12 +00:00
|
|
|
innertext="(~)",
|
|
|
|
)}}
|
|
|
|
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(
|
2020-01-15 00:44:12 +00:00
|
|
|
tag,
|
|
|
|
link=None,
|
2020-09-04 17:37:04 +00:00
|
|
|
onclick="return tags_on_this_page_add_forbid(event, '" + tag.name + "');",
|
2020-01-15 00:44:12 +00:00
|
|
|
innertext="(x)",
|
|
|
|
)}}
|
|
|
|
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(
|
2020-01-15 00:44:12 +00:00
|
|
|
tag,
|
|
|
|
link="info",
|
|
|
|
with_alt_description=True,
|
|
|
|
)}}
|
|
|
|
</li>
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
2020-09-30 00:49:03 +00:00
|
|
|
</div>
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-11-04 00:25:04 +00:00
|
|
|
<div id="right" class="panel">
|
2020-09-30 00:21:50 +00:00
|
|
|
<div id="error_message_area">
|
|
|
|
{% for warning in warnings %}
|
2020-11-04 00:35:53 +00:00
|
|
|
<p class="error_message">{{warning}}</p>
|
2020-09-30 00:21:50 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2020-11-04 00:35:53 +00:00
|
|
|
|
2020-09-30 00:21:50 +00:00
|
|
|
<div id="happy_message_area">
|
|
|
|
<p>You got {{results|length}} items.</p>
|
|
|
|
</div>
|
2020-11-04 00:35:53 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
{{prev_next_buttons()}}
|
2020-11-04 00:35:53 +00:00
|
|
|
|
2020-11-05 01:11:48 +00:00
|
|
|
<div id="search_results_holder" class="photos_holder">
|
2020-04-03 06:27:47 +00:00
|
|
|
{% for result in results %}
|
|
|
|
{% if result.__class__.__name__ == 'Photo' %}
|
2022-11-10 03:40:28 +00:00
|
|
|
{{cards.create_photo_card(result, view=search_kwargs.view)}}
|
2020-04-03 06:27:47 +00:00
|
|
|
{% elif result.__class__.__name__ == 'Album' %}
|
2022-11-10 03:40:28 +00:00
|
|
|
{{cards.create_album_card(result, view=search_kwargs.view)}}
|
2020-04-03 05:36:40 +00:00
|
|
|
{% endif %}
|
2018-02-18 02:19:47 +00:00
|
|
|
{% endfor %}
|
2016-12-24 03:49:51 +00:00
|
|
|
</div>
|
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
{{prev_next_buttons()}}
|
|
|
|
</div>
|
2018-02-18 02:19:47 +00:00
|
|
|
</div>
|
|
|
|
{{clipboard_tray.clipboard_tray()}}
|
2016-09-18 08:33:46 +00:00
|
|
|
</body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2017-05-13 22:27:08 +00:00
|
|
|
/*
|
2020-04-03 00:06:50 +00:00
|
|
|
These values should match those of the server itself. The purpose of this dict
|
|
|
|
is to know that we DON'T need to include these parameters in the url if the
|
|
|
|
selected form values are these.
|
2017-05-13 22:27:08 +00:00
|
|
|
*/
|
2020-09-15 01:33:53 +00:00
|
|
|
const PARAM_DEFAULTS = {
|
2016-11-07 02:00:30 +00:00
|
|
|
'limit': 50,
|
|
|
|
'view': 'grid',
|
2022-11-10 03:40:28 +00:00
|
|
|
'yield_albums': 'no',
|
2020-09-28 06:38:49 +00:00
|
|
|
'yield_photos': 'yes'
|
2016-11-07 02:00:30 +00:00
|
|
|
}
|
2021-06-01 21:12:09 +00:00
|
|
|
|
|
|
|
const MAX_ORDERBY_ULS = document.getElementsByClassName("select_orderby_column")[0].children.length;
|
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
function add_searchtag(ul, value, inputted_list, li_class)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
console.log("adding " + value);
|
2020-09-15 01:33:53 +00:00
|
|
|
const already_have = inputted_list.indexOf(value) !== -1;
|
2020-04-02 23:25:19 +00:00
|
|
|
if (already_have)
|
|
|
|
{return;}
|
|
|
|
|
|
|
|
inputted_list.push(value);
|
2020-09-15 01:33:53 +00:00
|
|
|
const new_li = document.createElement("li");
|
2020-04-02 23:25:19 +00:00
|
|
|
new_li.className = li_class;
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const new_span = document.createElement("span");
|
2021-01-08 21:57:27 +00:00
|
|
|
new_span.className = "tag_card";
|
2020-04-02 23:25:19 +00:00
|
|
|
new_span.innerHTML = value;
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const new_delbutton = document.createElement("button")
|
2020-04-02 23:25:19 +00:00
|
|
|
new_delbutton.classList.add("remove_tag_button");
|
|
|
|
new_delbutton.classList.add("red_button");
|
2020-04-03 00:01:24 +00:00
|
|
|
new_delbutton.onclick = function(){remove_searchtag(ul, value, inputted_list)};
|
2020-04-02 23:25:19 +00:00
|
|
|
|
|
|
|
new_li.appendChild(new_span);
|
|
|
|
new_li.appendChild(new_delbutton);
|
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
ul.insertBefore(new_li, ul.lastElementChild);
|
|
|
|
}
|
|
|
|
function add_searchtag_from_box(box, inputted_list, li_class)
|
|
|
|
{
|
|
|
|
if (box.offsetParent === null)
|
|
|
|
{
|
|
|
|
// The box is hidden probably because we're in Expression mode.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!box.value)
|
|
|
|
{return;}
|
2020-04-02 23:25:19 +00:00
|
|
|
|
2020-09-03 22:02:37 +00:00
|
|
|
let value = box.value;
|
2020-10-26 03:20:40 +00:00
|
|
|
if (tag_autocomplete.datalist !== null)
|
|
|
|
{
|
|
|
|
// If the autocomplete failed for whatever reason, or is simply taking
|
|
|
|
// too long, let's just let it slide.
|
|
|
|
value = tag_autocomplete.resolve(value);
|
|
|
|
if (value === null)
|
|
|
|
{return;}
|
|
|
|
}
|
2020-04-03 00:01:24 +00:00
|
|
|
|
|
|
|
console.log(inputted_list);
|
|
|
|
ul = box.parentElement.parentElement;
|
|
|
|
add_searchtag(ul, value, inputted_list, li_class)
|
|
|
|
box.value = "";
|
2020-04-02 23:25:19 +00:00
|
|
|
// The datalist autocomplete box can sometimes stick around after the
|
|
|
|
// tag has already been submitted and the input box moves down -- now
|
|
|
|
// covered by the autocomplete. So we temporarily unfocus it to make
|
|
|
|
// that thing go away.
|
|
|
|
box.blur();
|
|
|
|
box.focus();
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
function remove_searchtag(ul, value, inputted_list)
|
|
|
|
{
|
2016-09-18 08:33:46 +00:00
|
|
|
console.log("removing " + value);
|
2020-09-15 01:33:53 +00:00
|
|
|
const lis = ul.children;
|
2016-09-18 08:33:46 +00:00
|
|
|
//console.log(lis);
|
2020-09-03 22:33:37 +00:00
|
|
|
for (const li of lis)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
2021-01-08 21:57:27 +00:00
|
|
|
const tag_card = li.children[0];
|
|
|
|
if (! tag_card.classList.contains("tag_card"))
|
2016-09-18 08:33:46 +00:00
|
|
|
{continue}
|
|
|
|
|
2021-01-08 21:57:27 +00:00
|
|
|
const tagname = tag_card.innerHTML;
|
2016-09-18 08:33:46 +00:00
|
|
|
if (tagname != value)
|
|
|
|
{continue}
|
|
|
|
|
|
|
|
ul.removeChild(li);
|
|
|
|
splice_at = inputted_list.indexOf(tagname);
|
|
|
|
if (splice_at == -1)
|
|
|
|
{continue}
|
|
|
|
|
|
|
|
inputted_list.splice(splice_at, 1);
|
|
|
|
}
|
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
function add_new_orderby()
|
|
|
|
{
|
|
|
|
/* Called by the green + button */
|
2020-09-15 01:33:53 +00:00
|
|
|
const ul = document.getElementById("search_builder_orderby_ul");
|
2021-06-01 21:12:09 +00:00
|
|
|
const lis = ul.getElementsByClassName("search_builder_orderby_li");
|
|
|
|
if (lis.length >= MAX_ORDERBY_ULS)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2021-06-01 21:12:09 +00:00
|
|
|
prev_li = lis[lis.length - 1];
|
2020-09-15 01:33:53 +00:00
|
|
|
const new_li = prev_li.cloneNode(true);
|
2019-08-23 20:24:47 +00:00
|
|
|
ul.insertBefore(new_li, prev_li.nextSibling);
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
function orderby_remove_hook(button)
|
|
|
|
{
|
|
|
|
/* Called by the red button next to orderby dropdowns */
|
2020-09-15 01:33:53 +00:00
|
|
|
const li = button.parentElement;
|
|
|
|
const ul = li.parentElement;
|
2016-09-18 08:33:46 +00:00
|
|
|
// 2 because keep 1 row and the adder button
|
|
|
|
if (ul.children.length>2)
|
|
|
|
{
|
|
|
|
/* You can't remove the only one left */
|
|
|
|
ul.removeChild(li);
|
|
|
|
}
|
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2022-10-28 04:16:32 +00:00
|
|
|
function disable_yield_albums_if_not_has_albums()
|
|
|
|
{
|
|
|
|
const has_albums = document.querySelector("select[name='has_albums']");
|
|
|
|
const yield_albums = document.querySelector("select[name='yield_albums']");
|
|
|
|
if (has_albums.value == "no")
|
|
|
|
{
|
|
|
|
yield_albums.value = "no";
|
|
|
|
yield_albums.disabled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
yield_albums.disabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-23 20:26:20 +00:00
|
|
|
function orderby_hide_direction_hook(event)
|
|
|
|
{
|
|
|
|
if (event.target.value == "random")
|
|
|
|
{
|
|
|
|
event.target.nextElementSibling.classList.add("hidden");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event.target.nextElementSibling.classList.remove("hidden");
|
|
|
|
}
|
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
function simplify_tagnames(tags)
|
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const new_tags = [];
|
2020-09-08 23:42:44 +00:00
|
|
|
for (let tag of tags)
|
2016-10-10 03:50:13 +00:00
|
|
|
{
|
|
|
|
tag = tag.split(".");
|
|
|
|
tag = tag[tag.length - 1];
|
|
|
|
new_tags.push(tag);
|
|
|
|
}
|
|
|
|
return new_tags;
|
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2021-06-01 21:12:47 +00:00
|
|
|
function build_search_params()
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
/*
|
2021-06-01 21:12:47 +00:00
|
|
|
Gather up all the form data and tags and compose the URL parameters.
|
2016-09-18 08:33:46 +00:00
|
|
|
*/
|
2021-06-01 21:12:47 +00:00
|
|
|
const parameters = new URLSearchParams();
|
2020-04-03 00:11:29 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
// ignored. So let's run through each of their hooks to get them all saved.
|
|
|
|
add_searchtag_from_box(input_musts, inputted_musts, "search_builder_musts_inputted");
|
|
|
|
add_searchtag_from_box(input_mays, inputted_mays, "search_builder_mays_inputted");
|
|
|
|
add_searchtag_from_box(input_forbids, inputted_forbids, "search_builder_forbids_inputted");
|
|
|
|
|
2020-09-03 22:02:37 +00:00
|
|
|
let has_tag_params = false;
|
2021-06-01 21:12:47 +00:00
|
|
|
const musts = simplify_tagnames(inputted_musts).join(",");
|
|
|
|
if (musts) {parameters.set("tag_musts", musts); has_tag_params = true;}
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2021-06-01 21:12:47 +00:00
|
|
|
const mays = simplify_tagnames(inputted_mays).join(",");
|
|
|
|
if (mays) {parameters.set("tag_mays", mays); has_tag_params = true;}
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2021-06-01 21:12:47 +00:00
|
|
|
const forbids = simplify_tagnames(inputted_forbids).join(",");
|
|
|
|
if (forbids) {parameters.set("tag_forbids", forbids); has_tag_params = true;}
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const expression = document.getElementsByName("tag_expression")[0].value;
|
2016-09-18 08:33:46 +00:00
|
|
|
if (expression)
|
|
|
|
{
|
2017-02-25 06:07:59 +00:00
|
|
|
//expression = expression.replace(new RegExp(" ", 'g'), "-");
|
2021-06-01 21:12:47 +00:00
|
|
|
parameters.set("tag_expression", expression);
|
2020-09-03 22:46:34 +00:00
|
|
|
has_tag_params = true;
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const basic_inputs = document.getElementsByClassName("basic_param");
|
2020-09-03 22:33:37 +00:00
|
|
|
for (const basic_input of basic_inputs)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
2021-06-01 21:12:47 +00:00
|
|
|
let value = basic_input.value;
|
2016-11-06 00:58:37 +00:00
|
|
|
value = value.split("&").join("%26");
|
|
|
|
console.log(value);
|
2021-06-01 21:12:47 +00:00
|
|
|
if (PARAM_DEFAULTS[basic_input.name] == value)
|
2016-11-07 02:00:30 +00:00
|
|
|
{
|
|
|
|
// Don't clutter url with default values.
|
|
|
|
continue;
|
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
if (value == "")
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2021-06-01 21:12:47 +00:00
|
|
|
parameters.set(basic_input.name, value);
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const orderby_rows = document.getElementsByClassName("search_builder_orderby_li");
|
2020-09-08 23:42:44 +00:00
|
|
|
let orderby_params = [];
|
2020-09-03 22:33:37 +00:00
|
|
|
for (const orderby_row of orderby_rows)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const column = orderby_row.children[0].value;
|
2019-08-23 20:25:21 +00:00
|
|
|
if (column == "random")
|
|
|
|
{
|
|
|
|
orderby_params.push(column);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-15 01:33:53 +00:00
|
|
|
const sorter = orderby_row.children[1].value;
|
2019-08-23 20:25:21 +00:00
|
|
|
orderby_params.push(column + "-" + sorter);
|
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
orderby_params = orderby_params.join(",");
|
2016-11-07 02:00:30 +00:00
|
|
|
if (orderby_params && orderby_params != "created-desc")
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
2016-11-07 02:00:30 +00:00
|
|
|
// Don't clutter url with default of created-desc
|
2021-06-01 21:12:47 +00:00
|
|
|
parameters.set("orderby", orderby_params);
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
|
2021-06-01 21:12:47 +00:00
|
|
|
return parameters;
|
|
|
|
}
|
|
|
|
|
|
|
|
function submit_search()
|
|
|
|
{
|
|
|
|
const parameters = build_search_params().toString();
|
2021-06-02 00:51:57 +00:00
|
|
|
let url = "/search";
|
2021-06-01 21:12:47 +00:00
|
|
|
if (parameters !== "")
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
2021-06-01 21:12:47 +00:00
|
|
|
url += "?" + parameters.toString();
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
2016-11-06 00:58:37 +00:00
|
|
|
console.log(url);
|
2016-09-18 08:33:46 +00:00
|
|
|
window.location.href = url;
|
|
|
|
return false;
|
|
|
|
}
|
2021-06-01 21:12:47 +00:00
|
|
|
|
2021-06-04 04:28:05 +00:00
|
|
|
function submit_swipe()
|
|
|
|
{
|
|
|
|
const parameters = build_search_params().toString();
|
|
|
|
let url = "/swipe";
|
|
|
|
if (parameters !== "")
|
|
|
|
{
|
|
|
|
url += "?" + parameters.toString();
|
|
|
|
}
|
|
|
|
console.log(url);
|
|
|
|
window.location.href = url;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-15 00:44:12 +00:00
|
|
|
function tags_on_this_page_add_must(event, tagname)
|
2016-09-18 08:33:46 +00:00
|
|
|
{
|
|
|
|
add_searchtag(
|
2020-04-03 05:49:33 +00:00
|
|
|
ul_musts,
|
2018-07-23 01:17:39 +00:00
|
|
|
tagname,
|
2016-09-18 08:33:46 +00:00
|
|
|
inputted_musts,
|
|
|
|
"search_builder_musts_inputted"
|
|
|
|
);
|
2020-04-03 05:52:33 +00:00
|
|
|
submit_search();
|
2016-09-18 08:33:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-01-15 00:44:12 +00:00
|
|
|
function tags_on_this_page_add_may(event, tagname)
|
|
|
|
{
|
|
|
|
add_searchtag(
|
2020-04-03 05:49:33 +00:00
|
|
|
ul_mays,
|
2020-01-15 00:44:12 +00:00
|
|
|
tagname,
|
|
|
|
inputted_mays,
|
|
|
|
"search_builder_mays_inputted"
|
|
|
|
);
|
2020-04-03 05:52:33 +00:00
|
|
|
submit_search();
|
2020-01-15 00:44:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function tags_on_this_page_add_forbid(event, tagname)
|
|
|
|
{
|
|
|
|
add_searchtag(
|
2020-04-03 05:49:33 +00:00
|
|
|
ul_forbids,
|
2020-01-15 00:44:12 +00:00
|
|
|
tagname,
|
|
|
|
inputted_forbids,
|
|
|
|
"search_builder_forbids_inputted"
|
|
|
|
);
|
2020-04-03 05:52:33 +00:00
|
|
|
submit_search();
|
2020-01-15 00:44:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-04-03 00:06:50 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
function tag_input_hook(box, inputted_list, li_class)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
Assigned to the input boxes for musts, mays, forbids.
|
|
|
|
Hitting Enter will add the resovled tag to the search form.
|
|
|
|
*/
|
2020-04-03 00:01:24 +00:00
|
|
|
if (event.key !== "Enter")
|
2016-09-18 08:33:46 +00:00
|
|
|
{return;}
|
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
add_searchtag_from_box(box, inputted_list, li_class)
|
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
function tag_input_hook_musts()
|
|
|
|
{
|
|
|
|
tag_input_hook(this, inputted_musts, "search_builder_musts_inputted");
|
|
|
|
}
|
|
|
|
function tag_input_hook_mays()
|
|
|
|
{
|
|
|
|
tag_input_hook(this, inputted_mays, "search_builder_mays_inputted");
|
|
|
|
}
|
|
|
|
function tag_input_hook_forbids()
|
|
|
|
{
|
|
|
|
tag_input_hook(this, inputted_forbids, "search_builder_forbids_inputted");
|
2016-09-18 08:33:46 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 01:33:53 +00:00
|
|
|
const input_musts = document.getElementById("search_builder_musts_input");
|
|
|
|
const ul_musts = input_musts.parentElement.parentElement;
|
|
|
|
const input_mays = document.getElementById("search_builder_mays_input");
|
|
|
|
const ul_mays = input_mays.parentElement.parentElement;
|
|
|
|
const input_forbids = document.getElementById("search_builder_forbids_input");
|
|
|
|
const ul_forbids = input_forbids.parentElement.parentElement;
|
|
|
|
const input_expression = document.getElementById("search_builder_expression_input");
|
2016-09-18 08:33:46 +00:00
|
|
|
|
|
|
|
/* Prefix the form with the parameters from last search */
|
2020-09-15 01:33:53 +00:00
|
|
|
const inputted_musts = [];
|
|
|
|
const inputted_mays = [];
|
|
|
|
const inputted_forbids = [];
|
2016-09-18 08:33:46 +00:00
|
|
|
{% for tagtype in ["musts", "mays", "forbids"] %}
|
|
|
|
{% set key="tag_" + tagtype %}
|
2022-11-10 03:40:28 +00:00
|
|
|
{% if search_kwargs|attr(key) %}
|
|
|
|
{% for tag in search_kwargs|attr(key) %}
|
2020-09-27 18:53:38 +00:00
|
|
|
inputted_{{tagtype}}.push("{{tag.name|safe}}");
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endfor %}
|
2016-12-25 01:13:45 +00:00
|
|
|
{% endif %}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endfor %}
|
|
|
|
|
2021-06-02 00:52:17 +00:00
|
|
|
const search_go_button = document.getElementById("search_go_button");
|
2020-04-03 00:01:24 +00:00
|
|
|
input_musts.addEventListener("keyup", tag_input_hook_musts);
|
2020-09-03 22:39:48 +00:00
|
|
|
common.bind_box_to_button(input_musts, search_go_button, true);
|
|
|
|
|
2020-06-17 19:42:08 +00:00
|
|
|
input_mays.addEventListener("keyup", tag_input_hook_mays);
|
2020-09-03 22:39:48 +00:00
|
|
|
common.bind_box_to_button(input_mays, search_go_button, true);
|
|
|
|
|
2020-04-03 00:01:24 +00:00
|
|
|
input_forbids.addEventListener("keyup", tag_input_hook_forbids);
|
2020-09-03 22:39:48 +00:00
|
|
|
common.bind_box_to_button(input_forbids, search_go_button, true);
|
|
|
|
|
|
|
|
common.bind_box_to_button(input_expression, search_go_button);
|
2021-06-04 00:42:46 +00:00
|
|
|
|
|
|
|
function on_pageload()
|
|
|
|
{
|
|
|
|
photo_clipboard.register_hotkeys();
|
2022-10-28 04:16:32 +00:00
|
|
|
disable_yield_albums_if_not_has_albums();
|
2021-06-04 00:42:46 +00:00
|
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", on_pageload);
|
2016-11-27 09:06:11 +00:00
|
|
|
</script>
|
2018-02-24 08:24:38 +00:00
|
|
|
</html>
|