1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

commento.js: add scroll into view based on hash

This commit is contained in:
Adhityaa Chandrasekar
2019-02-17 17:45:05 -05:00
parent a22b49a112
commit 619231e32f
2 changed files with 18 additions and 0 deletions

View File

@ -1523,6 +1523,7 @@
attrSet(footer, "style", "");
nameWidthFix();
loadHash();
}
@ -1570,6 +1571,19 @@
}
function loadHash() {
if (window.location.hash && window.location.hash.startsWith("#commento-")) {
var el = $(ID_CARD + window.location.hash.split("-")[1]);
if (el === null) {
return;
}
classAdd(el, "highlighted");
el.scrollIntoView(true);
}
}
global.main = function(callback) {
root = $(ID_ROOT);
if (root === null) {