Link notification block to its main path

This commit is contained in:
Mouse Reeve
2021-10-02 11:24:07 -07:00
parent 2a9f8f8122
commit b9632039f9
11 changed files with 62 additions and 2 deletions

View File

@ -0,0 +1,22 @@
/* exported BlockHref */
/* globals BookWyrm */
let BlockHref = new class {
constructor() {
document.querySelectorAll('[data-href]')
.forEach(t => t.addEventListener('click', this.followLink.bind(this)));
}
/**
* Follow a fake link
*
* @param {Event} event
* @return {undefined}
*/
followLink(event) {
const url = event.currentTarget.dataset.href;
window.location.href = url;
}
}();