mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
recursive sharable link
This commit is contained in:
@@ -170,6 +170,7 @@
|
|||||||
const pswpElement = document.querySelectorAll('.pswp')[0];
|
const pswpElement = document.querySelectorAll('.pswp')[0];
|
||||||
const re = /pid=(\d+)/;
|
const re = /pid=(\d+)/;
|
||||||
const filterre = /#(.*)/;
|
const filterre = /#(.*)/;
|
||||||
|
const recursere = /\?recursive/;
|
||||||
let items = [];
|
let items = [];
|
||||||
let shown = [];
|
let shown = [];
|
||||||
let subfolders = [];
|
let subfolders = [];
|
||||||
@@ -186,13 +187,17 @@
|
|||||||
items = Object.values(data.images);
|
items = Object.values(data.images);
|
||||||
subfolders = data.subfolders;
|
subfolders = data.subfolders;
|
||||||
if (filterre.test(window.location.href)) {
|
if (filterre.test(window.location.href)) {
|
||||||
var selected = window.location.href.match(filterre)[1].split(",");
|
const selected = window.location.href.match(filterre)[1].split(",");
|
||||||
setFilter(selected);
|
setFilter(selected);
|
||||||
}
|
}
|
||||||
|
if (recursere.test(window.location.href)) {
|
||||||
|
document.getElementById("recursive").checked = true;
|
||||||
|
recursive();
|
||||||
|
}
|
||||||
filter();
|
filter();
|
||||||
|
|
||||||
if (re.test(window.location.href)) {
|
if (re.test(window.location.href)) {
|
||||||
var pid = window.location.href.match(re)[1];
|
const pid = window.location.href.match(re)[1];
|
||||||
openSwipe(parseInt(pid));
|
openSwipe(parseInt(pid));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -208,12 +213,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function recursive(sub = undefined) {
|
async function recursive(sub = undefined) {
|
||||||
|
const curr = window.location.href.split("#")
|
||||||
|
const content = document.getRootNode().innerHTML;
|
||||||
|
const title = document.title;
|
||||||
const ischecked = document.getElementById("recursive").checked;
|
const ischecked = document.getElementById("recursive").checked;
|
||||||
const folders = document.getElementsByClassName("folders")[0];
|
const folders = document.getElementsByClassName("folders")[0];
|
||||||
if (sub == undefined) {
|
if (sub == undefined) {
|
||||||
sub = subfolders;
|
sub = subfolders;
|
||||||
}
|
}
|
||||||
if (ischecked) {
|
if (ischecked) {
|
||||||
|
window.history.replaceState({ "html": content, "pageTitle": title }, "", curr[0].split("?")[0] + "?recursive#" + curr[1])
|
||||||
if (folders != undefined) {
|
if (folders != undefined) {
|
||||||
folders.style.display = "none";
|
folders.style.display = "none";
|
||||||
}
|
}
|
||||||
@@ -231,6 +240,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
window.history.replaceState({ "html": content, "pageTitle": title }, "", curr[0].split("?")[0] + "#" + curr[1])
|
||||||
if (folders != undefined) {
|
if (folders != undefined) {
|
||||||
folders.style.display = "";
|
folders.style.display = "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user