Merge pull request #217 from soulcramer:notification_filter

Made the show/hide anime not in my list persistent
This commit is contained in:
2019-04-27 19:38:36 +09:00
committed by GitHub
2 changed files with 32 additions and 10 deletions

View File

@ -42,10 +42,21 @@ export function hideAddedAnime() {
}
// Hides anime that are not in your list.
export function calendarShowAddedAnimeOnly() {
export function calendarShowAddedAnimeOnly(arn: AnimeNotifier, element: HTMLInputElement) {
for(let anime of findAll("calendar-entry")) {
if(anime.dataset.added === "false") {
anime.classList.toggle("hidden")
}
}
const showUserList = !Array.from(document.getElementsByClassName("calendar-entry"))
.some(value => value.classList.contains("hidden"));
let obj = {
"CalendarSettings.ShowUserList": showUserList
}
let apiEndpoint = arn.findAPIEndpoint(element);
arn.post(apiEndpoint, obj)
.catch(err => arn.statusMessage.showError(err));
}