diff --git a/patches/user-references/main.go b/patches/user-references/main.go index 0dbc4a51..46ad2777 100644 --- a/patches/user-references/main.go +++ b/patches/user-references/main.go @@ -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) diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index 61622040..b3cbead9 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -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 } } diff --git a/scripts/Diff.ts b/scripts/Diff.ts index 394d06dd..fc59b7c2 100644 --- a/scripts/Diff.ts +++ b/scripts/Diff.ts @@ -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) } } \ No newline at end of file diff --git a/scripts/actions.ts b/scripts/actions.ts index c6a8f702..a6e7cb5e 100644 --- a/scripts/actions.ts +++ b/scripts/actions.ts @@ -48,6 +48,8 @@ export function save(arn: AnimeNotifier, input: HTMLInputElement | HTMLTextAreaE .then(() => { arn.loading(false) input.disabled = false + + return arn.reloadContent() }) }