Removed unused parameters in scripts

This commit is contained in:
Eduard Urbach 2019-04-22 18:06:50 +09:00
parent 6e4097b3b6
commit b78785cadc
19 changed files with 31 additions and 30 deletions

View File

@ -2,7 +2,7 @@ import AnimeNotifier from "../AnimeNotifier"
import { findAll } from "scripts/Utils" import { findAll } from "scripts/Utils"
// Filter anime on explore page // 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 root = document.getElementById("filter-root") as HTMLElement
let elementYear = document.getElementById("filter-year") as HTMLSelectElement let elementYear = document.getElementById("filter-year") as HTMLSelectElement

View File

@ -1,7 +1,7 @@
import AnimeNotifier from "../AnimeNotifier" import AnimeNotifier from "../AnimeNotifier"
// Edit post // Edit post
export function editPost(arn: AnimeNotifier, element: HTMLElement) { export function editPost(_: AnimeNotifier, element: HTMLElement) {
let postId = element.dataset.id let postId = element.dataset.id
if(!postId) { if(!postId) {
@ -147,7 +147,7 @@ export async function reply(arn: AnimeNotifier, element: HTMLElement) {
} }
// Cancel replying to a post // Cancel replying to a post
export function cancelReply(arn: AnimeNotifier, element: HTMLElement) { export function cancelReply(arn: AnimeNotifier, _: HTMLElement) {
arn.reloadContent() arn.reloadContent()
} }

View File

@ -1,7 +1,7 @@
import AnimeNotifier from "../AnimeNotifier" import AnimeNotifier from "../AnimeNotifier"
// Enable notifications // Enable notifications
export async function enableNotifications(arn: AnimeNotifier, button: HTMLElement) { export async function enableNotifications(arn: AnimeNotifier, _: HTMLElement) {
if(!arn.user || !arn.user.dataset.id) { if(!arn.user || !arn.user.dataset.id) {
return return
} }
@ -13,7 +13,7 @@ export async function enableNotifications(arn: AnimeNotifier, button: HTMLElemen
} }
// Disable notifications // Disable notifications
export async function disableNotifications(arn: AnimeNotifier, button: HTMLElement) { export async function disableNotifications(arn: AnimeNotifier, _: HTMLElement) {
if(!arn.user || !arn.user.dataset.id) { if(!arn.user || !arn.user.dataset.id) {
return return
} }

View File

@ -199,11 +199,11 @@ export function searchBySpeech(arn: AnimeNotifier, element: HTMLElement) {
recognition.stop() recognition.stop()
} }
recognition.onerror = e => { recognition.onerror = _ => {
recognition.stop() recognition.stop()
} }
recognition.onend = e => { recognition.onend = _ => {
searchInput.placeholder = oldPlaceholder searchInput.placeholder = oldPlaceholder
element.classList.remove("speech-listening") element.classList.remove("speech-listening")
} }

View File

@ -34,7 +34,7 @@ export function chargeUp(arn: AnimeNotifier, button: HTMLElement) {
} }
// Toggle fade // Toggle fade
export function toggleFade(arn: AnimeNotifier, button: HTMLElement) { export function toggleFade(_: AnimeNotifier, button: HTMLElement) {
let elementId = button.dataset.elementId let elementId = button.dataset.elementId
if(!elementId) { if(!elementId) {

View File

@ -1,7 +1,7 @@
import AnimeNotifier from "../AnimeNotifier" import AnimeNotifier from "../AnimeNotifier"
// Toggle sidebar // Toggle sidebar
export function toggleSidebar(arn: AnimeNotifier) { export function toggleSidebar(_: AnimeNotifier) {
let sidebar = document.getElementById("sidebar") as HTMLElement let sidebar = document.getElementById("sidebar") as HTMLElement
sidebar.classList.toggle("sidebar-visible") sidebar.classList.toggle("sidebar-visible")
} }

View File

@ -166,7 +166,7 @@ export function applyTheme(themeName: string) {
} }
// Color picker // Color picker
export function pickColor(arn: AnimeNotifier, element: HTMLElement) { export function pickColor(_: AnimeNotifier, element: HTMLElement) {
let rootStyle = document.documentElement.style let rootStyle = document.documentElement.style
let variableName = `--${element.dataset.variable}` let variableName = `--${element.dataset.variable}`

View File

@ -31,7 +31,7 @@ async function updateFollow(arn: AnimeNotifier, element: HTMLElement, message: s
} }
// Show more // Show more
export function showMore(arn: AnimeNotifier, showMoreElement: HTMLElement) { export function showMore(_: AnimeNotifier, showMoreElement: HTMLElement) {
const elements = [...document.getElementsByClassName("show-more")] const elements = [...document.getElementsByClassName("show-more")]
for(let element of elements) { for(let element of elements) {

View File

@ -40,7 +40,7 @@ function togglePlayVideoElement(video: HTMLVideoElement) {
} }
// Toggle fullscreen // Toggle fullscreen
export function toggleFullscreen(arn: AnimeNotifier, button: HTMLElement) { export function toggleFullscreen(_: AnimeNotifier, button: HTMLElement) {
let elementId = button.dataset.id let elementId = button.dataset.id
if(!elementId) { if(!elementId) {

View File

@ -75,7 +75,7 @@ export default class AnimeNotifier {
observe: (elem: HTMLElement) => { observe: (elem: HTMLElement) => {
elem["became visible"]() elem["became visible"]()
}, },
unobserve: (elem: HTMLElement) => {} unobserve: (_: HTMLElement) => {}
} as IntersectionObserver } as IntersectionObserver
} }
} }
@ -514,7 +514,7 @@ export default class AnimeNotifier {
e.dataTransfer.setData("text", element.dataset.index) e.dataTransfer.setData("text", element.dataset.index)
}, false) }, false)
element.addEventListener("dblclick", async e => { element.addEventListener("dblclick", async _ => {
if(!element.draggable || !element.dataset.index) { if(!element.draggable || !element.dataset.index) {
return return
} }
@ -536,11 +536,11 @@ export default class AnimeNotifier {
} }
}, false) }, false)
element.addEventListener("dragenter", e => { element.addEventListener("dragenter", _ => {
element.classList.add("drag-enter") element.classList.add("drag-enter")
}, false) }, false)
element.addEventListener("dragleave", e => { element.addEventListener("dragleave", _ => {
element.classList.remove("drag-enter") element.classList.remove("drag-enter")
}, false) }, false)

View File

@ -111,7 +111,7 @@ export default class AudioPlayer {
this.audioNode.playbackRate.setValueAtTime(this.targetSpeed, 0) this.audioNode.playbackRate.setValueAtTime(this.targetSpeed, 0)
this.audioNode.start(0) this.audioNode.start(0)
this.audioNode.onended = (event: MediaStreamErrorEvent) => { this.audioNode.onended = (_: MediaStreamErrorEvent) => {
if(currentPlayId !== this.playId) { if(currentPlayId !== this.playId) {
return return
} }

View File

@ -21,7 +21,7 @@ export default class Diff {
let container = document.createElement("main") let container = document.createElement("main")
container.innerHTML = html container.innerHTML = html
return new Promise((resolve, reject) => { return new Promise((resolve, _) => {
Diff.childNodes(aRoot, container) Diff.childNodes(aRoot, container)
this.mutations.wait(resolve) 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. // root will diff the document root element with the given HTML string and apply DOM mutations.
static root(aRoot: HTMLElement, html: string) { static root(aRoot: HTMLElement, html: string) {
return new Promise((resolve, reject) => { return new Promise((resolve, _) => {
let rootContainer = document.createElement("html") let rootContainer = document.createElement("html")
rootContainer.innerHTML = html.replace("<!DOCTYPE html>", "") rootContainer.innerHTML = html.replace("<!DOCTYPE html>", "")

View File

@ -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. // Wait for mutations to finish before checking if we need infinite scroll to trigger.
if(Diff.mutations.mutations.length > 0) { if(Diff.mutations.mutations.length > 0) {
Diff.mutations.wait(() => check()) Diff.mutations.wait(() => check())

View File

@ -44,7 +44,7 @@ export default class ServerEvents {
} }
} }
ping(e: ServerEvent) { ping(_: ServerEvent) {
console.log("ping") console.log("ping")
} }

View File

@ -85,15 +85,18 @@ let excludeCache = new Set<string>([
]) ])
// onInstall // onInstall
async function onInstall(evt: InstallEvent) { async function onInstall(_: InstallEvent) {
console.log("service worker install") console.log("service worker install")
// Skip waiting for the old service worker to shutdown
await self.skipWaiting() await self.skipWaiting()
// Install cache
await installCache() await installCache()
} }
// onActivate // onActivate
function onActivate(evt: any) { function onActivate(_: any) {
console.log("service worker activate") console.log("service worker activate")
// Only keep current version of the cache and delete old caches // 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 // onDOMContentLoaded is called when the client sent this service worker
// a message that the page has been loaded. // a message that the page has been loaded.
onDOMContentLoaded(url: string) { onDOMContentLoaded(_: string) {
// ... // ...
} }
} }

View File

@ -15,9 +15,7 @@ export default class ServiceWorkerManager {
return return
} }
navigator.serviceWorker.register(this.uri).then(registration => { navigator.serviceWorker.register(this.uri)
// registration.update()
})
navigator.serviceWorker.addEventListener("message", evt => { navigator.serviceWorker.addEventListener("message", evt => {
this.onMessage(evt) this.onMessage(evt)

View File

@ -8,7 +8,7 @@ export default class SideBar {
constructor(element) { constructor(element) {
this.element = element this.element = element
document.body.addEventListener("click", e => { document.body.addEventListener("click", _ => {
if(document.activeElement && document.activeElement.id === "search") { if(document.activeElement && document.activeElement.id === "search") {
return return
} }

View File

@ -7,7 +7,7 @@ export default class VideoPlayer {
this.arn = arn this.arn = arn
} }
play(video: HTMLVideoElement) { play(_: HTMLVideoElement) {
} }

View File

@ -8,6 +8,6 @@
"strictFunctionTypes": false, "strictFunctionTypes": false,
"strictNullChecks": true, "strictNullChecks": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": false "noUnusedParameters": true
} }
} }