Update /photography.
This commit is contained in:
parent
1d70dac8a3
commit
55d4cc0d86
2 changed files with 27 additions and 19 deletions
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
html
|
html
|
||||||
{
|
{
|
||||||
|
height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
background-color: var(--color_htmlbg);
|
background-color: var(--color_htmlbg);
|
||||||
|
@ -31,11 +32,13 @@ html
|
||||||
|
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
min-height: 100%;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header
|
header
|
||||||
|
@ -44,21 +47,25 @@ header
|
||||||
max-width: 120em;
|
max-width: 120em;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
text-align: end;
|
text-align: end;
|
||||||
}
|
}
|
||||||
header > *
|
header > *
|
||||||
{
|
{
|
||||||
|
display: inline-block;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
background-color: var(--color_bodybg);
|
background-color: var(--color_bodybg);
|
||||||
}
|
}
|
||||||
.photograph
|
|
||||||
|
.photograph, .album
|
||||||
{
|
{
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photograph
|
||||||
|
{
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
background-color: var(--color_bodybg);
|
background-color: var(--color_bodybg);
|
||||||
}
|
}
|
||||||
|
@ -126,11 +133,11 @@ p:last-child
|
||||||
{
|
{
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
h1 {font-size: 2.5em;} h1 * {font-size: inherit;}
|
h1 {font-size: 2.00em;} h1 * {font-size: inherit;}
|
||||||
h2 {font-size: 2.0em;} h2 * {font-size: inherit;}
|
h2 {font-size: 1.75em;} h2 * {font-size: inherit;}
|
||||||
h3 {font-size: 1.5em;} h3 * {font-size: inherit;}
|
h3 {font-size: 1.50em;} h3 * {font-size: inherit;}
|
||||||
h4 {font-size: 1.2em;} h4 * {font-size: inherit;}
|
h4 {font-size: 1.25em;} h4 * {font-size: inherit;}
|
||||||
h5 {font-size: 1.0em;} h5 * {font-size: inherit;}
|
h5 {font-size: 1.00em;} h5 * {font-size: inherit;}
|
||||||
|
|
||||||
.header_anchor_link {display: none; font-size: 1.0em; text-decoration: none}
|
.header_anchor_link {display: none; font-size: 1.0em; text-decoration: none}
|
||||||
h1:hover > .header_anchor_link {display: initial;}
|
h1:hover > .header_anchor_link {display: initial;}
|
||||||
|
|
|
@ -22,14 +22,14 @@ def write(path, content):
|
||||||
f.write(content)
|
f.write(content)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def render_photo(photo, d):
|
def render_photo(photo, relative_directory):
|
||||||
small_name = make_thumbnail(photo)
|
small_name = make_thumbnail(photo)
|
||||||
basename = '/' + photo.relative_to(DOMAIN_ROOTDIR, simple=True)
|
basename = photo.relative_to(relative_directory, simple=True)
|
||||||
thumb = '/' + small_name.relative_to(DOMAIN_ROOTDIR, simple=True)
|
thumb = small_name.relative_to(relative_directory, simple=True)
|
||||||
article_id = photo.replace_extension('').basename
|
article_id = photo.replace_extension('').basename
|
||||||
|
|
||||||
return f'''
|
return f'''
|
||||||
<article class="photograph" id="{article_id}">
|
<article id="{article_id}" class="photograph">
|
||||||
<a href="{basename}"><img src="{thumb}" loading="lazy"/></a>
|
<a href="{basename}"><img src="{thumb}" loading="lazy"/></a>
|
||||||
</article>
|
</article>
|
||||||
'''
|
'''
|
||||||
|
@ -50,10 +50,10 @@ def render_album_preview(directory):
|
||||||
next_after_more = remaining[0].replace_extension('').basename
|
next_after_more = remaining[0].replace_extension('').basename
|
||||||
else:
|
else:
|
||||||
next_after_more = None
|
next_after_more = None
|
||||||
firsts = [render_photo(photo, pathclass.cwd()) for photo in firsts]
|
firsts = [render_photo(photo, directory.parent) for photo in firsts]
|
||||||
|
|
||||||
return jinja2.Template('''
|
return jinja2.Template('''
|
||||||
<article id="{{article_id}}">
|
<article id="{{article_id}}" class="album">
|
||||||
<h1><a href="{{album_path}}">{{directory.basename}}</a></h1>
|
<h1><a href="{{album_path}}">{{directory.basename}}</a></h1>
|
||||||
{% for photo in firsts %}
|
{% for photo in firsts %}
|
||||||
{{photo}}
|
{{photo}}
|
||||||
|
@ -66,7 +66,7 @@ def render_album_preview(directory):
|
||||||
''').render(
|
''').render(
|
||||||
article_id=article_id,
|
article_id=article_id,
|
||||||
directory=directory,
|
directory=directory,
|
||||||
album_path='/photography/' + directory.relative_to(PHOTOGRAPHY_ROOTDIR, simple=True),
|
album_path=directory.basename,
|
||||||
next_after_more=next_after_more,
|
next_after_more=next_after_more,
|
||||||
firsts=firsts,
|
firsts=firsts,
|
||||||
remaining=len(remaining),
|
remaining=len(remaining),
|
||||||
|
@ -123,9 +123,9 @@ def write_directory_index(directory):
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<span>hint: <kbd>←</kbd> / <kbd>→</kbd></span>
|
<div>hint: <kbd>←</kbd> / <kbd>→</kbd></div>
|
||||||
{% if do_rss %}
|
{% if do_rss %}
|
||||||
<a href="/photography/photography.atom">Atom</a>
|
<div><a href="/photography/photography.atom">Atom</a></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if do_back %}
|
{% if do_back %}
|
||||||
|
@ -185,7 +185,8 @@ def write_directory_index(directory):
|
||||||
const jump = (distance * 0.25) + (document.body.scrollTop < desired_scroll_position ? 1 : -1);
|
const jump = (distance * 0.25) + (document.body.scrollTop < desired_scroll_position ? 1 : -1);
|
||||||
document.body.scrollTop = document.body.scrollTop + jump;
|
document.body.scrollTop = document.body.scrollTop + jump;
|
||||||
console.log(`${document.body.scrollTop} ${desired_scroll_position}`);
|
console.log(`${document.body.scrollTop} ${desired_scroll_position}`);
|
||||||
if (document.body.scrollTop !== desired_scroll_position)
|
const new_distance = desired_scroll_position - document.body.scrollTop;
|
||||||
|
if (Math.abs(new_distance / distance) < 0.97)
|
||||||
{
|
{
|
||||||
window.requestAnimationFrame(scroll_step);
|
window.requestAnimationFrame(scroll_step);
|
||||||
}
|
}
|
||||||
|
@ -269,7 +270,7 @@ def make_thumbnail(photo):
|
||||||
(image_width, image_height) = image.size
|
(image_width, image_height) = image.size
|
||||||
(width, height) = imagetools.fit_into_bounds(image_width, image_height, 1440, 1440)
|
(width, height) = imagetools.fit_into_bounds(image_width, image_height, 1440, 1440)
|
||||||
image = image.resize((width, height), PIL.Image.ANTIALIAS)
|
image = image.resize((width, height), PIL.Image.ANTIALIAS)
|
||||||
image.save(small_name.absolute_path, quality=90)
|
image.save(small_name.absolute_path, quality=85)
|
||||||
print(small_name)
|
print(small_name)
|
||||||
return small_name
|
return small_name
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue