Cleanup
This commit is contained in:
parent
e646410fc2
commit
c8acdc0d11
26
scripts/Analytics.ts
Normal file
26
scripts/Analytics.ts
Normal file
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
@ -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")
|
||||
|
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user