Skip to content

Commit

Permalink
Fix gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiliavir committed Sep 17, 2022
1 parent 7f29070 commit e77afae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions assets/ts/bilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class Gallery {
{query: "=w1200-h1200", desc: "w1200"},
{query: "=w2000-h2000", desc: "w2000"}
];
private static lightbox = new PhotoSwipeLightbox({pswpModule: PhotoSwipe});

public static openGallery(e: HTMLElement): void {
let items = (<HTMLElementWithImages>e).images;
Expand All @@ -34,11 +33,13 @@ export class Gallery {
items = (<HTMLElementWithImages>e).images = galleries[preview.data("year")][preview.data("gallery")].i;
}

Gallery.lightbox.loadAndOpen(0, items.map(i => ({
srcset: Gallery.sizes.map(s => i.u + s.query + " " + s.desc).join(", "),
src: i.u + "=w1200-h1200",
alt: i.t
})), null);
const lightbox = new PhotoSwipeLightbox({pswpModule: PhotoSwipe, dataSource: items.map(i => ({
srcset: Gallery.sizes.map(s => i.u + s.query + " " + s.desc).join(", "),
src: i.u + "=w1200-h1200",
alt: i.t
}))});
lightbox.init();
lightbox.loadAndOpen(0);
}

public static initialize(): void {
Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/bilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="ratio-content">
<img class="preview"
alt="{{ $title }}"
src="unknown-preset"
src="/img/logo_color.png"
data-src="{{ printf "%s=w200-h200" (index $gallery.i 0).u }}"
data-year="{{ $year }}"
data-gallery="{{ $title }}" />
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/lunr": "2.3.4",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"autoprefixer": "10.4.9",
"autoprefixer": "10.4.11",
"copyfiles": "2.4.1",
"eslint": "8.23.1",
"glob-all": "3.3.0",
Expand All @@ -55,7 +55,7 @@
"stylelint": "14.11.0",
"stylelint-config-recommended-scss": "7.0.0",
"typescript": "4.8.3",
"w3c-html-validator": "1.1.0"
"w3c-html-validator": "1.1.1"
},
"dependencies": {
"jquery": "3.6.1",
Expand Down

0 comments on commit e77afae

Please sign in to comment.