2.0.0 - full gallery redesign to match Immich
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
<json>
|
||||
<![CDATA[
|
||||
{
|
||||
"fontFamily": "lg",
|
||||
"majorVersion": 2,
|
||||
"minorVersion": 0,
|
||||
"fontURL": "",
|
||||
"copyright": "",
|
||||
"license": "",
|
||||
"licenseURL": "",
|
||||
"description": "Font generated by IcoMoon.",
|
||||
"version": "Version 2.0",
|
||||
"fontId": "lg",
|
||||
"psName": "lg",
|
||||
"subFamily": "Regular",
|
||||
"fullName": "lg"
|
||||
}
|
||||
]]>
|
||||
</json>
|
||||
</metadata>
|
||||
<defs>
|
||||
<font id="lg" horiz-adv-x="1024">
|
||||
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||
<missing-glyph horiz-adv-x="1024" />
|
||||
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||
<glyph unicode="" glyph-name="pause_circle_outline" data-tags="pause_circle_outline" d="M554 256.667v340h86v-340h-86zM512 84.667q140 0 241 101t101 241-101 241-241 101-241-101-101-241 101-241 241-101zM512 852.667q176 0 301-125t125-301-125-301-301-125-301 125-125 301 125 301 301 125zM384 256.667v340h86v-340h-86z" />
|
||||
<glyph unicode="" glyph-name="play_circle_outline" data-tags="play_circle_outline" d="M512 84.667q140 0 241 101t101 241-101 241-241 101-241-101-101-241 101-241 241-101zM512 852.667q176 0 301-125t125-301-125-301-301-125-301 125-125 301 125 301 301 125zM426 234.667v384l256-192z" />
|
||||
<glyph unicode="" glyph-name="stack-2" data-tags="stack-2" d="M384 853.334h426.667q53 0 90.5-37.5t37.5-90.5v-426.667q0-53-37.5-90.5t-90.5-37.5h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 53 37.5 90.5t90.5 37.5zM170.667 675.334v-547.333q0-17.667 12.5-30.167t30.167-12.5h547.333q-13.333-37.667-46.333-61.5t-74.333-23.833h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 41.333 23.833 74.333t61.5 46.333zM810.667 768h-426.667q-17.667 0-30.167-12.5t-12.5-30.167v-426.667q0-17.667 12.5-30.167t30.167-12.5h426.667q17.667 0 30.167 12.5t12.5 30.167v426.667q0 17.667-12.5 30.167t-30.167 12.5z" />
|
||||
<glyph unicode="" glyph-name="clear" data-tags="clear" d="M810 664.667l-238-238 238-238-60-60-238 238-238-238-60 60 238 238-238 238 60 60 238-238 238 238z" />
|
||||
<glyph unicode="" glyph-name="arrow-left" data-tags="arrow-left" d="M426.667 768q17.667 0 30.167-12.5t12.5-30.167q0-18-12.667-30.333l-225.667-225.667h665q17.667 0 30.167-12.5t12.5-30.167-12.5-30.167-30.167-12.5h-665l225.667-225.667q12.667-12.333 12.667-30.333 0-17.667-12.5-30.167t-30.167-12.5q-18 0-30.333 12.333l-298.667 298.667q-12.333 13-12.333 30.333t12.333 30.333l298.667 298.667q12.667 12.333 30.333 12.333z" />
|
||||
<glyph unicode="" glyph-name="arrow-right" data-tags="arrow-right" d="M597.333 768q18 0 30.333-12.333l298.667-298.667q12.333-12.333 12.333-30.333t-12.333-30.333l-298.667-298.667q-12.333-12.333-30.333-12.333-18.333 0-30.5 12.167t-12.167 30.5q0 18 12.333 30.333l226 225.667h-665q-17.667 0-30.167 12.5t-12.5 30.167 12.5 30.167 30.167 12.5h665l-226 225.667q-12.333 12.333-12.333 30.333 0 18.333 12.167 30.5t30.5 12.167z" />
|
||||
<glyph unicode="" glyph-name="vertical_align_bottom" data-tags="vertical_align_bottom" d="M170 128.667h684v-86h-684v86zM682 384.667l-170-172-170 172h128v426h84v-426h128z" />
|
||||
<glyph unicode="" glyph-name="apps" data-tags="apps" d="M682 84.667v172h172v-172h-172zM682 340.667v172h172v-172h-172zM426 596.667v172h172v-172h-172zM682 768.667h172v-172h-172v172zM426 340.667v172h172v-172h-172zM170 340.667v172h172v-172h-172zM170 84.667v172h172v-172h-172zM426 84.667v172h172v-172h-172zM170 596.667v172h172v-172h-172z" />
|
||||
<glyph unicode="" glyph-name="fullscreen" data-tags="fullscreen" d="M598 724.667h212v-212h-84v128h-128v84zM726 212.667v128h84v-212h-212v84h128zM214 512.667v212h212v-84h-128v-128h-84zM298 340.667v-128h128v-84h-212v212h84z" />
|
||||
<glyph unicode="" glyph-name="fullscreen_exit" data-tags="fullscreen_exit" d="M682 596.667h128v-84h-212v212h84v-128zM598 128.667v212h212v-84h-128v-128h-84zM342 596.667v128h84v-212h-212v84h128zM214 256.667v84h212v-212h-84v128h-128z" />
|
||||
<glyph unicode="" glyph-name="zoom_in" data-tags="zoom_in" d="M512 512.667h-86v-86h-42v86h-86v42h86v86h42v-86h86v-42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z" />
|
||||
<glyph unicode="" glyph-name="zoom_out" data-tags="zoom_out" d="M298 554.667h214v-42h-214v42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z" />
|
||||
<glyph unicode="" glyph-name="share" data-tags="share" d="M768 252.667c68 0 124-56 124-124s-56-126-124-126-124 58-124 126c0 10 0 20 2 28l-302 176c-24-22-54-34-88-34-70 0-128 58-128 128s58 128 128 128c34 0 64-12 88-34l300 174c-2 10-4 20-4 30 0 70 58 128 128 128s128-58 128-128-58-128-128-128c-34 0-64 14-88 36l-300-176c2-10 4-20 4-30s-2-20-4-30l304-176c22 20 52 32 84 32z" />
|
||||
<glyph unicode="" glyph-name="rotate_left" data-tags="rotate_left" d="M554 764.667q126-16 213-112t87-226-87-226-213-112v86q92 16 153 87t61 165-61 165-153 87v-166l-194 190 194 194v-132zM302 156.667l62 62q46-34 106-44v-86q-96 12-168 68zM260 384.667q10-58 42-106l-60-60q-56 74-68 166h86zM304 574.667q-36-52-44-106h-86q12 90 70 166z" />
|
||||
<glyph unicode="" glyph-name="rotate_right" data-tags="rotate_right" d="M720 278.667q34 46 44 106h86q-12-92-68-166zM554 174.667q60 10 106 44l62-62q-72-56-168-68v86zM850 468.667h-86q-10 60-44 106l62 60q58-72 68-166zM664 702.667l-194-190v166q-92-16-153-87t-61-165 61-165 153-87v-86q-126 16-213 112t-87 226 87 226 213 112v132z" />
|
||||
<glyph unicode="" glyph-name="swap_horiz" data-tags="swap_horiz" d="M896 554.667l-170-170v128h-300v84h300v128zM298 468.667v-128h300v-84h-300v-128l-170 170z" />
|
||||
<glyph unicode="" glyph-name="swap_vert" data-tags="swap_vert" d="M384 810.667l170-170h-128v-300h-84v300h-128zM682 212.667h128l-170-170-170 170h128v300h84v-300z" />
|
||||
<glyph unicode="" glyph-name="facebook-with-circle" data-tags="facebook-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM628.429 612.659h-73.882c-8.755 0-18.483-11.52-18.483-26.829v-53.35h92.416l-13.978-76.083h-78.438v-228.403h-87.194v228.403h-79.104v76.083h79.104v44.749c0 64.205 44.544 116.378 105.677 116.378h73.882v-80.947z" />
|
||||
<glyph unicode="" glyph-name="google-with-circle" data-tags="google+-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM483.686 249.805c-30.874-15.002-64.102-16.589-76.954-16.589-2.458 0-3.84 0-3.84 0s-1.178 0-2.765 0c-20.070 0-119.962 4.608-119.962 95.59 0 89.395 108.8 96.41 142.131 96.41h0.87c-19.251 25.702-15.258 51.61-15.258 51.61-1.69-0.102-4.147-0.205-7.168-0.205-12.544 0-36.762 1.997-57.549 15.411-25.498 16.384-38.4 44.288-38.4 82.893 0 109.107 119.142 113.51 120.32 113.613h118.989v-2.611c0-13.312-23.91-15.923-40.192-18.125-5.53-0.819-16.64-1.894-19.763-3.482 30.157-16.128 35.021-41.421 35.021-79.104 0-42.906-16.794-65.587-34.611-81.51-11.059-9.882-19.712-17.613-19.712-28.006 0-10.189 11.878-20.582 25.702-32.717 22.579-19.917 53.555-47.002 53.555-92.723 0-47.258-20.326-81.050-60.416-100.454zM742.4 460.8h-76.8v-76.8h-51.2v76.8h-76.8v51.2h76.8v76.8h51.2v-76.8h76.8v-51.2zM421.018 401.92c-2.662 0-5.325-0.102-8.038-0.307-22.733-1.69-43.725-10.189-58.88-24.013-15.053-13.619-22.733-30.822-21.658-48.179 2.304-36.403 41.37-57.702 88.832-54.323 46.694 3.379 77.824 30.31 75.571 66.714-2.15 34.202-31.898 60.109-75.827 60.109zM465.766 599.808c-12.39 43.52-32.358 56.422-63.386 56.422-3.328 0-6.707-0.512-9.933-1.382-13.466-3.84-24.166-15.053-30.106-31.744-6.093-16.896-6.451-34.509-1.229-54.579 9.472-35.891 34.97-61.901 60.672-61.901 3.379 0 6.758 0.41 9.933 1.382 28.109 7.885 45.722 50.79 34.048 91.802z" />
|
||||
<glyph unicode="" glyph-name="pinterest-with-circle" data-tags="pinterest-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM545.638 344.32c-31.539 2.406-44.749 18.022-69.427 32.973-13.568-71.219-30.157-139.52-79.309-175.206-15.206 107.725 22.221 188.518 39.629 274.381-29.645 49.92 3.533 150.323 66.099 125.645 76.954-30.515-66.662-185.6 29.747-205.005 100.659-20.173 141.773 174.694 79.36 237.978-90.214 91.494-262.502 2.099-241.306-128.87 5.12-32 38.246-41.728 13.21-85.914-57.702 12.8-74.957 58.317-72.704 118.989 3.533 99.328 89.242 168.909 175.155 178.483 108.698 12.083 210.688-39.885 224.819-142.182 15.821-115.405-49.101-240.282-165.274-231.27z" />
|
||||
<glyph unicode="" glyph-name="twitter-with-circle" data-tags="twitter-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM711.936 549.683c0.205-4.198 0.256-8.397 0.256-12.493 0-128-97.331-275.507-275.405-275.507-54.682 0-105.574 15.974-148.378 43.52 7.526-0.922 15.258-1.28 23.091-1.28 45.363 0 87.091 15.411 120.218 41.421-42.342 0.819-78.080 28.774-90.419 67.174 5.888-1.075 11.93-1.69 18.176-1.69 8.806 0 17.408 1.178 25.498 3.379-44.288 8.909-77.67 48.026-77.67 94.925v1.178c13.056-7.219 28.006-11.622 43.878-12.134-26.010 17.408-43.059 47.002-43.059 80.64 0 17.715 4.762 34.406 13.107 48.691 47.77-58.573 119.040-97.075 199.526-101.222-1.69 7.117-2.509 14.49-2.509 22.118 0 53.402 43.315 96.819 96.819 96.819 27.802 0 52.992-11.776 70.656-30.618 22.067 4.403 42.752 12.39 61.44 23.501-7.219-22.579-22.528-41.574-42.547-53.606 19.61 2.406 38.246 7.578 55.603 15.309-12.954-19.405-29.389-36.506-48.282-50.125z" />
|
||||
<glyph unicode="" glyph-name="message-circle" data-tags="message-circle" d="M938.667 448.128v21.205c0 0.725-0.043 1.621-0.085 2.475-5.803 99.755-47.488 190.336-112.725 258.176-68.352 71.125-162.731 117.419-268.843 123.264-0.683 0.043-1.536 0.085-2.347 0.085h-20.864c-59.947 0.683-122.965-13.227-181.931-43.008-52.181-26.496-97.749-63.488-133.931-108.16-56.405-69.717-89.899-158.080-89.941-253.696-0.597-54.4 10.795-111.36 35.157-165.419l-75.605-226.859c-2.816-8.363-3.072-17.835 0-26.965 7.467-22.357 31.616-34.432 53.973-26.965l226.731 75.563c49.493-22.485 105.984-35.243 165.376-35.115 58.539 0.384 115.797 13.141 168.149 36.949 81.579 37.163 151.040 101.248 193.749 186.667 27.477 53.291 43.307 115.84 43.136 181.803zM853.333 447.872c0.128-52.267-12.459-101.333-33.664-142.464-34.176-68.352-88.832-118.827-153.259-148.139-41.387-18.859-86.827-28.971-133.376-29.269-52.096-0.128-101.163 12.459-142.293 33.664-10.624 5.504-22.528 6.059-33.067 2.56l-162.261-54.101 54.101 162.261c3.755 11.221 2.56 22.912-2.389 32.725-23.552 46.677-34.304 96.171-33.792 142.421 0.043 76.331 26.411 145.92 70.955 200.917 28.629 35.371 64.768 64.725 106.24 85.76 46.592 23.552 96.085 34.304 142.336 33.792h19.456c83.712-4.565 158.037-41.003 212.011-97.152 51.285-53.376 84.139-124.416 89.003-202.795z" />
|
||||
<glyph unicode="" glyph-name="maximize-2" data-tags="maximize-2" d="M793.003 768l-225.835-225.835c-16.683-16.683-16.683-43.691 0-60.331s43.691-16.683 60.331 0l225.835 225.835v-153.003c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667v256c0 5.803-1.152 11.307-3.243 16.341s-5.163 9.728-9.216 13.781c-0.043 0.043-0.043 0.043-0.085 0.085-3.925 3.925-8.619 7.083-13.781 9.216-5.035 2.091-10.539 3.243-16.341 3.243h-256c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667zM230.997 85.334l225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-225.835-225.835v153.003c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-256c0-23.552 19.115-42.667 42.667-42.667h256c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667z" />
|
||||
<glyph unicode="" glyph-name="minimize-2" data-tags="minimize-2" d="M700.331 554.667l225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-225.835-225.835v153.003c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-256c0-5.803 1.152-11.307 3.243-16.341s5.163-9.728 9.216-13.781c0.043-0.043 0.043-0.043 0.085-0.085 3.925-3.925 8.619-7.083 13.781-9.216 5.035-2.091 10.539-3.243 16.341-3.243h256c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667zM158.165 12.502l225.835 225.835v-153.003c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667v256c0 5.803-1.152 11.307-3.243 16.341s-5.163 9.728-9.216 13.781c-0.043 0.043-0.043 0.043-0.085 0.085-4.096 4.053-8.789 7.125-13.781 9.216-5.035 2.091-10.539 3.243-16.341 3.243h-256c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667h153.003l-225.835-225.835c-16.683-16.683-16.683-43.691 0-60.331s43.691-16.683 60.331 0z" />
|
||||
</font></defs></svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-down"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/><path d="M12 10v6"/><path d="m15 13-3 3-3-3"/></svg>
|
||||
|
Before Width: | Height: | Size: 391 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB |
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* lightgallery | 2.9.0 | October 1st 2025
|
||||
* http://www.lightgalleryjs.com/
|
||||
* Copyright (c) 2020 Sachin Neravath;
|
||||
* @license GPLv3
|
||||
*/
|
||||
|
||||
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l():"function"==typeof define&&define.amd?define(l):(e="undefined"!=typeof globalThis?globalThis:e||self).lgFullscreen=l()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var l,n=1,t=arguments.length;n<t;n++)for(var c in l=arguments[n])Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);return e}).apply(this,arguments)},l={fullScreen:!0,fullscreenPluginStrings:{toggleFullscreen:"Toggle Fullscreen"}};return function(){function n(n,t){return this.core=n,this.$LG=t,this.settings=e(e({},l),this.core.settings),this}return n.prototype.init=function(){var e="";if(this.settings.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;e='<button type="button" aria-label="'+this.settings.fullscreenPluginStrings.toggleFullscreen+'" class="lg-fullscreen lg-icon"></button>',this.core.$toolbar.append(e),this.fullScreen()}},n.prototype.isFullScreen=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},n.prototype.requestFullscreen=function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()},n.prototype.exitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},n.prototype.fullScreen=function(){var e=this;this.$LG(document).on("fullscreenchange.lg.global"+this.core.lgId+" \n webkitfullscreenchange.lg.global"+this.core.lgId+" \n mozfullscreenchange.lg.global"+this.core.lgId+" \n MSFullscreenChange.lg.global"+this.core.lgId,(function(){e.core.lgOpened&&e.core.outer.toggleClass("lg-fullscreen-on")})),this.core.outer.find(".lg-fullscreen").first().on("click.lg",(function(){e.isFullScreen()?e.exitFullscreen():e.requestFullscreen()}))},n.prototype.closeGallery=function(){this.isFullScreen()&&this.exitFullscreen()},n.prototype.destroy=function(){this.$LG(document).off("fullscreenchange.lg.global"+this.core.lgId+" \n webkitfullscreenchange.lg.global"+this.core.lgId+" \n mozfullscreenchange.lg.global"+this.core.lgId+" \n MSFullscreenChange.lg.global"+this.core.lgId)},n}()}));
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* lightgallery | 2.9.0 | October 1st 2025
|
||||
* http://www.lightgalleryjs.com/
|
||||
* Copyright (c) 2020 Sachin Neravath;
|
||||
* @license GPLv3
|
||||
*/
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).lgHash=e()}(this,(function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},e="lgAfterSlide",i="lgAfterClose",o={hash:!0,galleryId:"1",customSlideName:!1};return function(){function s(e,i){return this.core=e,this.$LG=i,this.settings=t(t({},o),this.core.settings),this}return s.prototype.init=function(){var t=this;this.settings.hash&&(this.oldHash=window.location.hash,setTimeout((function(){t.buildFromHash()}),100),this.core.LGel.on(e+".hash",this.onAfterSlide.bind(this)),this.core.LGel.on(i+".hash",this.onCloseAfter.bind(this)),this.$LG(window).on("hashchange.lg.hash.global"+this.core.lgId,this.onHashchange.bind(this)))},s.prototype.onAfterSlide=function(t){var e=this.core.galleryItems[t.detail.index].slideName;e=this.settings.customSlideName&&e||t.detail.index,history.replaceState?history.replaceState(null,"",window.location.pathname+window.location.search+"#lg="+this.settings.galleryId+"&slide="+e):window.location.hash="lg="+this.settings.galleryId+"&slide="+e},s.prototype.getIndexFromUrl=function(t){void 0===t&&(t=window.location.hash);var e=t.split("&slide=")[1],i=0;if(this.settings.customSlideName)for(var o=0;o<this.core.galleryItems.length;o++){if(this.core.galleryItems[o].slideName===e){i=o;break}}else i=parseInt(e,10);return isNaN(i)?0:i},s.prototype.buildFromHash=function(){var t=window.location.hash;if(t.indexOf("lg="+this.settings.galleryId)>0){this.$LG(document.body).addClass("lg-from-hash");var e=this.getIndexFromUrl(t);return this.core.openGallery(e),!0}},s.prototype.onCloseAfter=function(){this.oldHash&&this.oldHash.indexOf("lg="+this.settings.galleryId)<0?history.replaceState?history.replaceState(null,"",this.oldHash):window.location.hash=this.oldHash:history.replaceState?history.replaceState(null,document.title,window.location.pathname+window.location.search):window.location.hash=""},s.prototype.onHashchange=function(){if(this.core.lgOpened){var t=window.location.hash,e=this.getIndexFromUrl(t);t.indexOf("lg="+this.settings.galleryId)>-1?this.core.slide(e,!1,!1):this.core.lGalleryOn&&this.core.closeGallery()}},s.prototype.closeGallery=function(){this.settings.hash&&this.$LG(document.body).removeClass("lg-from-hash")},s.prototype.destroy=function(){this.core.LGel.off(".lg.hash"),this.core.LGel.off(".hash"),this.$LG(window).off("hashchange.lg.hash.global"+this.core.lgId)},s}()}));
|
||||
Vendored
-8
File diff suppressed because one or more lines are too long
Vendored
-8
File diff suppressed because one or more lines are too long
Vendored
-8
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
Vendored
-8
File diff suppressed because one or more lines are too long
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
PhotoSwipe overrides to match Immich's AssetViewer aesthetic.
|
||||
Layered on top of photoswipe/photoswipe.css.
|
||||
*/
|
||||
|
||||
.pswp {
|
||||
--pswp-bg: #000;
|
||||
--pswp-placeholder-bg: #111;
|
||||
--pswp-icon-color: #fff;
|
||||
--pswp-icon-color-secondary: transparent;
|
||||
--pswp-icon-stroke-width: 0;
|
||||
--pswp-error-text-color: #fff;
|
||||
--pswp-preloader-color: rgba(255, 255, 255, 0.4);
|
||||
--pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9);
|
||||
--pswp-transition-duration: 250ms;
|
||||
}
|
||||
|
||||
/* Hide UI Immich doesn't show */
|
||||
.pswp__button--zoom,
|
||||
.pswp__counter {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Top toolbar: subtle dark backdrop, no shadows */
|
||||
.pswp__top-bar {
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
/* Standard icon buttons: cleaner sizing, hover state */
|
||||
.pswp__button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
margin: 6px;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
|
||||
.pswp__button:hover,
|
||||
.pswp__button:focus-visible {
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.pswp__button--close {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* Custom download button - same metrics as the built-ins */
|
||||
.pswp__button--download-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.pswp__button--download-button .pswp__icn {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
/* Side arrows: hover-revealed on desktop, hidden by default on mobile */
|
||||
.pswp__button--arrow {
|
||||
width: 56px;
|
||||
height: 100px;
|
||||
margin-top: -50px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s, background-color 0.15s;
|
||||
border-radius: 8px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.pswp:hover .pswp__button--arrow {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.pswp__button--arrow:hover,
|
||||
.pswp__button--arrow:focus-visible {
|
||||
opacity: 1;
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Disable arrows at far ends of gallery */
|
||||
.pswp__button--arrow:disabled {
|
||||
opacity: 0 !important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Mobile: PhotoSwipe already auto-fades top bar; here we just hide arrows
|
||||
when configured to do so (default, matches Immich mobile). */
|
||||
html.pswp-no-arrows .pswp__button--arrow {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
html.pswp-no-mobile-arrows .pswp__button--arrow {
|
||||
display: none !important;
|
||||
}
|
||||
/* Mobile top bar is shorter and translucent */
|
||||
.pswp__top-bar {
|
||||
height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Video slide content */
|
||||
.pswp__video-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none; /* let PhotoSwipe handle gestures except on the video */
|
||||
}
|
||||
|
||||
.pswp__video-wrap video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
outline: none;
|
||||
pointer-events: auto;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
/* Smooth backdrop fade in/out to match Immich's open/close feel */
|
||||
.pswp__bg {
|
||||
transition: opacity var(--pswp-transition-duration);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,420 @@
|
||||
/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */
|
||||
|
||||
.pswp {
|
||||
--pswp-bg: #000;
|
||||
--pswp-placeholder-bg: #222;
|
||||
|
||||
|
||||
--pswp-root-z-index: 100000;
|
||||
|
||||
--pswp-preloader-color: rgba(79, 79, 79, 0.4);
|
||||
--pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9);
|
||||
|
||||
/* defined via js:
|
||||
--pswp-transition-duration: 333ms; */
|
||||
|
||||
--pswp-icon-color: #fff;
|
||||
--pswp-icon-color-secondary: #4f4f4f;
|
||||
--pswp-icon-stroke-color: #4f4f4f;
|
||||
--pswp-icon-stroke-width: 2px;
|
||||
|
||||
--pswp-error-text-color: var(--pswp-icon-color);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions)
|
||||
*/
|
||||
|
||||
.pswp {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: var(--pswp-root-z-index);
|
||||
display: none;
|
||||
touch-action: none;
|
||||
outline: 0;
|
||||
opacity: 0.003;
|
||||
contain: layout style size;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* Prevents focus outline on the root element,
|
||||
(it may be focused initially) */
|
||||
.pswp:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.pswp * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pswp img {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.pswp--open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pswp,
|
||||
.pswp__bg {
|
||||
transform: translateZ(0);
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
.pswp__bg {
|
||||
opacity: 0.005;
|
||||
background: var(--pswp-bg);
|
||||
}
|
||||
|
||||
.pswp,
|
||||
.pswp__scroll-wrap {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pswp__scroll-wrap,
|
||||
.pswp__bg,
|
||||
.pswp__container,
|
||||
.pswp__item,
|
||||
.pswp__content,
|
||||
.pswp__img,
|
||||
.pswp__zoom-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.pswp__img,
|
||||
.pswp__zoom-wrap {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img {
|
||||
cursor: -webkit-zoom-in;
|
||||
cursor: -moz-zoom-in;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.pswp--click-to-zoom.pswp--zoomed-in .pswp__img {
|
||||
cursor: move;
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active {
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* :active to override grabbing cursor */
|
||||
.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img,
|
||||
.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active,
|
||||
.pswp__img {
|
||||
cursor: -webkit-zoom-out;
|
||||
cursor: -moz-zoom-out;
|
||||
cursor: zoom-out;
|
||||
}
|
||||
|
||||
|
||||
/* Prevent selection and tap highlights */
|
||||
.pswp__container,
|
||||
.pswp__img,
|
||||
.pswp__button,
|
||||
.pswp__counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.pswp__item {
|
||||
/* z-index for fade transition */
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pswp__hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Allow to click through pswp__content element, but not its children */
|
||||
.pswp__content {
|
||||
pointer-events: none;
|
||||
}
|
||||
.pswp__content > * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
PhotoSwipe UI
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Error message appears when image is not loaded
|
||||
(JS option errorMsg controls markup)
|
||||
*/
|
||||
.pswp__error-msg-container {
|
||||
display: grid;
|
||||
}
|
||||
.pswp__error-msg {
|
||||
margin: auto;
|
||||
font-size: 1em;
|
||||
line-height: 1;
|
||||
color: var(--pswp-error-text-color);
|
||||
}
|
||||
|
||||
/*
|
||||
class pswp__hide-on-close is applied to elements that
|
||||
should hide (for example fade out) when PhotoSwipe is closed
|
||||
and show (for example fade in) when PhotoSwipe is opened
|
||||
*/
|
||||
.pswp .pswp__hide-on-close {
|
||||
opacity: 0.005;
|
||||
will-change: opacity;
|
||||
transition: opacity var(--pswp-transition-duration) cubic-bezier(0.4, 0, 0.22, 1);
|
||||
z-index: 10; /* always overlap slide content */
|
||||
pointer-events: none; /* hidden elements should not be clickable */
|
||||
}
|
||||
|
||||
/* class pswp--ui-visible is added when opening or closing transition starts */
|
||||
.pswp--ui-visible .pswp__hide-on-close {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* <button> styles, including css reset */
|
||||
.pswp__button {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 50px;
|
||||
height: 60px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
opacity: 0.85;
|
||||
-webkit-appearance: none;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
.pswp__button:hover,
|
||||
.pswp__button:active,
|
||||
.pswp__button:focus {
|
||||
transition: none;
|
||||
padding: 0;
|
||||
background: none;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp__button:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.pswp__icn {
|
||||
fill: var(--pswp-icon-color);
|
||||
color: var(--pswp-icon-color-secondary);
|
||||
}
|
||||
|
||||
.pswp__icn {
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
left: 9px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.pswp__icn-shadow {
|
||||
stroke: var(--pswp-icon-stroke-color);
|
||||
stroke-width: var(--pswp-icon-stroke-width);
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.pswp__icn:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
div element that matches size of large image,
|
||||
large image loads on top of it,
|
||||
used when msrc is not provided
|
||||
*/
|
||||
div.pswp__img--placeholder,
|
||||
.pswp__img--with-bg {
|
||||
background: var(--pswp-placeholder-bg);
|
||||
}
|
||||
|
||||
.pswp__top-bar {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
z-index: 10;
|
||||
|
||||
/* allow events to pass through top bar itself */
|
||||
pointer-events: none !important;
|
||||
}
|
||||
.pswp__top-bar > * {
|
||||
pointer-events: auto;
|
||||
/* this makes transition significantly more smooth,
|
||||
even though inner elements are not animated */
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Close button
|
||||
|
||||
*/
|
||||
.pswp__button--close {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Arrow buttons
|
||||
|
||||
*/
|
||||
.pswp__button--arrow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 75px;
|
||||
height: 100px;
|
||||
top: 50%;
|
||||
margin-top: -50px;
|
||||
}
|
||||
|
||||
.pswp__button--arrow:disabled {
|
||||
display: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.pswp__button--arrow .pswp__icn {
|
||||
top: 50%;
|
||||
margin-top: -30px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.pswp--one-slide .pswp__button--arrow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* hide arrows on touch screens */
|
||||
.pswp--touch .pswp__button--arrow {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* show arrows only after mouse was used */
|
||||
.pswp--has_mouse .pswp__button--arrow {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--prev {
|
||||
right: auto;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--next {
|
||||
right: 0px;
|
||||
}
|
||||
.pswp__button--arrow--next .pswp__icn {
|
||||
left: auto;
|
||||
right: 14px;
|
||||
/* flip horizontally */
|
||||
transform: scale(-1, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Zoom button
|
||||
|
||||
*/
|
||||
.pswp__button--zoom {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pswp--zoom-allowed .pswp__button--zoom {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* "+" => "-" */
|
||||
.pswp--zoomed-in .pswp__zoom-icn-bar-v {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Loading indicator
|
||||
|
||||
*/
|
||||
.pswp__preloader {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 50px;
|
||||
height: 60px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.pswp__preloader .pswp__icn {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s linear;
|
||||
animation: pswp-clockwise 600ms linear infinite;
|
||||
}
|
||||
|
||||
.pswp__preloader--active .pswp__icn {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
@keyframes pswp-clockwise {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
"1 of 10" counter
|
||||
|
||||
*/
|
||||
.pswp__counter {
|
||||
height: 30px;
|
||||
margin-top: 15px;
|
||||
margin-inline-start: 20px;
|
||||
font-size: 14px;
|
||||
line-height: 30px;
|
||||
color: var(--pswp-icon-color);
|
||||
text-shadow: 1px 1px 3px var(--pswp-icon-color-secondary);
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.pswp--one-slide .pswp__counter {
|
||||
display: none;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+352
-86
@@ -1,118 +1,384 @@
|
||||
html {
|
||||
background: #191919;
|
||||
/*
|
||||
Tokens ported from immich-app/immich v2.7.5 (web/src/app.css, 2026-05-23).
|
||||
Re-check approximately once a year for visual drift.
|
||||
|
||||
Font note: Immich uses "GoogleSans" (Google's proprietary font, not freely
|
||||
distributed). We use a system font stack with Inter from Google Fonts as a
|
||||
visually-close substitute. Same approach Immich's open-source consumers use.
|
||||
*/
|
||||
|
||||
/* Inter (OFL-1.1, see fonts/Inter-LICENSE.txt). Single variable WOFF2 covers
|
||||
all weights from 100-900, so we can use any weight in CSS without an extra
|
||||
network request. Vendored locally so IPP runs cleanly air-gapped. */
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
src: url('/share/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
#lightgallery a {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
:root {
|
||||
/* Immich light-mode tokens (RGB triplets so they compose via rgb(var(...))) */
|
||||
--immich-primary: 66 80 175;
|
||||
--immich-bg: 255 255 255;
|
||||
--immich-fg: 0 0 0;
|
||||
--immich-gray: 235 235 235;
|
||||
|
||||
/* Immich dark-mode tokens */
|
||||
--immich-dark-primary: 172 203 250;
|
||||
--immich-dark-bg: 10 10 10;
|
||||
--immich-dark-fg: 229 231 235;
|
||||
--immich-dark-gray: 33 33 33;
|
||||
|
||||
/* Active palette - light by default; html.dark overrides below */
|
||||
--color-bg: rgb(var(--immich-bg));
|
||||
--color-fg: rgb(var(--immich-fg));
|
||||
--color-primary: rgb(var(--immich-primary));
|
||||
--color-gray: rgb(var(--immich-gray));
|
||||
|
||||
--font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
|
||||
/* Horizontal inset for textual page content (title, description, group
|
||||
headers). The grid itself goes edge-to-edge on mobile so it doesn't use
|
||||
this value. */
|
||||
--gutter: 32px;
|
||||
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
:root {
|
||||
--gutter: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
html.dark {
|
||||
--color-bg: rgb(var(--immich-dark-bg));
|
||||
--color-fg: rgb(var(--immich-dark-fg));
|
||||
--color-primary: rgb(var(--immich-dark-primary));
|
||||
--color-gray: rgb(var(--immich-dark-gray));
|
||||
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
background: var(--color-bg);
|
||||
color: var(--color-fg);
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
|
||||
/* ===== Justified-rows / square-grid gallery (tiles are absolute-positioned by JS) ===== */
|
||||
|
||||
#gallery {
|
||||
/* Container is a positioned box; tiles are absolute-positioned by JS.
|
||||
Container height is set explicitly so the scrollbar reflects the full
|
||||
virtualized layout. */
|
||||
position: relative;
|
||||
margin: 0 var(--gutter) var(--gutter);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
/* Tiles go edge-to-edge on mobile, so the gallery doesn't use --gutter */
|
||||
#gallery {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
#lightgallery img {
|
||||
max-height: 250px;
|
||||
margin: 4px;
|
||||
#gallery a {
|
||||
position: absolute;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
background-color: var(--color-gray);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
/* left / top / width / height set per-tile by layoutGrid() in web.js;
|
||||
background-image is the decoded thumbhash placeholder, set by web.js. */
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
#lightgallery a {
|
||||
width: calc(100vw / 3 - 10px);
|
||||
height: calc(100vw / 3 - 10px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#lightgallery img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
}
|
||||
@media (min-width: 801px) {
|
||||
#lightgallery a.thumb-error {
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
margin: 4px;
|
||||
}
|
||||
#gallery img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
#lightgallery a.thumb-error {
|
||||
background: #2a2a2a;
|
||||
/* Hide the <img> until JS sets its src - otherwise Chrome renders its default
|
||||
broken-image glyph for img elements with explicit dimensions but no src
|
||||
(e.g. tiles awaiting load, or tiles whose in-flight fetch was cancelled
|
||||
when the user scrolled past). The <a>'s gray background shows through. */
|
||||
#gallery img:not([src]) {
|
||||
visibility: hidden;
|
||||
}
|
||||
#lightgallery a.thumb-error img {
|
||||
display: none;
|
||||
|
||||
#gallery a.thumb-error img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ===== Group headers (visible when ipp.groupGalleryByDate is enabled) ===== */
|
||||
|
||||
.group-header {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 16px 0 8px;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--color-fg);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
/* On mobile the gallery itself goes edge-to-edge, so the headers need
|
||||
their own left padding to keep the text away from the screen edge. */
|
||||
.group-header {
|
||||
padding-left: var(--gutter);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== Selection mode (checkmark + selected state) ===== */
|
||||
|
||||
.tile-check {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid rgba(255, 255, 255, 0.9);
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s, background-color 0.15s, border-color 0.15s;
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#gallery a:hover .tile-check,
|
||||
#gallery.select-mode .tile-check {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tile-check svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: #fff;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#gallery a.selected .tile-check {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#gallery a.selected .tile-check svg {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#gallery a.selected {
|
||||
outline: 3px solid var(--color-primary);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
.play-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-image: url('/share/static/images/play.png');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
opacity: 0.5;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-image: url('/share/static/images/play.png');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#lightgallery a:has(.play-icon):hover .play-icon {
|
||||
opacity: 1;
|
||||
#gallery a:has(.play-icon):hover .play-icon {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#password {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#header, #album-description {
|
||||
font-family: system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif;
|
||||
color: white;
|
||||
}
|
||||
/* ===== Header (title + asset count + download action) ===== */
|
||||
|
||||
#header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 28px var(--gutter) 12px;
|
||||
color: var(--color-fg);
|
||||
}
|
||||
|
||||
.header-text {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
font-size: 18pt;
|
||||
font-weight: bold;
|
||||
margin: 4px;
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
letter-spacing: -0.01em;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
#album-description h2 {
|
||||
font-size: 12pt;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
margin: 4px;
|
||||
white-space: pre-wrap;
|
||||
#header .subtitle {
|
||||
margin: 4px 0 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
#download-all {
|
||||
margin: auto 4px auto auto;
|
||||
flex: 0 0 auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
text-decoration: none;
|
||||
color: var(--color-fg);
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
|
||||
#loading-spinner {
|
||||
text-align: center;
|
||||
margin: 75px 0;
|
||||
#download-all:hover,
|
||||
#download-all:focus-visible {
|
||||
background-color: color-mix(in srgb, var(--color-fg) 10%, transparent);
|
||||
outline: none;
|
||||
}
|
||||
.loader {
|
||||
width: 48px;
|
||||
|
||||
#download-all svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#album-description {
|
||||
margin: 0;
|
||||
padding: 0 var(--gutter) 16px;
|
||||
color: var(--color-fg);
|
||||
opacity: 0.7;
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
#header {
|
||||
padding-top: 16px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
#header h1 {
|
||||
font-size: 22px;
|
||||
}
|
||||
#album-description {
|
||||
padding-bottom: 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== Selection toolbar (fixed at top while select-mode is active) ===== */
|
||||
|
||||
#select-toolbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 56px;
|
||||
background: var(--color-bg);
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--color-fg) 10%, transparent);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
z-index: 100;
|
||||
box-shadow: 0 1px 6px color-mix(in srgb, var(--color-fg) 6%, transparent);
|
||||
}
|
||||
|
||||
/* The display rule above is more specific than the browser's default
|
||||
[hidden] { display: none } - explicitly override so the toolbar honors
|
||||
the hidden attribute. */
|
||||
#select-toolbar[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.toolbar-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--color-fg);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
|
||||
.toolbar-btn:hover,
|
||||
.toolbar-btn:focus-visible {
|
||||
background-color: color-mix(in srgb, var(--color-fg) 10%, transparent);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.toolbar-btn svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#select-count {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
padding: 0 12px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: var(--color-fg);
|
||||
}
|
||||
|
||||
.toolbar-btn-text {
|
||||
flex: 0 0 auto;
|
||||
padding: 8px 16px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--color-fg);
|
||||
cursor: pointer;
|
||||
border-radius: 20px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
|
||||
.toolbar-btn-text:hover,
|
||||
.toolbar-btn-text:focus-visible {
|
||||
background-color: color-mix(in srgb, var(--color-fg) 10%, transparent);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
#select-toolbar {
|
||||
height: 48px;
|
||||
border: 5px solid #888;
|
||||
border-bottom-color: transparent;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
animation: rotation 1s linear infinite;
|
||||
}
|
||||
@keyframes rotation {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
#select-count {
|
||||
font-size: 15px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.toolbar-btn-text {
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/**
|
||||
* Encodes an RGBA image to a ThumbHash. RGB should not be premultiplied by A.
|
||||
*
|
||||
* @param w The width of the input image. Must be ≤100px.
|
||||
* @param h The height of the input image. Must be ≤100px.
|
||||
* @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.
|
||||
* @returns The ThumbHash as a Uint8Array.
|
||||
*/
|
||||
export function rgbaToThumbHash(w, h, rgba) {
|
||||
// Encoding an image larger than 100x100 is slow with no benefit
|
||||
if (w > 100 || h > 100) throw new Error(`${w}x${h} doesn't fit in 100x100`)
|
||||
let { PI, round, max, cos, abs } = Math
|
||||
|
||||
// Determine the average color
|
||||
let avg_r = 0, avg_g = 0, avg_b = 0, avg_a = 0
|
||||
for (let i = 0, j = 0; i < w * h; i++, j += 4) {
|
||||
let alpha = rgba[j + 3] / 255
|
||||
avg_r += alpha / 255 * rgba[j]
|
||||
avg_g += alpha / 255 * rgba[j + 1]
|
||||
avg_b += alpha / 255 * rgba[j + 2]
|
||||
avg_a += alpha
|
||||
}
|
||||
if (avg_a) {
|
||||
avg_r /= avg_a
|
||||
avg_g /= avg_a
|
||||
avg_b /= avg_a
|
||||
}
|
||||
|
||||
let hasAlpha = avg_a < w * h
|
||||
let l_limit = hasAlpha ? 5 : 7 // Use fewer luminance bits if there's alpha
|
||||
let lx = max(1, round(l_limit * w / max(w, h)))
|
||||
let ly = max(1, round(l_limit * h / max(w, h)))
|
||||
let l = [] // luminance
|
||||
let p = [] // yellow - blue
|
||||
let q = [] // red - green
|
||||
let a = [] // alpha
|
||||
|
||||
// Convert the image from RGBA to LPQA (composite atop the average color)
|
||||
for (let i = 0, j = 0; i < w * h; i++, j += 4) {
|
||||
let alpha = rgba[j + 3] / 255
|
||||
let r = avg_r * (1 - alpha) + alpha / 255 * rgba[j]
|
||||
let g = avg_g * (1 - alpha) + alpha / 255 * rgba[j + 1]
|
||||
let b = avg_b * (1 - alpha) + alpha / 255 * rgba[j + 2]
|
||||
l[i] = (r + g + b) / 3
|
||||
p[i] = (r + g) / 2 - b
|
||||
q[i] = r - g
|
||||
a[i] = alpha
|
||||
}
|
||||
|
||||
// Encode using the DCT into DC (constant) and normalized AC (varying) terms
|
||||
let encodeChannel = (channel, nx, ny) => {
|
||||
let dc = 0, ac = [], scale = 0, fx = []
|
||||
for (let cy = 0; cy < ny; cy++) {
|
||||
for (let cx = 0; cx * ny < nx * (ny - cy); cx++) {
|
||||
let f = 0
|
||||
for (let x = 0; x < w; x++)
|
||||
fx[x] = cos(PI / w * cx * (x + 0.5))
|
||||
for (let y = 0; y < h; y++)
|
||||
for (let x = 0, fy = cos(PI / h * cy * (y + 0.5)); x < w; x++)
|
||||
f += channel[x + y * w] * fx[x] * fy
|
||||
f /= w * h
|
||||
if (cx || cy) {
|
||||
ac.push(f)
|
||||
scale = max(scale, abs(f))
|
||||
} else {
|
||||
dc = f
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scale)
|
||||
for (let i = 0; i < ac.length; i++)
|
||||
ac[i] = 0.5 + 0.5 / scale * ac[i]
|
||||
return [dc, ac, scale]
|
||||
}
|
||||
let [l_dc, l_ac, l_scale] = encodeChannel(l, max(3, lx), max(3, ly))
|
||||
let [p_dc, p_ac, p_scale] = encodeChannel(p, 3, 3)
|
||||
let [q_dc, q_ac, q_scale] = encodeChannel(q, 3, 3)
|
||||
let [a_dc, a_ac, a_scale] = hasAlpha ? encodeChannel(a, 5, 5) : []
|
||||
|
||||
// Write the constants
|
||||
let isLandscape = w > h
|
||||
let header24 = round(63 * l_dc) | (round(31.5 + 31.5 * p_dc) << 6) | (round(31.5 + 31.5 * q_dc) << 12) | (round(31 * l_scale) << 18) | (hasAlpha << 23)
|
||||
let header16 = (isLandscape ? ly : lx) | (round(63 * p_scale) << 3) | (round(63 * q_scale) << 9) | (isLandscape << 15)
|
||||
let hash = [header24 & 255, (header24 >> 8) & 255, header24 >> 16, header16 & 255, header16 >> 8]
|
||||
let ac_start = hasAlpha ? 6 : 5
|
||||
let ac_index = 0
|
||||
if (hasAlpha) hash.push(round(15 * a_dc) | (round(15 * a_scale) << 4))
|
||||
|
||||
// Write the varying factors
|
||||
for (let ac of hasAlpha ? [l_ac, p_ac, q_ac, a_ac] : [l_ac, p_ac, q_ac])
|
||||
for (let f of ac)
|
||||
hash[ac_start + (ac_index >> 1)] |= round(15 * f) << ((ac_index++ & 1) << 2)
|
||||
return new Uint8Array(hash)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
|
||||
*
|
||||
* @param hash The bytes of the ThumbHash.
|
||||
* @returns The width, height, and pixels of the rendered placeholder image.
|
||||
*/
|
||||
export function thumbHashToRGBA(hash) {
|
||||
let { PI, min, max, cos, round } = Math
|
||||
|
||||
// Read the constants
|
||||
let header24 = hash[0] | (hash[1] << 8) | (hash[2] << 16)
|
||||
let header16 = hash[3] | (hash[4] << 8)
|
||||
let l_dc = (header24 & 63) / 63
|
||||
let p_dc = ((header24 >> 6) & 63) / 31.5 - 1
|
||||
let q_dc = ((header24 >> 12) & 63) / 31.5 - 1
|
||||
let l_scale = ((header24 >> 18) & 31) / 31
|
||||
let hasAlpha = header24 >> 23
|
||||
let p_scale = ((header16 >> 3) & 63) / 63
|
||||
let q_scale = ((header16 >> 9) & 63) / 63
|
||||
let isLandscape = header16 >> 15
|
||||
let lx = max(3, isLandscape ? hasAlpha ? 5 : 7 : header16 & 7)
|
||||
let ly = max(3, isLandscape ? header16 & 7 : hasAlpha ? 5 : 7)
|
||||
let a_dc = hasAlpha ? (hash[5] & 15) / 15 : 1
|
||||
let a_scale = (hash[5] >> 4) / 15
|
||||
|
||||
// Read the varying factors (boost saturation by 1.25x to compensate for quantization)
|
||||
let ac_start = hasAlpha ? 6 : 5
|
||||
let ac_index = 0
|
||||
let decodeChannel = (nx, ny, scale) => {
|
||||
let ac = []
|
||||
for (let cy = 0; cy < ny; cy++)
|
||||
for (let cx = cy ? 0 : 1; cx * ny < nx * (ny - cy); cx++)
|
||||
ac.push((((hash[ac_start + (ac_index >> 1)] >> ((ac_index++ & 1) << 2)) & 15) / 7.5 - 1) * scale)
|
||||
return ac
|
||||
}
|
||||
let l_ac = decodeChannel(lx, ly, l_scale)
|
||||
let p_ac = decodeChannel(3, 3, p_scale * 1.25)
|
||||
let q_ac = decodeChannel(3, 3, q_scale * 1.25)
|
||||
let a_ac = hasAlpha && decodeChannel(5, 5, a_scale)
|
||||
|
||||
// Decode using the DCT into RGB
|
||||
let ratio = thumbHashToApproximateAspectRatio(hash)
|
||||
let w = round(ratio > 1 ? 32 : 32 * ratio)
|
||||
let h = round(ratio > 1 ? 32 / ratio : 32)
|
||||
let rgba = new Uint8Array(w * h * 4), fx = [], fy = []
|
||||
for (let y = 0, i = 0; y < h; y++) {
|
||||
for (let x = 0; x < w; x++, i += 4) {
|
||||
let l = l_dc, p = p_dc, q = q_dc, a = a_dc
|
||||
|
||||
// Precompute the coefficients
|
||||
for (let cx = 0, n = max(lx, hasAlpha ? 5 : 3); cx < n; cx++)
|
||||
fx[cx] = cos(PI / w * (x + 0.5) * cx)
|
||||
for (let cy = 0, n = max(ly, hasAlpha ? 5 : 3); cy < n; cy++)
|
||||
fy[cy] = cos(PI / h * (y + 0.5) * cy)
|
||||
|
||||
// Decode L
|
||||
for (let cy = 0, j = 0; cy < ly; cy++)
|
||||
for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx * ly < lx * (ly - cy); cx++, j++)
|
||||
l += l_ac[j] * fx[cx] * fy2
|
||||
|
||||
// Decode P and Q
|
||||
for (let cy = 0, j = 0; cy < 3; cy++) {
|
||||
for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 3 - cy; cx++, j++) {
|
||||
let f = fx[cx] * fy2
|
||||
p += p_ac[j] * f
|
||||
q += q_ac[j] * f
|
||||
}
|
||||
}
|
||||
|
||||
// Decode A
|
||||
if (hasAlpha)
|
||||
for (let cy = 0, j = 0; cy < 5; cy++)
|
||||
for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 5 - cy; cx++, j++)
|
||||
a += a_ac[j] * fx[cx] * fy2
|
||||
|
||||
// Convert to RGB
|
||||
let b = l - 2 / 3 * p
|
||||
let r = (3 * l - b + q) / 2
|
||||
let g = r - q
|
||||
rgba[i] = max(0, 255 * min(1, r))
|
||||
rgba[i + 1] = max(0, 255 * min(1, g))
|
||||
rgba[i + 2] = max(0, 255 * min(1, b))
|
||||
rgba[i + 3] = max(0, 255 * min(1, a))
|
||||
}
|
||||
}
|
||||
return { w, h, rgba }
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the average color from a ThumbHash. RGB is not be premultiplied by A.
|
||||
*
|
||||
* @param hash The bytes of the ThumbHash.
|
||||
* @returns The RGBA values for the average color. Each value ranges from 0 to 1.
|
||||
*/
|
||||
export function thumbHashToAverageRGBA(hash) {
|
||||
let { min, max } = Math
|
||||
let header = hash[0] | (hash[1] << 8) | (hash[2] << 16)
|
||||
let l = (header & 63) / 63
|
||||
let p = ((header >> 6) & 63) / 31.5 - 1
|
||||
let q = ((header >> 12) & 63) / 31.5 - 1
|
||||
let hasAlpha = header >> 23
|
||||
let a = hasAlpha ? (hash[5] & 15) / 15 : 1
|
||||
let b = l - 2 / 3 * p
|
||||
let r = (3 * l - b + q) / 2
|
||||
let g = r - q
|
||||
return {
|
||||
r: max(0, min(1, r)),
|
||||
g: max(0, min(1, g)),
|
||||
b: max(0, min(1, b)),
|
||||
a
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the approximate aspect ratio of the original image.
|
||||
*
|
||||
* @param hash The bytes of the ThumbHash.
|
||||
* @returns The approximate aspect ratio (i.e. width / height).
|
||||
*/
|
||||
export function thumbHashToApproximateAspectRatio(hash) {
|
||||
let header = hash[3]
|
||||
let hasAlpha = hash[2] & 0x80
|
||||
let isLandscape = hash[4] & 0x80
|
||||
let lx = isLandscape ? hasAlpha ? 5 : 7 : header & 7
|
||||
let ly = isLandscape ? header & 7 : hasAlpha ? 5 : 7
|
||||
return lx / ly
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes an RGBA image to a PNG data URL. RGB should not be premultiplied by
|
||||
* A. This is optimized for speed and simplicity and does not optimize for size
|
||||
* at all. This doesn't do any compression (all values are stored uncompressed).
|
||||
*
|
||||
* @param w The width of the input image. Must be ≤100px.
|
||||
* @param h The height of the input image. Must be ≤100px.
|
||||
* @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.
|
||||
* @returns A data URL containing a PNG for the input image.
|
||||
*/
|
||||
export function rgbaToDataURL(w, h, rgba) {
|
||||
let row = w * 4 + 1
|
||||
let idat = 6 + h * (5 + row)
|
||||
let bytes = [
|
||||
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0,
|
||||
w >> 8, w & 255, 0, 0, h >> 8, h & 255, 8, 6, 0, 0, 0, 0, 0, 0, 0,
|
||||
idat >>> 24, (idat >> 16) & 255, (idat >> 8) & 255, idat & 255,
|
||||
73, 68, 65, 84, 120, 1
|
||||
]
|
||||
let table = [
|
||||
0, 498536548, 997073096, 651767980, 1994146192, 1802195444, 1303535960,
|
||||
1342533948, -306674912, -267414716, -690576408, -882789492, -1687895376,
|
||||
-2032938284, -1609899400, -1111625188
|
||||
]
|
||||
let a = 1, b = 0
|
||||
for (let y = 0, i = 0, end = row - 1; y < h; y++, end += row - 1) {
|
||||
bytes.push(y + 1 < h ? 0 : 1, row & 255, row >> 8, ~row & 255, (row >> 8) ^ 255, 0)
|
||||
for (b = (b + a) % 65521; i < end; i++) {
|
||||
let u = rgba[i] & 255
|
||||
bytes.push(u)
|
||||
a = (a + u) % 65521
|
||||
b = (b + a) % 65521
|
||||
}
|
||||
}
|
||||
bytes.push(
|
||||
b >> 8, b & 255, a >> 8, a & 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130
|
||||
)
|
||||
for (let [start, end] of [[12, 29], [37, 41 + idat]]) {
|
||||
let c = ~0
|
||||
for (let i = start; i < end; i++) {
|
||||
c ^= bytes[i]
|
||||
c = (c >>> 4) ^ table[c & 15]
|
||||
c = (c >>> 4) ^ table[c & 15]
|
||||
}
|
||||
c = ~c
|
||||
bytes[end++] = c >>> 24
|
||||
bytes[end++] = (c >> 16) & 255
|
||||
bytes[end++] = (c >> 8) & 255
|
||||
bytes[end++] = c & 255
|
||||
}
|
||||
return 'data:image/png;base64,' + btoa(String.fromCharCode(...bytes))
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a ThumbHash to a PNG data URL. This is a convenience function that
|
||||
* just calls "thumbHashToRGBA" followed by "rgbaToDataURL".
|
||||
*
|
||||
* @param hash The bytes of the ThumbHash.
|
||||
* @returns A data URL containing a PNG for the rendered ThumbHash.
|
||||
*/
|
||||
export function thumbHashToDataURL(hash) {
|
||||
let image = thumbHashToRGBA(hash)
|
||||
return rgbaToDataURL(image.w, image.h, image.rgba)
|
||||
}
|
||||
+760
-56
@@ -1,68 +1,772 @@
|
||||
// How many thumbnails to load per "page" fetched from Immich
|
||||
const PER_PAGE = 50
|
||||
// @ts-check
|
||||
// ============================================================================
|
||||
// Gallery client - virtualized justified/square grid, PhotoSwipe v5 lightbox
|
||||
//
|
||||
// Layout is pre-computed for all items based on container width. Only tiles
|
||||
// within viewport ± 1 viewport-height buffer exist in the DOM at any moment.
|
||||
// PhotoSwipe runs with a full dataSource array so the lightbox navigates
|
||||
// across all items regardless of which tiles are currently rendered.
|
||||
// ============================================================================
|
||||
|
||||
class LGallery {
|
||||
items
|
||||
lightGallery
|
||||
element
|
||||
index = PER_PAGE
|
||||
// Runtime URLs served by Express, not filesystem paths. TypeScript's resolver
|
||||
// can't follow them, so we silence its module-not-found errors here. The
|
||||
// imports themselves work fine at runtime.
|
||||
// @ts-ignore
|
||||
import PhotoSwipeLightbox from '/share/static/photoswipe/photoswipe-lightbox.esm.js'
|
||||
// @ts-ignore
|
||||
import { thumbHashToDataURL } from '/share/static/thumbhash/thumbhash.js'
|
||||
|
||||
/**
|
||||
* Create a lightGallery instance and populate it with the first page of gallery items
|
||||
*/
|
||||
init (params = {}) {
|
||||
// Create the lightGallery instance
|
||||
this.element = document.getElementById('lightgallery')
|
||||
this.lightGallery = lightGallery(this.element, Object.assign({
|
||||
plugins: [lgZoom, lgThumbnail, lgVideo, lgFullscreen, lgHash],
|
||||
speed: 500,
|
||||
/*
|
||||
This license key was graciously provided by LightGallery under their
|
||||
GPLv3 open-source project license:
|
||||
*/
|
||||
licenseKey: '8FFA6495-676C4D30-8BFC54B6-4D0A6CEC'
|
||||
/*
|
||||
Please do not take it and use it for other projects, as it was provided
|
||||
specifically for Immich Public Proxy.
|
||||
/**
|
||||
* @typedef {Object} GalleryItem
|
||||
* @property {string} id
|
||||
* @property {'IMAGE'|'VIDEO'} type
|
||||
* @property {string} previewUrl
|
||||
* @property {string} thumbnailUrl
|
||||
* @property {string} [downloadUrl]
|
||||
* @property {string} [videoData] JSON-stringified video source info
|
||||
* @property {string} [description] Escaped HTML fragment for the lightbox caption
|
||||
* @property {string} downloadFilename
|
||||
* @property {number} [width]
|
||||
* @property {number} [height]
|
||||
* @property {string} [thumbhash]
|
||||
* @property {string} [fileCreatedAt] ISO date
|
||||
*/
|
||||
|
||||
For your own projects you can use the default license key of
|
||||
0000-0000-000-0000 as per their docs:
|
||||
/**
|
||||
* @typedef {Object} LightboxConfig
|
||||
* @property {boolean} [showArrows]
|
||||
* @property {boolean} [showDownload]
|
||||
* @property {boolean} [mobileArrows]
|
||||
*/
|
||||
|
||||
https://www.lightgalleryjs.com/docs/settings/#licenseKey
|
||||
*/
|
||||
}, params.lgConfig))
|
||||
this.items = params.items
|
||||
/**
|
||||
* @typedef {Object} InitParams
|
||||
* @property {GalleryItem[]} [items]
|
||||
* @property {number} [openItem] 1-based; opens lightbox on the Nth item
|
||||
* @property {LightboxConfig} [lightboxConfig]
|
||||
* @property {boolean} [groupByDate]
|
||||
*/
|
||||
|
||||
const spinner = document.getElementById('loading-spinner')
|
||||
if (spinner) {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
if (entries[0].isIntersecting) {
|
||||
lgallery.loadMoreItems(observer, spinner)
|
||||
}
|
||||
}, { rootMargin: '200px' })
|
||||
observer.observe(spinner)
|
||||
/**
|
||||
* @typedef {Object} LayoutEntry
|
||||
* @property {number} index
|
||||
* @property {number} left
|
||||
* @property {number} top
|
||||
* @property {number} width
|
||||
* @property {number} height
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} HeaderEntry
|
||||
* @property {string} label
|
||||
* @property {number} top
|
||||
* @property {number} height
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} GroupSpec
|
||||
* @property {string | null} label
|
||||
* @property {number[]} indices
|
||||
*/
|
||||
|
||||
// Justified-rows target row height (matches Immich's main view)
|
||||
const TARGET_ROW_HEIGHT = 235
|
||||
const GAP = 4
|
||||
const MOBILE_BREAKPOINT = 640
|
||||
const MOBILE_COLS = 3
|
||||
const IMAGE_LOAD_MARGIN_PX = 300
|
||||
const SCROLL_SETTLE_MS = 100
|
||||
const BUFFER_VIEWPORTS = 1
|
||||
// Height reserved for each month header (must agree with .group-header CSS)
|
||||
const HEADER_HEIGHT = 48
|
||||
// Vertical gap between groups
|
||||
const GROUP_GAP = 16
|
||||
|
||||
// MDI download icon (Apache 2.0). Same icon set Immich uses for its viewer.
|
||||
const ICON_DOWNLOAD = '<svg class="pswp__icn" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"/></svg>'
|
||||
|
||||
// ----- module state ---------------------------------------------------------
|
||||
|
||||
/** @type {GalleryItem[]} */
|
||||
let items = []
|
||||
/** @type {LayoutEntry[]} - sparse, indexed by GalleryItem index */
|
||||
let layout = []
|
||||
/** @type {HeaderEntry[]} - empty when groupByDate is off */
|
||||
let headers = []
|
||||
let groupByDate = false
|
||||
/** @type {HTMLElement | null} */
|
||||
let container = null
|
||||
/** @type {any} - PhotoSwipeLightbox instance; external module, leave untyped */
|
||||
let lightbox = null
|
||||
/** @type {LightboxConfig} */
|
||||
let lightboxConfig = {}
|
||||
/** @type {Map<number, HTMLAnchorElement>} */
|
||||
const renderedTiles = new Map()
|
||||
/** @type {Map<string, HTMLElement>} */
|
||||
const renderedHeaders = new Map()
|
||||
let lastContainerW = 0
|
||||
|
||||
// Selection mode (mode-toggle UX: hidden checkmarks until activated)
|
||||
let selectMode = false
|
||||
/** @type {Set<string>} - set of asset IDs */
|
||||
const selected = new Set()
|
||||
/** @type {HTMLElement | null} */
|
||||
let toolbarEl = null
|
||||
/** @type {HTMLElement | null} */
|
||||
let countEl = null
|
||||
/** @type {HTMLButtonElement | null} */
|
||||
let selectAllBtn = null
|
||||
/** @type {HTMLButtonElement | null} */
|
||||
let cancelBtn = null
|
||||
/** @type {HTMLButtonElement | null} */
|
||||
let downloadBtn = null
|
||||
|
||||
// Inline SVG for the check icon shown inside selected tiles' checkmark circle
|
||||
const CHECK_SVG = '<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg>'
|
||||
|
||||
// Long-press threshold for entering select mode via touch/mouse
|
||||
const LONG_PRESS_MS = 500
|
||||
|
||||
// ----- layout computation ---------------------------------------------------
|
||||
|
||||
function computeLayout (containerW) {
|
||||
const tileLayout = new Array(items.length)
|
||||
const newHeaders = []
|
||||
const groups = groupByDate ? groupItemsByMonth() : [{ label: null, indices: itemIndices() }]
|
||||
const isMobile = containerW < MOBILE_BREAKPOINT
|
||||
let y = 0
|
||||
for (let g = 0; g < groups.length; g++) {
|
||||
const group = groups[g]
|
||||
if (group.label) {
|
||||
newHeaders.push({ label: group.label, top: y, height: HEADER_HEIGHT })
|
||||
y += HEADER_HEIGHT
|
||||
}
|
||||
y = isMobile
|
||||
? layoutSquareGroup(containerW, group.indices, y, tileLayout)
|
||||
: layoutJustifiedGroup(containerW, group.indices, y, tileLayout)
|
||||
if (g < groups.length - 1) y += GROUP_GAP
|
||||
}
|
||||
return {
|
||||
layout: tileLayout,
|
||||
headers: newHeaders,
|
||||
totalHeight: Math.max(0, y)
|
||||
}
|
||||
}
|
||||
|
||||
function itemIndices () {
|
||||
const out = new Array(items.length)
|
||||
for (let i = 0; i < items.length; i++) out[i] = i
|
||||
return out
|
||||
}
|
||||
|
||||
/** @returns {GroupSpec[]} */
|
||||
function groupItemsByMonth () {
|
||||
// Preserve item order (already sorted desc by render.ts when grouping is on)
|
||||
/** @type {Map<string, GroupSpec>} */
|
||||
const map = new Map()
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const key = (items[i].fileCreatedAt || '').slice(0, 7) || 'undated'
|
||||
let g = map.get(key)
|
||||
if (!g) {
|
||||
g = { label: monthLabel(key), indices: [] }
|
||||
map.set(key, g)
|
||||
}
|
||||
g.indices.push(i)
|
||||
}
|
||||
return Array.from(map.values())
|
||||
}
|
||||
|
||||
/** @param {string} key @returns {string} */
|
||||
function monthLabel (key) {
|
||||
if (key === 'undated') return 'Undated'
|
||||
const parts = key.split('-')
|
||||
const y = Number(parts[0])
|
||||
const m = Number(parts[1])
|
||||
if (!y || !m) return key
|
||||
// Intl.DateTimeFormat picks up the browser's locale; UTC timeZone keeps
|
||||
// the displayed month consistent with the UTC YYYY-MM bucket key.
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
timeZone: 'UTC'
|
||||
}).format(new Date(Date.UTC(y, m - 1, 1)))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} containerW
|
||||
* @param {number[]} indices
|
||||
* @param {number} startY
|
||||
* @param {LayoutEntry[]} tileLayout
|
||||
* @returns {number} The y position past the last tile (no trailing gap)
|
||||
*/
|
||||
function layoutSquareGroup (containerW, indices, startY, tileLayout) {
|
||||
const tileSize = Math.floor((containerW - (MOBILE_COLS - 1) * GAP) / MOBILE_COLS)
|
||||
let col = 0
|
||||
let x = 0
|
||||
let y = startY
|
||||
for (const idx of indices) {
|
||||
tileLayout[idx] = { index: idx, left: x, top: y, width: tileSize, height: tileSize }
|
||||
col++
|
||||
if (col === MOBILE_COLS) {
|
||||
col = 0
|
||||
x = 0
|
||||
y += tileSize + GAP
|
||||
} else {
|
||||
x += tileSize + GAP
|
||||
}
|
||||
}
|
||||
// If the last row was partial, advance y to past it
|
||||
if (col > 0) y += tileSize
|
||||
// Otherwise back off the trailing inter-row gap
|
||||
else if (y > startY) y -= GAP
|
||||
return y
|
||||
}
|
||||
|
||||
/**
|
||||
* Load more gallery items as per lightGallery docs
|
||||
* https://www.lightgalleryjs.com/demos/infinite-scrolling/
|
||||
*/
|
||||
loadMoreItems (observer, spinner) {
|
||||
if (this.index < this.items.length) {
|
||||
// Append new thumbnails
|
||||
this.items
|
||||
.slice(this.index, this.index + PER_PAGE)
|
||||
.forEach(item => {
|
||||
this.element.insertAdjacentHTML('beforeend', item.html + '\n')
|
||||
})
|
||||
this.index += PER_PAGE
|
||||
this.lightGallery.refresh()
|
||||
function layoutJustifiedGroup (containerW, indices, startY, tileLayout) {
|
||||
let rowItems = []
|
||||
let aspectSum = 0
|
||||
let y = startY
|
||||
|
||||
const applyRow = (rowItems, height, isLastRow) => {
|
||||
const intHeight = Math.floor(height)
|
||||
let x = 0
|
||||
rowItems.forEach(({ idx, aspect }, i) => {
|
||||
const isFinalInRow = i === rowItems.length - 1
|
||||
const w = (!isLastRow && isFinalInRow)
|
||||
? containerW - x
|
||||
: Math.floor(aspect * height)
|
||||
tileLayout[idx] = { index: idx, left: x, top: y, width: w, height: intHeight }
|
||||
x += w + GAP
|
||||
})
|
||||
y += intHeight + GAP
|
||||
}
|
||||
|
||||
for (const idx of indices) {
|
||||
const item = items[idx]
|
||||
const w = item.width || 1
|
||||
const h = item.height || 1
|
||||
const aspect = w / h
|
||||
rowItems.push({ idx, aspect })
|
||||
aspectSum += aspect
|
||||
const projectedH = (containerW - (rowItems.length - 1) * GAP) / aspectSum
|
||||
if (projectedH <= TARGET_ROW_HEIGHT) {
|
||||
applyRow(rowItems, projectedH, false)
|
||||
rowItems = []
|
||||
aspectSum = 0
|
||||
}
|
||||
}
|
||||
if (rowItems.length) applyRow(rowItems, TARGET_ROW_HEIGHT, true)
|
||||
|
||||
// y advanced past the last row's trailing gap; back off
|
||||
return y > startY ? y - GAP : y
|
||||
}
|
||||
|
||||
// ----- tile DOM construction ------------------------------------------------
|
||||
|
||||
function onThumbError () {
|
||||
this.closest('a').classList.add('thumb-error')
|
||||
}
|
||||
|
||||
// Cache of decoded thumbhash → PNG data URL. Same thumbhash on multiple
|
||||
// tile-creations (revisits during virtualization) reuses the same URL.
|
||||
const thumbhashCache = new Map()
|
||||
|
||||
function decodeThumbhash (base64) {
|
||||
const cached = thumbhashCache.get(base64)
|
||||
if (cached) return cached
|
||||
try {
|
||||
const binary = atob(base64)
|
||||
const bytes = new Uint8Array(binary.length)
|
||||
for (let i = 0; i < bytes.length; i++) bytes[i] = binary.charCodeAt(i)
|
||||
const url = thumbHashToDataURL(bytes)
|
||||
thumbhashCache.set(base64, url)
|
||||
return url
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function createTile (index) {
|
||||
const item = items[index]
|
||||
const l = layout[index]
|
||||
const a = document.createElement('a')
|
||||
a.dataset.index = index
|
||||
if (item.type !== 'VIDEO') a.href = item.previewUrl
|
||||
a.style.left = l.left + 'px'
|
||||
a.style.top = l.top + 'px'
|
||||
a.style.width = l.width + 'px'
|
||||
a.style.height = l.height + 'px'
|
||||
|
||||
if (item.thumbhash) {
|
||||
const url = decodeThumbhash(item.thumbhash)
|
||||
if (url) a.style.backgroundImage = 'url(' + url + ')'
|
||||
}
|
||||
|
||||
const img = document.createElement('img')
|
||||
img.alt = item.description || ''
|
||||
img.dataset.src = item.thumbnailUrl
|
||||
img.onerror = onThumbError
|
||||
a.appendChild(img)
|
||||
|
||||
if (item.type === 'VIDEO') {
|
||||
const playIcon = document.createElement('div')
|
||||
playIcon.className = 'play-icon'
|
||||
a.appendChild(playIcon)
|
||||
}
|
||||
|
||||
// Selection checkmark (rendered only when select mode is even possible -
|
||||
// i.e. when the page included the toolbar element)
|
||||
if (toolbarEl) {
|
||||
const check = document.createElement('div')
|
||||
check.className = 'tile-check'
|
||||
check.innerHTML = CHECK_SVG
|
||||
check.addEventListener('click', (e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if (!selectMode) enterSelectMode()
|
||||
toggleSelection(item.id)
|
||||
})
|
||||
a.appendChild(check)
|
||||
if (selected.has(item.id)) a.classList.add('selected')
|
||||
attachLongPress(a, item.id)
|
||||
}
|
||||
|
||||
a.addEventListener('click', (e) => {
|
||||
e.preventDefault()
|
||||
if (selectMode) {
|
||||
toggleSelection(item.id)
|
||||
} else {
|
||||
// Remove the loading spinner and stop observing once all items are loaded
|
||||
observer.disconnect()
|
||||
spinner.remove()
|
||||
openLightbox(index)
|
||||
}
|
||||
})
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// ----- long-press (enter select mode) --------------------------------------
|
||||
|
||||
function attachLongPress (tile, id) {
|
||||
let timer = null
|
||||
let pressed = false
|
||||
const cancel = () => {
|
||||
if (timer) { clearTimeout(timer); timer = null }
|
||||
}
|
||||
tile.addEventListener('pointerdown', (e) => {
|
||||
// Ignore right/middle clicks
|
||||
if (e.button !== undefined && e.button !== 0) return
|
||||
pressed = false
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
pressed = true
|
||||
if (!selectMode) enterSelectMode()
|
||||
toggleSelection(id)
|
||||
}, LONG_PRESS_MS)
|
||||
})
|
||||
tile.addEventListener('pointerup', cancel)
|
||||
tile.addEventListener('pointercancel', cancel)
|
||||
tile.addEventListener('pointerleave', cancel)
|
||||
tile.addEventListener('pointermove', (e) => {
|
||||
// Cancel long-press if pointer moves significantly (scroll, drag)
|
||||
if (Math.abs(e.movementX) + Math.abs(e.movementY) > 6) cancel()
|
||||
})
|
||||
// Swallow the synthetic click that follows a successful long-press so it
|
||||
// doesn't open the lightbox.
|
||||
tile.addEventListener('click', (e) => {
|
||||
if (pressed) {
|
||||
pressed = false
|
||||
e.preventDefault()
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
}, true)
|
||||
}
|
||||
|
||||
// ----- selection state -----------------------------------------------------
|
||||
|
||||
function enterSelectMode () {
|
||||
if (selectMode) return
|
||||
selectMode = true
|
||||
if (container) container.classList.add('select-mode')
|
||||
if (toolbarEl) toolbarEl.hidden = false
|
||||
}
|
||||
|
||||
function exitSelectMode () {
|
||||
if (!selectMode) return
|
||||
selectMode = false
|
||||
// Clear DOM markers on the tiles currently in the DOM
|
||||
for (const a of renderedTiles.values()) a.classList.remove('selected')
|
||||
selected.clear()
|
||||
if (container) container.classList.remove('select-mode')
|
||||
if (toolbarEl) toolbarEl.hidden = true
|
||||
updateSelectionUI()
|
||||
}
|
||||
|
||||
function toggleSelection (id) {
|
||||
if (selected.has(id)) selected.delete(id)
|
||||
else selected.add(id)
|
||||
const idx = items.findIndex(it => it.id === id)
|
||||
const tile = idx >= 0 ? renderedTiles.get(idx) : null
|
||||
if (tile) tile.classList.toggle('selected', selected.has(id))
|
||||
// Auto-exit if user deselected the last item
|
||||
if (selected.size === 0 && selectMode) exitSelectMode()
|
||||
else updateSelectionUI()
|
||||
}
|
||||
|
||||
function updateSelectionUI () {
|
||||
if (countEl) {
|
||||
countEl.textContent = selected.size + ' selected'
|
||||
}
|
||||
if (downloadBtn) downloadBtn.disabled = selected.size === 0
|
||||
if (selectAllBtn) {
|
||||
selectAllBtn.textContent =
|
||||
selected.size === items.length ? 'Deselect all' : 'Select all'
|
||||
}
|
||||
}
|
||||
|
||||
function selectAllOrNone () {
|
||||
if (selected.size === items.length) {
|
||||
// Deselect all but keep select mode active
|
||||
for (const a of renderedTiles.values()) a.classList.remove('selected')
|
||||
selected.clear()
|
||||
updateSelectionUI()
|
||||
} else {
|
||||
if (!selectMode) enterSelectMode()
|
||||
for (const item of items) selected.add(item.id)
|
||||
for (const a of renderedTiles.values()) a.classList.add('selected')
|
||||
updateSelectionUI()
|
||||
}
|
||||
}
|
||||
|
||||
function downloadSelected () {
|
||||
if (selected.size === 0) return
|
||||
// Form POST so the browser handles streaming the zip directly to disk.
|
||||
const form = document.createElement('form')
|
||||
form.method = 'POST'
|
||||
form.action = window.location.pathname + '/download'
|
||||
const input = document.createElement('input')
|
||||
input.type = 'hidden'
|
||||
input.name = 'assets'
|
||||
input.value = JSON.stringify(Array.from(selected))
|
||||
form.appendChild(input)
|
||||
document.body.appendChild(form)
|
||||
form.submit()
|
||||
form.remove()
|
||||
}
|
||||
|
||||
function setupToolbar () {
|
||||
toolbarEl = document.getElementById('select-toolbar')
|
||||
// No toolbar means downloads aren't allowed for this share; nothing to wire
|
||||
if (!toolbarEl) return
|
||||
countEl = document.getElementById('select-count')
|
||||
selectAllBtn = /** @type {HTMLButtonElement | null} */ (document.getElementById('select-all'))
|
||||
cancelBtn = /** @type {HTMLButtonElement | null} */ (document.getElementById('select-cancel'))
|
||||
downloadBtn = /** @type {HTMLButtonElement | null} */ (document.getElementById('select-download'))
|
||||
if (cancelBtn) cancelBtn.addEventListener('click', exitSelectMode)
|
||||
if (selectAllBtn) selectAllBtn.addEventListener('click', selectAllOrNone)
|
||||
if (downloadBtn) downloadBtn.addEventListener('click', downloadSelected)
|
||||
updateSelectionUI()
|
||||
}
|
||||
|
||||
// ----- virtualization -------------------------------------------------------
|
||||
|
||||
function getVisibleRange () {
|
||||
const containerTop = container.getBoundingClientRect().top
|
||||
const viewportTopInContainer = -containerTop
|
||||
const viewportBottomInContainer = viewportTopInContainer + window.innerHeight
|
||||
const buffer = window.innerHeight * BUFFER_VIEWPORTS
|
||||
return {
|
||||
top: viewportTopInContainer - buffer,
|
||||
bottom: viewportBottomInContainer + buffer
|
||||
}
|
||||
}
|
||||
|
||||
function createHeader (header) {
|
||||
const el = document.createElement('h2')
|
||||
el.className = 'group-header'
|
||||
el.style.top = header.top + 'px'
|
||||
el.textContent = header.label
|
||||
return el
|
||||
}
|
||||
|
||||
function virtualize () {
|
||||
if (!container || !layout.length) return
|
||||
const { top, bottom } = getVisibleRange()
|
||||
|
||||
// Tiles
|
||||
const neededTiles = new Set()
|
||||
for (const l of layout) {
|
||||
if (!l) continue
|
||||
if (l.top + l.height < top) continue
|
||||
if (l.top > bottom) break
|
||||
neededTiles.add(l.index)
|
||||
}
|
||||
for (const [index, el] of renderedTiles) {
|
||||
if (!neededTiles.has(index)) {
|
||||
el.remove()
|
||||
renderedTiles.delete(index)
|
||||
}
|
||||
}
|
||||
for (const index of neededTiles) {
|
||||
if (renderedTiles.has(index)) continue
|
||||
const tile = createTile(index)
|
||||
container.appendChild(tile)
|
||||
renderedTiles.set(index, tile)
|
||||
}
|
||||
|
||||
// Group headers (when grouping is enabled; headers is empty otherwise)
|
||||
const neededHeaders = new Set()
|
||||
for (const h of headers) {
|
||||
if (h.top + h.height < top) continue
|
||||
if (h.top > bottom) break
|
||||
neededHeaders.add(h.label)
|
||||
}
|
||||
for (const [label, el] of renderedHeaders) {
|
||||
if (!neededHeaders.has(label)) {
|
||||
el.remove()
|
||||
renderedHeaders.delete(label)
|
||||
}
|
||||
}
|
||||
for (const label of neededHeaders) {
|
||||
if (renderedHeaders.has(label)) continue
|
||||
const h = headers.find(x => x.label === label)
|
||||
if (!h) continue
|
||||
const el = createHeader(h)
|
||||
container.appendChild(el)
|
||||
renderedHeaders.set(label, el)
|
||||
}
|
||||
}
|
||||
|
||||
function computeLayoutAndRender () {
|
||||
if (!container) return
|
||||
const containerW = container.clientWidth
|
||||
if (containerW <= 0) return
|
||||
if (containerW === lastContainerW) {
|
||||
virtualize()
|
||||
return
|
||||
}
|
||||
lastContainerW = containerW
|
||||
|
||||
const result = computeLayout(containerW)
|
||||
layout = result.layout
|
||||
headers = result.headers
|
||||
container.style.height = result.totalHeight + 'px'
|
||||
|
||||
for (const [, el] of renderedTiles) el.remove()
|
||||
renderedTiles.clear()
|
||||
for (const [, el] of renderedHeaders) el.remove()
|
||||
renderedHeaders.clear()
|
||||
|
||||
virtualize()
|
||||
loadVisibleTiles()
|
||||
}
|
||||
|
||||
// ----- image src lifecycle --------------------------------------------------
|
||||
|
||||
function loadVisibleTiles () {
|
||||
if (!container) return
|
||||
const vpHeight = window.innerHeight
|
||||
const containerTop = container.getBoundingClientRect().top
|
||||
for (const a of renderedTiles.values()) {
|
||||
const img = a.firstElementChild
|
||||
if (!(img instanceof HTMLImageElement)) continue
|
||||
const aTopInVp = containerTop + parseFloat(a.style.top || '0')
|
||||
const aHeight = parseFloat(a.style.height || '0')
|
||||
const isFar = aTopInVp + aHeight < -IMAGE_LOAD_MARGIN_PX ||
|
||||
aTopInVp > vpHeight + IMAGE_LOAD_MARGIN_PX
|
||||
if (isFar) {
|
||||
if (img.src && !img.complete) {
|
||||
img.dataset.src = img.src
|
||||
img.removeAttribute('src')
|
||||
}
|
||||
} else if (img.dataset.src) {
|
||||
img.src = img.dataset.src
|
||||
img.removeAttribute('data-src')
|
||||
}
|
||||
}
|
||||
}
|
||||
const lgallery = new LGallery()
|
||||
|
||||
// ----- scroll handling ------------------------------------------------------
|
||||
|
||||
let scrollFrame = null
|
||||
let loadTimer = null
|
||||
|
||||
function onScroll () {
|
||||
if (scrollFrame == null) {
|
||||
scrollFrame = requestAnimationFrame(() => {
|
||||
scrollFrame = null
|
||||
virtualize()
|
||||
})
|
||||
}
|
||||
if (loadTimer) clearTimeout(loadTimer)
|
||||
loadTimer = setTimeout(() => {
|
||||
loadTimer = null
|
||||
loadVisibleTiles()
|
||||
}, SCROLL_SETTLE_MS)
|
||||
}
|
||||
|
||||
// ----- PhotoSwipe -----------------------------------------------------------
|
||||
|
||||
function parseVideoData (item) {
|
||||
try {
|
||||
const data = JSON.parse(item.videoData || '{}')
|
||||
const source = (data.source && data.source[0]) || {}
|
||||
return { src: source.src || '', type: source.type || 'video/mp4' }
|
||||
} catch (e) {
|
||||
return { src: '', type: 'video/mp4' }
|
||||
}
|
||||
}
|
||||
|
||||
function escapeAttr (s) {
|
||||
return String(s).replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>')
|
||||
}
|
||||
|
||||
function buildDataSource () {
|
||||
return items.map(item => {
|
||||
if (item.type === 'VIDEO') {
|
||||
const v = parseVideoData(item)
|
||||
return {
|
||||
html:
|
||||
'<div class="pswp__video-wrap">' +
|
||||
'<video controls playsinline poster="' + escapeAttr(item.thumbnailUrl) + '">' +
|
||||
'<source src="' + escapeAttr(v.src) + '" type="' + escapeAttr(v.type) + '">' +
|
||||
'</video>' +
|
||||
'</div>'
|
||||
}
|
||||
}
|
||||
return {
|
||||
src: item.previewUrl,
|
||||
width: item.width || 1600,
|
||||
height: item.height || 1200,
|
||||
msrc: item.thumbnailUrl,
|
||||
alt: item.description || ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function initLightbox () {
|
||||
lightbox = new PhotoSwipeLightbox({
|
||||
dataSource: buildDataSource(),
|
||||
pswpModule: () => import('/share/static/photoswipe/photoswipe.esm.js'),
|
||||
bgOpacity: 1,
|
||||
showHideAnimationType: 'fade',
|
||||
closeOnVerticalDrag: true,
|
||||
arrowKeys: true,
|
||||
loop: false,
|
||||
padding: { top: 56, bottom: 56, left: 16, right: 16 }
|
||||
})
|
||||
|
||||
// Download button (only registered if config enables it)
|
||||
if (lightboxConfig.showDownload) {
|
||||
lightbox.on('uiRegister', () => {
|
||||
lightbox.pswp.ui.registerElement({
|
||||
name: 'download-button',
|
||||
order: 8,
|
||||
isButton: true,
|
||||
tagName: 'a',
|
||||
ariaLabel: 'Download',
|
||||
html: ICON_DOWNLOAD,
|
||||
onInit: (el, pswp) => {
|
||||
el.setAttribute('target', '_blank')
|
||||
el.setAttribute('rel', 'noopener')
|
||||
const update = () => {
|
||||
const item = items[pswp.currIndex]
|
||||
if (item && item.downloadUrl) {
|
||||
el.href = item.downloadUrl
|
||||
el.setAttribute('download', item.downloadFilename || '')
|
||||
} else {
|
||||
el.removeAttribute('href')
|
||||
}
|
||||
}
|
||||
update()
|
||||
pswp.on('change', update)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Hash navigation: sync window.location.hash with the open slide
|
||||
lightbox.on('uiRegister', () => {
|
||||
const pswp = lightbox.pswp
|
||||
pswp.on('change', () => {
|
||||
const item = items[pswp.currIndex]
|
||||
if (item) history.replaceState(null, '', '#' + item.id)
|
||||
})
|
||||
pswp.on('close', () => {
|
||||
history.replaceState(null, '', window.location.pathname + window.location.search)
|
||||
scrollToCurrentSlide(pswp.currIndex)
|
||||
})
|
||||
})
|
||||
|
||||
// Optional control hiding (defaults match Immich's behavior)
|
||||
const docEl = document.documentElement
|
||||
if (!lightboxConfig.showArrows) docEl.classList.add('pswp-no-arrows')
|
||||
if (!lightboxConfig.mobileArrows) docEl.classList.add('pswp-no-mobile-arrows')
|
||||
|
||||
lightbox.init()
|
||||
}
|
||||
|
||||
function openLightbox (index) {
|
||||
if (lightbox) lightbox.loadAndOpen(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the page so the tile for the given item is comfortably in view.
|
||||
* Called from the lightbox close handler - if the user navigated prev/next
|
||||
* inside the lightbox, or arrived via a #asset-id deep link, the tile they
|
||||
* end on may be far from the original scroll position. We only scroll when
|
||||
* the tile is genuinely off-screen, so closing on a still-visible tile
|
||||
* doesn't jiggle the page.
|
||||
*/
|
||||
function scrollToCurrentSlide (index) {
|
||||
if (!container || index == null || !layout[index]) return
|
||||
const entry = layout[index]
|
||||
const containerTop = container.getBoundingClientRect().top + window.scrollY
|
||||
const tileTop = containerTop + entry.top
|
||||
const tileBottom = tileTop + entry.height
|
||||
const viewportTop = window.scrollY
|
||||
const viewportBottom = viewportTop + window.innerHeight
|
||||
// Already mostly visible - leave the scroll alone
|
||||
if (tileTop >= viewportTop && tileBottom <= viewportBottom) return
|
||||
// Center the tile vertically in the viewport
|
||||
const targetScroll = tileTop - (window.innerHeight - entry.height) / 2
|
||||
window.scrollTo({ top: Math.max(0, targetScroll), behavior: 'instant' })
|
||||
}
|
||||
|
||||
// ----- entry point ----------------------------------------------------------
|
||||
|
||||
function readInitParams () {
|
||||
const el = document.getElementById('ipp-init')
|
||||
if (!el) return {}
|
||||
try { return JSON.parse(el.textContent || '{}') } catch (e) { return {} }
|
||||
}
|
||||
|
||||
function init () {
|
||||
const params = readInitParams()
|
||||
items = params.items || []
|
||||
lightboxConfig = params.lightboxConfig || {}
|
||||
groupByDate = !!params.groupByDate
|
||||
container = document.getElementById('gallery')
|
||||
if (!container) return
|
||||
|
||||
setupToolbar()
|
||||
initLightbox()
|
||||
|
||||
let resizeFrame
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
if (resizeFrame) cancelAnimationFrame(resizeFrame)
|
||||
resizeFrame = requestAnimationFrame(computeLayoutAndRender)
|
||||
})
|
||||
resizeObserver.observe(container)
|
||||
|
||||
window.addEventListener('scroll', onScroll, { passive: true })
|
||||
|
||||
// Deep-link: prefer #asset-id in the URL hash, fall back to ?openItem
|
||||
const hash = window.location.hash.slice(1)
|
||||
if (hash) {
|
||||
const idx = items.findIndex(it => it.id === hash)
|
||||
if (idx >= 0) openLightbox(idx)
|
||||
} else if (params.openItem && params.openItem > 0 && params.openItem <= items.length) {
|
||||
openLightbox(params.openItem - 1)
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
Reference in New Issue
Block a user