TypeScript cleanup

This commit is contained in:
2018-04-02 07:34:16 +02:00
parent 3f86a970f0
commit 88296da8be
44 changed files with 135 additions and 133 deletions

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Add anime to collection
export async function addAnimeToCollection(arn: AnimeNotifier, button: HTMLButtonElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Play audio
export function playAudio(arn: AnimeNotifier, element: HTMLElement) {

View File

@ -1,4 +1,5 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
import { requestIdleCallback } from "../Utils"
// Load
export function load(arn: AnimeNotifier, element: HTMLElement) {
@ -13,7 +14,7 @@ export function diff(arn: AnimeNotifier, element: HTMLElement) {
arn.diff(url)
.then(() => {
// Avoid instant layout thrashing
arn.requestIdleCallback(() => arn.scrollTo(element))
requestIdleCallback(() => arn.scrollTo(element))
})
.catch(console.error)
}

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// newAnimeDiffIgnore
export function newAnimeDiffIgnore(arn: AnimeNotifier, button: HTMLButtonElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
import { findAll } from "scripts/Utils";
// Filter anime on explore page

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Follow user
export function followUser(arn: AnimeNotifier, elem: HTMLElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Edit post
export function editPost(arn: AnimeNotifier, element: HTMLElement) {

View File

@ -1,5 +1,5 @@
import { AnimeNotifier } from "../AnimeNotifier"
import { Diff } from "../Diff"
import AnimeNotifier from "../AnimeNotifier"
import Diff from "../Diff"
// Load more
export async function loadMore(arn: AnimeNotifier, button: HTMLButtonElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Chrome extension installation
export function installExtension(arn: AnimeNotifier, button: HTMLElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// like
export async function like(arn: AnimeNotifier, element: HTMLElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Enable notifications
export async function enableNotifications(arn: AnimeNotifier, button: HTMLElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// New
export function newObject(arn: AnimeNotifier, button: HTMLButtonElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Publish
export function publish(arn: AnimeNotifier, button: HTMLButtonElement) {

View File

@ -1,5 +1,5 @@
import { AnimeNotifier } from "../AnimeNotifier"
import { delay } from "../Utils"
import AnimeNotifier from "../AnimeNotifier"
import { delay, requestIdleCallback } from "../Utils"
// Search page reference
var emptySearchHTML = ""
@ -122,7 +122,7 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, e: Ke
.then(showResponseInElement(arn, url, "anime", animeSearchResults))
.catch(console.error)
arn.requestIdleCallback(() => {
requestIdleCallback(() => {
fetch("/_/character-search/" + term, fetchOptions)
.then(showResponseInElement(arn, url, "character", characterSearchResults))
.catch(console.error)

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Save new data from an input field
export function save(arn: AnimeNotifier, input: HTMLElement) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Charge up
export function chargeUp(arn: AnimeNotifier, button: HTMLElement) {
@ -55,7 +55,7 @@ export function buyItem(arn: AnimeNotifier, button: HTMLElement) {
if(body !== "ok") {
throw body
}
return arn.reloadContent()
})
.then(() => arn.statusMessage.showInfo(`You bought ${itemName} for ${price} gems. Check out your inventory to confirm the purchase.`, 4000))

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Toggle sidebar
export function toggleSidebar(arn: AnimeNotifier) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
// Close status message
export function closeStatusMessage(arn: AnimeNotifier) {

View File

@ -1,4 +1,4 @@
import { AnimeNotifier } from "../AnimeNotifier"
import AnimeNotifier from "../AnimeNotifier"
let currentTheme = "light"

View File

@ -1,5 +1,5 @@
import { AnimeNotifier } from "../AnimeNotifier"
import { StatusMessage } from "../StatusMessage"
import AnimeNotifier from "../AnimeNotifier"
import StatusMessage from "../StatusMessage"
// Select file
export function selectFile(arn: AnimeNotifier, button: HTMLButtonElement) {

20
scripts/Actions/index.ts Normal file
View File

@ -0,0 +1,20 @@
export * from "./Audio"
export * from "./AnimeList"
export * from "./Diff"
export * from "./Editor"
export * from "./Explore"
export * from "./FollowUser"
export * from "./Forum"
export * from "./InfiniteScroller"
export * from "./Install"
export * from "./Like"
export * from "./Notifications"
export * from "./Object"
export * from "./Publish"
export * from "./Search"
export * from "./Serialization"
export * from "./Shop"
export * from "./SideBar"
export * from "./StatusMessage"
export * from "./Theme"
export * from "./Upload"