diff options
| author | Ken D'Ambrosio <ken@jots.org> | 2026-05-10 14:38:04 +0000 |
|---|---|---|
| committer | Ken D'Ambrosio <ken@jots.org> | 2026-05-10 14:38:04 +0000 |
| commit | a7c16b99a4284826ac5ac0ace4ee0f760a548ff4 (patch) | |
| tree | c8cb3679de1a88d3d8a54f787462aae944c91114 /app.rb | |
| parent | fa36e54d878a3274f7728eb0b84c351b33f3c6ed (diff) | |
Add slideshow: root-level, shuffle, fullscreen, click-to-album
- Root slideshow: all_media_entries walks the full media tree so
/slideshow/ shows every photo across all albums; Slideshow button
always appears on the root album page
- Shuffle and Full screen checkboxes sit next to the Slideshow button
on the album page; options pass as ?shuffle=1&fullscreen=1 URL params
- Fullscreen uses a tap-to-activate overlay (browsers block auto-entry
on page load); webkit-prefixed for Safari; ⛶ button and F key for
mid-session toggle
- Fullscreen mode hides controls, counter, caption bar, and site header
- Exiting fullscreen auto-pauses so the current photo stays visible
- Click/tap anywhere in the stage navigates to the photo's album
lightbox; reads the live src attribute instead of ssIdx to avoid a
race where ssIdx advances during the cross-fade while the old photo
is still on screen
- layout.erb excluded from slideshow (layout: false) so the site header
never appears there
- CSS cache-busted with ?v=2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app.rb')
| -rw-r--r-- | app.rb | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -250,6 +250,18 @@ get '/slideshow/*' do slideshow_view(params[:splat].first.chomp('/')) end +def all_media_entries + dirs = [MEDIA_ROOT] + Dir.glob("#{MEDIA_ROOT}/**/*/").sort + dirs.flat_map do |dir| + rel = dir.delete_prefix(MEDIA_ROOT).delete_prefix('/') + data = load_album(dir) + next [] if data['visible'] == false && !admin? + album_files(dir, data).select { |e| %i[image video].include?(e[:type]) }.map do |e| + e.merge(file_rel: rel.empty? ? e[:name] : "#{rel}/#{e[:name]}") + end + end +end + def slideshow_view(rel) dir = resolve_dir(rel) halt 404 unless File.directory?(dir) @@ -258,8 +270,14 @@ def slideshow_view(rel) @rel = rel @title = data['title'] || (rel.empty? ? 'Albums' : File.basename(dir)) - @entries = album_files(dir, data).select { |e| %i[image video].include?(e[:type]) } - erb :slideshow + @entries = if rel.empty? + all_media_entries + else + album_files(dir, data) + .select { |e| %i[image video].include?(e[:type]) } + .map { |e| e.merge(file_rel: "#{rel}/#{e[:name]}") } + end + erb :slideshow, layout: false end # ── Admin routes ─────────────────────────────────────────────────────────────── |
