diff --git a/scripts/Analytics.ts b/scripts/Analytics.ts new file mode 100644 index 00000000..f4c91fab --- /dev/null +++ b/scripts/Analytics.ts @@ -0,0 +1,26 @@ +export class Analytics { + push() { + let analytics = { + general: { + timezoneOffset: new Date().getTimezoneOffset() + }, + screen: { + width: screen.width, + height: screen.height, + availableWidth: screen.availWidth, + availableHeight: screen.availHeight, + pixelRatio: window.devicePixelRatio + }, + system: { + cpuCount: navigator.hardwareConcurrency, + platform: navigator.platform + } + } + + fetch("/dark-flame-master", { + method: "POST", + credentials: "same-origin", + body: JSON.stringify(analytics) + }) + } +} \ No newline at end of file diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index 63142e05..7cb57f1b 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -7,9 +7,11 @@ import { MutationQueue } from "./MutationQueue" import { StatusMessage } from "./StatusMessage" import { PushManager } from "./PushManager" import { TouchController } from "./TouchController" +import { Analytics } from "./Analytics" export class AnimeNotifier { app: Application + analytics: Analytics user: HTMLElement title: string webpEnabled: boolean @@ -118,6 +120,9 @@ export class AnimeNotifier { // Push manager this.pushManager = new PushManager() + // Analytics + this.analytics = new Analytics() + // Sidebar control this.sideBar = this.app.find("sidebar") @@ -180,7 +185,9 @@ export class AnimeNotifier { this.registerServiceWorker() // Analytics - this.pushAnalytics() + if(this.user) { + this.analytics.push() + } // Offline message if(navigator.onLine === false) { @@ -290,35 +297,6 @@ export class AnimeNotifier { } } - pushAnalytics() { - if(!this.user) { - return - } - - let analytics = { - general: { - timezoneOffset: new Date().getTimezoneOffset() - }, - screen: { - width: screen.width, - height: screen.height, - availableWidth: screen.availWidth, - availableHeight: screen.availHeight, - pixelRatio: window.devicePixelRatio - }, - system: { - cpuCount: navigator.hardwareConcurrency, - platform: navigator.platform - } - } - - fetch("/dark-flame-master", { - method: "POST", - credentials: "same-origin", - body: JSON.stringify(analytics) - }) - } - setSelectBoxValue() { for(let element of document.getElementsByTagName("select")) { element.value = element.getAttribute("value") diff --git a/scripts/Diff.ts b/scripts/Diff.ts index 88cc90fc..0fc7ffcb 100644 --- a/scripts/Diff.ts +++ b/scripts/Diff.ts @@ -68,13 +68,6 @@ export class Diff { let elemA = a as HTMLElement let elemB = b as HTMLElement - // Skip iframes - // This part needs to be executed AFTER lazy images check - // to allow lazily loaded iframes to update their data src. - if(elemA.tagName === "IFRAME") { - continue - } - let removeAttributes: Attr[] = [] for(let x = 0; x < elemA.attributes.length; x++) {