mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Photoswipe gallery (#740)
* implement photoswipe galleries * dependency wrangling * photoswipe-dynamic-caption plugin
This commit is contained in:
@ -23,9 +23,24 @@
|
||||
// our frontend templates don't load the common bundle.js since it contains React etc
|
||||
// so we can't use any dependencies that would deduplicate with the other files
|
||||
|
||||
const Photoswipe = require("photoswipe/dist/umd/photoswipe.umd.min.js");
|
||||
const PhotoswipeLightbox = require("photoswipe/dist/umd/photoswipe-lightbox.umd.min.js");
|
||||
const PhotoswipeCaptionPlugin = require("photoswipe-dynamic-caption-plugin").default;
|
||||
|
||||
const lightbox = new PhotoswipeLightbox({
|
||||
gallery: '.photoswipe-gallery',
|
||||
children: 'a',
|
||||
pswpModule: Photoswipe,
|
||||
});
|
||||
|
||||
new PhotoswipeCaptionPlugin(lightbox, {
|
||||
type: 'auto',
|
||||
});
|
||||
|
||||
lightbox.init();
|
||||
|
||||
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
|
||||
let checkbox = document.getElementById(label.htmlFor);
|
||||
console.log(label, checkbox);
|
||||
if (checkbox != undefined) {
|
||||
function update() {
|
||||
if(checkbox.checked) {
|
||||
|
Reference in New Issue
Block a user