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