diff --git a/assets/scripts/heartbeat.js b/assets/scripts/heartbeat.js index 3e3803f..7c74d21 100644 --- a/assets/scripts/heartbeat.js +++ b/assets/scripts/heartbeat.js @@ -6,20 +6,30 @@ document.addEventListener('DOMContentLoaded', async function() { try { const response = await fetch('https://quinten0508.com/api/heartbeat'); const data = await response.json(); - const phoneDevice = data.find(device => device.device_name === 'Phone'); - if (phoneDevice) { - const phoneTimestamp = phoneDevice.last_beat.timestamp; - const timestampMilliseconds = phoneTimestamp * 1000; - + + // Find device with the latest heartbeat + let latestDevice = null; + let latestTimestamp = 0; + + data.forEach(device => { + const timestamp = device.last_beat.timestamp; + if (timestamp > latestTimestamp) { + latestTimestamp = timestamp; + latestDevice = device; + } + }); + + if (latestDevice) { + const timestampMilliseconds = latestTimestamp * 1000; const currentTime = Date.now(); const difference = currentTime - timestampMilliseconds; const isDead = difference > (1000 * 60 * 60 * 48); const online = difference < (1000 * 60 * 5); + if (online) { heartbeatElement.textContent = 'Online!'; heartbeatElement.style = 'color: #00b400'; - return; } else if (isDead) { heartbeatElement.textContent = 'Dead'; heartbeatElement.style = 'color: #b30000'; @@ -28,8 +38,9 @@ document.addEventListener('DOMContentLoaded', async function() { heartbeatElement.style = 'color: #00b400'; } + } else { - console.error('Device "Phone" not found.'); + console.error('No devices found.'); } } catch (error) { console.error('Error fetching last beat:', error); @@ -39,4 +50,4 @@ document.addEventListener('DOMContentLoaded', async function() { // Fetch the last beat immediately and then every 10 seconds fetchLastBeat(); setInterval(fetchLastBeat, 10000); -}); +}); \ No newline at end of file diff --git a/gallery.html b/gallery.html index a51f1ea..08ed218 100644 --- a/gallery.html +++ b/gallery.html @@ -7,92 +7,13 @@ + + - @@ -190,6 +111,16 @@ + + diff --git a/gallery/20240708_amsterdam.html b/gallery/20240708_amsterdam.html index 1eb19d7..eb83e83 100644 --- a/gallery/20240708_amsterdam.html +++ b/gallery/20240708_amsterdam.html @@ -7,80 +7,13 @@ + + - - @@ -146,7 +79,7 @@
Current directory:

- /home/quinten/gallery/20250301_porter + /home/quinten/gallery/20240708_amsterdam

diff --git a/gallery/20240802_chamonix.html b/gallery/20240802_chamonix.html index 7f4ecff..d5a33d3 100644 --- a/gallery/20240802_chamonix.html +++ b/gallery/20240802_chamonix.html @@ -7,79 +7,12 @@ + - @@ -146,7 +79,7 @@
Current directory:

- /home/quinten/gallery + /home/quinten/gallery/20240802_chamonix

diff --git a/gallery/20250301_porter.html b/gallery/20250301_porter.html index 7291d00..11fba08 100644 --- a/gallery/20250301_porter.html +++ b/gallery/20250301_porter.html @@ -7,79 +7,12 @@ + - diff --git a/gallery/template.html b/gallery/template.html index 0dbdcf4..5ada16d 100644 --- a/gallery/template.html +++ b/gallery/template.html @@ -7,79 +7,12 @@ + - @@ -146,7 +79,7 @@
Current directory:

- /home/quinten/gallery/20250301_porter + /home/quinten/gallery/TEMPLATE

diff --git a/style_gallery.css b/style_gallery.css new file mode 100644 index 0000000..3d36872 --- /dev/null +++ b/style_gallery.css @@ -0,0 +1,69 @@ +h6 { + margin-bottom: 1rem; +} +.gallery-divider { + width: 100%; /* Fill the horizontal space */ + white-space: nowrap; /* Prevent wrapping */ + overflow: hidden; /* Hide overflow */ + font-size: 2rem; + margin: 0; + margin-top: 1em; + margin-bottom: 1em; +} +.masonry { /* Masonry container */ + column-count: 2; + column-gap: 1em; +} + .gallery-masonry-img { /* Masonry bricks or child elements */ + background-color: #eee; + display: inline-block; + margin: 0 0 1em; + width: 100%; + } + +.gallery-img { + margin-top: 1em; + margin-bottom: 3em; + display: block; + margin-left: auto; + margin-right: auto; + width: 60%; + height: auto; +} + +.gallery-video-box { + margin-top: 1em; + margin-bottom: 3em; + display: flex; + flex-direction: column; + align-items: center; +} + .gallery-video { + width: 100%; + height: auto; + } + .gallery-media-caption { + font-weight: 500; + font-style: italic; + font-size: 1.2rem; + margin: 0; + padding: 0; + margin-top: 0.5em; + color: #e9e9e9a2; + } + + .gallery-spoiler-text { + background: white; + color: transparent; + cursor: help; + user-select: none; + transition: background 0.2s ease, color 0.1s ease;; + } + .gallery-spoiler-text:hover, + .gallery-spoiler-text:focus { + background: black; + color: inherit; + } +#links-tree ul li:first-child::before { +content: "← "; /* arrow for "BACK" button */ +} \ No newline at end of file