perserve the first 4 checkboxes in /submit too

master
Aevann1 2022-08-15 08:42:59 +02:00
parent b033b518b8
commit 26bbc8b69a
4 changed files with 37 additions and 21 deletions

View File

@ -1,6 +1,11 @@
document.getElementById('post-title').value = localStorage.getItem("post_title")
document.getElementById('post-text').value = localStorage.getItem("post_text")
document.getElementById('post-url').value = localStorage.getItem("post_url")
document.getElementById('post-title').value = localStorage.getItem("post-title")
document.getElementById('post-text').value = localStorage.getItem("post-text")
document.getElementById('post-url').value = localStorage.getItem("post-url")
document.getElementById('post-new').checked = localStorage.getItem("post-new") == 'true'
document.getElementById('post-nsfw').checked = localStorage.getItem("post-nsfw") == 'true'
document.getElementById('post-private').checked = localStorage.getItem("post-private") == 'true'
document.getElementById('post-club').checked = localStorage.getItem("post-club") == 'true'
markdown(document.getElementById("post-text"));
@ -77,7 +82,7 @@ document.onpaste = function(event) {
document.getElementById('file-upload').setAttribute('required', 'false');
}
document.getElementById('post-url').value = null;
localStorage.setItem("post_url", "")
localStorage.setItem("post-url", "")
checkForRequired();
}
}
@ -97,11 +102,17 @@ document.getElementById('file-upload').addEventListener('change', function(){
})
function savetext() {
localStorage.setItem("post_title", document.getElementById('post-title').value)
localStorage.setItem("post_text", document.getElementById('post-text').value)
localStorage.setItem("post_url", document.getElementById('post-url').value)
localStorage.setItem("post-title", document.getElementById('post-title').value)
localStorage.setItem("post-text", document.getElementById('post-text').value)
localStorage.setItem("post-url", document.getElementById('post-url').value)
let sub = document.getElementById('sub')
if (sub) localStorage.setItem("sub", sub.value)
localStorage.setItem("post-new", document.getElementById('post-new').checked)
localStorage.setItem("post-nsfw", document.getElementById('post-nsfw').checked)
localStorage.setItem("post-private", document.getElementById('post-private').checked)
localStorage.setItem("post-club", document.getElementById('post-club').checked)
}

View File

@ -1137,10 +1137,15 @@
{% if success %}
<script>
history.pushState(null, null, '{{p.permalink}}');
localStorage.setItem("post_title", "")
localStorage.setItem("post_text", "")
localStorage.setItem("post_url", "")
localStorage.setItem("post-title", "")
localStorage.setItem("post-text", "")
localStorage.setItem("post-url", "")
localStorage.setItem("sub", "")
localStorage.setItem("post-new", false)
localStorage.setItem("post-nsfw", false)
localStorage.setItem("post-private", false)
localStorage.setItem("post-club", false)
</script>
{% endif %}

View File

@ -170,29 +170,29 @@
<pre></pre>
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="new" name="new">
<label class="custom-control-label" for="new">Make the default comment sorting "new"</label>
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-new" name="new" onchange="savetext()">
<label class="custom-control-label" for="post-new">Make the default comment sorting "new"</label>
</div>
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="nsfw" name="over_18">
<label class="custom-control-label" for="nsfw">+18</label>
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-nsfw" name="over_18" onchange="savetext()">
<label class="custom-control-label" for="post-nsfw">+18</label>
</div>
<div class="custom-control custom-checkbox">
<input onchange='draft(this);' autocomplete="off" type="checkbox" class="custom-control-input" id="private" name="private">
<label class="custom-control-label" for="private">Draft</label>
<input onchange='draft(this);' autocomplete="off" type="checkbox" class="custom-control-input" id="post-private" name="private" onchange="savetext()">
<label class="custom-control-label" for="post-private">Draft</label>
</div>
{% if FEATURES['COUNTRY_CLUB'] -%}
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="club" name="club">
<label class="custom-control-label" for="club">{{CC_TITLE}} thread</label>
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-club" name="club" onchange="savetext()">
<label class="custom-control-label" for="post-club">{{CC_TITLE}} thread</label>
</div>
{%- endif %}
<div class="custom-control custom-checkbox">
<input onchange='draft(this);' autocomplete="off" type="checkbox" class="custom-control-input" id="ghost" name="ghost" {% if v.coins < 100 %}disabled{% endif %}>
<label class="custom-control-label" for="ghost">Ghost Thread (cost: 100 coins)</label>
<input onchange='draft(this);' autocomplete="off" type="checkbox" class="custom-control-input" id="post-ghost" name="ghost" {% if v.coins < 100 %}disabled{% endif %}>
<label class="custom-control-label" for="post-ghost">Ghost Thread (cost: 100 coins)</label>
</div>
<pre>

View File

@ -25,7 +25,7 @@ set CACHE_VER = {
'js/formatting.js': 240,
'js/lottery.js': 256,
'js/marked.js': 283,
'js/submit.js': 269,
'js/submit.js': 270,
'js/userpage.js': 244,
'js/userpage_v.js': 245,
'js/lozad.js': 260,