plutopluto

git clone https://git.ce9e.org/plutopluto.git

commit
5fafa14acfea42f24913782381c1a635c50b9099
parent
36bf62a5173651729a23b9a7359aed8d64dd818d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-07-02 07:55
tweak post UI

Diffstat

M plutopluto/__init__.py 13 +++++--------
M plutopluto/index.html 5 +++--
M plutopluto/static/plutopluto.js 11 ++++++-----
M plutopluto/static/style.css 3 ++-

4 files changed, 16 insertions, 16 deletions


diff --git a/plutopluto/__init__.py b/plutopluto/__init__.py

@@ -37,17 +37,14 @@ def parse(url):
   37    37         d['title'] = item.get('title')
   38    38         d['link'] = item.get('link')
   39    39         d['source'] = feed.feed.get('title')
   -1    40         d['source_link'] = feed.feed.get('link')
   -1    41         d['content'] = item.get('description', '')
   40    42         if 'youtube' in url:
   41    -1             template = u'<img alt="%s" src="%s" />\n<div>%s</div>'
   42    -1             d['content'] = template % (
   43    -1                 item['media_content'][0]['url'],
   -1    43             thumbnail = '<a href="%s"><img alt="" src="%s" /></a>' % (
   -1    44                 d['link'],
   44    45                 item['media_thumbnail'][0]['url'],
   45    -1                 item['media_description'],
   46    46             )
   47    -1         elif 'content' in item:
   48    -1             d['content'] = item['content'][0]['value']
   49    -1         else:
   50    -1             d['content'] = item.get('description')
   -1    47             d['content'] = thumbnail + d['content']
   51    48         return d
   52    49 
   53    50     return {

diff --git a/plutopluto/index.html b/plutopluto/index.html

@@ -13,11 +13,12 @@
   13    13 	<template>
   14    14 		<article>
   15    15 			<header>
   16    -1 				<a class="source u-bold" href="{{link}}" title="{{title}}">{{source}}</a>
   -1    16 				<a class="source u-bold" href="{{source_link}}">{{source}}</a>
   17    17 				<span class="meta">
   18    -1 					&middot; Posted on <a href="{{link}}">{{dt}}</a>
   -1    18 					&middot; Posted on {{dt}}
   19    19 				</span>
   20    20 			</header>
   -1    21 			<h2 class="title"><a href="{{link}}">{{title}}</a></h2>
   21    22 			{{{content}}}
   22    23 		</article>
   23    24 	</template>

diff --git a/plutopluto/static/plutopluto.js b/plutopluto/static/plutopluto.js

@@ -46,11 +46,12 @@ var appendEntries = function(entries) {
   46    46 		var li = document.createElement('li');
   47    47 		li.className = 'post';
   48    48 		li.innerHTML = template.innerHTML
   49    -1 			.replace('{{source}}', escapeHTML(entry.source))
   50    -1 			.replace('{{link}}', escapeHTML(entry.link))
   51    -1 			.replace('{{title}}', escapeHTML(entry.title))
   52    -1 			.replace('{{dt}}', escapeHTML(formatDate(entry.dt)))
   53    -1 			.replace('{{{content}}}', entry.content);
   -1    49 			.replaceAll('{{source}}', escapeHTML(entry.source))
   -1    50 			.replaceAll('{{source_link}}', escapeHTML(entry.source_link))
   -1    51 			.replaceAll('{{link}}', escapeHTML(entry.link))
   -1    52 			.replaceAll('{{title}}', escapeHTML(entry.title))
   -1    53 			.replaceAll('{{dt}}', escapeHTML(formatDate(entry.dt)))
   -1    54 			.replaceAll('{{{content}}}', entry.content);
   54    55 		stream.append(li);
   55    56 	});
   56    57 };

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

@@ -76,7 +76,8 @@ hr {
   76    76 	font-size: small;
   77    77 }
   78    78 
   79    -1 .post header a {
   -1    79 .post header a,
   -1    80 .post .title a {
   80    81 	color: inherit;
   81    82 	text-decoration: none;
   82    83 }