General improvements

This commit is contained in:
2017-06-20 14:16:23 +02:00
parent 009c73629f
commit 877b2433e4
11 changed files with 68 additions and 9 deletions

View File

@ -43,6 +43,14 @@ export class AnimeNotifier {
}
}
onPopState(e: PopStateEvent) {
if(e.state) {
this.app.load(e.state, false)
} else if(this.app.currentPath !== this.app.originalPath) {
this.app.load(this.app.originalPath, false)
}
}
updateAvatars() {
for(let element of findAll(".user-image")) {
let img = element as HTMLImageElement
@ -60,4 +68,14 @@ export class AnimeNotifier {
}
}
}
// onResize(e: UIEvent) {
// let hasScrollbar = this.app.content.clientHeight === this.app.content.scrollHeight
// if(hasScrollbar) {
// this.app.content.classList.add("has-scrollbar")
// } else {
// this.app.content.classList.remove("has-scrollbar")
// }
// }
}

View File

@ -55,7 +55,7 @@ export class Application {
this.currentPath = url
// Start sending a network request
let request = this.get("/_" + url)
let request = this.get("/_" + url).catch(error => error)
let onTransitionEnd = e => {
// Ignore transitions of child elements.

View File

@ -7,9 +7,5 @@ let arn = new AnimeNotifier(app)
document.addEventListener("DOMContentLoaded", arn.onContentLoaded.bind(arn))
document.addEventListener("readystatechange", arn.onReadyStateChange.bind(arn))
window.onpopstate = e => {
if(e.state)
app.load(e.state, false)
else if(app.currentPath !== app.originalPath)
app.load(app.originalPath, false)
}
window.addEventListener("popstate", arn.onPopState.bind(arn))
// window.addEventListener("resize", arn.onResize.bind(arn))