From 67786bdd1934a4b7d7048ab10dbce3cc0df8a380 Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Sat, 15 Feb 2025 11:25:25 +0100 Subject: [PATCH] test pswp (photoswipe+lightbox) another photoswipe shortcodes collection that wont work --- assets/css/pswp-gallery.css | 35 ++++++++ assets/js/pswp-init.js | 64 ++++++++++++++ .../75-winlink-on-android-with-woad/index.md | 6 ++ .../test/session.packet.1.png | 3 + .../test/session.packet.2.png | 3 + .../test/session.packet.3.png | 3 + layouts/partials/extend-head.html | 18 ++-- layouts/shortcodes/figure.html | 24 +++++ layouts/shortcodes/gallery.html | 7 ++ layouts/shortcodes/pswp-init.html | 88 +++++++++++++++++++ 10 files changed, 244 insertions(+), 7 deletions(-) create mode 100644 assets/css/pswp-gallery.css create mode 100644 assets/js/pswp-init.js create mode 100644 content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.1.png create mode 100644 content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.2.png create mode 100644 content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.3.png create mode 100644 layouts/shortcodes/figure.html create mode 100644 layouts/shortcodes/gallery.html create mode 100644 layouts/shortcodes/pswp-init.html diff --git a/assets/css/pswp-gallery.css b/assets/css/pswp-gallery.css new file mode 100644 index 0000000..c3a776d --- /dev/null +++ b/assets/css/pswp-gallery.css @@ -0,0 +1,35 @@ +.gallery { + float: none; + border: 1px solid lightgrey; + padding: 10px; + margin: 0px 0px 10px 10px; +} +.gallery .title{ + text-align: center; + clear:left; + //border-top: 1px solid lightgrey; +} +.gallery img { + width: 100%; + height: auto; +} +.gallery figure { + display: block; + float: left; + margin: 0 5px 5px 0; +} +.gallery figcaption { + display: none; +} +figcaption { + font-size: 75%; +} + +span[itemprop="copyrightHolder"] { + color : #888; + float: right; +} + +span[itemprop="copyrightHolder"]:before { + content: "Foto: "; +} diff --git a/assets/js/pswp-init.js b/assets/js/pswp-init.js new file mode 100644 index 0000000..38ae072 --- /dev/null +++ b/assets/js/pswp-init.js @@ -0,0 +1,64 @@ +/* +Put this file in /static/js/pswp-init.js +*/ +$( document ).ready(function() { + var items = []; // array of slide objects that will be passed to PhotoSwipe() + // for every figure element on the page: + $('figure').each( function() { + if ($(this).attr('class') == 'pswp-ignore') return true; // ignore any figures where class="pswp-ignore" + // get properties from child a/img/figcaption elements, + var $figure = $(this), + $a = $figure.find('a'), + $src = $a.attr('href'), + $title = $figure.find('figcaption').html(), + $msrc = $figure.find('img').attr('src'); + // if data-size on tag is set, read it and create an item + if ($a.data('size')) { + var $size = $a.data('size').split('x'); + var item = { + src : $src, + w : $size[0], + h : $size[1], + title : $title, + msrc : $msrc + }; + // if not, set temp default size then load the image to check actual size + } else { + var item = { + src : $src, + w : 800, // temp default size + h : 600, // temp default size + title : $title, + msrc : $msrc + }; + // load the image to check its dimensions + // update the item as soon as w and h are known (check every 30ms) + var img = new Image(); + img.src = $src; + var wait = setInterval(function() { + var w = img.naturalWidth, + h = img.naturalHeight; + if (w && h) { + clearInterval(wait); + item.w = w; + item.h = h; + } + }, 30); + } + // Save the index of this image then add it to the array + var index = items.length; + items.push(item); + // Event handler for click on a figure + $figure.on('click', function(event) { + event.preventDefault(); // prevent the normal behaviour i.e. load the hyperlink + // Get the PSWP element and initialise it with the desired options + var $pswp = $('.pswp')[0]; + var options = { + index: index, + bgOpacity: 0.8, + showHideOpacity: true + } + new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options).init(); + }); + }); +}); \ No newline at end of file diff --git a/content/posts/2025/75-winlink-on-android-with-woad/index.md b/content/posts/2025/75-winlink-on-android-with-woad/index.md index 8aaea97..4eb9d03 100644 --- a/content/posts/2025/75-winlink-on-android-with-woad/index.md +++ b/content/posts/2025/75-winlink-on-android-with-woad/index.md @@ -23,6 +23,8 @@ tags: - Winlink --- +{{< pswp-init >}} + So I recently sold my iPhone 14 Pro and bought a Google Pixel 9 Pro. I used that for about two weeks when I finally replaced the vanilla Android with [GrapheneOS](https://grapheneos.org/). @@ -35,6 +37,10 @@ I assume the app is all set up with basic information like CALLSIGN, Grid, etc. ## Packet connection +![Session config screen](session.packet.1.png) +![Packet config screen](session.packet.2.png) +![TNC config screen](session.packet.3.png) + I love simple and small configurations (mostly) and this one is really small. When I'm out hiking I usually have an HT with me -- usually an Icom ID-52. Together with a Mobilinkd diff --git a/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.1.png b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.1.png new file mode 100644 index 0000000..ce14295 --- /dev/null +++ b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22b1ea28d1ff0f0ba3ae74bd94412baae8c4a843792acf223c4405175478df53 +size 26848 diff --git a/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.2.png b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.2.png new file mode 100644 index 0000000..5951504 --- /dev/null +++ b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c66f43bb7fd8f76c43be18127a427c348c7550c4f35e841a535564ab3c29d784 +size 28416 diff --git a/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.3.png b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.3.png new file mode 100644 index 0000000..ca7ec9e --- /dev/null +++ b/content/posts/2025/75-winlink-on-android-with-woad/test/session.packet.3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:126860b0dd154c880e73522506845d8dc6840feb5b48e9ec9f3a230a68d9e030 +size 30369 diff --git a/layouts/partials/extend-head.html b/layouts/partials/extend-head.html index e6af5b6..be4c74b 100644 --- a/layouts/partials/extend-head.html +++ b/layouts/partials/extend-head.html @@ -1,9 +1,13 @@ -{{- if eq .Site.BaseURL "https://oe7drt.com/" }} - {{ partial "plausible_head.html" . }} -{{- end }} +{{- if eq .Site.BaseURL "https://oe7drt.com/" }} {{ partial +"plausible_head.html" . }} {{- end }} -{{ with resources.Get "js/lightbox.js" }} {{ if hugo.IsDevelopment }} {{ with . + +{{ with resources.Get "js/pswp-init.js" }} {{ if hugo.IsDevelopment }} {{ with . | js.Build }} {{ end }} {{ else }} {{ $opts := (dict "minify" true "targetPath" -"js/lightbox.js") }} {{ with . | js.Build $opts | fingerprint }} +"js/pswp-init.js") }} {{ with . | js.Build $opts | fingerprint }} -{{ end }} {{ end }} {{ end }} {{ with resources.Get "css/lightbox.css" }} {{ if -hugo.IsDevelopment }} {{ with . }} +{{ end }} {{ end }} {{ end }} {{ with resources.Get "css/pswp-gallery.css" }} {{ +if hugo.IsDevelopment }} {{ with . }} + +
+ + + + {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} +
+ {{ with .Get "title" }}

{{.}}

{{ end }} + {{ if or (.Get "caption") (.Get "attr")}} +

+ {{ .Get "caption" }} + {{ with .Get "attrlink"}}{{ .Get "attr" }}{{ else }}{{ .Get "attr"}}{{ end }} +

+ {{ end }} +
+ {{ end }} +
\ No newline at end of file diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html new file mode 100644 index 0000000..c61b1f4 --- /dev/null +++ b/layouts/shortcodes/gallery.html @@ -0,0 +1,7 @@ + + diff --git a/layouts/shortcodes/pswp-init.html b/layouts/shortcodes/pswp-init.html new file mode 100644 index 0000000..5ef8f21 --- /dev/null +++ b/layouts/shortcodes/pswp-init.html @@ -0,0 +1,88 @@ + + + + + + + + + +