mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-06 19:39:32 -06:00
[feature] Allow user to choose "gallery" style web layout
This commit is contained in:
parent
d3c3d34aae
commit
7e689edbe3
82 changed files with 2840 additions and 1154 deletions
|
|
@ -40,6 +40,9 @@ const lightbox = new PhotoswipeLightbox({
|
|||
gallery: '.photoswipe-gallery',
|
||||
children: '.photoswipe-slide',
|
||||
pswpModule: Photoswipe,
|
||||
// Bit darker than default 0.8.
|
||||
bgOpacity: 0.9,
|
||||
loop: false,
|
||||
});
|
||||
|
||||
new PhotoswipeCaptionPlugin(lightbox, {
|
||||
|
|
@ -71,7 +74,8 @@ lightbox.addFilter('itemData', (item) => {
|
|||
}
|
||||
},
|
||||
width: parseInt(el.dataset.pswpWidth),
|
||||
height: parseInt(el.dataset.pswpHeight)
|
||||
height: parseInt(el.dataset.pswpHeight),
|
||||
parentStatus: el.dataset.pswpParentStatus,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
|
|
@ -98,6 +102,26 @@ lightbox.on("close", function () {
|
|||
}
|
||||
});
|
||||
|
||||
lightbox.on('uiRegister', function() {
|
||||
lightbox.pswp.ui.registerElement({
|
||||
name: 'open-post-link',
|
||||
ariaLabel: 'Open post',
|
||||
order: 8,
|
||||
isButton: true,
|
||||
tagName: "a",
|
||||
html: '<span title="Open post"><span class="sr-only">Open post</span><i class="fa fa-lg fa-external-link-square" aria-hidden="true"></i></span>',
|
||||
onInit: (el, pswp) => {
|
||||
el.setAttribute('target', '_blank');
|
||||
el.setAttribute('rel', 'noopener');
|
||||
pswp.on('change', () => {
|
||||
el.href = pswp.currSlide.data.parentStatus
|
||||
? pswp.currSlide.data.parentStatus
|
||||
: pswp.currSlide.data.element.dataset.pswpParentStatus;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
lightbox.init();
|
||||
|
||||
function dynamicSpoiler(className, updateFunc) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue