[bbcode] remove jquery
This commit is contained in:
parent
8121f4d6db
commit
de96ce8129
1 changed files with 8 additions and 6 deletions
|
@ -1,18 +1,20 @@
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
$(".shm-clink").each(function(idx, elm) {
|
document.querySelectorAll(".shm-clink").forEach(function(el) {
|
||||||
var target_id = $(elm).data("clink-sel");
|
var target_id = el.getAttribute("data-clink-sel");
|
||||||
if(target_id && $(target_id).length > 0) {
|
if(target_id && document.querySelectorAll(target_id).length > 0) {
|
||||||
// if the target comment is already on this page, don't bother
|
// if the target comment is already on this page, don't bother
|
||||||
// switching pages
|
// switching pages
|
||||||
$(elm).attr("href", target_id);
|
el.setAttribute("href", target_id);
|
||||||
|
|
||||||
// highlight it when clicked
|
// highlight it when clicked
|
||||||
$(elm).click(function(e) {
|
el.addEventListener("click", function(e) {
|
||||||
// This needs jQuery UI
|
// This needs jQuery UI
|
||||||
$(target_id).highlight();
|
$(target_id).highlight();
|
||||||
});
|
});
|
||||||
|
|
||||||
// vanilla target name should already be in the URL tag, but this
|
// vanilla target name should already be in the URL tag, but this
|
||||||
// will include the anon ID as displayed on screen
|
// will include the anon ID as displayed on screen
|
||||||
$(elm).html("@"+$(target_id+" .username").html());
|
el.innerHTML = "@"+document.querySelector(target_id+" .username").innerHTML;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue