mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 11:09:26 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
48950d1d82
|
|||
|
e1d74c3091
|
|||
|
f57d81f508
|
@@ -91,7 +91,6 @@
|
|||||||
"--exclude-folder",
|
"--exclude-folder",
|
||||||
"*/Galleries/*",
|
"*/Galleries/*",
|
||||||
"--folderthumbnails",
|
"--folderthumbnails",
|
||||||
"--reread-metadata"
|
|
||||||
],
|
],
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"name": "production",
|
"name": "production",
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ def generate_html(folder: str, title: str, _args: Args, raw: list[str], version:
|
|||||||
contains_files = False
|
contains_files = False
|
||||||
images = []
|
images = []
|
||||||
subfolders = []
|
subfolders = []
|
||||||
subfoldertags = []
|
subfoldertags = set()
|
||||||
foldername = folder.removeprefix(_args.root_directory)
|
foldername = folder.removeprefix(_args.root_directory)
|
||||||
foldername = f"{foldername}/" if foldername else ""
|
foldername = f"{foldername}/" if foldername else ""
|
||||||
baseurl = urllib.parse.quote(foldername)
|
baseurl = urllib.parse.quote(foldername)
|
||||||
@@ -422,7 +422,7 @@ def generate_html(folder: str, title: str, _args: Args, raw: list[str], version:
|
|||||||
for item in tqdm(items, total=len(items), desc=f"Getting image infos - {folder}", unit="files", ascii=True, dynamic_ncols=True):
|
for item in tqdm(items, total=len(items), desc=f"Getting image infos - {folder}", unit="files", ascii=True, dynamic_ncols=True):
|
||||||
if item not in EXCLUDES and not item.startswith("."):
|
if item not in EXCLUDES and not item.startswith("."):
|
||||||
if os.path.isdir(os.path.join(folder, item)):
|
if os.path.isdir(os.path.join(folder, item)):
|
||||||
subfoldertags = process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo)
|
subfoldertags.update(process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo))
|
||||||
else:
|
else:
|
||||||
contains_files = True
|
contains_files = True
|
||||||
if os.path.splitext(item)[1].lower() in _args.file_extensions:
|
if os.path.splitext(item)[1].lower() in _args.file_extensions:
|
||||||
@@ -436,7 +436,7 @@ def generate_html(folder: str, title: str, _args: Args, raw: list[str], version:
|
|||||||
for item in items:
|
for item in items:
|
||||||
if item not in EXCLUDES and not item.startswith("."):
|
if item not in EXCLUDES and not item.startswith("."):
|
||||||
if os.path.isdir(os.path.join(folder, item)):
|
if os.path.isdir(os.path.join(folder, item)):
|
||||||
subfoldertags = process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo)
|
subfoldertags.update(process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo))
|
||||||
else:
|
else:
|
||||||
contains_files = True
|
contains_files = True
|
||||||
if os.path.splitext(item)[1].lower() in _args.file_extensions:
|
if os.path.splitext(item)[1].lower() in _args.file_extensions:
|
||||||
@@ -641,15 +641,7 @@ def create_html_file(
|
|||||||
logger.info("writing html file", extra={"path": html_file})
|
logger.info("writing html file", extra={"path": html_file})
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
if len(subfoldertags) > 1 and len(alltags) > 1:
|
|
||||||
alltags.update(set(subfoldertags))
|
|
||||||
return sorted(alltags)
|
return sorted(alltags)
|
||||||
elif len(subfoldertags) > 1:
|
|
||||||
return sorted(subfoldertags)
|
|
||||||
elif len(alltags) > 1:
|
|
||||||
return sorted(alltags)
|
|
||||||
else:
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
def list_folder(folder: str, title: str, _args: Args, raw: list[str], version: str, logo: str) -> list[tuple[str, str, str]]:
|
def list_folder(folder: str, title: str, _args: Args, raw: list[str], version: str, logo: str) -> list[tuple[str, str, str]]:
|
||||||
|
|||||||
@@ -174,7 +174,6 @@
|
|||||||
let shown = [];
|
let shown = [];
|
||||||
let subfolders = [];
|
let subfolders = [];
|
||||||
let controllers = {};
|
let controllers = {};
|
||||||
let currentFolder = "";
|
|
||||||
|
|
||||||
function requestMetadata() {
|
function requestMetadata() {
|
||||||
fetch(".metadata.json").then(response => {
|
fetch(".metadata.json").then(response => {
|
||||||
@@ -196,12 +195,6 @@
|
|||||||
var pid = window.location.href.match(re)[1];
|
var pid = window.location.href.match(re)[1];
|
||||||
openSwipe(parseInt(pid));
|
openSwipe(parseInt(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items == []) {
|
|
||||||
document.getElementById("imagelist").style.display = "none"
|
|
||||||
} else {
|
|
||||||
document.getElementById("imagelist").style.display = ""
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => console.error('Failed to fetch data:', error));
|
.catch(error => console.error('Failed to fetch data:', error));
|
||||||
}
|
}
|
||||||
@@ -225,7 +218,6 @@
|
|||||||
folders.style.display = "none";
|
folders.style.display = "none";
|
||||||
}
|
}
|
||||||
for (const folder of sub) {
|
for (const folder of sub) {
|
||||||
currentFolder = folder.name;
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(folder.metadata);
|
const response = await fetch(folder.metadata);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
@@ -299,7 +291,8 @@
|
|||||||
function filter() {
|
function filter() {
|
||||||
shown = [];
|
shown = [];
|
||||||
|
|
||||||
window.location.href = window.location.href.split("#")[0] + "#";
|
const curr = window.location.href.split("#")[0] + "#";
|
||||||
|
const path = window.location.href.split("#")[0].replace("index.html", "");
|
||||||
|
|
||||||
const selected_tags = [];
|
const selected_tags = [];
|
||||||
const tagcheckboxes = document.querySelectorAll("#tagdropdown input[class='tag']:checked");
|
const tagcheckboxes = document.querySelectorAll("#tagdropdown input[class='tag']:checked");
|
||||||
@@ -318,26 +311,30 @@
|
|||||||
const include = selected_tags.every(tag => tags.some(t => t.startsWith(tag)));
|
const include = selected_tags.every(tag => tags.some(t => t.startsWith(tag)));
|
||||||
|
|
||||||
if (include || selected_tags.length === 0) {
|
if (include || selected_tags.length === 0) {
|
||||||
if (isRecursiveChecked || item.folder === currentFolder) {
|
if (!isRecursiveChecked) {
|
||||||
|
if (item.src.replace(item.name, "") == path) {
|
||||||
|
shown.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
shown.push(item);
|
shown.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateImageList();
|
updateImageList();
|
||||||
window.location.href += urltags;
|
window.location.href = curr + urltags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setFilter(selected) {
|
function setFilter(selected) {
|
||||||
tagdropdown = document.getElementById("tagdropdown").getElementsByTagName("li");
|
const tagcheckboxes = document.querySelectorAll("#tagdropdown input[class='tag']");
|
||||||
selected.forEach((tag) => {
|
selected.forEach((tag) => {
|
||||||
for (var i = 0; i < tagdropdown.length; i++) {
|
tagcheckboxes.forEach((checkbox) => {
|
||||||
if (tagdropdown[i].innerText == tag) {
|
if (checkbox.parentElement.id.trim().substring(1).replace(" ", "%20") == tag) {
|
||||||
tagdropdown[i].firstChild.firstChild.checked = true;
|
checkbox.checked = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 7.3 MiB After Width: | Height: | Size: 7.3 MiB |
Reference in New Issue
Block a user