Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default view / saved filters for gallery view #2404

Closed
praul opened this issue Mar 21, 2022 · 5 comments · Fixed by #4962
Closed

Default view / saved filters for gallery view #2404

praul opened this issue Mar 21, 2022 · 5 comments · Fixed by #4962
Labels
improvement Something needed tweaking.

Comments

@praul
Copy link

praul commented Mar 21, 2022

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 praul added the help wanted Extra attention is needed label Mar 21, 2022
@ghfsa
Copy link

ghfsa commented Mar 24, 2022

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

@WithoutPants WithoutPants added bug report Bug reports that are not yet verified and removed help wanted Extra attention is needed labels Apr 6, 2022
@JDsnyke
Copy link

JDsnyke commented Apr 11, 2022

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

@AaronPorts
Copy link

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

@WithoutPants WithoutPants added improvement Something needed tweaking. and removed bug report Bug reports that are not yet verified labels Feb 13, 2024
@WithoutPants WithoutPants changed the title [Bug Report] Default view / saved filters for gallery view Default view / saved filters for gallery view Feb 13, 2024
@Tetrax-10
Copy link
Contributor

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()
})()

@KaoriRinaFujimoto
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something needed tweaking.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants