master
Aevann1 2022-01-30 23:19:59 +02:00
parent 16f2f5d927
commit 381f295998
4 changed files with 256 additions and 251 deletions

View File

@ -604,7 +604,7 @@ def api_comment(v):
g.db.commit()
if request.headers.get("Authorization"): return c.json
return render_template("comments.html", v=v, comments=[c])
return render_template("comments.html", v=v, comments=[c], ajax=True)

View File

@ -338,7 +338,7 @@ def viewmore(v, pid, sort, offset):
if len(comments) == len(comments2): offset = None
comments = comments2
return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset)
return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset, ajax=True)
@app.post("/morecomments/<cid>")
@ -387,7 +387,7 @@ def morecomments(v, cid):
c = g.db.query(Comment).filter_by(id=cid).one_or_none()
comments = c.replies
return render_template("comments.html", v=v, comments=comments, render_replies=True)
return render_template("comments.html", v=v, comments=comments, render_replies=True, ajax=True)
@app.post("/edit_post/<pid>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")

View File

@ -573,7 +573,7 @@ def messagereply(v):
g.db.add(notif)
g.db.commit()
return render_template("comments.html", v=v, comments=[new_comment])
return render_template("comments.html", v=v, comments=[new_comment], ajax=True)
@app.get("/2faqr/<secret>")
@auth_required

View File

@ -1,14 +1,15 @@
{% if comment_info and not request.full_path.endswith('#context') %}
{% if not ajax %}
{% if comment_info and not request.full_path.endswith('#context') %}
<script>
history.pushState(null, null, '#context');
</script>
{% endif %}
{% endif %}
{% if v %}
{% if v %}
{% include "award_modal.html" %}
{% endif %}
{% endif %}
<style>
<style>
html {
scroll-padding-top: 75px;
}
@ -31,9 +32,9 @@
background: rgba(255,255,255,0.2);
padding: 12px;
}
</style>
</style>
<div style="display:none" id="popover">
<div style="display:none" id="popover">
<div class="popover-user-profile" role="tooltip">
<img loading="lazy" class="pop-banner w-100 h-64 object-cover">
<div class="d-flex align-items-end px-3 mt-n6 mb-3">
@ -69,7 +70,8 @@
</a>
</div>
</div>
</div>
</div>
{% endif %}
{% macro single_comment(c, level=1) %}
@ -742,7 +744,8 @@
{% endfor %}
{% if v %}
{% if not ajax %}
{% if v %}
{% include "gif_modal.html" %}
{% include "emoji_modal.html" %}
{% if v.admin_level > 1 %}
@ -808,9 +811,9 @@
</div>
</div>
</div>
{% endif %}
{% endif %}
<style>
<style>
.mod:before {
content: '(((';
}
@ -901,25 +904,25 @@
margin-right: 3px;
margin-top: -2px;
}
</style>
</style>
{% if v %}
{% if v %}
<script src="/static/assets/js/marked.js?a=220"></script>
<script src="/static/assets/js/comments_v.js?a=235"></script>
{% endif %}
{% endif %}
<script src="/static/assets/js/clipboard.js?a=220"></script>
<script src="/static/assets/js/clipboard.js?a=220"></script>
{% if v and v.admin_level > 1 %}
{% if v and v.admin_level > 1 %}
<script src="/static/assets/js/comments_admin.js?a=220"></script>
{% endif %}
{% endif %}
{% include "expanded_image_modal.html" %}
{% include "expanded_image_modal.html" %}
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
<script src="/static/assets/js/comments.js?a=221"></script>
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
<script src="/static/assets/js/comments.js?a=221"></script>
<script>
<script>
{% if p and (not v or v.highlightcomments) %}
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
lastCount = comments['{{p.id}}']
@ -935,7 +938,8 @@
{% endfor %}
}
{% endif %}
</script>
</script>
{% endif %}
{% if offset %}
{% if p %}
@ -944,4 +948,5 @@
<br>
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}})">VIEW MORE COMMENTS</a></div>
{% endif %}
</body>