Link notification block to its main path
This commit is contained in:
parent
2a9f8f8122
commit
b9632039f9
11 changed files with 62 additions and 2 deletions
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;
|
||||
}
|
||||
}();
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue