remove frontend char limits for distinguished

master
Aevann 2024-10-19 08:42:12 +03:00
parent 42f99b6704
commit 0f3f4285bb
4 changed files with 21 additions and 4 deletions

View File

@ -18,6 +18,13 @@ for (const key of save_checked) {
}
}
if (document.getElementById('post-distinguished').checked) {
postText.minLength = 0;
postText.maxLength = document.getElementById('POST_BODY_LENGTH_LIMIT').value
}
charLimit('post-text','character-count-submit-text-form')
function savetext() {
for (const id of save_value)
{
@ -112,6 +119,14 @@ function ghost_toggle(t) {
}
}
function distinguished_toggle(t) {
if (t.checked == true) {
postText.minLength = 0;
postText.maxLength = document.getElementById('POST_BODY_LENGTH_LIMIT').value
charLimit('post-text','character-count-submit-text-form')
}
}
function checkRepost() {
const system = document.getElementById('system')
system.innerHTML = "";

View File

@ -293,7 +293,7 @@
{% if v and (v.id == c.author_id or v.admin_level >= PERMS['POST_COMMENT_EDITING']) %}
<div id="comment-edit-{{c.id}}" class="d-none comment-write collapsed child">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.id == c.author_id and v.bird %}140{% else %}10000{% endif %}" data-preview="preview-edit-{{c.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('comment-edit-body-{{c.id}}','charcount-edit-{{c.id}}');handle_disabled(this)" id="comment-edit-body-{{c.id}}" data-id="{{c.id}}" name="body" form="comment-edit-form-{{c.id}}" class="file-ta comment-box form-control rounded" placeholder="Add your comment..." rows="3">{{c.body}}</textarea>
<textarea autocomplete="off" {% if v.longpost and not c.distinguished %}minlength="280"{% endif %} maxlength="{% if v.id == c.author_id and v.bird and not c.distinguished %}140{% else %}10000{% endif %}" data-preview="preview-edit-{{c.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('comment-edit-body-{{c.id}}','charcount-edit-{{c.id}}');handle_disabled(this)" id="comment-edit-body-{{c.id}}" data-id="{{c.id}}" name="body" form="comment-edit-form-{{c.id}}" class="file-ta comment-box form-control rounded" placeholder="Add your comment..." rows="3">{{c.body}}</textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-edit-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>

View File

@ -217,7 +217,7 @@
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<input hidden name="current_page" value="{{request.path}}">
<textarea id="post-edit-title" autocomplete="off" maxlength="500" name="title" class="comment-box form-control rounded" required placeholder="title">{{p.title}}</textarea>
<textarea autocomplete="off" name="body" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.id == p.author_id and v.bird %}140{% else %}{{POST_BODY_LENGTH_LIMIT(v)}}{% endif %}" data-preview="post-edit-{{p.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('post-edit-box-{{p.id}}','charcount-post-edit')" id="post-edit-box-{{p.id}}" form="post-edit-form-{{p.id}}" class="file-ta comment-box form-control rounded" placeholder="Add text to your post..." rows="10" data-id="{{p.id}}">{{p.body}}</textarea>
<textarea autocomplete="off" name="body" {% if v.longpost and not p.distinguished %}minlength="280"{% endif %} maxlength="{% if v.id == p.author_id and v.bird and not p.distinguished %}140{% else %}{{POST_BODY_LENGTH_LIMIT(v)}}{% endif %}" data-preview="post-edit-{{p.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('post-edit-box-{{p.id}}','charcount-post-edit')" id="post-edit-box-{{p.id}}" form="post-edit-form-{{p.id}}" class="file-ta comment-box form-control rounded" placeholder="Add text to your post..." rows="10" data-id="{{p.id}}">{{p.body}}</textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-post-edit" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>

View File

@ -108,14 +108,14 @@
{% if v.can_post_in_ghost_threads %}
<div class="custom-control custom-checkbox">
<input data-nonce="{{g.nonce}}" data-onchange='ghost_toggle(this)' autocomplete="off" type="checkbox" class="custom-control-input" id="post-ghost" name="ghost">
<input data-nonce="{{g.nonce}}" data-onchange='savetext();ghost_toggle(this)' autocomplete="off" type="checkbox" class="custom-control-input" id="post-ghost" name="ghost">
<label class="custom-control-label" for="post-ghost">Ghost thread</label>
</div>
{% endif %}
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] %}
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="post-distinguished" name="distinguished" data-nonce="{{g.nonce}}" data-onchange="savetext()">
<input data-nonce="{{g.nonce}}" data-onchange='savetext();distinguished_toggle(this)' autocomplete="off" type="checkbox" class="custom-control-input" id="post-distinguished" name="distinguished">
<label class="custom-control-label" for="post-distinguished">Distinguished</label>
</div>
{% endif %}
@ -146,6 +146,8 @@
{% include "modals/emoji.html" %}
{% include "modals/gif.html" %}
<input hidden id="POST_BODY_LENGTH_LIMIT" value="{{POST_BODY_LENGTH_LIMIT(v)}}">
{% if SITE_NAME == 'WPD' %}
{% for hole in hole_objs %}
<div id="{{hole}}-sidebar" class="d-none">