persist site dropdown selection via _site url param
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
|||||||
Pictures/*
|
Pictures/*
|
||||||
!Pictures/.gitkeep
|
!Pictures/.gitkeep
|
||||||
|
Previews/*
|
||||||
|
!Previews/.gitkeep
|
||||||
.env
|
.env
|
||||||
booru.db
|
booru.db
|
||||||
@@ -125,6 +125,17 @@
|
|||||||
form.submit();
|
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');
|
const job_id = new URLSearchParams(window.location.search).get('job_id');
|
||||||
if (job_id) {
|
if (job_id) {
|
||||||
const box = document.getElementById('progress-box');
|
const box = document.getElementById('progress-box');
|
||||||
@@ -202,6 +213,7 @@
|
|||||||
const _params = new URLSearchParams(window.location.search);
|
const _params = new URLSearchParams(window.location.search);
|
||||||
const _url_idx = parseInt(_params.get('idx') || '0', 10);
|
const _url_idx = parseInt(_params.get('idx') || '0', 10);
|
||||||
let i = (_url_idx > 0 && _url_idx < images.length) ? _url_idx : 0;
|
let i = (_url_idx > 0 && _url_idx < images.length) ? _url_idx : 0;
|
||||||
|
|
||||||
let playing=false, timer=null;
|
let playing=false, timer=null;
|
||||||
let shuffled = false;
|
let shuffled = false;
|
||||||
let order = [...Array(images.length).keys()];
|
let order = [...Array(images.length).keys()];
|
||||||
|
|||||||
Reference in New Issue
Block a user