commento.js: use scrollIntoView for #commento

This commit is contained in:
Adhityaa Chandrasekar 2019-03-02 15:16:56 -05:00
parent 15b1640f89
commit 88d4f8afcf

View File

@ -1610,14 +1610,18 @@
function loadHash() { function loadHash() {
if (window.location.hash && window.location.hash.startsWith("#commento-")) { if (window.location.hash) {
var el = $(ID_CARD + window.location.hash.split("-")[1]); if (window.location.hash.startsWith("#commento-")) {
if (el === null) { var el = $(ID_CARD + window.location.hash.split("-")[1]);
return; if (el === null) {
} return;
}
classAdd(el, "highlighted-card"); classAdd(el, "highlighted-card");
el.scrollIntoView(true); el.scrollIntoView(true);
} else if (window.location.hash.startsWith("#commento")) {
root.scrollIntoView(true);
}
} }
} }