Compare commits

..

2 Commits

Author SHA1 Message Date
mid
aa95418b70 No logging in as administator & moderator in anarchy mode 2024-08-05 22:08:19 +03:00
mid
6f5302043d Improve index search form 2024-08-05 21:56:13 +03:00
2 changed files with 45 additions and 27 deletions

View File

@ -2,32 +2,38 @@
{% function content() %} {% function content() %}
<div style="text-align:center;height:50%;margin-top:25vh;"> <div style="text-align:center;height:50%;margin-top:25vh;">
<div style="max-width:15cm;display:inline-block;"> <div style="width:12cm;display:inline-block;">
<h1>{{ Escapes.htmlescape(BigGlobe.cfg.sitename) }}</h1> <h1>{{ Escapes.htmlescape(BigGlobe.cfg.sitename) }}</h1>
<form action="/search" method="GET" id="searchform"> <form action="/search" method="GET" id="searchform">
<input type="text" name="n" placeholder="Filter by name..." style="position:relative;width:100%;" /> <input type="text" name="n" placeholder="Filter by name..." style="position:relative;width:100%;" />
{% if BigGlobe.cfg.enable18plus then %}
<ul class="over18">
<li>
<input type="radio" name="a" value="-1" id="o18h" onchange="upd(-1)" checked />
<label for="o18h">Hide 18+</label>
</li><li>
<input type="radio" name="a" value="0" id="o18s" onchange="upd(0)" />
<label for="o18s">Show 18+</label>
</li><li>
<input type="radio" name="a" value="1" id="o18o" onchange="upd(1)" />
<label for="o18o">Only 18+</label>
</li>
</ul>
{% end %}
<input type="hidden" id="tparam" name="t" value="" /> <input type="hidden" id="tparam" name="t" value="" />
<div data-formid="searchform" data-formparaminputid="tparam" style="position:relative;width:100%;margin-top:1em;" class="tagbox">
<p>Filter by tags...</p> <div style="position: relative;">
<span style="position:relative;min-width:4px;left:0;" contenteditable></span> <div data-formid="searchform" data-formparaminputid="tparam" style="position:relative;width:58%;margin-top:1em;display:inline-block;vertical-align:top;white-space:nowrap;overflow-x:scroll;" class="tagbox">
<p>Filter by tags...</p>
<!-- Firefox has a 10-year old bug where a contenteditable with 0 padding loses focus when you press the right arrow key to the end -->
<span style="position:relative;min-width:4px;left:0;padding-right:1px;" contenteditable autofocus></span>
</div>
{% if BigGlobe.cfg.enable18plus then %}
<ul class="over18" style="width:40%;display:inline-block;vertical-align:middle;">
<li>
<input type="radio" name="a" value="-1" id="o18h" onchange="upd(-1)" checked />
<label for="o18h">&#x1F6C7;</label>
</li><li>
<input type="radio" name="a" value="0" id="o18s" onchange="upd(0)" />
<label for="o18s">18+?</label>
</li><li>
<input type="radio" name="a" value="1" id="o18o" onchange="upd(1)" />
<label for="o18o">&check;</label>
</li>
</ul>
{% end %}
<div class="autocomplete" style="visibility:hidden;width:100%;position:absolute;top:70%;box-sizing:border-box;"></div>
</div> </div>
<div class="autocomplete" style="visibility:hidden;width:100%;"></div>
<input type="submit" value="Search" style="margin-top:1em;" /> <input type="submit" value="Search" style="margin-top:1em;" />
@ -77,6 +83,8 @@
showalltags = function() {} showalltags = function() {}
} }
document.querySelector("[autofocus]").focus()
</script> </script>
{% end %} {% end %}

View File

@ -19,9 +19,15 @@
worked = false worked = false
end end
if worked and BigGlobe.cfg.anarchy == "ANARCHY" then if BigGlobe.cfg.anarchy == "ANARCHY" then
response:addHeader("Refresh", "3;url=" .. zzz) if u and u.privs > DB.USER_PRIVS_APPROVED then
response:statusCode(303) worked = false
end
if worked then
response:addHeader("Refresh", "3;url=" .. zzz)
response:statusCode(303)
end
end end
end end
@ -30,9 +36,13 @@
{% function content() %} {% function content() %}
{% if BigGlobe.cfg.anarchy == "ANARCHY" then %} {% if BigGlobe.cfg.anarchy == "ANARCHY" then %}
<p>In anarchy mode, anyone can be anything. Please wait..</p> {% if worked and zzz then %}
<p>In anarchy mode, anyone can be anything. Please wait..</p>
<p>If that doesn't work, <a href="{{ Escapes.htmlescape(zzz) }}">click here</a>.</p>
<p>If that doesn't work, <a href="{{ Escapes.htmlescape(zzz) }}">click here</a>.</p>
{% else %}
<p>User doesn't exist.</p>
{% end %}
{% else %} {% else %}
{% if worked then %} {% if worked then %}
<p>Link has been sent to {{ em and Escapes.htmlescape(em) }}. This page may be closed.</p> <p>Link has been sent to {{ em and Escapes.htmlescape(em) }}. This page may be closed.</p>
@ -42,4 +52,4 @@
{% end %} {% end %}
{% end %} {% end %}
{# base.inc {# base.inc