From 635999a6fe0f86f5888f5a7b5e0b03085af9f6f4 Mon Sep 17 00:00:00 2001 From: kekskurse Date: Wed, 19 Jul 2023 14:42:12 +0200 Subject: [PATCH] content from old page --- .gitmodules | 3 + .hugo_build.lock | 0 content/about.md | 8 + content/posts/2020-10-01-Edifier-remote.md | 81 +++++++ .../posts/2020-10-03-spaziergang-grenau.md | 42 ++++ content/posts/2020-10-17-Hugo-Shortcodes.md | 79 ++++++ content/posts/2020-10-28-Mqtt-At-Home.md | 35 +++ content/posts/2020-12-22-foto-wokflow.md | 44 ++++ content/posts/2021-01-19-Lampe.md | 24 ++ .../posts/2021-03-07-signal-dbus-golang.md | 227 ++++++++++++++++++ content/posts/2021-10-10-schweden.md | 51 ++++ content/posts/2022-03-02-sterne.md | 25 ++ content/posts/my-first-post.md | 6 + hugo.toml | 38 ++- layouts/shortcodes/figure.html | 29 +++ layouts/shortcodes/gallery.html | 41 ++++ layouts/shortcodes/load-photoswipe.html | 71 ++++++ ...s_a4b227022dfae4b28843e276c7e6b126.content | 1 + ...scss_a4b227022dfae4b28843e276c7e6b126.json | 1 + static/css/hugo-easy-gallery.css | 159 ++++++++++++ static/js/load-photoswipe.js | 80 ++++++ themes/hugo-blog-awesome | 1 + 22 files changed, 1045 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 .hugo_build.lock create mode 100644 content/about.md create mode 100644 content/posts/2020-10-01-Edifier-remote.md create mode 100644 content/posts/2020-10-03-spaziergang-grenau.md create mode 100644 content/posts/2020-10-17-Hugo-Shortcodes.md create mode 100644 content/posts/2020-10-28-Mqtt-At-Home.md create mode 100644 content/posts/2020-12-22-foto-wokflow.md create mode 100644 content/posts/2021-01-19-Lampe.md create mode 100644 content/posts/2021-03-07-signal-dbus-golang.md create mode 100644 content/posts/2021-10-10-schweden.md create mode 100644 content/posts/2022-03-02-sterne.md create mode 100644 content/posts/my-first-post.md create mode 100644 layouts/shortcodes/figure.html create mode 100644 layouts/shortcodes/gallery.html create mode 100644 layouts/shortcodes/load-photoswipe.html create mode 100644 resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.content create mode 100644 resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.json create mode 100644 static/css/hugo-easy-gallery.css create mode 100644 static/js/load-photoswipe.js create mode 160000 themes/hugo-blog-awesome diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e84a7c7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "themes/hugo-blog-awesome"] + path = themes/hugo-blog-awesome + url = https://github.com/hugo-sid/hugo-blog-awesome.git diff --git a/.hugo_build.lock b/.hugo_build.lock new file mode 100644 index 0000000..e69de29 diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..c47e6ba --- /dev/null +++ b/content/about.md @@ -0,0 +1,8 @@ +--- +title: "About" +date: 2020-10-01T14:49:09+02:00 +draft: false +cc: "" +--- + +Mail: hello [at] kekskurse.de \ No newline at end of file diff --git a/content/posts/2020-10-01-Edifier-remote.md b/content/posts/2020-10-01-Edifier-remote.md new file mode 100644 index 0000000..41972cf --- /dev/null +++ b/content/posts/2020-10-01-Edifier-remote.md @@ -0,0 +1,81 @@ +--- +title: "Edifier R1700BT Remote Control" +date: 2020-10-01T14:44:25+02:00 +draft: false +description: "Use a Wemos to create an mqtt-based remote control" +tags: ["WeMos", "Arduino", "Blog"] +categories: ["Electronics"] +startpage: true +lang: gb +--- + +After I got the Edifier R1700BT Speaker I notice that i want to control them like all my other stuff with my moile phone and MQTT. So i got some IR reciver and LEDs to simulate the Edifier Remote with a Wemos who is connected to my MQTT Server. + +{{< tweet 1310694353187344385 >}} + +I figure out the IR-Codes used: + +* 149389439 -> power on/off +* 149356799 -> mute +* 149369039 -> Volume Up +* 149393519 -> Volume Down +* 149377199 -> Switch input to Bluetooth +* 149399639 -> Switch input to Line In + +## Hardware + +I connected the IR-LED to the D4 Pin of a Wemos. I used [this question](https://antwortenhier.me/q/wie-steuere-ich-die-ir-led-mit-esp8266-pint-bei-3-3-v-und-mosfet-um-einen-62376266277) as basic idea. + +{{< figure src="/img/2020/10/ir-remote/plan.png" >}} + +## Software + +With this Numbers, and the [pubsubclient](https://github.com/knolleary/pubsubclient) and [IRremoteESP8266](https://github.com/crankyoldgit/IRremoteESP8266) i just can subscripe to some topics, and every time a message aravid at one of the topics i could send the code to the speaker: + +``` +if(String(topic)=="musik/power") { + irsend.sendNEC(149389439, 32); + Serial.println("EDIFIER: Power"); +} + +if(String(topic)=="musik/mute") { + irsend.sendNEC(149356799, 32); + Serial.println("EDIFIER: Mute"); +} + +if(String(topic)=="musik/down") { + irsend.sendNEC(149369039, 32); + Serial.println("EDIFIER: Down"); +} + +if(String(topic)=="musik/up") { + irsend.sendNEC(149393519, 32); + Serial.println("EDIFIER: UP"); +} + +if(String(topic)=="musik/bluetooth") { + irsend.sendNEC(149377199, 32); + Serial.println("EDIFIER: Bluetooth"); +} + +if(String(topic)=="musik/line") { + irsend.sendNEC(149399639, 32); + Serial.println("EDIFIER: Line"); +} +``` + +## Final Result + +After solder everything to a perforated board I got the following result. + +{{< figure src="/img/2020/10/ir-remote/result.jpg" >}} + +Maybe I will create another smaller version to hide next to the speaker. For now it works. + +## Complete Code + + +You can got the complete code here: [Complete Code](/code/ir-wemos-mosfet.txt) + + +{{< load-photoswipe >}} \ No newline at end of file diff --git a/content/posts/2020-10-03-spaziergang-grenau.md b/content/posts/2020-10-03-spaziergang-grenau.md new file mode 100644 index 0000000..cdc981d --- /dev/null +++ b/content/posts/2020-10-03-spaziergang-grenau.md @@ -0,0 +1,42 @@ +--- +title: "Spaziergang Grünau" +date: 2020-10-03T00:00:01+00:00 +draft: false +categories: ["Images"] +description: "Spaziergang Grünau" +tags: ["Lost Places", "Blog"] +startpage: false +lang: img +gallery: "/img/2020/10/spaziergang-grenau/DSC06680_01.jpg" +cc: "by-nc-sa" +--- +Heute lief ich am [ehemalige Funkhaus Grünau](https://de.wikipedia.org/wiki/Funkhaus_Gr%C3%BCnau) vorbei. Das Gebäude kann aktuell scheinbar nicht mehr betreten werden. + +{{< gallery caption-position="bottom" caption-effect="fade" >}} + {{< figure src="/img/2020/10/gruenau/DSC06623.jpg" caption="Eingangstür" >}} + {{< figure src="/img/2020/10/gruenau/DSC06676.jpg" caption="Seitenansicht Rechts" >}} + {{< figure src="/img/2020/10/gruenau/DSC06677.jpg" caption="Seitenansicht Links" >}} + {{< figure src="/img/2020/10/gruenau/DSC06673.jpg" caption="Wasser Seite" >}} + {{< figure src="/img/2020/10/gruenau/DSC06675.jpg" caption="Grafitti" >}} +{{< /gallery >}} + +Hinter dem Funkhaus schließt sich ein schöner Fuß/Rad weg an. Auf diesem kann entlang des Wassers spaziert werden mit vielen Sitzplätzen inc Wasserblick. Außerdem ist sehr leicht an vielen Stellen in die Tram die alle 20 Minuten den selben weg entlangfährt einzusteigen und sich wieder zurück fahren zu lassen. + +{{< gallery caption-position="bottom" caption-effect="fade" >}} + {{< figure src="/img/2020/10/gruenau/DSC06633_01.jpg" caption="Pilz" >}} + {{< figure src="/img/2020/10/gruenau/DSC06643.jpg" caption="Bauwerk auf Wasser" >}} + {{< figure src="/img/2020/10/gruenau/DSC06647.jpg" caption="Steg auf Wasser" >}} + {{< figure src="/img/2020/10/gruenau/DSC06661.jpg" caption="Rote Bojen umrandet von Blättern" >}} + {{< figure src="/img/2020/10/gruenau/DSC06680_01.jpg" caption="Tram" >}} + {{< figure src="/img/2020/10/gruenau/DSC06682_01.jpg" caption="Parkendes Motorad" >}} + {{< figure src="/img/2020/10/gruenau/DSC06694_01.jpg" caption="Ins Wasser reichender Baum" >}} + {{< figure src="/img/2020/10/gruenau/DSC06711.jpg" caption="Ins Wasser reichender Baum" >}} + {{< figure src="/img/2020/10/gruenau/DSC06725.jpg" caption="Sitzgelegenheit am Wasser" >}} + {{< figure src="/img/2020/10/gruenau/DSC06730.jpg" caption="Bote" >}} +{{< /gallery >}} + + + + + +{{< load-photoswipe >}} diff --git a/content/posts/2020-10-17-Hugo-Shortcodes.md b/content/posts/2020-10-17-Hugo-Shortcodes.md new file mode 100644 index 0000000..df0e2d1 --- /dev/null +++ b/content/posts/2020-10-17-Hugo-Shortcodes.md @@ -0,0 +1,79 @@ +--- +title: "Own Hugo Shortcodes" +date: 2020-10-17T02:22:53+02:00 +draft: false +description: "How to create your own Shortcodes with Hugo" +tags: ["Hugo", "Go", "Blog"] +categories: ["Programming"] +startpage: true +lang: gb +--- +After using [Hugo](https://gohugo.io/) for this Webpage I want to create a [Gallery Page](/gallery/). I already used [hugo-easy-gallery](https://github.com/liwenyip/hugo-easy-gallery) inside Posts so i noticed the "layouts/shortcodes" folder at my projekt. After I created a new Layout for one Page and implement all the used HTML/JS/CSS Stuff i thought it would be a better way to use the "normal" layout and find anouther way to create the Gallery view. + +## Generale Shortcodes + +I created a new html file inside the Folder `layouts/shortcodes`. I called it `test.html` for now. In this file I could insert some basic HTML Code: + +``` +FooBar Sample +``` + +and a new md file for my Gallery with the following content: + +``` +--- +title: "Gallery" +date: 2020-10-01T14:49:09+02:00 +draft: true +--- +{{\}} +``` + +which together create the following Result: + +{{< figure src="/img/2020/10/hugo-shortcodes/test-html.png" >}} + +Based on the [offical documentation](https://gohugo.io/templates/shortcode-templates/) hugo try to find the html File in the `/layouts/shortcodes/.html` or the `/themes//layouts/shortcodes/.html` directory. + +## Create a Gallery with a Shortcode + +The Gallery Page is a overview over multible Posts, so i don't want to show a Publish Date. On my theme I need to create a small hack to achieve that, I added a new Varieable to my Posts call `hideDate`. In my template single.html file i just added an if to check if the Parametet is set: + +``` +{{ if eq .Params.hideDate nil}} +
Posted on {{ dateFormat "Jan 2, 2006" .Date }}{{ if .Draft }} DRAFT {{ end }}
+{{ end }} +``` + +I also added a `gallery` Field in the Post-Header of all Content Fiels which should be shown in the Gallery. The `gallery` fieeld contains a link to an image. So I can query for that posts in the hugo langauge. + +``` +{{ $pages := where (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) ".Params.gallery" "!=" nil }} +``` + +To create the Galery itselfs i used the JQuery (i know its not the best any more but easy to integrate in hugo) [Justified-Gallery](http://miromannino.github.io/Justified-Gallery/). Also there is no reason to show the Gallery two times at one Page, therefore I don't care about loading the js file multible times. If te same shourcade is used more than one time it may make sens to move the loading of external javascript files to another place. + +After all I have the following shortcode-file: + +``` + + + +{{ $pages := where (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) ".Params.gallery" "!=" nil }} +
+ {{ range $pages }} + + {{ .Title }} + + {{ end }} +
+
+ + +``` \ No newline at end of file diff --git a/content/posts/2020-10-28-Mqtt-At-Home.md b/content/posts/2020-10-28-Mqtt-At-Home.md new file mode 100644 index 0000000..592948f --- /dev/null +++ b/content/posts/2020-10-28-Mqtt-At-Home.md @@ -0,0 +1,35 @@ +--- +title: "MQTT at Home" +date: 2020-11-26T21:32:53+02:00 +draft: false +description: "How I use MQTT at Home to connect stuff." +tags: ["MQTT", "IoT", "Blog", "Go"] +categories: ["Programming"] +startpage: true +lang: gb +--- +Ok i live in a small appartment, but at least I have three Window and a little bit stuff to connect with each other. I startes with [Ikea TRÅDFRI](https://www.ikea.com/de/de/cat/ikea-home-smart-beleuchtung-36812/) and some selfe made components based Arudino/Wemos. About one year ago I tried [zigbee2mqtt](https://www.zigbee2mqtt.io/) to connect the ikea bulbs to MQTT without using my own buggy code. I used a MQTT-Broker on a Virtual Server somewhere in the internet and develop some PHP-Application with lumen (some of them running in kubernetes) to connect everything. + +After some issues with my Internet Provider I beginn with a easyer and locale alternative. I already used a Raspberry Pi for zigbee2mqtt so i want to run everything on it. On the other hand I want a secound MQTT Server in the Internet(tm) to connect from other networks. Also I like the idear of smaller "services" managed single features. + +## Basic Setup + +First i setup [supervisord](http://supervisord.org/) on the pi to managed all scripts. I develope the new Services in golang, so first i build a small wrapper arround [paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang), so all Services has the same configure also for the Last Will and Testament. It connected without crdentials to a mqtt server running on the same pi (localhost). Than i could start creating single services. One react to all incomming MQTT-Message if a button is pressed and change the light-modus. The light-modus are topics with retained messages. Another services subscribed to this topic and send the mqtt messages to zigbee2mqtt which changed the light bulbs. + + +## MQTT Bridge + +For all topics contained a state like the light-modus i created a set topic. The light modus for the "main" room could be `light-modus/main`, to change it i published a message to `light-modus/main/set`. I used another service just mirrow the incomming messages at the set topic (not retained) and send it to the original topic (as retained messages). + +The [Mosquito MQTT Broker](https://mosquitto.org/) has a feature to setup a bridge between two MQTT Server. So i setup another instanc of it at a VM in the internet. After that i can configure on the MQTT Broker on my locale pi to connect to the remote mqtt server. I relay messages from status topics (like light-modus), sensor and device informations (from zigbee2mqtt) and subscripe to some */set topics. With this setup everything works fine without internet in my apparment. But as long as the internet connection is avalible I can publish messages to the online mqtt server which would be recived locale. + +## Automation + +All Automation Services are also written in go, and had a feature toggle as retained mqtt topic (with a seperate /set topic). With this I can change the behavior of it. For example i had a service checking if I'm currenlty in im appartment and the value of the lumex sensor falls below a special value. If that happends it will turn on the light. But I dont always want that to happend to I can toggle this feature. + +Also all status information are avalible as retained messages at the MQTT-Broker. So each service can restart without any issues. + +## Interface + + +I still use [Mqtt Dash](https://play.google.com/store/apps/details?id=net.routix.mqttdash&hl=de&gl=US) at my Android Device do control most things. Some information like the room temperature are already stored in a graphite database to have access via [grafana](https://grafana.com/). In the feature I want to create some status dashboard based on the last will of the service and some zigbee2mqtt messages. Also maybe a webpage connecting to the broker to controll the light with a tablet. \ No newline at end of file diff --git a/content/posts/2020-12-22-foto-wokflow.md b/content/posts/2020-12-22-foto-wokflow.md new file mode 100644 index 0000000..5da0433 --- /dev/null +++ b/content/posts/2020-12-22-foto-wokflow.md @@ -0,0 +1,44 @@ +--- +title: "Workflow zum bearbeiten von Bildern" +date: 2020-12-22T21:32:53+02:00 +draft: false +description: "Mein aktueller Workflow um Bilder zu bearbeiten" +categories: ["Fotografie"] +tags: ["Blog"] +startpage: true +lang: de +--- +Grundlegend bearbeite ich meine Bilder ab jetzt mit Caputre One auf Windows. Da ich kein lokales Windows System habe, nutzte ich den Cloud-Dienst Shadow. Das bearbeiten funktioniert auf dem Remote-System ziemlich gut. Ledigleich das hochladen auf die Windows VM war bis jetzt immer recht umständlich. Jetzt habe ich angefangen mit einen Workflow auszudenken mit dem das beschleunidgt werden kann. + +Das Ziel ist es das die Bilder mit den richtigen Metatags ausgestattet werden, wenn vorhanden sollen die GPS Daten aus einem gpx File entnommen werden. Außerdem sollen die Datein am ende auf meinem NAS liegen und bei AWS gebackupt werden. Dabei bearbeiteten Bilder können im Capture One Katalog auf der Windows VM bleiben. + +# Bilder von SD Karte auf NAS kopieren +Die Bilder gruppiere ich basierend ich auf basis von dem was ich gemacht habe (aktuell gibt es ja eher Touren bei denen Fotos entstehen). Auf dem NAS lege ich einen Ordner mit dem Namen "yyyy-mm-dd *name*" an und kopiere alle Bilder dort hinein. Wenn ich während der aufnahmen ein GPS-Tracker an habe wird die entsprechende gpx Datei mit in dieses Verzeichnis kopiert. Das Kopieren der Datei erfolgt lokale von meinem Linux System. + +# GPS Daten +Um die GPS Daten aus dem GPX-File zu laden und den Bildern hinzuzufügen habe ich ein kleines Python Script entwickelt. Aktuell arbeitet dieses noch mit der Zeitzohne Europe/Berlin und einer Zeitkorrektur. Das soll in Zukunft geändert werden und die Kamera Daten dirket im UTC Format aufnehmen. + +Leider werden in den EXIF Daten zur aufnahme des Bildes keine Zeitzohne mit gespeichert. So muss ich das manuel auffangen. + +Der Script prüft in der vorhanden GPX Datei welcher Zeitpunkt am nähesten zu der Aufnahme liegt, das limmit liegt bei 10 minuten abstand zwischen der Aufnahme und dem GPS Track. Danach haben alle Bilder die ungefähren GPS Daten \o/ + +[Python Script](https://git.keks.cloud/kekskurse/exif-data/src/branch/master/gps-data.py) + +# Update MetaDaten +Bei den EXIF Daten aus der A6400 fehlt die Zeitzohne und es gibt keine weiteren Informationen dazu. Bei meiner ersten Suche im Internet gab es unterschiedliche wege wie dieses hinterlegt werden kann. Da ich weiß wie meine Kamera eingestellt ist will ich die fehlende Metadaten per Script ergänzen und z.B. die Information das die Bilder Aufnahme angaben in UTC erfolgen. Dieses steht aber zum jetzigen Zeitpunkt noch aus. + +# Bilder in Windows bearbeiten +Mein Shadow Computer habe ich per Wireguard in mein VPN eingebunden. Auf diese Weise kann ich ein Zugriff auf mein NAS ermöglichen. Caputre One kann von dem NAS wo ich den entsprechendem Projektordner auswähle die Bilder Importieren. Dieses kopieren ist da mein Internet doch nicht unendlich schnell ist sehr langsam. Da ich bis jetzt die Bilder aber auf einen Server und von da wieder runtergeladen habe ist es auf jeden fall einfacher. + +Den Ordner im Capture One kann ich dann nach dem Moto "yyyy-mm-dd *name*" hinterlegen. Nachdem der Import (der gerne auch mal eine halbe Stunde und noch länger dauern kann) sind die Datein aber auf dem Windows System verfügbar und Capture One kann schnell auf die Daten zugreifen. + +# Backup der Daten auf dem NAS +Nachdem ich die Bilder auf Capture One bearbeitet habe exportiere ich den Katalog für den entsprechendem Ordner und speichere ihn über das VPN auf meinem NAS im "Projektordner". + +# Backup der Bilder zu ABS +Um die Daten im Falle eines Festplatten versagen noch zu haben speichere ich die Daten noch in AWS S3. Im vergleich zu einer weiteren Festplatten die extern gelagert wird ist ein Backup zu S3 Glacier Deep Archive einfach günstiger. + +# Probleme +Wenn ich nach dem export des Katalogs oder nach dem Backup zu ABS die Bilder weiter bearbeite gehen diese änderungen möglicherweise verloren wenn der Windows Cloud Rechner weg ist. + +Außerdem ist der Upload von meinem NAS zu dem Windows Rechner recht langsam. \ No newline at end of file diff --git a/content/posts/2021-01-19-Lampe.md b/content/posts/2021-01-19-Lampe.md new file mode 100644 index 0000000..184317e --- /dev/null +++ b/content/posts/2021-01-19-Lampe.md @@ -0,0 +1,24 @@ +--- +title: "Lampe" +date: 2021-01-19T19:25:53+02:00 +draft: false +description: "Lampe" +tags: ["Blog"] +categories: ["Electronics"] +startpage: true +lang: de +--- + +# Prototyp +Nachdem ich im Internet(tm) nach einer Lampe gesucht habe die noch hinter meinem Sofa Platz hat bin ich auf folgendes Model gestoßen [Amazon Link](https://www.amazon.de/Stehleuchte-Fernbedienung-Farbwechsel-Schlafzimmer-Energieklasse/dp/B08L6HPCVX/). Der Preis von über 80 Euro für ein Rohr und einen LED-Stripe war mir jedoch etwas zu viel. + +Also habe ich mich auf die Suche nach teilen gemacht um einen prototypen selber zu bauen. Gefunden habe ich die [Paulmann Delta Profil mit Diffusor](https://www.obi.de/led-streifen/paulmann-delta-profil-mit-diffusor-2-m/p/4512125) die schon eine recht passende form haben um in der ecke meines Zimmers zu stehen. Für den ersten entwurf habe ich die billigsten LED-Strips vom Baumarkt genommen, mit diesen "schönen" Infrarot fernbedienungen... Wenn man bedenkt dass diese Strips keine eigenen Weißen LEDs haben, und auch kein warmweiß können ist das ergebnis ok. Im nächsten schritt wird es das selbe nochmal geben mit warm und kaltweißen LEDs und der Steuerung per Zigbee. + +Ergebnis des Prototyps: +{{< gallery caption-position="bottom" caption-effect="fade" >}} + {{< figure src="/img/2021/01/lampe/kekskurse_lampe000_382_1200.jpg" caption="Lampe, blau, mit Büchern im vordergrund" >}} + {{< figure src="/img/2021/01/lampe/kekskurse_lampe000_383_1200.jpg" caption="Lampe von oben" >}} + {{< figure src="/img/2021/01/lampe/kekskurse_lampe000_385_1200.jpg" caption="Lampe, rot, reflektion auf Glastisch" >}} + +{{< /gallery >}} +{{< load-photoswipe >}} \ No newline at end of file diff --git a/content/posts/2021-03-07-signal-dbus-golang.md b/content/posts/2021-03-07-signal-dbus-golang.md new file mode 100644 index 0000000..ed39008 --- /dev/null +++ b/content/posts/2021-03-07-signal-dbus-golang.md @@ -0,0 +1,227 @@ +--- +title: "Using the signal-cli dbus interface in golang" +date: 2021-03-07T10:25:53+02:00 +draft: false +description: "Using the signal-cli dbus interface in golang" +tags: ["Blog", "Go"] +categories: ["Programming"] +startpage: true +lang: en +--- + +The [signal-cli](https://github.com/AsamK/signal-cli) tool profieds a dbus interface to get and send messages from other programms. The Documentation for that is avalible in the [signal-cli wiki](https://github.com/AsamK/signal-cli/wiki/DBus-service) but that not so easy to understand if you never work with dbus before. + +# Setup signal-cli +To setup signal-cli and pair it as secound device to an existing account you first need to install signal-cli, that steps based on your os. After you install it you can create a new "Pairing-Code" by runnuning `signal-cli link -n "mybot"`. The given code can used on the webpage [goqr.me](http://goqr.me/) to create an qr code, which you can scann with the signal app on your mobile device. + +After that you can start signal-cli as deamon, for example with the following command with also print all incomming events as json on your cli: + +``` +signal-cli -u +49176XXXXXXX -o json daemon +``` + +# Getting Messages +First we need to connect to the DBus system, thats possible with the [godbus/dbus](https://github.com/godbus/dbus) package. The connection based on the example from the package is really easy: +``` +conn, err := dbus.ConnectSessionBus() +if err != nil { + fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err) + return err +} +defer conn.Close() +``` + +After that we need to told the dbus package which messages we want to recive and create a channel where we can revice all signales. To got the signal messages the follwoing code works for me: + +``` +if err = conn.AddMatchSignal( + dbus.WithMatchInterface("org.asamk.Signal"), +); err != nil { + return err +} +c := make(chan *dbus.Signal, 10) +conn.Signal(c) +``` +than we can "listen" to the channel and got the messages the signal-cli deamon sends: + +``` +for v := range c { + fmt.Println(v) +} +``` + +That will create mainly two signales im interested in, first getting a message from another conversation partner: + +``` +&{:1.34 /org/asamk/Signal org.asamk.Signal.MessageReceived [1615064176455 +49176XXXXXXXX [] Durchgefallen []] 11} +``` + +and secound getting a Sync Message, it will be send if yourself send a message from another device to a conversation partner: + +``` +&{:1.34 /org/asamk/Signal org.asamk.Signal.SyncMessageReceived [1615064055775 +49176XXXXXXXXX +49176XXXXXXX [] Ich bin ein test []] 8} +``` + + +# Parsing Messages +If i just focus on 1:1 chats i could parse both kinds of events. Here two examples without error handling. First on the "Incomming Messages" : + +``` +type IncommingMessage struct { + Timestamp int64 + Source string + Message string + Attachments []string +} + +func parseMessageReceived(v *dbus.Signal) IncommingMessage { + msg := IncommingMessage{} + msg.Timestamp, _ = v.Body[0].(int64) + msg.Source = v.Body[1].(string) + msg.Message = v.Body[3].(string) + msg.Attachments = v.Body[4].([]string) + return msg +} +``` + +and for the Snyc Events: + +``` +type SyncMessage struct { + Timestamp int64 + Source string + Destination string + Message string + Attachments []string +} + +func parseSyncMessageReceived(v *dbus.Signal) SyncMessage { + msg := SyncMessage{} + msg.Timestamp, _ = v.Body[0].(int64) + msg.Source = v.Body[1].(string) + msg.Destination = v.Body[2].(string) + msg.Message = v.Body[4].(string) + msg.Attachments = v.Body[5].([]string) + return msg +} +``` + + + +That functions will return strucs you can easy use for your application. + +# Sending Messages + +For the sending we also need a dbus connection, but unlike in the receving message part we don't subscribe to the events we produse one which will be consumed by the signal-cli deamon and send as chat messages to the conversation. All other devices (like your mobile phone) will get a SyncMessage event and show that "new" message too. + +First you need to create the connection like before: + +``` +conn, err := dbus.ConnectSessionBus() +if err != nil { + fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err) + os.Exit(1) +} +defer conn.Close() +``` + +after that just send a call like this: + +``` +obj := conn.Object("org.asamk.Signal", "/org/asamk/Signal") +call := obj.Call("org.asamk.Signal.sendMessage",0, "Your really cool message", []string{}, "+49176XXXXXXX") +if call.Err != nil { + panic(call.Err) +} +``` + + +# Example + +Here an "full" example of getting messages (without error handling) + +``` +func listenToDbus() error { + conn, err := dbus.ConnectSessionBus() + if err != nil { + fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err) + return err + } + defer conn.Close() + + if err = conn.AddMatchSignal( + dbus.WithMatchInterface("org.asamk.Signal"), + ); err != nil { + return err + } + + c := make(chan *dbus.Signal, 10) + conn.Signal(c) + for v := range c { + if v.Name == "org.asamk.Signal.SyncMessageReceived" { + msg := parseSyncMessageReceived(v) + // do something with msg like a callback + } + if v.Name == "org.asamk.Signal.MessageReceived" { + msg := parseMessageReceived(v) + // do something with msg like a callback + } + } + + return nil +} + +type SyncMessage struct { + Timestamp int64 + Source string + Destination string + Message string + Attachments []string +} + +func parseSyncMessageReceived(v *dbus.Signal) SyncMessage { + msg := SyncMessage{} + msg.Timestamp, _ = v.Body[0].(int64) + msg.Source = v.Body[1].(string) + msg.Destination = v.Body[2].(string) + msg.Message = v.Body[4].(string) + msg.Attachments = v.Body[5].([]string) + return msg +} + +type IncommingMessage struct { + Timestamp int64 + Source string + Message string + Attachments []string +} + +func parseMessageReceived(v *dbus.Signal) IncommingMessage { + msg := IncommingMessage{} + msg.Timestamp, _ = v.Body[0].(int64) + msg.Source = v.Body[1].(string) + msg.Message = v.Body[3].(string) + msg.Attachments = v.Body[4].([]string) + return msg +} +``` + +and another one to sending messages: + +``` +func SendMessage(to string, msg string) { + conn, err := dbus.ConnectSessionBus() + if err != nil { + fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err) + os.Exit(1) + } + defer conn.Close() + + obj := conn.Object("org.asamk.Signal", "/org/asamk/Signal") + call := obj.Call("org.asamk.Signal.sendMessage",0, msg, []string{}, to) + if call.Err != nil { + panic(call.Err) + } +} + +``` \ No newline at end of file diff --git a/content/posts/2021-10-10-schweden.md b/content/posts/2021-10-10-schweden.md new file mode 100644 index 0000000..dd70e74 --- /dev/null +++ b/content/posts/2021-10-10-schweden.md @@ -0,0 +1,51 @@ +--- +title: "Urlaub Schweden" +date: 2021-10-10T00:00:01+00:00 +draft: true +categories: ["Images"] +tags: ["Blog", "holiday", "sweden"] +description: "Kurzurlaub schweden" +startpage: true +lang: img +gallery: "/img/2021/10/schweden-sonnenuntergang/DSC03460_1.jpg" +cc: "by-nc-sa" +--- + +Eigentlich sollte es nur ein gemeinsammes Abendessen werden. Am ende wurde von irgendwelchen Menschen(tm) ein Ferienwohnung bei [Jönköping](https://de.wikipedia.org/wiki/J%C3%B6nk%C3%B6ping) gebucht und es gab einen kurzen Ausflug nach Schweden \o/ + +Das Ferienhaus war das linke der beiden Gebäude auf dem oberen Bild. Los ging es für mich um 8 Uhr morgends wo ich mit dem Elektro Auto abgeholt wurde. Für die etwas über 600km mussten wir zweimal laden, was mit etwa einer Stunde wesentlich länger dauerte als ein kurzer Stopp zum tanken. So wurde die Anreise zwar wesentlich länger allerdings mit ausreichend Pausen und Bewegung auf dem weg. + +Danach gab es 3 Tage schweden, bevor der letzten Tag wieder im Auto verbracht wurde. + +{{}} + +## Tag 1 +Nach der Ankunft am vorabend gab es am ersten Tag einen ersten Spaziergang durch die gegend bei der Ferienwohnung, das mit dem Sonnenaufgang hat mit den ganzen Wolken leider nicht geklappt und es bliebt den ganzen Tag so diesig. Glücklicherweise sind beim Fotografieren auf dem Steg nur meine Schuhe und nicht mehr von mir nass geworden. +{{< gallery dir="/img/2021/10/schweden-spaziergang" caption-position="none" caption-effect="fade" />}} + +Da wir mit einem Elektro Auto unterwegs waren sind wir am Nachmittag zu einer Ladestation in der nähe von [Jönköping](https://de.wikipedia.org/wiki/J%C3%B6nk%C3%B6ping). Während wir darauf warteten dass das Auto geladen ist machten wir einen ersten Besuch am [Vättern](https://de.wikipedia.org/wiki/V%C3%A4ttern), dem zweitgrößten Sees Schwedens. +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-joengkoeping) + +Zum Nachmittag hin gab es noch einen kleinen Ausflug zum Stalpets Wasserfälle, der mit 19 metern höchste Wasserfall Südschwedens. +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-stalpets-wasserfall) + +Da sich das Wetter über den abend immer weiter aufgeklärt hat, bin ich an den See um einen Sonnenuntergang dort zu fotografieren. Auf dem weg zurück zur Ferienwohnung entwickelte sich Nebel was mit einem zum teil noch roten Himmel wunderbar aussah. +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-sonnenuntergang) + + +## Tag 2 +Der nächste haben wir uns ein Ruderbot gemietet und sind damit auf eine kleine Insel gefahrne die wir spontan besetzt haben. Wir ist in dem fall etwas übertrieben, da ich mit einem Ruderbot mich nur sinnlos im kreis drehen kann musste das für mich gemacht werden. + +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-rudern)] + +Zum abend fuhren wir nach [Jönköping](https://de.wikipedia.org/wiki/J%C3%B6nk%C3%B6ping). Ein kleiner Spaziergang durch die Stadt, ein Essen bei Max Burger und ein gemütlicher abend in einer Kneipe. + +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-joenkoeping-abends) + +# Tag 3 + +Den letzten Tag gab es einen Ausflug nach [Gränna](https://de.wikipedia.org/wiki/Gr%C3%A4nna) wo Menschen(tm) Süßigkeiten kaufen wollten. Dort waren wir wieder am See und ich nutzte die Zeit mich mit einer Katze anzufreunden wärend ich durch die Straßen lief. Die Hauptstraße selber wirkt sehr touristisch. +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-graenna) + +Um noch einen Blick auf Schwedische Elche werfen zu können besuchten wir den [Skullaryd Älgpark](http://skullaryd-algpark.se/de/home.html) wo wir zwar andere deutsche touristen hörten aber auch eine Stunde lang uns Tiere wärend der fütterung anschauen konnten. +[Bilder](https://gallery.kekskurse.de/gallery/2021-10-schweden-skullaryd-aelgpark) diff --git a/content/posts/2022-03-02-sterne.md b/content/posts/2022-03-02-sterne.md new file mode 100644 index 0000000..53f8189 --- /dev/null +++ b/content/posts/2022-03-02-sterne.md @@ -0,0 +1,25 @@ +--- +title: "Sternenhimmel fotografieren" +date: 2022-03-02T00:00:01+00:00 +draft: false +categories: ["Images", "Blog"] +description: "Sternenhimmel fotografieren" +startpage: true +lang: img +gallery: "https://image.kekskurse.de/v1/image?gallery=2022-03-02-sterne&pixel=800&image=DSC09476.jpg" +cc: "by-nc-sa" +--- +Zurzeit habe ich merere Pläne was ich in der Zukunft so machen möchte, wenn dies oder das passiert ist. Da nur planen auf dauer auch nicht glücklich macht habe ich ein etwas "unkomplizierteren" Ausflug gemachat. Die PhotoPills App sagte mir das es ein guter Zeitpunkt sei um Sterne zu fotografieren, die wetter app sagte bis zum frühen Nachmittag noch eine klare Nacht vorraus, das Bahnticket was bezahlbar. + +# Gallery +[Bilder](https://gallery.kekskurse.de/gallery/2022-03-sternenhimmel-fotografieren) + +# Ausflug +Mit dem Bahn bin ich nach Rathenow gefahren, von da aus mit dem Fahrrad weiter. Auf dem Hinweg hielt ich bei der [Bockwindmühle Prietzen](https://www.rhinow.de/verzeichnis/objekt.php?mandat=54101) zum Fotografieren, hier war dann auch der Ort wo ich beim zusammenbauen vom Stativ eis abkratzen musste. + +Von da aus war es nurnoch etwa 1km zu der Vogelbeobachtungshütte die ich im vorfeld auf Google Maps gefunden hatte und die windgeschützt aussah. Glücklicherweise war sie wirklich recht gemütlich und fast sowas wie warm im gegensat zum windigem draußen. + +![Innenbereich der Hütte](/img/2022/03/sterne/20220303_010025.jpg) + +Wärend die Kamera vor sich hin fotografierte konnte ich mein mitgebrachtes Essen essen. Als der warme Tee gegen 5 Uhr leer war habe ich meine Sachen zusammengepackt und bin zurückgefahren. Was mit wiedermal aufgefallen ist das ich viel zu viele Sachen mitgenommen hatte, das sollte ich irgendwann nochmal besser einschätzen. + diff --git a/content/posts/my-first-post.md b/content/posts/my-first-post.md new file mode 100644 index 0000000..3e78977 --- /dev/null +++ b/content/posts/my-first-post.md @@ -0,0 +1,6 @@ +--- +title: "My First Post" +date: 2023-07-19T11:54:06+02:00 +draft: true +--- + diff --git a/hugo.toml b/hugo.toml index 1d7c819..afe0036 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,3 +1,39 @@ -baseURL = 'http://example.org/' +baseURL = 'https://www.kekskurse.de/' languageCode = 'en-us' title = 'My New Hugo Site' +theme = 'hugo-blog-awesome' + +[[params.socialIcons]] +name = "github" +url = "https://github.com/kekskurse" + +[[params.socialIcons]] +name = "twitter" +url = "https://twitter.com/kekskurse" + +[[params.socialIcons]] +name = "Rss" +url = "index.xml" + + +[menu] + [[menu.main]] + # The page reference (pageRef) is useful for menu highlighting + # When pageRef is set, setting `url` is optional; it will be used as a fallback if the page is not found. + pageRef="/" + name = 'Home' + url = '/' + weight = 10 + [[menu.main]] + pageRef="posts" + name = 'Posts' + url = '/posts/' + weight = 20 + [[menu.main]] + pageRef="about" + name = 'About' + url = '/about/' + weight = 30 + +[params] + goToTop = true \ No newline at end of file diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html new file mode 100644 index 0000000..3676c68 --- /dev/null +++ b/layouts/shortcodes/figure.html @@ -0,0 +1,29 @@ + + +{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} +{{- $.Page.Scratch.Add "figurecount" 1 -}} + +{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }} +
+
+
+ +
+ {{ with .Get "link" | default (.Get "src") }}{{ end }} + {{- 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 }} +
+
diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html new file mode 100644 index 0000000..6c644b9 --- /dev/null +++ b/layouts/shortcodes/gallery.html @@ -0,0 +1,41 @@ + + +{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} +{{- $.Page.Scratch.Add "figurecount" 1 }} +{{ $baseURL := .Site.BaseURL }} + diff --git a/layouts/shortcodes/load-photoswipe.html b/layouts/shortcodes/load-photoswipe.html new file mode 100644 index 0000000..06b4249 --- /dev/null +++ b/layouts/shortcodes/load-photoswipe.html @@ -0,0 +1,71 @@ + + + +{{ if not ($.Page.Scratch.Get "photoswipeloaded") }} + {{ $.Page.Scratch.Set "photoswipeloaded" 1 }} + + + + + + + + + + + + + +{{ end }} \ No newline at end of file diff --git a/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.content b/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.content new file mode 100644 index 0000000..a20bc4d --- /dev/null +++ b/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.content @@ -0,0 +1 @@ +@font-face{font-display:swap;font-family:roboto;font-style:normal;font-weight:400;src:url(fonts/Roboto/roboto-v30-latin-regular.eot);src:url(fonts/Roboto/roboto-v30-latin-regular.eot?#iefix)format("embedded-opentype"),url(fonts/Roboto/roboto-v30-latin-regular.woff2)format("woff2"),url(fonts/Roboto/roboto-v30-latin-regular.woff)format("woff"),url(fonts/Roboto/roboto-v30-latin-regular.ttf)format("truetype"),url(fonts/Roboto/roboto-v30-latin-regular.svg#Roboto)format("svg")}*{-webkit-transition:background-color 75ms ease-in,border-color 75ms ease-in;-moz-transition:background-color 75ms ease-in,border-color 75ms ease-in;-ms-transition:background-color 75ms ease-in,border-color 75ms ease-in;-o-transition:background-color 75ms ease-in,border-color 75ms ease-in;transition:background-color 75ms ease-in,border-color 75ms ease-in}.notransition{-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none}html{overflow-x:hidden;width:100%}body,h1,h2,h3,h4,h5,h6,p,blockquote,pre,hr,dl,dd,ol,ul,figure{margin:0;padding:0}body{min-height:100vh;overflow-x:hidden;position:relative;color:#434648;background-color:#fff;font:16px/1.85 Roboto,sans-serif;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-webkit-font-feature-settings:"kern" 1;-moz-font-feature-settings:"kern" 1;-o-font-feature-settings:"kern" 1;font-feature-settings:"kern" 1;font-kerning:normal;box-sizing:border-box}h1,h2,h3,h4,h5,h6,p,blockquote,pre,ul,ol,dl,figure{margin-top:10px;margin-bottom:10px}strong,b{font-weight:700;color:#0d122b}hr{border-bottom:0;border-style:solid;border-color:#ececec}img{max-width:100%;vertical-align:middle;-webkit-user-drag:none;margin:0 auto;text-align:center}figure{position:relative}figure>img{display:block;position:relative}figcaption{font-size:13px;text-align:center}ul li{display:list-item;text-align:-webkit-match-parent}ol li{position:relative}ul,ol{margin-top:0;margin-left:30px}li{padding-bottom:1px;padding-top:1px}li:before{color:#0d122b}li>ul,li>ol{margin-bottom:2px;margin-top:0}h1,h2,h3,h4,h5,h6{color:#0d122b;font-weight:700}h1+ul,h1+ol,h2+ul,h2+ol,h3+ul,h3+ol,h4+ul,h4+ol,h5+ul,h5+ol,h6+ul,h6+ol{margin-top:10px}@media screen and (max-width:768px){h1,h2,h3,h4,h5,h6{scroll-margin-top:65px}}h1>a,h2>a,h3>a,h4>a,h5>a,h6>a{text-decoration:none;border:none}h1>a:hover,h2>a:hover,h3>a:hover,h4>a:hover,h5>a:hover,h6>a:hover{text-decoration:none;border:none}a{color:inherit;text-decoration-color:#d2c7c7}a:hover{color:#003fff}a:focus{outline:3px solid rgba(0,54,199,.6);outline-offset:2px}del{color:inherit}em{color:inherit}blockquote{color:#525b66;opacity:.9;border-left:5px solid #c4c8cc;padding:0 0 0 1rem;margin-left:.3rem;margin-right:.3rem;font-size:1em}blockquote>:last-child{margin-bottom:0;margin-top:0}.wrapper{max-width:-webkit-calc(720px - (30px * 2));max-width:calc(720px - (30px * 2));position:relative;margin-right:auto;margin-left:auto;padding-right:30px;padding-left:30px}@media screen and (max-width:768px){.wrapper{max-width:-webkit-calc(720px - (30px));max-width:calc(720px - (30px));padding-right:20px;padding-left:20px}.wrapper.blurry{animation:.2s ease-in forwards blur;-webkit-animation:.2s ease-in forwards blur}}u{text-decoration-color:#d2c7c7}small{font-size:14px}sup{border-radius:10%;top:-3px;left:2px;font-size:small;position:relative;margin-right:2px}.overflow-table{overflow-x:auto}table{width:100%;margin-top:15px;border-collapse:collapse;font-size:14px}table thead{font-weight:700;color:#0d122b;border-bottom:1px solid #ececec}table th,table td,table tr{border:1px solid #ececec;padding:2px 7px}.navbar:after,.wrapper:after{content:"";display:table;clear:both}mark,::selection{background:#fffba0;color:#0d122b}.gist table{border:0}.gist table tr,.gist table td{border:0}.navbar{height:auto;max-width:calc(890px - (30px * 2));max-width:-webkit-calc(890px - (30px * 2));position:relative;margin-right:auto;margin-left:auto;border-bottom:1px solid #ececec;padding:.5rem .3rem}.logo{float:left;margin:.5rem 0 0 1rem}.logo>svg{opacity:.7}.logo:hover>svg{opacity:1}@media screen and (max-width:768px){.logo{padding-top:.3rem}}.menu{user-select:none;-ms-user-select:none;-webkit-user-select:none}.menu ul{margin:0}.menu .menu-separator{margin-right:.7rem}@media screen and (max-width:768px){.menu .menu-separator{display:none}}.menu a#mode{-webkit-transform:scale(1,1);transform:scale(1,1);opacity:.7;z-index:1}.menu a#mode:hover{cursor:pointer;opacity:1}.menu a#mode:active{-webkit-transform:scale(.9,.9);transform:scale(.9,.9)}.menu a#mode .mode-moon{display:block}.menu a#mode .mode-moon line{stroke:#0d122b;fill:none}.menu a#mode .mode-moon circle{fill:#0d122b;stroke:#0d122b}.menu a#mode .mode-sunny{display:none}.menu a#mode .mode-sunny line{stroke:#eaeaea;fill:none}.menu a#mode .mode-sunny circle{fill:none;stroke:#eaeaea}.menu .trigger{float:right;display:flex;align-items:center}.menu .menu-trigger{display:none}.menu .menu-icon{display:none}.menu li{display:inline-block;margin:0;padding:0;list-style:none}@media screen and (max-width:768px){.menu li{display:block;margin:0;padding:0;list-style:none}}.menu .menu-link{color:#0d122b;line-height:2.25;text-decoration:none;padding:.3rem .5rem;opacity:.7;letter-spacing:.015rem}.menu .menu-link:hover{opacity:1}.menu .menu-link:not(:last-child){margin-right:5px}@media screen and (max-width:768px){.menu .menu-link{opacity:.8}}.menu .menu-link.active{opacity:1;font-weight:600}@media screen and (max-width:768px){.menu{position:fixed;top:0;left:0;right:0;z-index:2;text-align:center;height:50px;background-color:#fff;border-bottom:1px solid #ececec}.menu a#mode{left:10px;top:12px}.menu .menu-icon{display:block;position:absolute;right:0;margin:.7rem .3rem 0 0;cursor:pointer;text-align:center;z-index:1}.menu .menu-icon>svg{opacity:.7}.menu .menu-icon:hover>svg{opacity:1}.menu .menu-icon:active{-webkit-transform:scale(.9,.9);transform:scale(.9,.9)}.menu input[type=checkbox]:not(:checked)~.trigger{clear:both;visibility:hidden}.menu input[type=checkbox]:checked~.trigger{position:fixed;animation:.2s ease-in forwards fadein;-webkit-animation:.2s ease-in forwards fadein;flex-direction:column;justify-content:center;height:100vh;width:100%;top:0}.menu .menu-link{display:block;box-sizing:border-box;font-size:1.1em}.menu .menu-link:not(:last-child){margin:0;padding:2px 0}}.author{margin-top:6.3rem;margin-bottom:7.2rem;text-align:center}@media screen and (max-width:768px){.author{margin-bottom:3em}}.author .author-avatar{width:70px;height:70px;border-radius:100%;user-select:none;background-color:#0d122b;-ms-user-select:none;-webkit-user-select:none;-webkit-animation:.5s ease-in forwards fadein;animation:.5s ease-in forwards fadein;opacity:1;object-fit:cover}.author .author-name{font-size:1.7em;margin-bottom:2px}.author .author-bio{margin:0 auto;opacity:.9;max-width:393px;line-height:1.688}.posts-item-note{padding-bottom:.3rem;font-weight:500;color:#0d122b}.post-item{display:flex;padding-top:5px;padding-bottom:6px;justify-content:space-between;flex-direction:row;align-items:center}.post-item:not(:first-child){border-top:1px solid #ececec}.post-item .post-item-date{min-width:96px;color:#0d122b}@media screen and (max-width:768px){.post-item .post-item-date{font-size:16px}}.post-item .post-item-title{margin:0;border:0;padding:0;font-size:16px;font-weight:400;letter-spacing:.1px}.post-item .post-item-title a{color:#434648;transition:all 150ms ease-in 0s}.post-item .post-item-title a:hover,.post-item .post-item-title afocus{color:#0d122b}.footer{margin-top:8em;margin-bottom:2em;text-align:center}@media screen and (max-width:768px){.footer{margin-top:3em}}.footer span.footer_item{opacity:.8;font-weight:700;font-size:14px}.footer a.footer_item{opacity:.8;text-decoration:none}.footer a.footer_item:not(:last-child){margin-right:10px}.footer a.footer_item:not(:last-child):hover{opacity:1}.footer_copyright{font-size:13px;display:block;color:#6b7886;opacity:.8;margin-top:.7rem;padding:.3rem .95rem}.footer_social-icons a{text-decoration:none;margin-right:.31rem}.footer_social-icons svg{color:#888a90;height:24px;width:24px}.footer_social-icons svg:hover{color:#ddd}.not-found{text-align:center;display:flex;justify-content:center;flex-direction:column;height:75vh}.not-found .title{font-size:5em;font-weight:700;line-height:1.1;color:#0d122b;text-shadow:1px 0 0 #003fff}.not-found .phrase{color:#434648}.not-found .solution{color:#003fff;letter-spacing:.5px}.not-found .solution:hover{color:#0036c7}.search-article{position:relative;margin-bottom:50px}.search-article label[for=search-input]{position:relative;top:10px;left:11px}.search-article input[type=search]{top:0;left:0;border:0;width:100%;height:40px;outline:none;position:absolute;border-radius:5px;padding:10px 10px 10px 35px;color:#434648;-webkit-appearance:none;font-size:16px;background-color:rgba(128,128,128,.1);border:1px solid rgba(128,128,128,.1)}.search-article input[type=search]::-webkit-input-placeholder{color:gray}.search-article input[type=search]::-webkit-search-decoration,.search-article input[type=search]::-webkit-search-results-decoration{display:none}#search-results{text-align:center}#search-results li{text-align:left}.archive-tags{height:auto}.archive-tags .tag-item{padding:1px 3px;border-radius:2px;border:1px solid rgba(128,128,128,.1);background-color:rgba(128,128,128,.1)}sub,sup{font-size:79%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}kbd{font-size:85%;border-radius:3px;color:#333638;background:#d8dbe2;display:inline-block;font-family:Consolas,monaco,monospace;line-height:1;padding:2px 4px;white-space:nowrap}mark{background:#ff0;color:#000;border-radius:3px}@media screen and (max-width:768px){.wrapper.post{padding-left:15px;padding-right:15px}}.header{margin-top:7.8em}.header .header-title{font-size:2em;line-height:1.2;margin-top:10px;margin-bottom:20px}.header .header-title.center{text-align:center}@media screen and (max-width:768px){.header .header-title{font-size:1.9em}}.post-meta{padding-top:3px;line-height:1.3;color:#6b7886}.post-meta time{position:relative;margin-right:1.5em}.post-meta span[itemprop=author]{border-bottom:1px dotted #ececec}.page-content{padding-top:8px}.page-content iframe{text-align:center}.page-content figure img{border-radius:2px}.page-content figure figcaption{margin-top:5px;font-style:italic;font-size:14px}.page-content a{color:#003fff;text-decoration:none}.page-content a[target=_blank]::after{content:" \2197";font-size:14px;line-height:0;position:relative;bottom:5px;vertical-align:baseline}.page-content a:hover{color:#0036c7}.page-content a:focus{color:#003fff}.page-content>p{margin:0;padding-top:15px;padding-bottom:15px}.page-content ul.task-list{list-style:none;margin:0}.page-content ul.task-list li::before{content:""}.page-content ul.task-list li input[type=checkbox]{margin-right:10px}.page-content dl dt{font-weight:700}.page-content h1,.page-content h2,.page-content h3,.page-content h4,.page-content h5,.page-content h6{color:#0d122b;font-weight:700;margin-top:30px;margin-bottom:0;letter-spacing:.03rem}.page-content h1:hover .anchor-head,.page-content h2:hover .anchor-head,.page-content h3:hover .anchor-head,.page-content h4:hover .anchor-head,.page-content h5:hover .anchor-head,.page-content h6:hover .anchor-head{color:#003fff;opacity:1}.page-content h1 .anchor-head,.page-content h2 .anchor-head,.page-content h3 .anchor-head,.page-content h4 .anchor-head,.page-content h5 .anchor-head,.page-content h6 .anchor-head{position:relative;opacity:0;outline:none}.page-content h1 .anchor-head::before,.page-content h2 .anchor-head::before,.page-content h3 .anchor-head::before,.page-content h4 .anchor-head::before,.page-content h5 .anchor-head::before,.page-content h6 .anchor-head::before{content:"#";position:absolute;right:-3px;width:1em;font-weight:700}.page-content h1{font-size:24px}.page-content h2{font-size:22px}.page-content h3{font-size:20px}.page-content h4{font-size:20px}.page-content h5{font-size:16px}.page-content h6{font-size:14px}.post-nav{display:flex;position:relative;margin-top:5em;border-top:1px solid #ececec;line-height:1.4}.post-nav .post-nav-item{border-bottom:0;font-weight:700;padding-bottom:10px;width:50%;padding-top:10px;text-decoration:none;box-sizing:border-box}.post-nav .post-nav-item .post-title{color:#0d122b}.post-nav .post-nav-item:hover .post-title,.post-nav .post-nav-item:focus .post-title{color:#0036c7;opacity:.9}.post-nav .post-nav-item .nav-arrow{font-weight:400;font-size:14px;color:#6b7886;margin-bottom:3px}.post-nav .post-nav-item:nth-child(odd){padding-left:0;padding-right:20px}.post-nav .post-nav-item:nth-child(even){text-align:right;padding-right:0;padding-left:20px}@media screen and (max-width:768px){.post-nav{display:block;font-size:14px}.post-nav .post-nav-item{display:block;width:100%}.post-nav .post-nav-item:nth-child(even){border-left:0;padding-left:0;border-top:1px solid #ececec}}.post-updated-at{font-family:ubuntu mono,monospace}code{font-family:Consolas,monospace;text-rendering:optimizeLegibility;font-feature-settings:"calt" 1;font-variant-ligatures:normal;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;font-size:inherit}p>code{font-size:.9em;padding:1px 3px;position:relative;top:-1px;color:#333638;background-color:#d8dbe2;border-radius:2px;border:1px solid rgba(128,128,128,.1)}pre{background-color:#1a1b21;border-radius:.3rem;padding:.5rem 1rem;display:block;overflow-x:auto}@media screen and (max-width:768px){pre{margin:0 calc(51% - 51vw)}}pre::-webkit-scrollbar{height:.5rem}pre::-webkit-scrollbar-track{background:#606071;border-radius:.1rem}pre::-webkit-scrollbar-thumb{background:#999ea2;border-radius:.3rem}pre::-webkit-scrollbar-thumb:hover{background:#424546}pre>code{color:#fff;max-width:50rem;margin-left:auto;margin-right:auto;line-height:1.5;display:block;border:0}.highlight table td{padding:5px}.highlight table pre{margin:0}.highlight,.highlight .w{color:#fbf1c7}.highlight .err{color:#fb4934;font-weight:700}.highlight .c,.highlight .cd,.highlight .cm,.highlight .c1,.highlight .cs{color:#928374;font-style:italic}.highlight .cp{color:#8ec07c}.highlight .nt{color:#fb4934}.highlight .o,.highlight .ow{color:#fbf1c7}.highlight .p,.highlight .pi{color:#fbf1c7}.highlight .gi{color:#b8bb26;background-color:#282828}.highlight .gd{color:#fb4934;background-color:#282828}.highlight .gh{color:#b8bb26;font-weight:700}.highlight .k,.highlight .kn,.highlight .kp,.highlight .kr,.highlight .kv{color:#fb4934}.highlight .kc{color:#d3869b}.highlight .kt{color:#fabd2f}.highlight .kd{color:#fe8019}.highlight .s,.highlight .sb,.highlight .sc,.highlight .sd,.highlight .s2,.highlight .sh,.highlight .sx,.highlight .s1{color:#b8bb26;font-style:italic}.highlight .si{color:#b8bb26;font-style:italic}.highlight .sr{color:#b8bb26;font-style:italic}.highlight .se{color:#fe8019}.highlight .nn{color:#8ec07c}.highlight .nc{color:#8ec07c}.highlight .no{color:#d3869b}.highlight .na{color:#b8bb26}.highlight .m,.highlight .mf,.highlight .mh,.highlight .mi,.highlight .il,.highlight .mo,.highlight .mb,.highlight .mx{color:#d3869b}.highlight .ss{color:#83a598}details{cursor:pointer}.toc{margin:1.1rem 0 1rem;padding:.5rem 1rem;border-radius:.3rem;background-color:#edecec}.toc ul{padding-top:1rem;margin-left:1rem;padding-left:1rem}.toc ul li{margin-bottom:.5em;line-height:1.4}@keyframes fadein{0%{opacity:.2}100%{opacity:.8}}@keyframes blur{0%{filter:blur(0)}100%{filter:blur(4px)}}.embed-responsive{height:0;max-width:100%;overflow:hidden;position:relative;padding-bottom:56.25%;margin-top:20px}.embed-responsive iframe,.embed-responsive object,.embed-responsive embed{top:0;left:0;width:100%;height:100%;position:absolute}.main-404{padding:9rem 0;text-align:center}@media(prefers-color-scheme:dark){html:not(.light) body{color:#babdc4;background-color:#131418}html:not(.light) h1,html:not(.light) h2,html:not(.light) h3,html:not(.light) h4,html:not(.light) h5,html:not(.light) h6{color:#eaeaea}html:not(.light) table thead{color:#eaeaea;border-color:#1b1d25}html:not(.light) table th,html:not(.light) table td,html:not(.light) table tr{border-color:#1b1d25}html:not(.light) .page-content a{color:#77a8fd}html:not(.light) .page-content a:hover,html:not(.light) .page-content a:active,html:not(.light) .page-content a:focus{color:#5292ff}html:not(.light) .page-content h3{border-color:#1b1d25}html:not(.light) .page-content h1 .anchor-head,html:not(.light) .page-content h2 .anchor-head,html:not(.light) .page-content h3 .anchor-head,html:not(.light) .page-content h4 .anchor-head,html:not(.light) .page-content h5 .anchor-head,html:not(.light) .page-content h6 .anchor-head{color:#77a8fd}html:not(.light) .toc{background-color:#323232}html:not(.light) #totop{color:#babdc4;background-color:#676767b3}html:not(.light) #totop:hover{background-color:#676767}html:not(.light) li>code,html:not(.light) p>code{font-size:.9em;padding:1px 3px;position:relative;top:-1px;color:#c2c4ca;background-color:#2d2d2d;border-radius:2px;border:1px solid rgba(128,128,128,.1)}html:not(.light) kbd{color:#c2c4ca;background-color:#2d2d2d}html:not(.light) hr{border-color:#1b1d25}html:not(.light) .post-meta{color:#767f87}html:not(.light) .post-meta time::after{background-color:#1b1d25}html:not(.light) .post-meta span[itemprop=author]{border-color:#1b1d25}html:not(.light) a{color:inherit;text-decoration-color:#4a4d56}html:not(.light) a:hover{color:#77a8fd}html:not(.light) a:focus{outline-color:rgba(44,118,246,.6)}html:not(.light) li:before{color:#eaeaea}html:not(.light) blockquote{color:#9b9ba3;border-color:#4a4d56}html:not(.light) strong,html:not(.light) b{color:#eaeaea}html:not(.light) .navbar{border-color:#1b1d25}html:not(.light) .navbar .menu a#mode .mode-sunny{display:block}html:not(.light) .navbar .menu a#mode .mode-moon{display:none}html:not(.light) .navbar .menu .menu-link{color:#eaeaea}}@media screen and (prefers-color-scheme:dark) and (max-width:768px){html:not(.light) .navbar .menu{background-color:#131418;border-color:#1b1d25}html:not(.light) .navbar .menu input[type=checkbox]:checked~.trigger{background:#131418}}@media(prefers-color-scheme:dark){html:not(.light) .post-item:not(:first-child){border-color:#1b1d25}html:not(.light) .post-item .post-item-date{color:#eaeaea}html:not(.light) .post-item .post-item-title a{color:#babdc4}html:not(.light) .post-item .post-item-title a:hover,html:not(.light) .post-item .post-item-title afocus{color:#eaeaea}html:not(.light) .post-nav{border-color:#1b1d25}html:not(.light) .post-nav .post-nav-item{font-weight:700}html:not(.light) .post-nav .post-nav-item .post-title{color:#eaeaea;opacity:.9}html:not(.light) .post-nav .post-nav-item:hover .post-title,html:not(.light) .post-nav .post-nav-item:focus .post-title{color:#5292ff}html:not(.light) .post-nav .post-nav-item .nav-arrow{color:#767f87}}@media screen and (prefers-color-scheme:dark) and (max-width:768px){html:not(.light) .post-nav .post-nav-item:nth-child(even){border-color:#1b1d25}}@media(prefers-color-scheme:dark){html:not(.light) .footer span.footer_item{color:#eaeaea}html:not(.light) .footer a.footer_item:not(:last-child){color:#eaeaea}html:not(.light) .footer .footer_copyright{color:#767f87;opacity:1}html:not(.light) .not-found .title{color:#eaeaea;text-shadow:1px 0 0 #77a8fd}html:not(.light) .not-found .phrase{color:#babdc4}html:not(.light) .not-found .solution{color:#77a8fd}html:not(.light) .not-found .solution:hover{color:#5292ff}html:not(.light) .search-article input[type=search]{color:#babdc4}html:not(.light) .search-article input[type=search]::-webkit-input-placeholder{color:rgba(128,128,128,.8)}}html.dark body{color:#babdc4;background-color:#131418}html.dark h1,html.dark h2,html.dark h3,html.dark h4,html.dark h5,html.dark h6{color:#eaeaea}html.dark table thead{color:#eaeaea;border-color:#1b1d25}html.dark table th,html.dark table td,html.dark table tr{border-color:#1b1d25}html.dark .page-content a{color:#77a8fd}html.dark .page-content a:hover,html.dark .page-content a:active,html.dark .page-content a:focus{color:#5292ff}html.dark .page-content h3{border-color:#1b1d25}html.dark .page-content h1 .anchor-head,html.dark .page-content h2 .anchor-head,html.dark .page-content h3 .anchor-head,html.dark .page-content h4 .anchor-head,html.dark .page-content h5 .anchor-head,html.dark .page-content h6 .anchor-head{color:#77a8fd}html.dark .toc{background-color:#323232}html.dark #totop{color:#babdc4;background-color:#676767b3}html.dark #totop:hover{background-color:#676767}html.dark li>code,html.dark p>code{font-size:.9em;padding:1px 3px;position:relative;top:-1px;color:#c2c4ca;background-color:#2d2d2d;border-radius:2px;border:1px solid rgba(128,128,128,.1)}html.dark kbd{color:#c2c4ca;background-color:#2d2d2d}html.dark hr{border-color:#1b1d25}html.dark .post-meta{color:#767f87}html.dark .post-meta time::after{background-color:#1b1d25}html.dark .post-meta span[itemprop=author]{border-color:#1b1d25}html.dark a{color:inherit;text-decoration-color:#4a4d56}html.dark a:hover{color:#77a8fd}html.dark a:focus{outline-color:rgba(44,118,246,.6)}html.dark li:before{color:#eaeaea}html.dark blockquote{color:#9b9ba3;border-color:#4a4d56}html.dark strong,html.dark b{color:#eaeaea}html.dark .navbar{border-color:#1b1d25}html.dark .navbar .menu a#mode .mode-sunny{display:block}html.dark .navbar .menu a#mode .mode-moon{display:none}html.dark .navbar .menu .menu-link{color:#eaeaea}@media screen and (max-width:768px){html.dark .navbar .menu{background-color:#131418;border-color:#1b1d25}html.dark .navbar .menu input[type=checkbox]:checked~.trigger{background:#131418}}html.dark .post-item:not(:first-child){border-color:#1b1d25}html.dark .post-item .post-item-date{color:#eaeaea}html.dark .post-item .post-item-title a{color:#babdc4}html.dark .post-item .post-item-title a:hover,html.dark .post-item .post-item-title afocus{color:#eaeaea}html.dark .post-nav{border-color:#1b1d25}html.dark .post-nav .post-nav-item{font-weight:700}html.dark .post-nav .post-nav-item .post-title{color:#eaeaea;opacity:.9}html.dark .post-nav .post-nav-item:hover .post-title,html.dark .post-nav .post-nav-item:focus .post-title{color:#5292ff}html.dark .post-nav .post-nav-item .nav-arrow{color:#767f87}@media screen and (max-width:768px){html.dark .post-nav .post-nav-item:nth-child(even){border-color:#1b1d25}}html.dark .footer span.footer_item{color:#eaeaea}html.dark .footer a.footer_item:not(:last-child){color:#eaeaea}html.dark .footer .footer_copyright{color:#767f87;opacity:1}html.dark .not-found .title{color:#eaeaea;text-shadow:1px 0 0 #77a8fd}html.dark .not-found .phrase{color:#babdc4}html.dark .not-found .solution{color:#77a8fd}html.dark .not-found .solution:hover{color:#5292ff}html.dark .search-article input[type=search]{color:#babdc4}html.dark .search-article input[type=search]::-webkit-input-placeholder{color:rgba(128,128,128,.8)}.list-page .post-year{padding-bottom:.5rem}html{scroll-behavior:smooth}#totop{visibility:hidden;color:#434648;position:fixed;bottom:60px;right:30px;z-index:1;border-radius:10%;background-color:#dfe0e397;transition:visibility .5s,opacity .8s linear}#totop:hover{background-color:#dfe0e3}#totop svg{margin:auto;display:block;height:40px;width:40px} \ No newline at end of file diff --git a/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.json b/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.json new file mode 100644 index 0000000..e9ba343 --- /dev/null +++ b/resources/_gen/assets/scss/sass/main.scss_a4b227022dfae4b28843e276c7e6b126.json @@ -0,0 +1 @@ +{"Target":"style.min.d16f523c36741e07697791cfe4bcb09b8c92c7034d5cbf85980df65d92a70e97.css","MediaType":"text/css","Data":{"Integrity":"sha256-0W9SPDZ0Hgdpd5HP5Lywm4ySxwNNXL+FmA32XZKnDpc="}} \ No newline at end of file diff --git a/static/css/hugo-easy-gallery.css b/static/css/hugo-easy-gallery.css new file mode 100644 index 0000000..d78dfec --- /dev/null +++ b/static/css/hugo-easy-gallery.css @@ -0,0 +1,159 @@ +/* +Put this file in /static/css/hugo-easy-gallery.css +Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ +*/ + + +/* +Grid Layout Styles +*/ +.gallery { + overflow: hidden; + margin: 10px; + max-width: 768px; +} +.gallery .box { + float: left; + position: relative; + /* Default: 1 tile wide */ + width: 100%; + padding-bottom: 100%; +} +@media only screen and (min-width : 365px) { + /* Tablet view: 2 tiles */ + .gallery .box { + width: 50%; + padding-bottom: 50%; + } +} +@media only screen and (min-width : 480px) { + /* Small desktop / ipad view: 3 tiles */ + .gallery .box { + width: 33.3%; + padding-bottom: 33.3%; /* */ + } +} +@media only screen and (min-width : 9999px) { + /* Medium desktop: 4 tiles */ + .box { + width: 25%; + padding-bottom: 25%; + } +} + +/* +Transition styles +*/ +.gallery.hover-transition figure, +.gallery.hover-effect-zoom .img, +.gallery:not(.caption-effect-appear) figcaption, +.fancy-figure:not(.caption-effect-appear) figcaption { + -webkit-transition: all 0.3s ease-in-out; + -moz-transition: all 0.3s ease-in-out; + -o-transition: all 0.3s ease-in-out; + transition: all 0.3s ease-in-out; +} +/* +figure styles +*/ +figure { + position:relative; /* purely to allow absolution positioning of figcaption */ + overflow: hidden; +} +.gallery figure { + position: absolute; + left: 5px; + right: 5px; + top: 5px; + bottom: 5px; +} +.gallery.hover-effect-grow figure:hover { + transform: scale(1.05); +} +.gallery.hover-effect-shrink figure:hover { + transform: scale(0.95); +} +.gallery.hover-effect-slidedown figure:hover { + transform: translateY(5px); +} +.gallery.hover-effect-slideup figure:hover { + transform: translateY(-5px); +} + +/* +img / a styles +*/ + +.gallery .img { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-size: cover; + background-position: 50% 50%; + background-repeat: no-repeat; +} +.gallery.hover-effect-zoom figure:hover .img { + transform: scale(1.05); +} +.gallery img { + display: none; /* only show the img if not inside a gallery */ +} +figure a { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; +} + +/* +figcaption styles +*/ +.gallery figcaption, +.fancy-figure figcaption { + position: absolute; + bottom: 0; + left: 0; + right: 0; + background: #000; + color: #FFF; + text-align: center; + font-size: 75%; /* change this if you want bigger text */ + background: rgba(0, 0, 0, 0.5); + opacity: 1; + cursor: pointer; +} +.gallery.caption-position-none figcaption, +.fancy-figure.caption-position-none figcaption { + display: none; +} +.gallery.caption-position-center figcaption, +.fancy-figure.caption-position-center figcaption { + top: 0; + padding: 40% 5px; +} +.gallery.caption-position-bottom figcaption, +.fancy-figure.caption-position-bottom figcaption { + padding: 5px; +} +.gallery.caption-effect-fade figure:not(:hover) figcaption, +.gallery.caption-effect-appear figure:not(:hover) figcaption, +.fancy-figure.caption-effect-fade figure:not(:hover) figcaption, +.fancy-figure.caption-effect-appear figure:not(:hover) figcaption { + background: rgba(0, 0, 0, 0); + opacity: 0; +} +.gallery.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption, +.fancy-figure.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption { + margin-bottom: -100%; +} +.gallery.caption-effect-slide.caption-position-center figure:not(:hover) figcaption, +.fancy-figure.caption-effect-slide.caption-position-center figure:not(:hover) figcaption { + top: 100%; +} +figcaption p { + margin: auto; /* override style in theme */ +} + diff --git a/static/js/load-photoswipe.js b/static/js/load-photoswipe.js new file mode 100644 index 0000000..978c66d --- /dev/null +++ b/static/js/load-photoswipe.js @@ -0,0 +1,80 @@ +/* +Put this file in /static/js/load-photoswipe.js +Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ +*/ + +/* Show an alert if this js file has been loaded twice */ +if (window.loadphotoswipejs) { + window.alert("You've loaded load-photoswipe.js twice. See https://github.com/liwenyip/hugo-easy-gallery/issues/6") +} +var loadphotoswipejs = 1 + +/* TODO: Make the share function work */ +$( document ).ready(function() { + /* + Initialise Photoswipe + */ + 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') == 'no-photoswipe') return true; // ignore any figures where class="no-photoswipe" + // get properties from child a/img/figcaption elements, + var $figure = $(this), + $a = $figure.find('a'), + $img = $figure.find('img'), + $src = $a.attr('href'), + $title = $img.attr('alt'), + $msrc = $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 + }; + console.log("Using pre-defined dimensions for " + $src); + // 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 + }; + console.log("Using default dimensions for " + $src); + // 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; + console.log("Got actual dimensions for " + img.src); + } + }, 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/themes/hugo-blog-awesome b/themes/hugo-blog-awesome new file mode 160000 index 0000000..68c1599 --- /dev/null +++ b/themes/hugo-blog-awesome @@ -0,0 +1 @@ +Subproject commit 68c1599c16493878126b48d61f69744c5b0a6384