🚧 Started to work on notifications filter

This commit is contained in:
Soulcramer
2019-03-02 22:16:24 +01:00
parent 157a5f7487
commit 86170f4604
2 changed files with 43 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import AnimeNotifier from "../AnimeNotifier"
import { findAll } from "scripts/Utils"
import {findAll} from "scripts/Utils"
// Filter anime on explore page
export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
@ -10,7 +10,7 @@ export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
let elementStatus = document.getElementById("filter-status") 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
img.src = arn.emptyPixel()
img.classList.remove("element-found")
@ -32,8 +32,8 @@ export function toggleHideAddedAnime() {
// Hides anime that are already in your list.
export function hideAddedAnime() {
for(let anime of findAll("anime-grid-cell")) {
if(anime.dataset.added !== "true") {
for (let anime of findAll("anime-grid-cell")) {
if (anime.dataset.added !== "true") {
continue
}
@ -42,10 +42,21 @@ export function hideAddedAnime() {
}
// Hides anime that are not in your list.
export function calendarShowAddedAnimeOnly() {
for(let anime of findAll("calendar-entry")) {
if(anime.dataset.added === "false") {
export function calendarShowAddedAnimeOnly(arn: AnimeNotifier, element: HTMLInputElement) {
for (let anime of findAll("calendar-entry")) {
if (anime.dataset.added === "false") {
anime.classList.toggle("hidden")
}
}
const anime = document.getElementsByClassName("calendar-entry").item(0)
const showUserList = !anime.classList.contains("hidden")
let obj = {
"CalendarSettings.ShowUserList": showUserList
}
let apiEndpoint = arn.findAPIEndpoint(element);
arn.post(apiEndpoint, obj)
.catch(err => arn.statusMessage.showError(err));
}