Some checks failed
Blowfish Docs Deploy / build (push) Has been cancelled
Blowfish Docs Deploy / deploy (push) Has been cancelled
Test Build / Build Example Site (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Update Hugo version / updateBlowfish (push) Has been cancelled
Delete exampleSite Add initial content, images & docker-compose.yml Use extend-head.html for analytics Set remote url to gitea.novicelab.io Remove original .git due to "shallow update not allowed" error
40 lines
993 B
JavaScript
40 lines
993 B
JavaScript
function _getDefaultPackeryOptions() {
|
|
return {
|
|
percentPosition: true,
|
|
gutter: 5,
|
|
resize: true,
|
|
};
|
|
}
|
|
|
|
function _getPackeryOptions(nodeGallery) {
|
|
const defaults = _getDefaultPackeryOptions();
|
|
const {
|
|
packeryGutter,
|
|
packeryPercentPosition,
|
|
packeryResize,
|
|
} = nodeGallery.dataset;
|
|
|
|
return {
|
|
percentPosition:
|
|
packeryPercentPosition !== undefined
|
|
? packeryPercentPosition === "true"
|
|
: defaults.percentPosition,
|
|
gutter:
|
|
packeryGutter !== undefined ? parseInt(packeryGutter, 10) : defaults.gutter,
|
|
resize:
|
|
packeryResize !== undefined ? packeryResize === "true" : defaults.resize,
|
|
};
|
|
}
|
|
|
|
(function init() {
|
|
window.addEventListener("load", function () {
|
|
let packeries = [];
|
|
let nodeGalleries = document.querySelectorAll(".gallery");
|
|
|
|
nodeGalleries.forEach((nodeGallery) => {
|
|
let packery = new Packery(nodeGallery, _getPackeryOptions(nodeGallery));
|
|
packeries.push(packery);
|
|
});
|
|
});
|
|
})();
|