diff --git a/scripts/Actions/AnimeList.ts b/scripts/Actions/AnimeList.ts index 40751e75..75f9d10f 100644 --- a/scripts/Actions/AnimeList.ts +++ b/scripts/Actions/AnimeList.ts @@ -26,7 +26,7 @@ export function removeAnimeFromCollection(arn: AnimeNotifier, button: HTMLElemen return } - button.innerText = "Removing..." + button.textContent = "Removing..." let {animeId, nick} = button.dataset let apiEndpoint = arn.findAPIEndpoint(button) diff --git a/scripts/Actions/FollowUser.ts b/scripts/Actions/FollowUser.ts index d6325654..d5021a54 100644 --- a/scripts/Actions/FollowUser.ts +++ b/scripts/Actions/FollowUser.ts @@ -4,7 +4,7 @@ import AnimeNotifier from "../AnimeNotifier" export function followUser(arn: AnimeNotifier, elem: HTMLElement) { return arn.post(elem.dataset.api) .then(() => arn.reloadContent()) - .then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").innerText + ".")) + .then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").textContent + ".")) .catch(err => arn.statusMessage.showError(err)) } @@ -12,6 +12,6 @@ export function followUser(arn: AnimeNotifier, elem: HTMLElement) { export function unfollowUser(arn: AnimeNotifier, elem: HTMLElement) { return arn.post(elem.dataset.api) .then(() => arn.reloadContent()) - .then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").innerText + ".")) + .then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").textContent + ".")) .catch(err => arn.statusMessage.showError(err)) } \ No newline at end of file diff --git a/scripts/Actions/Search.ts b/scripts/Actions/Search.ts index 61928940..6355ffb6 100644 --- a/scripts/Actions/Search.ts +++ b/scripts/Actions/Search.ts @@ -112,7 +112,7 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, evt?: searchPageTitle = document.getElementsByTagName("h1")[0] } - searchPageTitle.innerText = document.title + searchPageTitle.textContent = document.title if(!term || term.length < 1) { await arn.innerHTML(searchPage, emptySearchHTML) diff --git a/scripts/Actions/Serialization.ts b/scripts/Actions/Serialization.ts index 54674f44..192093c6 100644 --- a/scripts/Actions/Serialization.ts +++ b/scripts/Actions/Serialization.ts @@ -4,7 +4,7 @@ import AnimeNotifier from "../AnimeNotifier" export async function save(arn: AnimeNotifier, input: HTMLElement) { let obj = {} let isContentEditable = input.isContentEditable - let value = isContentEditable ? input.innerText : (input as HTMLInputElement).value + let value = isContentEditable ? input.textContent : (input as HTMLInputElement).value if(value === undefined) { return @@ -134,8 +134,8 @@ export function increaseEpisode(arn: AnimeNotifier, element: HTMLElement) { } let prev = element.previousSibling as HTMLElement - let episodes = parseInt(prev.innerText) - prev.innerText = String(episodes + 1) + let episodes = parseInt(prev.textContent) + prev.textContent = String(episodes + 1) save(arn, prev) } diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index aa4f694a..e74559f4 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -168,14 +168,18 @@ export default class AnimeNotifier { ]) // Apply page title + this.applyPageTitle() + } + + applyPageTitle() { let headers = document.getElementsByTagName("h1") - if(this.app.currentPath === "/" || headers.length === 0 || headers[0].innerText === "NOTIFY.MOE") { + if(this.app.currentPath === "/" || headers.length === 0 || headers[0].textContent === "NOTIFY.MOE") { if(document.title !== this.title) { document.title = this.title } } else { - document.title = headers[0].innerText + document.title = headers[0].textContent } } @@ -445,11 +449,11 @@ export default class AnimeNotifier { } for(let element of findAll("count-up")) { - let final = parseInt(element.innerText) + let final = parseInt(element.textContent) let duration = 2000.0 let start = Date.now() - element.innerText = "0" + element.textContent = "0" let callback = () => { let progress = (Date.now() - start) / duration @@ -458,7 +462,7 @@ export default class AnimeNotifier { progress = 1 } - element.innerText = String(Math.round(progress * final)) + element.textContent = String(Math.round(progress * final)) if(progress < 1) { window.requestAnimationFrame(callback) @@ -917,12 +921,9 @@ export default class AnimeNotifier { scrollTo(target: HTMLElement) { const duration = 250.0 - const steps = 60 - const interval = duration / steps const fullSin = Math.PI / 2 const contentPadding = 24 - let scrollHandle: number let newScroll = 0 let finalScroll = Math.max(target.offsetTop - contentPadding, 0) diff --git a/scripts/AudioPlayer.ts b/scripts/AudioPlayer.ts index 6b8895c7..7c6a0eef 100644 --- a/scripts/AudioPlayer.ts +++ b/scripts/AudioPlayer.ts @@ -201,7 +201,7 @@ export default class AudioPlayer { // Remove title this.trackLink.href = "" - this.trackLink.innerText = "" + this.trackLink.textContent = "" // Hide anime info this.animeLink.href = "" @@ -287,7 +287,7 @@ export default class AudioPlayer { let trackInfoResponse = await fetch("/api/soundtrack/" + trackId) let track = await trackInfoResponse.json() this.trackLink.href = "/soundtrack/" + track.id - this.trackLink.innerText = track.title.canonical || track.title.native + this.trackLink.textContent = track.title.canonical || track.title.native let animeId = "" diff --git a/scripts/DateView.ts b/scripts/DateView.ts index 6d2ece95..49291f09 100644 --- a/scripts/DateView.ts +++ b/scripts/DateView.ts @@ -61,7 +61,7 @@ function getRemainingTime(remaining: number): string { export function displayAiringDate(element: HTMLElement, now: Date) { if(element.dataset.startDate === "") { - element.innerText = "" + element.textContent = "" return } @@ -86,7 +86,7 @@ export function displayAiringDate(element: HTMLElement, now: Date) { remainingString = remainingString.substring(1) + " ago" } - element.innerText = remainingString + element.textContent = remainingString if(remaining < 0) { airingVerb = "aired" @@ -104,7 +104,7 @@ export function displayAiringDate(element: HTMLElement, now: Date) { export function displayDate(element: HTMLElement, now: Date) { if(element.dataset.date === "") { - element.innerText = "" + element.textContent = "" return } @@ -122,7 +122,7 @@ export function displayDate(element: HTMLElement, now: Date) { remainingString = remainingString.substring(1) + " ago" } - element.innerText = remainingString + element.textContent = remainingString let tooltip = dayNames[startDate.getDay()] + " " + startTime if(element.classList.contains("no-tip")) { @@ -135,7 +135,7 @@ export function displayDate(element: HTMLElement, now: Date) { export function displayTime(element: HTMLElement, now: Date) { if(element.dataset.date === "") { - element.innerText = "" + element.textContent = "" return } @@ -145,5 +145,5 @@ export function displayTime(element: HTMLElement, now: Date) { let m = startDate.getMinutes() let startTime = (h <= 9 ? "0" + h : h) + ":" + (m <= 9 ? "0" + m : m) - element.innerText = startTime + element.textContent = startTime } \ No newline at end of file diff --git a/scripts/NotificationManager.ts b/scripts/NotificationManager.ts index 783cee96..d2eca193 100644 --- a/scripts/NotificationManager.ts +++ b/scripts/NotificationManager.ts @@ -27,7 +27,7 @@ export default class NotificationManager { render() { Diff.mutations.queue(() => { - this.counter.innerText = this.unseen.toString() + this.counter.textContent = this.unseen.toString() if(this.unseen === 0) { this.counter.classList.add("hidden") diff --git a/scripts/StatusMessage.ts b/scripts/StatusMessage.ts index 6aeaecca..ebe99cb5 100644 --- a/scripts/StatusMessage.ts +++ b/scripts/StatusMessage.ts @@ -12,7 +12,7 @@ export default class StatusMessage { show(message: string, duration: number) { let messageId = String(Date.now()) - this.text.innerText = message + this.text.textContent = message this.container.classList.remove("fade-out") this.container.dataset.messageId = messageId