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
|
||||
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
|
||||
|
@ -154,21 +154,21 @@ export class Application {
|
||||
|
||||
for(let i = 0; i < links.length; i++) {
|
||||
let link = links[i] as HTMLElement
|
||||
|
||||
// link.classList.remove(this.ajaxClass)
|
||||
|
||||
let self = this
|
||||
|
||||
link.onclick = function(e) {
|
||||
// Middle mouse button should have standard behaviour
|
||||
if(e.which === 2)
|
||||
if(e.which === 2) {
|
||||
return
|
||||
}
|
||||
|
||||
let url = this.getAttribute("href")
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
if(!url || url === self.currentPath)
|
||||
if(!url || url === self.currentPath) {
|
||||
return
|
||||
}
|
||||
|
||||
// Load requested page
|
||||
self.load(url)
|
||||
|
@ -113,8 +113,6 @@ class MyServiceWorker {
|
||||
return evt.respondWith(this.fromNetwork(request))
|
||||
}
|
||||
|
||||
console.log("Fetch:", request.url)
|
||||
|
||||
// Clear cache on authentication and fetch it normally
|
||||
if(request.url.includes("/auth/") || request.url.includes("/logout")) {
|
||||
return evt.respondWith(caches.delete(this.cache.version).then(() => fetch(request)))
|
||||
|
Loading…
Reference in New Issue
Block a user