Fixed a problem that caused tabs to reload pages

This commit is contained in:
2017-12-04 12:21:41 +01:00
parent 26ab168dd7
commit e8a8e5fb5a
3 changed files with 11 additions and 7 deletions

View File

@ -52,6 +52,7 @@ export class AnimeNotifier {
// Never remove src property on diffs
Diff.persistentAttributes.add("src")
// Is intersection observer supported?
if("IntersectionObserver" in window) {
// Enable lazy load
this.visibilityObserver = new IntersectionObserver(
@ -451,6 +452,11 @@ export class AnimeNotifier {
element.removeEventListener(oldAction.trigger, oldAction.handler)
}
// This prevents default actions on links
if(actionTrigger === "click" && element.tagName === "A") {
element.onclick = null
}
if(!(actionName in actions)) {
this.statusMessage.showError(`Action '${actionName}' has not been defined`)
continue