remotes/1693045480750635534/spooky-22
Aevann1 2022-02-22 12:38:28 +02:00
parent 278735448b
commit 7e5a8400a5
2 changed files with 14 additions and 16 deletions

View File

@ -862,7 +862,7 @@ def submit_post(v, sub=None):
return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body, ghost=submit_ghost(v,g.db)), 400 return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body, ghost=submit_ghost(v,g.db)), 400
sub = request.values.get("sub") sub = request.values.get("sub").replace('/s/','')
if sub and sub != 'none': if sub and sub != 'none':
sub = g.db.query(Sub.name).filter_by(name=sub.strip().lower()).one_or_none() sub = g.db.query(Sub.name).filter_by(name=sub.strip().lower()).one_or_none()

View File

@ -80,22 +80,20 @@
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}"> <input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
{% if SITE_NAME != 'Drama' or sub %} {% if SITE_NAME != 'Drama' or sub %}
<label class='mt-4' for="title">Sub</label> <label class='mt-4' for="title">Sub</label>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='sub' class="form-control" form="submitform" name="sub"> <input list="subs" autocomplete="off" id='sub' class="form-control" form="submitform" name="sub" oninput="savetext()">
<datalist id="subs">
{% if SITE_NAME != 'Ruqqus' %} {% if SITE_NAME != 'Ruqqus' %}
<option value="none" selected> <option value="/s/none" selected></option>
None
</option>
{% endif %} {% endif %}
{% for s in SUBS %} {% for s in SUBS %}
<option value="{{s}}" {% if sub and sub.name == s %}selected{% endif %}> <option value="/s/{{s}}" {% if sub and sub.name == s %}selected{% endif %}></option>
/s/{{s}}
</option>
{% endfor %} {% endfor %}
</select> </datalist>
</div> </div>
{% endif %} {% endif %}
@ -110,7 +108,7 @@
<div id="urlblock"> <div id="urlblock">
<label for="URL" class="mt-3">URL</label> <label for="URL" class="mt-3">URL</label>
<input autocomplete="off" class="form-control" id="post-URL" aria-describedby="URLHelp" name="url" placeholder="Optional if you have text." value="{{request.values.get('url','')}}" required oninput="checkForRequired();hide_image();autoSuggestTitle()"> <input autocomplete="off" class="form-control" id="post-url" aria-describedby="URLHelp" name="url" placeholder="Optional if you have text." value="{{request.values.get('url','')}}" required oninput="checkForRequired();hide_image();autoSuggestTitle();savetext()">
<small class="form-text text-muted">To post an image, use a direct image link such as i.imgur.com</small> <small class="form-text text-muted">To post an image, use a direct image link such as i.imgur.com</small>
</div> </div>
<div id="image-upload-block"> <div id="image-upload-block">
@ -225,16 +223,16 @@
{% endblock %} {% endblock %}
<script> <script>
let fetched_title = localStorage.getItem("post_title") document.getElementById('post-title').value = localStorage.getItem("post_title")
document.getElementById('post-title').value = fetched_title document.getElementById('post-text').value = localStorage.getItem("post_text")
let fetched_text = localStorage.getItem("post_text") document.getElementById('post-url').value = localStorage.getItem("post_url")
document.getElementById('post-text').value = fetched_text document.getElementById('sub').value = localStorage.getItem("sub")
function checkForRequired() { function checkForRequired() {
var title = document.getElementById("post-title"); var title = document.getElementById("post-title");
var url = document.getElementById("post-URL"); var url = document.getElementById("post-url");
var text = document.getElementById("post-text"); var text = document.getElementById("post-text");
@ -271,7 +269,7 @@
<script src="/static/assets/js/marked.js?a=242"></script> <script src="/static/assets/js/marked.js?a=242"></script>
<script src="/static/assets/js/formatting.js?a=240"></script> <script src="/static/assets/js/formatting.js?a=240"></script>
<script src="/static/assets/js/submit.js?a=244"></script> <script src="/static/assets/js/submit.js?a=246"></script>
{% include "emoji_modal.html" %} {% include "emoji_modal.html" %}
{% include "gif_modal.html" %} {% include "gif_modal.html" %}