diff --git a/scripts/Application.ts b/scripts/Application.ts index 9576511c..4d569723 100644 --- a/scripts/Application.ts +++ b/scripts/Application.ts @@ -207,9 +207,6 @@ export class Application { } emit(eventName: string) { - document.dispatchEvent(new Event(eventName, { - "bubbles": true, - "cancelable": true - })) + document.dispatchEvent(new Event(eventName)) } } \ No newline at end of file diff --git a/scripts/SideBar.ts b/scripts/SideBar.ts index 33dd4823..6b5ee703 100644 --- a/scripts/SideBar.ts +++ b/scripts/SideBar.ts @@ -1,4 +1,5 @@ import { TouchController } from "./TouchController" +import { Diff } from "./Diff" export class SideBar { element: HTMLElement @@ -20,11 +21,11 @@ export class SideBar { } show() { - this.element.classList.add("sidebar-visible") + Diff.mutations.queue(() => this.element.classList.add("sidebar-visible")) } hide() { - this.element.classList.remove("sidebar-visible") + Diff.mutations.queue(() => this.element.classList.remove("sidebar-visible")) } toggle() { diff --git a/scripts/Utils.ts b/scripts/Utils.ts index 9eeaef9f..8546907d 100644 --- a/scripts/Utils.ts +++ b/scripts/Utils.ts @@ -15,15 +15,7 @@ export function plural(count: number, singular: string): string { } export function canUseWebP(): boolean { - let canvas = document.createElement("canvas") - - if(!!(canvas.getContext && canvas.getContext("2d"))) { - // WebP representation possible - return canvas.toDataURL("image/webp").indexOf("data:image/webp") === 0 - } else { - // In very old browsers (IE 8) canvas is not supported - return false - } + return document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") === 0 } export function swapElements(a: Node, b: Node) {