Fixed a problem that caused tabs to reload pages
This commit is contained in:
parent
26ab168dd7
commit
e8a8e5fb5a
@ -52,6 +52,7 @@ export class AnimeNotifier {
|
|||||||
// Never remove src property on diffs
|
// Never remove src property on diffs
|
||||||
Diff.persistentAttributes.add("src")
|
Diff.persistentAttributes.add("src")
|
||||||
|
|
||||||
|
// Is intersection observer supported?
|
||||||
if("IntersectionObserver" in window) {
|
if("IntersectionObserver" in window) {
|
||||||
// Enable lazy load
|
// Enable lazy load
|
||||||
this.visibilityObserver = new IntersectionObserver(
|
this.visibilityObserver = new IntersectionObserver(
|
||||||
@ -451,6 +452,11 @@ export class AnimeNotifier {
|
|||||||
element.removeEventListener(oldAction.trigger, oldAction.handler)
|
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)) {
|
if(!(actionName in actions)) {
|
||||||
this.statusMessage.showError(`Action '${actionName}' has not been defined`)
|
this.statusMessage.showError(`Action '${actionName}' has not been defined`)
|
||||||
continue
|
continue
|
||||||
|
@ -154,21 +154,21 @@ export class Application {
|
|||||||
|
|
||||||
for(let i = 0; i < links.length; i++) {
|
for(let i = 0; i < links.length; i++) {
|
||||||
let link = links[i] as HTMLElement
|
let link = links[i] as HTMLElement
|
||||||
|
|
||||||
// link.classList.remove(this.ajaxClass)
|
|
||||||
|
|
||||||
let self = this
|
let self = this
|
||||||
|
|
||||||
link.onclick = function(e) {
|
link.onclick = function(e) {
|
||||||
// Middle mouse button should have standard behaviour
|
// Middle mouse button should have standard behaviour
|
||||||
if(e.which === 2)
|
if(e.which === 2) {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let url = this.getAttribute("href")
|
let url = this.getAttribute("href")
|
||||||
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
if(!url || url === self.currentPath)
|
if(!url || url === self.currentPath) {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Load requested page
|
// Load requested page
|
||||||
self.load(url)
|
self.load(url)
|
||||||
|
@ -113,8 +113,6 @@ class MyServiceWorker {
|
|||||||
return evt.respondWith(this.fromNetwork(request))
|
return evt.respondWith(this.fromNetwork(request))
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Fetch:", request.url)
|
|
||||||
|
|
||||||
// Clear cache on authentication and fetch it normally
|
// Clear cache on authentication and fetch it normally
|
||||||
if(request.url.includes("/auth/") || request.url.includes("/logout")) {
|
if(request.url.includes("/auth/") || request.url.includes("/logout")) {
|
||||||
return evt.respondWith(caches.delete(this.cache.version).then(() => fetch(request)))
|
return evt.respondWith(caches.delete(this.cache.version).then(() => fetch(request)))
|
||||||
|
Loading…
Reference in New Issue
Block a user