Merge pull request #217 from soulcramer:notification_filter
Made the show/hide anime not in my list persistent
This commit is contained in:
commit
09b002147d
@ -2,8 +2,9 @@ component Calendar(days []*utils.CalendarDay, user *arn.User)
|
|||||||
h1.mountable Calendar
|
h1.mountable Calendar
|
||||||
|
|
||||||
.corner-buttons
|
.corner-buttons
|
||||||
button.action(data-trigger="click", data-action="calendarShowAddedAnimeOnly", title="Show anime in my collection")
|
if user != nil
|
||||||
RawIcon("eye")
|
button.action(data-trigger="click", data-action="calendarShowAddedAnimeOnly", data-api="/api/settings/" + user.ID, title="Show anime in my collection")
|
||||||
|
RawIcon("eye-slash")
|
||||||
|
|
||||||
.week
|
.week
|
||||||
each day in days
|
each day in days
|
||||||
@ -11,10 +12,20 @@ component Calendar(days []*utils.CalendarDay, user *arn.User)
|
|||||||
h3.weekday-name.mountable(data-mountable-type=day.Name)= day.Name
|
h3.weekday-name.mountable(data-mountable-type=day.Name)= day.Name
|
||||||
.calendar-entries
|
.calendar-entries
|
||||||
each entry in day.Entries
|
each entry in day.Entries
|
||||||
a.calendar-entry.mountable(href=entry.Anime.Link(), data-mountable-type=day.Name, data-added=entry.Added)
|
CalendarEntry(day, entry, user)
|
||||||
img.calendar-entry-image.lazy(data-src=entry.Anime.ImageLink("small"), data-webp="true", data-color=entry.Anime.AverageColor(), alt=entry.Anime.Title.ByUser(user))
|
|
||||||
.calendar-entry-info
|
component CalendarEntry(day *utils.CalendarDay, entry *utils.CalendarEntry, user *arn.User)
|
||||||
.calendar-entry-title= entry.Anime.Title.ByUser(user)
|
if user != nil && user.Settings().CalendarSettings.ShowUserList == false && !entry.Added
|
||||||
.calendar-entry-time-and-episode
|
a.calendar-entry.hidden.mountable(href=entry.Anime.Link(), data-mountable-type=day.Name, data-added=entry.Added)
|
||||||
.calendar-entry-time.utc-date-absolute(data-date=entry.Episode.AiringDate.Start)
|
CalendarView(day, entry, user)
|
||||||
.calendar-entry-episode= "Ep: " + strconv.Itoa(entry.Episode.Number)
|
else
|
||||||
|
a.calendar-entry.mountable(href=entry.Anime.Link(), data-mountable-type=day.Name, data-added=entry.Added)
|
||||||
|
CalendarView(day, entry, user)
|
||||||
|
|
||||||
|
component CalendarView(day *utils.CalendarDay, entry *utils.CalendarEntry, user *arn.User)
|
||||||
|
img.calendar-entry-image.lazy(data-src=entry.Anime.ImageLink("small"), data-webp="true", data-color=entry.Anime.AverageColor(), alt=entry.Anime.Title.ByUser(user))
|
||||||
|
.calendar-entry-info
|
||||||
|
.calendar-entry-title= entry.Anime.Title.ByUser(user)
|
||||||
|
.calendar-entry-time-and-episode
|
||||||
|
.calendar-entry-time.utc-date-absolute(data-date=entry.Episode.AiringDate.Start)
|
||||||
|
.calendar-entry-episode= "Ep: " + strconv.Itoa(entry.Episode.Number)
|
@ -42,10 +42,21 @@ export function hideAddedAnime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hides anime that are not in your list.
|
// 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")) {
|
for(let anime of findAll("calendar-entry")) {
|
||||||
if(anime.dataset.added === "false") {
|
if(anime.dataset.added === "false") {
|
||||||
anime.classList.toggle("hidden")
|
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));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user