stash icon indicating copy to clipboard operation
stash copied to clipboard

Default view / saved filters for gallery view

Open praul opened this issue 2 years ago • 5 comments

In gallery view, I am unable to set a default view. Saved filters don't work, since the gallery-dependance is always included as a filter.

image

Expected behavior I am able to use filters and "Set as default" just like when viewing scenes. This would probably mean handling gallery view without applying the filter "Galleries include".

Thanks for your efforts, I really enjoy stash Sorry if this is a duplicate. I know, this problem exists for a while now..

praul avatar Mar 21 '22 08:03 praul

IMO, this default view is also needed for page Models >Scenes

ghfsa avatar Mar 24 '22 07:03 ghfsa

I agree, would love to have the option to change default views per menu item!

JDsnyke avatar Apr 11 '22 20:04 JDsnyke

It would be great to set default global filters for Scenes, Galleries, Images and Movies tabs for all performers.

AaronPorts avatar Aug 05 '22 12:08 AaronPorts

For now I have been using this custom js to sort the gallery page. you can also change the view type by editing this => ?sortby=rating&sortdir=desc. Note: you need to have stashUserscriptLibrary installed in order to work.

function getLocalStorage(key) {
    return localStorage.getItem(key)
}

function setLocalStorage(key, value) {
    localStorage.setItem(key, value)
}

function customSortGalleryPage() {
    const sortgalleryLocalStorageKey = "customjs:sortgallery:lastpath"

    stash.addEventListener("stash:page", (e) => {
        if (!stash.matchUrl(window.location.href, /galleries\/\d+/)) {
            setLocalStorage(sortgalleryLocalStorageKey, e.detail?.event)
        }
    })

    stash.addEventListeners(["stash:page:gallery:images", "stash:page:gallery:add"], (e) => {
        if (e.detail?.event !== (getLocalStorage(sortgalleryLocalStorageKey) ?? "")) {
            setLocalStorage(sortgalleryLocalStorageKey, e.detail?.event)
            setTimeout(() => {
                window.location.search = "?sortby=rating&sortdir=desc"
            }, 100)
        }
    })
}

;(async () => {
    while (!window.stash) {
        await new Promise((resolve) => setTimeout(resolve, 100))
    }

    customSortGalleryPage()
})()

Tetrax-10 avatar Feb 13 '24 16:02 Tetrax-10

For now I have been using this custom js to sort the gallery page. you can also change the view type by editing this => ?sortby=rating&sortdir=desc. Note: you need to have stashUserscriptLibrary installed in order to work.

function getLocalStorage(key) {
    return localStorage.getItem(key)
}

function setLocalStorage(key, value) {
    localStorage.setItem(key, value)
}

function customSortGalleryPage() {
    const sortgalleryLocalStorageKey = "customjs:sortgallery:lastpath"

    stash.addEventListener("stash:page", (e) => {
        if (!stash.matchUrl(window.location.href, /galleries\/\d+/)) {
            setLocalStorage(sortgalleryLocalStorageKey, e.detail?.event)
        }
    })

    stash.addEventListeners(["stash:page:gallery:images", "stash:page:gallery:add"], (e) => {
        if (e.detail?.event !== (getLocalStorage(sortgalleryLocalStorageKey) ?? "")) {
            setLocalStorage(sortgalleryLocalStorageKey, e.detail?.event)
            setTimeout(() => {
                window.location.search = "?sortby=rating&sortdir=desc"
            }, 100)
        }
    })
}

;(async () => {
    while (!window.stash) {
        await new Promise((resolve) => setTimeout(resolve, 100))
    }

    customSortGalleryPage()
})()

thanks for your solution - I borrowed it and it works very well

KaoriRinaFujimoto avatar Feb 17 '24 20:02 KaoriRinaFujimoto