Allow editing of settings

This commit is contained in:
Eduard Urbach 2017-06-24 02:10:04 +02:00
parent 3fcb1bc36e
commit 8d976488ee
4 changed files with 15 additions and 3 deletions

View File

@ -25,7 +25,7 @@ func main() {
count++
println(count, user.Nick)
user.SetNick(user.Nick)
user.ForceSetNick(user.Nick)
if user.Email != "" {
user.SetEmail(user.Email)

View File

@ -30,6 +30,7 @@ export class AnimeNotifier {
})
.then(response => response.text())
.then(html => Diff.innerHTML(this.app.content, html))
.then(() => this.app.emit("DOMContentLoaded"))
}
loading(isLoading: boolean) {
@ -42,13 +43,17 @@ export class AnimeNotifier {
updateActions() {
for(let element of findAll("action")) {
if(element["action assigned"]) {
continue
}
let actionName = element.dataset.action
element.addEventListener(element.dataset.trigger, e => {
actions[actionName](this, element, e)
})
element.classList.remove("action")
element["action assigned"] = true
}
}

View File

@ -48,6 +48,11 @@ export class Diff {
a.setAttribute(attrib.name, b.getAttribute(attrib.name))
}
}
// Special case: Apply state of input elements
if(a !== document.activeElement && a instanceof HTMLInputElement && b instanceof HTMLInputElement) {
a.value = b.value
}
}
Diff.childNodes(a, b)
@ -57,7 +62,7 @@ export class Diff {
static innerHTML(aRoot: HTMLElement, html: string) {
let bRoot = document.createElement("main")
bRoot.innerHTML = html
Diff.childNodes(aRoot, bRoot)
}
}

View File

@ -48,6 +48,8 @@ export function save(arn: AnimeNotifier, input: HTMLInputElement | HTMLTextAreaE
.then(() => {
arn.loading(false)
input.disabled = false
return arn.reloadContent()
})
}