Filter thumbnails in folders and galleries picker

NimaiNimai Grin there, done thatAustin, TXRegistered Users Posts: 560 Major grins

The Folders & Galleries block that you can add to a page is great for highlighting specific work, but when you go to select items, there's no search box or other way to sort the contents. In my case, after 15 years of "Portraits" I have many customer galleries, usually named "Firstname Year", and they end up sorted by first name. But when I want to find all galleries from 2021, for example, there's no way to filter this list. I am looking into adding a Search box but I don't know enough about YUI.

For now, I just change the search value (in this example, '2021') in this statement and run this in the JavaScript developer tool:

Array.from(document.getElementsByClassName('sm-thumbnail-album')).forEach( a => {
    let n=a.getElementsByTagName('h4')[0].textContent.toLowerCase();
    a.style.display=n.includes('2021')?'':'none';
} )

Anyone know how to add a search box to invoke this filter function? Thanks!

Comments

  • AllenAllen "tweak 'til it squeaks" St. Louis, MoRegistered Users Posts: 9,940 Major grins

    I think running in a developer tool is only using the memory of the page that's loaded into the pc. Smug does not allow any JavaScript.

    Al - Just a volunteer here having fun
    My Website index | My Blog
Sign In or Register to comment.