mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 11:09:26 +00:00
now checking url with regex
This commit is contained in:
@@ -31,7 +31,7 @@ FAVICON_PATH = ".static/favicon.ico"
|
|||||||
GLOBAL_CSS_PATH = ".static/global.css"
|
GLOBAL_CSS_PATH = ".static/global.css"
|
||||||
DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css")
|
DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css")
|
||||||
DEFAULT_AUTHOR = "Author"
|
DEFAULT_AUTHOR = "Author"
|
||||||
VERSION = "1.9.12"
|
VERSION = "1.9.13"
|
||||||
RAW_EXTENSIONS = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"]
|
RAW_EXTENSIONS = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"]
|
||||||
IMG_EXTENSIONS = [".jpg", ".jpeg"]
|
IMG_EXTENSIONS = [".jpg", ".jpeg"]
|
||||||
EXCLUDES = [".lock", "index.html", "manifest.json", ".sizelist.json", ".thumbnails", ".static"]
|
EXCLUDES = [".lock", "index.html", "manifest.json", ".sizelist.json", ".thumbnails", ".static"]
|
||||||
@@ -321,6 +321,8 @@ def list_folder(folder: str, title: str, _args: Args, raw: list[str]) -> None:
|
|||||||
sizelistfile.seek(0)
|
sizelistfile.seek(0)
|
||||||
sizelistfile.write(json.dumps(sizelist, indent=4))
|
sizelistfile.write(json.dumps(sizelist, indent=4))
|
||||||
sizelistfile.truncate()
|
sizelistfile.truncate()
|
||||||
|
if os.path.exists(os.path.join(folder, ".sizelist.json")) and sizelist == {}:
|
||||||
|
os.remove(os.path.join(folder, ".sizelist.json"))
|
||||||
if not contains_files and not _args.use_fancy_folders:
|
if not contains_files and not _args.use_fancy_folders:
|
||||||
return
|
return
|
||||||
if images or (_args.use_fancy_folders and not contains_files) or (_args.use_fancy_folders and _args.ignore_other_files):
|
if images or (_args.use_fancy_folders and not contains_files) or (_args.use_fancy_folders and _args.ignore_other_files):
|
||||||
@@ -370,6 +372,8 @@ def list_folder(folder: str, title: str, _args: Args, raw: list[str]) -> None:
|
|||||||
else:
|
else:
|
||||||
if os.path.exists(os.path.join(folder, "index.html")):
|
if os.path.exists(os.path.join(folder, "index.html")):
|
||||||
os.remove(os.path.join(folder, "index.html"))
|
os.remove(os.path.join(folder, "index.html"))
|
||||||
|
if os.path.exists(os.path.join(folder, ".sizelist.json")):
|
||||||
|
os.remove(os.path.join(folder, ".sizelist.json"))
|
||||||
if not _args.non_interactive_mode:
|
if not _args.non_interactive_mode:
|
||||||
pbardict["htmlbar"].update(1)
|
pbardict["htmlbar"].update(1)
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,21 @@
|
|||||||
touch-action: none;
|
touch-action: none;
|
||||||
z-index: 1500;
|
z-index: 1500;
|
||||||
-webkit-text-size-adjust: 100%;
|
-webkit-text-size-adjust: 100%;
|
||||||
|
text-size-adjust: 100%;
|
||||||
/* create separate layer, to avoid paint on window.onscroll in webkit/blink */
|
/* create separate layer, to avoid paint on window.onscroll in webkit/blink */
|
||||||
-webkit-backface-visibility: hidden;
|
-webkit-backface-visibility: hidden;
|
||||||
outline: none; }
|
backface-visibility: hidden;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp * {
|
.pswp * {
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box; }
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp img {
|
.pswp img {
|
||||||
max-width: none; }
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* style is added when JS option showHideOpacity is set to true */
|
/* style is added when JS option showHideOpacity is set to true */
|
||||||
.pswp--animate_opacity {
|
.pswp--animate_opacity {
|
||||||
@@ -31,28 +38,33 @@
|
|||||||
will-change: opacity;
|
will-change: opacity;
|
||||||
/* for open/close transition */
|
/* for open/close transition */
|
||||||
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); }
|
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--open {
|
.pswp--open {
|
||||||
display: block; }
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--zoom-allowed .pswp__img {
|
.pswp--zoom-allowed .pswp__img {
|
||||||
/* autoprefixer: off */
|
/* autoprefixer: off */
|
||||||
cursor: -webkit-zoom-in;
|
cursor: -webkit-zoom-in;
|
||||||
cursor: -moz-zoom-in;
|
cursor: -moz-zoom-in;
|
||||||
cursor: zoom-in; }
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--zoomed-in .pswp__img {
|
.pswp--zoomed-in .pswp__img {
|
||||||
/* autoprefixer: off */
|
/* autoprefixer: off */
|
||||||
cursor: -webkit-grab;
|
cursor: -webkit-grab;
|
||||||
cursor: -moz-grab;
|
cursor: -moz-grab;
|
||||||
cursor: grab; }
|
cursor: grab;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--dragging .pswp__img {
|
.pswp--dragging .pswp__img {
|
||||||
/* autoprefixer: off */
|
/* autoprefixer: off */
|
||||||
cursor: -webkit-grabbing;
|
cursor: -webkit-grabbing;
|
||||||
cursor: -moz-grabbing;
|
cursor: -moz-grabbing;
|
||||||
cursor: grabbing; }
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Background is added as a separate element.
|
Background is added as a separate element.
|
||||||
@@ -67,7 +79,9 @@
|
|||||||
background: #000;
|
background: #000;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
-webkit-backface-visibility: hidden;
|
-webkit-backface-visibility: hidden;
|
||||||
will-change: opacity; }
|
backface-visibility: hidden;
|
||||||
|
will-change: opacity;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__scroll-wrap {
|
.pswp__scroll-wrap {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -75,7 +89,8 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden; }
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__container,
|
.pswp__container,
|
||||||
.pswp__zoom-wrap {
|
.pswp__zoom-wrap {
|
||||||
@@ -85,7 +100,8 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0; }
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Prevent selection and tap highlights */
|
/* Prevent selection and tap highlights */
|
||||||
.pswp__container,
|
.pswp__container,
|
||||||
@@ -95,7 +111,8 @@
|
|||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
-webkit-touch-callout: none; }
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__zoom-wrap {
|
.pswp__zoom-wrap {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -105,22 +122,27 @@
|
|||||||
transform-origin: left top;
|
transform-origin: left top;
|
||||||
/* for open/close transition */
|
/* for open/close transition */
|
||||||
-webkit-transition: -webkit-transform 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
-webkit-transition: -webkit-transform 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1); }
|
transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__bg {
|
.pswp__bg {
|
||||||
will-change: opacity;
|
will-change: opacity;
|
||||||
/* for open/close transition */
|
/* for open/close transition */
|
||||||
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); }
|
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--animated-in .pswp__bg,
|
.pswp--animated-in .pswp__bg,
|
||||||
.pswp--animated-in .pswp__zoom-wrap {
|
.pswp--animated-in .pswp__zoom-wrap {
|
||||||
-webkit-transition: none;
|
-webkit-transition: none;
|
||||||
transition: none; }
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__container,
|
.pswp__container,
|
||||||
.pswp__zoom-wrap {
|
.pswp__zoom-wrap {
|
||||||
-webkit-backface-visibility: hidden; }
|
-webkit-backface-visibility: hidden;
|
||||||
|
backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__item {
|
.pswp__item {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -128,34 +150,40 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
overflow: hidden; }
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__img {
|
.pswp__img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0; }
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
stretched thumbnail or div placeholder element (see below)
|
stretched thumbnail or div placeholder element (see below)
|
||||||
style is added to avoid flickering in webkit/blink when layers overlap
|
style is added to avoid flickering in webkit/blink when layers overlap
|
||||||
*/
|
*/
|
||||||
.pswp__img--placeholder {
|
.pswp__img--placeholder {
|
||||||
-webkit-backface-visibility: hidden; }
|
-webkit-backface-visibility: hidden;
|
||||||
|
backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
div element that matches size of large image
|
div element that matches size of large image
|
||||||
large image loads on top of it
|
large image loads on top of it
|
||||||
*/
|
*/
|
||||||
.pswp__img--placeholder--blank {
|
.pswp__img--placeholder--blank {
|
||||||
background: #222; }
|
background: #222;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp--ie .pswp__img {
|
.pswp--ie .pswp__img {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0; }
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Error message appears when image is not loaded
|
Error message appears when image is not loaded
|
||||||
@@ -170,8 +198,10 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
margin-top: -8px;
|
margin-top: -8px;
|
||||||
color: #CCC; }
|
color: #CCC;
|
||||||
|
}
|
||||||
|
|
||||||
.pswp__error-msg a {
|
.pswp__error-msg a {
|
||||||
color: #CCC;
|
color: #CCC;
|
||||||
text-decoration: underline; }
|
text-decoration: underline;
|
||||||
|
}
|
||||||
@@ -146,6 +146,8 @@
|
|||||||
{ src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}" },
|
{ src: "{{ image.url }}", w: {{ image.width }}, h: {{ image.height }}, msrc: "{{ image.thumbnail }}" },
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
];
|
];
|
||||||
|
var re = /pid=(\d+)/;
|
||||||
|
|
||||||
function openSwipe(img) {
|
function openSwipe(img) {
|
||||||
// define options (if needed)
|
// define options (if needed)
|
||||||
var options = {
|
var options = {
|
||||||
@@ -155,8 +157,9 @@
|
|||||||
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
||||||
gallery.init();
|
gallery.init();
|
||||||
}
|
}
|
||||||
if (window.location.href.indexOf("pid=") > -1) {
|
|
||||||
var pid = window.location.href.split('pid=')[1].split('#')[0];
|
if (re.test(window.location.href)) {
|
||||||
|
var pid = window.location.href.match(re)[1];
|
||||||
openSwipe(parseInt(pid));
|
openSwipe(parseInt(pid));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user