turns out we didnt need a dedicated ajax variable

master
Aevann1 2022-08-30 07:26:13 +02:00
parent 1a69b98b72
commit 7fbcec3b82
4 changed files with 7 additions and 7 deletions

View File

@ -638,7 +638,7 @@ def comment(v):
g.db.flush() g.db.flush()
if request.headers.get("Authorization"): return c.json if request.headers.get("Authorization"): return c.json
return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True, new_comment=True)} return {"comment": render_template("comments.html", v=v, comments=[c], new_comment=True)}

View File

@ -328,7 +328,7 @@ def viewmore(v, pid, sort, offset):
else: offset += 1 else: offset += 1
comments = comments2 comments = comments2
return render_template("comments.html", v=v, comments=comments, p=post, ids=list(ids), render_replies=True, pid=pid, sort=sort, offset=offset, ajax=True) return render_template("comments.html", v=v, comments=comments, p=post, ids=list(ids), render_replies=True, pid=pid, sort=sort, offset=offset)
@app.get("/morecomments/<cid>") @app.get("/morecomments/<cid>")
@ -383,7 +383,7 @@ def morecomments(v, cid):
if comments: p = comments[0].post if comments: p = comments[0].post
else: p = None else: p = None
return render_template("comments.html", v=v, comments=comments, p=p, render_replies=True, ajax=True) return render_template("comments.html", v=v, comments=comments, p=p, render_replies=True)
@app.post("/edit_post/<pid>") @app.post("/edit_post/<pid>")
@limiter.limit("1/second;10/minute;100/hour;200/day") @limiter.limit("1/second;10/minute;100/hour;200/day")

View File

@ -805,7 +805,7 @@ def messagereply(v):
g.db.delete(n) g.db.delete(n)
return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True)} return {"comment": render_template("comments.html", v=v, comments=[c])}
@app.get("/2faqr/<secret>") @app.get("/2faqr/<secret>")
@auth_required @auth_required

View File

@ -1,6 +1,6 @@
{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- from 'util/assetcache.html' import asset, asset_siteimg with context -%}
{%- import 'util/helpers.html' as help -%} {%- import 'util/helpers.html' as help -%}
{% if not ajax %} {% if not request.headers.get("xhr") %}
{% if comment_info %} {% if comment_info %}
<script> <script>
if (location.hash != 'context') if (location.hash != 'context')
@ -795,7 +795,7 @@
{% endfor %} {% endfor %}
{% if not ajax %} {% if not request.headers.get("xhr") %}
{% if v %} {% if v %}
{% include "gif_modal.html" %} {% include "gif_modal.html" %}
{% include "emoji_modal.html" %} {% include "emoji_modal.html" %}
@ -949,7 +949,7 @@
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div> <div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div>
{% endif %} {% endif %}
{% if SITE_NAME == 'rDrama' and not ajax and v and 'SamsungBrowser' not in g.agent %} {% if SITE_NAME == 'rDrama' and not request.headers.get("xhr") and v and 'SamsungBrowser' not in g.agent %}
<script> <script>
const element = document.getElementsByClassName('comment-section')[0]; const element = document.getElementsByClassName('comment-section')[0];
let color = getComputedStyle(element).getPropertyValue('background-color'); let color = getComputedStyle(element).getPropertyValue('background-color');