persist site dropdown selection via _site url param

This commit is contained in:
Johannes
2026-05-06 03:51:33 +02:00
parent 0e03681b5d
commit 5f33ff8468
2 changed files with 14 additions and 0 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,6 @@
Pictures/*
!Pictures/.gitkeep
Previews/*
!Previews/.gitkeep
.env
booru.db

View File

@@ -125,6 +125,17 @@
form.submit();
};
const _site_param = new URLSearchParams(window.location.search).get('_site');
if (_site_param) {
const sel = document.getElementById('site-select');
if (sel) sel.value = _site_param;
}
document.getElementById('site-select').addEventListener('change', function() {
const p = new URLSearchParams(window.location.search);
p.set('_site', this.value);
history.replaceState(null, '', '?' + p.toString());
});
const job_id = new URLSearchParams(window.location.search).get('job_id');
if (job_id) {
const box = document.getElementById('progress-box');
@@ -202,6 +213,7 @@
const _params = new URLSearchParams(window.location.search);
const _url_idx = parseInt(_params.get('idx') || '0', 10);
let i = (_url_idx > 0 && _url_idx < images.length) ? _url_idx : 0;
let playing=false, timer=null;
let shuffled = false;
let order = [...Array(images.length).keys()];