diff --git a/static/app.js b/static/app.js index 94debe7..4b4d6f7 100644 --- a/static/app.js +++ b/static/app.js @@ -18,6 +18,7 @@ const recents_list = document.getElementById("recents_list"); const img_track = document.getElementById("img_track"); const img_counter = document.getElementById("img_counter"); const back_btn = document.getElementById("back_btn"); +const fs_btn = document.getElementById("fs_btn"); const arrow_left = document.getElementById("arrow_left"); const arrow_right = document.getElementById("arrow_right"); const loading_bar = document.getElementById("loading_bar"); @@ -260,6 +261,20 @@ back_btn.addEventListener("click", close_gallery); arrow_left.addEventListener("click", prev_image); arrow_right.addEventListener("click", next_image); +fs_btn.addEventListener("click", toggle_fullscreen); + +function toggle_fullscreen() { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen().catch(() => {}); + } else { + document.exitFullscreen().catch(() => {}); + } +} + +document.addEventListener("fullscreenchange", () => { + fs_btn.innerHTML = document.fullscreenElement ? "✕" : "⛶"; +}); + recents_list.addEventListener("click", e => { const chip = e.target.closest(".recent_chip"); if (!chip) return; diff --git a/static/index.html b/static/index.html index db919a5..1adb2a8 100644 --- a/static/index.html +++ b/static/index.html @@ -45,6 +45,7 @@