Replace innerText with textContent
This commit is contained in:
parent
00678cf6a4
commit
050355d8ae
@ -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)
|
||||
|
@ -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))
|
||||
}
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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 = ""
|
||||
|
||||
|
@ -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
|
||||
}
|
@ -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")
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user