diff --git a/scripts/Actions/Explore.ts b/scripts/Actions/Explore.ts index f8ce3803..4f257535 100644 --- a/scripts/Actions/Explore.ts +++ b/scripts/Actions/Explore.ts @@ -2,7 +2,7 @@ import AnimeNotifier from "../AnimeNotifier" import { findAll } from "scripts/Utils" // Filter anime on explore page -export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) { +export function filterAnime(arn: AnimeNotifier, _: HTMLInputElement) { let root = document.getElementById("filter-root") as HTMLElement let elementYear = document.getElementById("filter-year") as HTMLSelectElement diff --git a/scripts/Actions/Forum.ts b/scripts/Actions/Forum.ts index 9d3778ba..c9c05cf6 100644 --- a/scripts/Actions/Forum.ts +++ b/scripts/Actions/Forum.ts @@ -1,7 +1,7 @@ import AnimeNotifier from "../AnimeNotifier" // Edit post -export function editPost(arn: AnimeNotifier, element: HTMLElement) { +export function editPost(_: AnimeNotifier, element: HTMLElement) { let postId = element.dataset.id if(!postId) { @@ -147,7 +147,7 @@ export async function reply(arn: AnimeNotifier, element: HTMLElement) { } // Cancel replying to a post -export function cancelReply(arn: AnimeNotifier, element: HTMLElement) { +export function cancelReply(arn: AnimeNotifier, _: HTMLElement) { arn.reloadContent() } diff --git a/scripts/Actions/Notifications.ts b/scripts/Actions/Notifications.ts index c4efe8a2..86b0b9f3 100644 --- a/scripts/Actions/Notifications.ts +++ b/scripts/Actions/Notifications.ts @@ -1,7 +1,7 @@ import AnimeNotifier from "../AnimeNotifier" // Enable notifications -export async function enableNotifications(arn: AnimeNotifier, button: HTMLElement) { +export async function enableNotifications(arn: AnimeNotifier, _: HTMLElement) { if(!arn.user || !arn.user.dataset.id) { return } @@ -13,7 +13,7 @@ export async function enableNotifications(arn: AnimeNotifier, button: HTMLElemen } // Disable notifications -export async function disableNotifications(arn: AnimeNotifier, button: HTMLElement) { +export async function disableNotifications(arn: AnimeNotifier, _: HTMLElement) { if(!arn.user || !arn.user.dataset.id) { return } diff --git a/scripts/Actions/Search.ts b/scripts/Actions/Search.ts index e25128e5..2c416068 100644 --- a/scripts/Actions/Search.ts +++ b/scripts/Actions/Search.ts @@ -199,11 +199,11 @@ export function searchBySpeech(arn: AnimeNotifier, element: HTMLElement) { recognition.stop() } - recognition.onerror = e => { + recognition.onerror = _ => { recognition.stop() } - recognition.onend = e => { + recognition.onend = _ => { searchInput.placeholder = oldPlaceholder element.classList.remove("speech-listening") } diff --git a/scripts/Actions/Shop.ts b/scripts/Actions/Shop.ts index 56d46597..26d5c47b 100644 --- a/scripts/Actions/Shop.ts +++ b/scripts/Actions/Shop.ts @@ -34,7 +34,7 @@ export function chargeUp(arn: AnimeNotifier, button: HTMLElement) { } // Toggle fade -export function toggleFade(arn: AnimeNotifier, button: HTMLElement) { +export function toggleFade(_: AnimeNotifier, button: HTMLElement) { let elementId = button.dataset.elementId if(!elementId) { diff --git a/scripts/Actions/SideBar.ts b/scripts/Actions/SideBar.ts index 8b0746a8..b7d98a26 100644 --- a/scripts/Actions/SideBar.ts +++ b/scripts/Actions/SideBar.ts @@ -1,7 +1,7 @@ import AnimeNotifier from "../AnimeNotifier" // Toggle sidebar -export function toggleSidebar(arn: AnimeNotifier) { +export function toggleSidebar(_: AnimeNotifier) { let sidebar = document.getElementById("sidebar") as HTMLElement sidebar.classList.toggle("sidebar-visible") } \ No newline at end of file diff --git a/scripts/Actions/Theme.ts b/scripts/Actions/Theme.ts index 68e7402b..dc991c4e 100644 --- a/scripts/Actions/Theme.ts +++ b/scripts/Actions/Theme.ts @@ -166,7 +166,7 @@ export function applyTheme(themeName: string) { } // Color picker -export function pickColor(arn: AnimeNotifier, element: HTMLElement) { +export function pickColor(_: AnimeNotifier, element: HTMLElement) { let rootStyle = document.documentElement.style let variableName = `--${element.dataset.variable}` diff --git a/scripts/Actions/User.ts b/scripts/Actions/User.ts index 86b5bfaa..ff0d7430 100644 --- a/scripts/Actions/User.ts +++ b/scripts/Actions/User.ts @@ -31,7 +31,7 @@ async function updateFollow(arn: AnimeNotifier, element: HTMLElement, message: s } // Show more -export function showMore(arn: AnimeNotifier, showMoreElement: HTMLElement) { +export function showMore(_: AnimeNotifier, showMoreElement: HTMLElement) { const elements = [...document.getElementsByClassName("show-more")] for(let element of elements) { diff --git a/scripts/Actions/Video.ts b/scripts/Actions/Video.ts index 7204de15..f6e1af4b 100644 --- a/scripts/Actions/Video.ts +++ b/scripts/Actions/Video.ts @@ -40,7 +40,7 @@ function togglePlayVideoElement(video: HTMLVideoElement) { } // Toggle fullscreen -export function toggleFullscreen(arn: AnimeNotifier, button: HTMLElement) { +export function toggleFullscreen(_: AnimeNotifier, button: HTMLElement) { let elementId = button.dataset.id if(!elementId) { diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index cef05e8a..71ddeaae 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -75,7 +75,7 @@ export default class AnimeNotifier { observe: (elem: HTMLElement) => { elem["became visible"]() }, - unobserve: (elem: HTMLElement) => {} + unobserve: (_: HTMLElement) => {} } as IntersectionObserver } } @@ -514,7 +514,7 @@ export default class AnimeNotifier { e.dataTransfer.setData("text", element.dataset.index) }, false) - element.addEventListener("dblclick", async e => { + element.addEventListener("dblclick", async _ => { if(!element.draggable || !element.dataset.index) { return } @@ -536,11 +536,11 @@ export default class AnimeNotifier { } }, false) - element.addEventListener("dragenter", e => { + element.addEventListener("dragenter", _ => { element.classList.add("drag-enter") }, false) - element.addEventListener("dragleave", e => { + element.addEventListener("dragleave", _ => { element.classList.remove("drag-enter") }, false) diff --git a/scripts/AudioPlayer.ts b/scripts/AudioPlayer.ts index 0f8df755..466aa370 100644 --- a/scripts/AudioPlayer.ts +++ b/scripts/AudioPlayer.ts @@ -111,7 +111,7 @@ export default class AudioPlayer { this.audioNode.playbackRate.setValueAtTime(this.targetSpeed, 0) this.audioNode.start(0) - this.audioNode.onended = (event: MediaStreamErrorEvent) => { + this.audioNode.onended = (_: MediaStreamErrorEvent) => { if(currentPlayId !== this.playId) { return } diff --git a/scripts/Diff.ts b/scripts/Diff.ts index 51550508..a9f57939 100644 --- a/scripts/Diff.ts +++ b/scripts/Diff.ts @@ -21,7 +21,7 @@ export default class Diff { let container = document.createElement("main") container.innerHTML = html - return new Promise((resolve, reject) => { + return new Promise((resolve, _) => { Diff.childNodes(aRoot, container) this.mutations.wait(resolve) }) @@ -29,7 +29,7 @@ export default class Diff { // root will diff the document root element with the given HTML string and apply DOM mutations. static root(aRoot: HTMLElement, html: string) { - return new Promise((resolve, reject) => { + return new Promise((resolve, _) => { let rootContainer = document.createElement("html") rootContainer.innerHTML = html.replace("", "") diff --git a/scripts/InfiniteScroller.ts b/scripts/InfiniteScroller.ts index b251be64..c1c68dcf 100644 --- a/scripts/InfiniteScroller.ts +++ b/scripts/InfiniteScroller.ts @@ -14,7 +14,7 @@ export default class InfiniteScroller { } } - this.container.addEventListener("scroll", e => { + this.container.addEventListener("scroll", _ => { // Wait for mutations to finish before checking if we need infinite scroll to trigger. if(Diff.mutations.mutations.length > 0) { Diff.mutations.wait(() => check()) diff --git a/scripts/ServerEvents.ts b/scripts/ServerEvents.ts index 4b56a055..c3e40237 100644 --- a/scripts/ServerEvents.ts +++ b/scripts/ServerEvents.ts @@ -44,7 +44,7 @@ export default class ServerEvents { } } - ping(e: ServerEvent) { + ping(_: ServerEvent) { console.log("ping") } diff --git a/scripts/ServiceWorker/ServiceWorker.ts b/scripts/ServiceWorker/ServiceWorker.ts index 0dff8369..748334d2 100644 --- a/scripts/ServiceWorker/ServiceWorker.ts +++ b/scripts/ServiceWorker/ServiceWorker.ts @@ -85,15 +85,18 @@ let excludeCache = new Set([ ]) // onInstall -async function onInstall(evt: InstallEvent) { +async function onInstall(_: InstallEvent) { console.log("service worker install") + // Skip waiting for the old service worker to shutdown await self.skipWaiting() + + // Install cache await installCache() } // onActivate -function onActivate(evt: any) { +function onActivate(_: any) { console.log("service worker activate") // Only keep current version of the cache and delete old caches @@ -450,7 +453,7 @@ class MyClient { // onDOMContentLoaded is called when the client sent this service worker // a message that the page has been loaded. - onDOMContentLoaded(url: string) { + onDOMContentLoaded(_: string) { // ... } } diff --git a/scripts/ServiceWorkerManager.ts b/scripts/ServiceWorkerManager.ts index b4f4157b..bf777c87 100644 --- a/scripts/ServiceWorkerManager.ts +++ b/scripts/ServiceWorkerManager.ts @@ -15,9 +15,7 @@ export default class ServiceWorkerManager { return } - navigator.serviceWorker.register(this.uri).then(registration => { - // registration.update() - }) + navigator.serviceWorker.register(this.uri) navigator.serviceWorker.addEventListener("message", evt => { this.onMessage(evt) diff --git a/scripts/SideBar.ts b/scripts/SideBar.ts index 94683508..db1fd050 100644 --- a/scripts/SideBar.ts +++ b/scripts/SideBar.ts @@ -8,7 +8,7 @@ export default class SideBar { constructor(element) { this.element = element - document.body.addEventListener("click", e => { + document.body.addEventListener("click", _ => { if(document.activeElement && document.activeElement.id === "search") { return } diff --git a/scripts/VideoPlayer.ts b/scripts/VideoPlayer.ts index 2d089d66..8bf644c2 100644 --- a/scripts/VideoPlayer.ts +++ b/scripts/VideoPlayer.ts @@ -7,7 +7,7 @@ export default class VideoPlayer { this.arn = arn } - play(video: HTMLVideoElement) { + play(_: HTMLVideoElement) { } diff --git a/tsconfig.json b/tsconfig.json index 0726cf13..81bdf9e3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,6 @@ "strictFunctionTypes": false, "strictNullChecks": true, "noUnusedLocals": true, - "noUnusedParameters": false + "noUnusedParameters": true } } \ No newline at end of file