Merge pull request #172 from Amatrelan/sticky-hide
Persistent hide #123
This commit is contained in:
commit
9c67a51fb4
@ -25,11 +25,21 @@ export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
|
||||
arn.diff(`${root.dataset.url}/${year}/${season}/${status}/${type}`)
|
||||
}
|
||||
|
||||
// Hides anime that are already in your list.
|
||||
export function hideAddedAnime() {
|
||||
for(let anime of findAll("anime-grid-cell")) {
|
||||
if(anime.dataset.added === "true") {
|
||||
anime.classList.toggle("anime-grid-cell-hide")
|
||||
// Hides anime that are already in your list. And "toggles" localStorage.hide if button is pressed
|
||||
export function hideAddedAnime(arn?: AnimeNotifier, input?: HTMLButtonElement) {
|
||||
if(input) {
|
||||
if(localStorage.getItem("hide-added-anime") === "true") {
|
||||
localStorage.setItem("hide-added-anime", "false")
|
||||
} else {
|
||||
localStorage.setItem("hide-added-anime", "true")
|
||||
}
|
||||
}
|
||||
|
||||
if(input || localStorage.getItem("hide-added-anime") === "true") {
|
||||
for(let anime of findAll("anime-grid-cell")) {
|
||||
if(anime.dataset.added === "true") {
|
||||
anime.classList.toggle("anime-grid-cell-hide")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,8 @@ export default class AnimeNotifier {
|
||||
Promise.resolve().then(() => this.dragAndDrop()),
|
||||
Promise.resolve().then(() => this.colorStripes()),
|
||||
Promise.resolve().then(() => this.assignTooltipOffsets()),
|
||||
Promise.resolve().then(() => this.countUp())
|
||||
Promise.resolve().then(() => this.countUp()),
|
||||
Promise.resolve().then(() => this.hideAddedAnime())
|
||||
])
|
||||
|
||||
// Apply page title
|
||||
@ -473,6 +474,17 @@ export default class AnimeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
// Hides user anime automatically if localStorage.hide is true
|
||||
hideAddedAnime() {
|
||||
if(!this.app.currentPath.includes("/explore") && !this.app.currentPath.includes("/genre")) {
|
||||
return
|
||||
}
|
||||
|
||||
if(localStorage.getItem("hide-added-anime") === "true") {
|
||||
actions.hideAddedAnime()
|
||||
}
|
||||
}
|
||||
|
||||
markPlayingSoundTrack() {
|
||||
for(let element of findAll("soundtrack-play-area")) {
|
||||
if(element.dataset.soundtrackId === this.currentSoundTrackId) {
|
||||
|
Loading…
Reference in New Issue
Block a user