diff --git a/templates/forum/topic.html b/templates/forum/topic.html index 885b70a..fa85d0e 100755 --- a/templates/forum/topic.html +++ b/templates/forum/topic.html @@ -1503,6 +1503,25 @@ {% endblock %} {% block extra_js %} + // Scroll to reply anchor (e.g. from notification link #reply-55) + (function() { + var hash = window.location.hash; + if (hash && hash.startsWith('#reply-')) { + var target = document.getElementById(hash.substring(1)); + if (target) { + var headerH = document.querySelector('header'); + var offset = headerH ? headerH.offsetHeight + 16 : 80; + setTimeout(function() { + var top = target.getBoundingClientRect().top + window.pageYOffset - offset; + window.scrollTo({ top: top, behavior: 'smooth' }); + target.style.transition = 'box-shadow 0.3s ease'; + target.style.boxShadow = '0 0 0 3px var(--primary-light, #4a6999)'; + setTimeout(function() { target.style.boxShadow = ''; }, 3000); + }, 200); + } + } + })(); + function showToast(message, type = 'info', duration = 4000) { const container = document.getElementById('toastContainer'); const icons = { success: '✓', error: '✕', warning: '⚠', info: 'ℹ' };