Deleted app.find()
This commit is contained in:
parent
88296da8be
commit
ab0c933b3d
@ -32,6 +32,6 @@ export function removeAnimeFromCollection(arn: AnimeNotifier, button: HTMLElemen
|
||||
let apiEndpoint = arn.findAPIEndpoint(button)
|
||||
|
||||
arn.post(apiEndpoint + "/remove/" + animeId, "")
|
||||
.then(() => arn.app.load(`/+${nick}/animelist/` + (arn.app.find("Status") as HTMLSelectElement).value))
|
||||
.then(() => arn.app.load(`/+${nick}/animelist/` + (document.getElementById("Status") as HTMLSelectElement).value))
|
||||
.catch(err => arn.statusMessage.showError(err))
|
||||
}
|
@ -3,11 +3,11 @@ import { findAll } from "scripts/Utils";
|
||||
|
||||
// Filter anime on explore page
|
||||
export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
|
||||
let root = arn.app.find("filter-root")
|
||||
let root = document.getElementById("filter-root")
|
||||
|
||||
let elementYear = arn.app.find("filter-year") as HTMLSelectElement
|
||||
let elementStatus = arn.app.find("filter-status") as HTMLSelectElement
|
||||
let elementType = arn.app.find("filter-type") as HTMLSelectElement
|
||||
let elementYear = document.getElementById("filter-year") as HTMLSelectElement
|
||||
let elementStatus = document.getElementById("filter-status") as HTMLSelectElement
|
||||
let elementType = document.getElementById("filter-type") as HTMLSelectElement
|
||||
|
||||
for(let element of findAll("anime-grid-image")) {
|
||||
let img = element as HTMLImageElement
|
||||
|
@ -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 " + arn.app.find("nick").innerText + "."))
|
||||
.then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").innerText + "."))
|
||||
.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 " + arn.app.find("nick").innerText + "."))
|
||||
.then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").innerText + "."))
|
||||
.catch(err => arn.statusMessage.showError(err))
|
||||
}
|
@ -4,11 +4,11 @@ import AnimeNotifier from "../AnimeNotifier"
|
||||
export function editPost(arn: AnimeNotifier, element: HTMLElement) {
|
||||
let postId = element.dataset.id
|
||||
|
||||
let render = arn.app.find("render-" + postId)
|
||||
let toolbar = arn.app.find("toolbar-" + postId)
|
||||
let title = arn.app.find("title-" + postId)
|
||||
let source = arn.app.find("source-" + postId)
|
||||
let edit = arn.app.find("edit-toolbar-" + postId)
|
||||
let render = document.getElementById("render-" + postId)
|
||||
let toolbar = document.getElementById("toolbar-" + postId)
|
||||
let title = document.getElementById("title-" + postId)
|
||||
let source = document.getElementById("source-" + postId)
|
||||
let edit = document.getElementById("edit-toolbar-" + postId)
|
||||
|
||||
render.classList.toggle("hidden")
|
||||
toolbar.classList.toggle("hidden")
|
||||
@ -23,8 +23,8 @@ export function editPost(arn: AnimeNotifier, element: HTMLElement) {
|
||||
// Save post
|
||||
export function savePost(arn: AnimeNotifier, element: HTMLElement) {
|
||||
let postId = element.dataset.id
|
||||
let source = arn.app.find("source-" + postId) as HTMLTextAreaElement
|
||||
let title = arn.app.find("title-" + postId) as HTMLInputElement
|
||||
let source = document.getElementById("source-" + postId) as HTMLTextAreaElement
|
||||
let title = document.getElementById("title-" + postId) as HTMLInputElement
|
||||
let text = source.value
|
||||
|
||||
let updates: any = {
|
||||
@ -58,8 +58,8 @@ export function deletePost(arn: AnimeNotifier, element: HTMLElement) {
|
||||
|
||||
// Forum reply
|
||||
export function forumReply(arn: AnimeNotifier) {
|
||||
let textarea = arn.app.find("new-reply") as HTMLTextAreaElement
|
||||
let thread = arn.app.find("thread")
|
||||
let textarea = document.getElementById("new-reply") as HTMLTextAreaElement
|
||||
let thread = document.getElementById("thread")
|
||||
|
||||
let post = {
|
||||
text: textarea.value,
|
||||
@ -80,9 +80,9 @@ export function newGroupPost(arn: AnimeNotifier) {
|
||||
|
||||
// Create thread
|
||||
export function createThread(arn: AnimeNotifier) {
|
||||
let title = arn.app.find("title") as HTMLInputElement
|
||||
let text = arn.app.find("text") as HTMLTextAreaElement
|
||||
let category = arn.app.find("tag") as HTMLInputElement
|
||||
let title = document.getElementById("title") as HTMLInputElement
|
||||
let text = document.getElementById("text") as HTMLTextAreaElement
|
||||
let category = document.getElementById("tag") as HTMLInputElement
|
||||
|
||||
let thread = {
|
||||
title: title.value,
|
||||
|
@ -11,7 +11,7 @@ export async function loadMore(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||
arn.loading(true)
|
||||
button.disabled = true
|
||||
|
||||
let target = arn.app.find("load-more-target")
|
||||
let target = document.getElementById("load-more-target")
|
||||
let index = button.dataset.index
|
||||
|
||||
try {
|
||||
|
@ -138,7 +138,7 @@ export function addNumber(arn: AnimeNotifier, element: HTMLElement) {
|
||||
return
|
||||
}
|
||||
|
||||
let input = arn.app.find(element.dataset.id) as HTMLInputElement
|
||||
let input = document.getElementById(element.dataset.id) as HTMLInputElement
|
||||
let add = parseInt(element.dataset.add)
|
||||
let num = parseInt(input.value)
|
||||
let newValue = num + add
|
||||
|
@ -2,5 +2,5 @@ import AnimeNotifier from "../AnimeNotifier"
|
||||
|
||||
// Toggle sidebar
|
||||
export function toggleSidebar(arn: AnimeNotifier) {
|
||||
arn.app.find("sidebar").classList.toggle("sidebar-visible")
|
||||
document.getElementById("sidebar").classList.toggle("sidebar-visible")
|
||||
}
|
@ -102,9 +102,9 @@ export default class AnimeNotifier {
|
||||
this.webpEnabled = canUseWebP()
|
||||
|
||||
// Initiate the elements we need
|
||||
this.user = this.app.find("user")
|
||||
this.app.content = this.app.find("content")
|
||||
this.app.loading = this.app.find("loading")
|
||||
this.user = document.getElementById("user")
|
||||
this.app.content = document.getElementById("content")
|
||||
this.app.loading = document.getElementById("loading")
|
||||
|
||||
// Theme
|
||||
if(this.user && this.user.dataset.pro === "true" && this.user.dataset.theme !== "light") {
|
||||
@ -113,8 +113,8 @@ export default class AnimeNotifier {
|
||||
|
||||
// Status message
|
||||
this.statusMessage = new StatusMessage(
|
||||
this.app.find("status-message"),
|
||||
this.app.find("status-message-text")
|
||||
document.getElementById("status-message"),
|
||||
document.getElementById("status-message-text")
|
||||
)
|
||||
|
||||
// Push manager
|
||||
@ -130,7 +130,7 @@ export default class AnimeNotifier {
|
||||
this.analytics = new Analytics()
|
||||
|
||||
// Sidebar control
|
||||
this.sideBar = new SideBar(this.app.find("sidebar"))
|
||||
this.sideBar = new SideBar(document.getElementById("sidebar"))
|
||||
|
||||
// Infinite scrolling
|
||||
this.infiniteScroller = new InfiniteScroller(this.app.content.parentElement, 150)
|
||||
@ -205,7 +205,7 @@ export default class AnimeNotifier {
|
||||
|
||||
// document.body.appendChild(titleList)
|
||||
|
||||
// let search = this.app.find("search") as HTMLInputElement
|
||||
// let search = document.getElementById("search") as HTMLInputElement
|
||||
// search.setAttribute("list", titleList.id)
|
||||
}
|
||||
|
||||
@ -314,9 +314,9 @@ export default class AnimeNotifier {
|
||||
return
|
||||
}
|
||||
|
||||
let enableButton = this.app.find("enable-notifications") as HTMLButtonElement
|
||||
let disableButton = this.app.find("disable-notifications") as HTMLButtonElement
|
||||
let testButton = this.app.find("test-notification") as HTMLButtonElement
|
||||
let enableButton = document.getElementById("enable-notifications") as HTMLButtonElement
|
||||
let disableButton = document.getElementById("disable-notifications") as HTMLButtonElement
|
||||
let testButton = document.getElementById("test-notification") as HTMLButtonElement
|
||||
|
||||
if(!this.pushManager.pushSupported) {
|
||||
enableButton.classList.add("hidden")
|
||||
@ -912,7 +912,7 @@ export default class AnimeNotifier {
|
||||
|
||||
// "F" = Search
|
||||
if(e.keyCode === 70) {
|
||||
let search = this.app.find("search") as HTMLInputElement
|
||||
let search = document.getElementById("search") as HTMLInputElement
|
||||
|
||||
search.focus()
|
||||
search.select()
|
||||
|
@ -30,10 +30,6 @@ export default class Application {
|
||||
})
|
||||
}
|
||||
|
||||
find(id: string): HTMLElement | null {
|
||||
return document.getElementById(id)
|
||||
}
|
||||
|
||||
get(url: string): Promise<string> {
|
||||
// return fetch(url, {
|
||||
// credentials: "same-origin"
|
||||
|
Loading…
Reference in New Issue
Block a user