add search operators menu

master
Aevann 2024-11-13 15:22:14 +02:00
parent d7a63f8cbd
commit 4cf3cfe59b
2 changed files with 31 additions and 12 deletions

View File

@ -6489,7 +6489,7 @@ div.custom-control:last-of-type {
} }
} }
.dropdown-menu button.searchparam { .dropdown-menu button.searchparam, .dropdown-menu button.searchoperator {
color: var(--gray-100); color: var(--gray-100);
text-decoration: none; text-decoration: none;
text-transform: none; text-transform: none;
@ -6500,6 +6500,9 @@ div.custom-control:last-of-type {
width: 150px; width: 150px;
} }
.dropdown-menu button.searchoperator {
pointer-events: none;
}
.comment-text blockquote { .comment-text blockquote {
max-height: 2000px; max-height: 2000px;

View File

@ -31,64 +31,80 @@
<div class="card-body pb-2"> <div class="card-body pb-2">
<div> <div>
<div id="searchparams-dropdown" class="dropdown dropdown-actions"> <div id="searchparams-dropdown" class="dropdown dropdown-actions">
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton2" data-bs-toggle="dropdown" data-bs-display="static"><strong>Advanced search operators (with examples)</strong></button>
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px)">
<div>
<div style="display: inline-block; width: 150px; text-align: center">Exact</div>
<button type="button" class="searchoperator mb-1">"black african"</button>
</div>
<div>
<div style="display: inline-block; width: 150px; text-align: center">Or</div>
<button type="button" class="searchoperator mb-1">black OR african</button>
</div>
<div>
<div style="display: inline-block; width: 150px; text-align: center">Not</div>
<button type="button" class="searchoperator mb-1">black - african</button>
</div>
</div>
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton2" data-bs-toggle="dropdown" data-bs-display="static"><strong>Advanced search parameters (with examples)</strong></button> <button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton2" data-bs-toggle="dropdown" data-bs-display="static"><strong>Advanced search parameters (with examples)</strong></button>
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px)"> <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px)">
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Before Date:</div> <div style="display: inline-block; width: 150px; text-align: center">Before Date</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">before:2022-12-30</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">before:2022-12-30</button>
</div> </div>
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">After Date:</div> <div style="display: inline-block; width: 150px; text-align: center">After Date</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">after:2022-12-30</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">after:2022-12-30</button>
</div> </div>
{% if not request.path.startswith('/search/users') %} {% if not request.path.startswith('/search/users') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Author:</div> <div style="display: inline-block; width: 150px; text-align: center">Author</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">author:quadnarca</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">author:quadnarca</button>
</div> </div>
{% endif %} {% endif %}
{% if request.path.startswith('/search/messages') %} {% if request.path.startswith('/search/messages') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Sent To:</div> <div style="display: inline-block; width: 150px; text-align: center">Sent To</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">sentto:carpathianflorist</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">sentto:carpathianflorist</button>
</div> </div>
{% elif request.path.startswith('/search/posts') or request.path.startswith('/search/comments') %} {% elif request.path.startswith('/search/posts') or request.path.startswith('/search/comments') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Hole:</div> <div style="display: inline-block; width: 150px; text-align: center">Hole</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">hole:music</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">hole:music</button>
</div> </div>
{% if request.path.startswith('/search/comments') %} {% if request.path.startswith('/search/comments') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Post ID:</div> <div style="display: inline-block; width: 150px; text-align: center">Post ID</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">post:504</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">post:504</button>
</div> </div>
{% elif request.path.startswith('/search/posts') %} {% elif request.path.startswith('/search/posts') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Domain:</div> <div style="display: inline-block; width: 150px; text-align: center">Domain</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">domain:reddit.com</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">domain:reddit.com</button>
</div> </div>
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Post Title Only:</div> <div style="display: inline-block; width: 150px; text-align: center">Post Title Only</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">title_only:true</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">title_only:true</button>
</div> </div>
{% if SITE_NAME != 'WPD' %} {% if SITE_NAME != 'WPD' %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Subreddit:</div> <div style="display: inline-block; width: 150px; text-align: center">Subreddit</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">subreddit:menslib</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this)" class="searchparam mb-1">subreddit:menslib</button>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if FEATURES['NSFW_MARKING'] %} {% if FEATURES['NSFW_MARKING'] %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">NSFW:</div> <div style="display: inline-block; width: 150px; text-align: center">NSFW</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">nsfw:true</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">nsfw:true</button>
</div> </div>
{% endif %} {% endif %}
{% if request.path.startswith('/search/posts') %} {% if request.path.startswith('/search/posts') %}
<div> <div>
<div style="display: inline-block; width: 150px; text-align: center">Effortpost:</div> <div style="display: inline-block; width: 150px; text-align: center">Effortpost</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">effortpost:true</button> <button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam(this, 'bool')" class="searchparam mb-1">effortpost:true</button>
</div> </div>
{% endif %} {% endif %}