forked from rDrama/rDrama
1
0
Fork 0

make the page always jump to the comment you wanna view

master
Aevann1 2022-06-10 20:01:12 +02:00
parent b2ef1f0fce
commit f9a0cff350
2 changed files with 5 additions and 4 deletions

View File

@ -67,8 +67,8 @@ def pusher_thread(interests, c, username):
@auth_desired
def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}#context")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','') + '#context')
try: cid = int(cid)
except: abort(404)

View File

@ -1,9 +1,10 @@
{%- from 'util/assetcache.html' import asset -%}
{%- import 'util/helpers.html' as help -%}
{% if not ajax %}
{% if comment_info and not request.full_path.endswith('#context') %}
{% if comment_info %}
<script>
history.pushState(null, null, '#context');
if (location.hash != 'context')
location.hash = 'context'
</script>
{% endif %}