Link notification block to its main path
This commit is contained in:
22
bookwyrm/static/js/block_href.js
Normal file
22
bookwyrm/static/js/block_href.js
Normal 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;
|
||||
}
|
||||
}();
|
||||
|
Reference in New Issue
Block a user