Use const variables when applicable

This commit is contained in:
2019-11-17 18:25:14 +09:00
parent 454e8572e3
commit 878f1913e3
39 changed files with 405 additions and 403 deletions

View File

@ -3,24 +3,24 @@ import { findAll } from "scripts/Utils"
// Filter anime on explore page
export function filterAnime(arn: AnimeNotifier, _: HTMLInputElement) {
let root = document.getElementById("filter-root") as HTMLElement
const root = document.getElementById("filter-root") as HTMLElement
let elementYear = document.getElementById("filter-year") as HTMLSelectElement
let elementSeason = document.getElementById("filter-season") as HTMLSelectElement
let elementStatus = document.getElementById("filter-status") as HTMLSelectElement
let elementType = document.getElementById("filter-type") as HTMLSelectElement
const elementYear = document.getElementById("filter-year") as HTMLSelectElement
const elementSeason = document.getElementById("filter-season") as HTMLSelectElement
const elementStatus = document.getElementById("filter-status") as HTMLSelectElement
const elementType = document.getElementById("filter-type") as HTMLSelectElement
for(let element of findAll("anime-grid-image")) {
let img = element as HTMLImageElement
for(const element of findAll("anime-grid-image")) {
const img = element as HTMLImageElement
img.src = arn.emptyPixel()
img.classList.remove("element-found")
img.classList.remove("element-color-preview")
}
let year = elementYear.value || "any"
let season = elementSeason.value || "any"
let status = elementStatus.value || "any"
let type = elementType.value || "any"
const year = elementYear.value || "any"
const season = elementSeason.value || "any"
const status = elementStatus.value || "any"
const type = elementType.value || "any"
arn.diff(`${root.dataset.url}/${year}/${season}/${status}/${type}`)
}
@ -32,7 +32,7 @@ export function toggleHideAddedAnime() {
// Hides anime that are already in your list.
export function hideAddedAnime() {
for(let anime of findAll("anime-grid-cell")) {
for(const anime of findAll("anime-grid-cell")) {
if(anime.dataset.added !== "true") {
continue
}
@ -43,7 +43,7 @@ export function hideAddedAnime() {
// Hides anime that are not in your list.
export async function calendarShowAddedAnimeOnly(arn: AnimeNotifier, element: HTMLInputElement) {
let calendar = document.getElementById("calendar")
const calendar = document.getElementById("calendar")
if(!calendar || calendar.dataset.showAddedAnimeOnly === undefined) {
return
@ -57,8 +57,8 @@ export async function calendarShowAddedAnimeOnly(arn: AnimeNotifier, element: HT
}
// Save the state in the database
let showAddedAnimeOnly = calendar.dataset.showAddedAnimeOnly === "true"
let apiEndpoint = arn.findAPIEndpoint(element)
const showAddedAnimeOnly = calendar.dataset.showAddedAnimeOnly === "true"
const apiEndpoint = arn.findAPIEndpoint(element)
try {
await arn.post(apiEndpoint, {