neddit

the frontend of the frontpage of the internet  https://neddit.ce9e.org
git clone https://git.ce9e.org/neddit.git

commit
b835252fd9ed70233c601931a9c4c365cf7b64c8
parent
59d7a0d4ed8ca14a810d12e81cbda222e8191f58
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-06-09 09:00
Revert "truncate long posts in listing"

This reverts commit 59d7a0d4ed8ca14a810d12e81cbda222e8191f58.

Diffstat

M neddit.py 1 -
M static/style.css 14 --------------
M templates/_post.html 67 ++++++++++++++++++++++++++++---------------------------------

3 files changed, 31 insertions, 51 deletions


diff --git a/neddit.py b/neddit.py

@@ -92,7 +92,6 @@ def generic(path):
   92    92 	else:
   93    93 		tpl = env.get_template('listing.html')
   94    94 		context.update(a)
   95    -1 		context['truncate'] = True
   96    95 
   97    96 	return tpl.render(**context)
   98    97 

diff --git a/static/style.css b/static/style.css

@@ -233,20 +233,6 @@ input:focus {
  233   233 	margin-right: 0.5em;
  234   234 }
  235   235 
  236    -1 .truncate {
  237    -1 	position: relative;
  238    -1 	max-block-size: 120vb;
  239    -1 	overflow-y: clip;
  240    -1 }
  241    -1 .truncated-link {
  242    -1 	position: absolute;
  243    -1 	top: 100vb;
  244    -1 	left: 0;
  245    -1 	right: 0;
  246    -1 	height: 20vb;
  247    -1 	background-image: linear-gradient(to bottom, transparent, var(--bg-color));
  248    -1 }
  249    -1 
  250   236 @media (prefers-color-scheme: dark) {
  251   237 	html {
  252   238 		--bg-color: #111;

diff --git a/templates/_post.html b/templates/_post.html

@@ -7,43 +7,38 @@
    7     7 		<a href="{{ post.data.url }}" target="_blank"><img class="thumbnail" src="{{ post.data.thumbnail }}" alt=""></a>
    8     8 	{% endif %}
    9     9 	<h2><a href="{{ post.data.permalink }}">{{ post.data.title }}</a></h2>
   10    -1 	<div {% if truncate %}class="truncate"{% endif %}>
   11    -1 		{% if post.data.selftext %}
   12    -1 			<p>{{ post.data.selftext_html|safe }}</p>
   13    -1 		{% endif %}
   14    -1 		{% if post.data.post_hint == 'hosted:video' %}
   15    -1 			<video class="poster" controls muted loop preload="none" poster="{{ post.data.thumbnail }}">
   16    -1 				<source src="{{ post.data.media.reddit_video.dash_url }}">
   17    -1 				<source src="{{ post.data.media.reddit_video.hls_url }}">
   18    -1 				<source src="{{ post.data.media.reddit_video.fallback_url|dash_resize }}" type="video/mp4">
   19    -1 				<source src="{{ post.data.media.reddit_video.fallback_url }}" type="video/mp4">
   20    -1 				<source src="{{ post.data.media.reddit_video.scrubber_media_url }}" type="video/mp4">
   21    -1 			</video>
   22    -1 		{% elif post.data.is_gallery %}
   23    -1 			{% for gallery_item in post.data.gallery_data['items'] %}
   24    -1 				{% with img = post.data.media_metadata[gallery_item.media_id] %}
   25    -1 					<picture>
   26    -1 						<source srcset="{% for res in img.p %}{{ res.u }} {{ res.x }}w{% if not loop.last %}, {% endif %}{% endfor %}" sizes="40em">
   27    -1 						<img class="poster" src="{{ img.p|last|attr('u') }}">
   28    -1 					</picture>
   29    -1 				{% endwith %}
   -1    10 	{% if post.data.selftext %}
   -1    11 		<p>{{ post.data.selftext_html|safe }}</p>
   -1    12 	{% endif %}
   -1    13 	{% if post.data.post_hint == 'hosted:video' %}
   -1    14 		<video class="poster" controls muted loop preload="none" poster="{{ post.data.thumbnail }}">
   -1    15 			<source src="{{ post.data.media.reddit_video.dash_url }}">
   -1    16 			<source src="{{ post.data.media.reddit_video.hls_url }}">
   -1    17 			<source src="{{ post.data.media.reddit_video.fallback_url|dash_resize }}" type="video/mp4">
   -1    18 			<source src="{{ post.data.media.reddit_video.fallback_url }}" type="video/mp4">
   -1    19 			<source src="{{ post.data.media.reddit_video.scrubber_media_url }}" type="video/mp4">
   -1    20 		</video>
   -1    21 	{% elif post.data.is_gallery %}
   -1    22 		{% for gallery_item in post.data.gallery_data['items'] %}
   -1    23 			{% with img = post.data.media_metadata[gallery_item.media_id] %}
   -1    24 				<picture>
   -1    25 					<source srcset="{% for res in img.p %}{{ res.u }} {{ res.x }}w{% if not loop.last %}, {% endif %}{% endfor %}" sizes="40em">
   -1    26 					<img class="poster" src="{{ img.p|last|attr('u') }}">
   -1    27 				</picture>
   -1    28 			{% endwith %}
   -1    29 		{% endfor %}
   -1    30 	{% elif post.data.post_hint == 'image' %}
   -1    31 		<a href="{{ post.data.url }}" target="_blank">
   -1    32 			{% for img in post.data.preview.images %}
   -1    33 				<picture>
   -1    34 					<source srcset="{% for res in img.resolutions %}{{ res.url }} {{ res.width }}w{% if not loop.last %}, {% endif %}{% endfor %}" sizes="40em">
   -1    35 					<img class="poster" src="{{ img.source.url }}">
   -1    36 				</picture>
   30    37 			{% endfor %}
   31    -1 		{% elif post.data.post_hint == 'image' %}
   32    -1 			<a href="{{ post.data.url }}" target="_blank">
   33    -1 				{% for img in post.data.preview.images %}
   34    -1 					<picture>
   35    -1 						<source srcset="{% for res in img.resolutions %}{{ res.url }} {{ res.width }}w{% if not loop.last %}, {% endif %}{% endfor %}" sizes="40em">
   36    -1 						<img class="poster" src="{{ img.source.url }}">
   37    -1 					</picture>
   38    -1 				{% endfor %}
   39    -1 			</a>
   40    -1 		{% elif post.data.url %}
   41    -1 			<a href="{{ post.data.url }}" target="_blank">{{ post.data.url }}</a>
   42    -1 		{% endif %}
   43    -1 		{% if truncate %}
   44    -1 			<a href="{{ post.data.permalink }}" tabindex="-1" aria-hidden="true" class="truncated-link"></a>
   45    -1 		{% endif %}
   46    -1 	</div>
   -1    38 		</a>
   -1    39 	{% elif post.data.url %}
   -1    40 		<a href="{{ post.data.url }}" target="_blank">{{ post.data.url }}</a>
   -1    41 	{% endif %}
   47    42 	<footer>
   48    43 		<span>{{ post.data.score|k }} Points</span>
   49    44 		<a href="{{ post.data.permalink }}" tabindex="-1">{{ post.data.num_comments }} Comments</a>