Gallery: add touch swipe support for iPhone/iPad
This commit is contained in:
@@ -5,5 +5,5 @@ panel: true
|
||||
|
||||
cards:
|
||||
- type: iframe
|
||||
url: /local/snapshots/indkorsel_loader.html?v=20260516103510
|
||||
url: /local/snapshots/indkorsel_loader.html?v=20260516103651
|
||||
aspect_ratio: 100%
|
||||
|
||||
@@ -129,6 +129,18 @@ html = f"""<!DOCTYPE html>
|
||||
document.getElementById('modal').addEventListener('click', function(e){{
|
||||
if(e.target === this) closeModal();
|
||||
}});
|
||||
// Touch swipe support (iPhone/iPad)
|
||||
let _tx = null;
|
||||
document.getElementById('modal').addEventListener('touchstart', e => {{
|
||||
_tx = e.changedTouches[0].clientX;
|
||||
}}, {{passive: true}});
|
||||
document.getElementById('modal').addEventListener('touchend', e => {{
|
||||
if(_tx === null) return;
|
||||
const dx = e.changedTouches[0].clientX - _tx;
|
||||
_tx = null;
|
||||
if(Math.abs(dx) < 40) return; // ignore taps
|
||||
navigate(dx < 0 ? 1 : -1); // swipe left = næste, swipe right = forrige
|
||||
}}, {{passive: true}});
|
||||
function pruneSnapshots(){{
|
||||
if(!confirm('Slet alle undtagen de 100 nyeste billeder?')) return;
|
||||
const btn = document.getElementById('pruneBtn');
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,5 +3,5 @@
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<meta http-equiv="refresh" content="0; url=/local/snapshots/indkorsel_gallery.html?v=20260516103510">
|
||||
<meta http-equiv="refresh" content="0; url=/local/snapshots/indkorsel_gallery.html?v=20260516103651">
|
||||
</head><body></body></html>
|
||||
Reference in New Issue
Block a user