quick & dirty youtube thumbnails in catalog support
This commit is contained in:
parent
bac23d22f8
commit
73eb8c6b58
@ -20,12 +20,16 @@
|
|||||||
{% for post in recent_posts %}
|
{% for post in recent_posts %}
|
||||||
<div class="thread">
|
<div class="thread">
|
||||||
<a href="{{post.link}}">
|
<a href="{{post.link}}">
|
||||||
|
{% if post.youtube %}
|
||||||
|
<img src="http://img.youtube.com/vi/{{ post.youtube }}/0.jpg" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}">
|
||||||
|
{% elseif post.file %}
|
||||||
<img src="{{post.file}}" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}">
|
<img src="{{post.file}}" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}">
|
||||||
</a>
|
{% endif %}
|
||||||
<span class="replies">
|
<span class="replies">
|
||||||
<strong>{% trans %}1 reply{% plural post.reply_count %}{{ count }} replies{% endtrans %}</strong><br/>
|
<strong>{% trans %}1 reply{% plural post.reply_count %}{{ count }} replies{% endtrans %}</strong><br/>
|
||||||
{{ post.body }}
|
{{ post.body }}
|
||||||
</span>
|
</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
|
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
|
||||||
$post['board_name'] = $board['name'];
|
$post['board_name'] = $board['name'];
|
||||||
$post['file'] = $config['uri_thumb'] . $post['thumb'];
|
$post['file'] = $config['uri_thumb'] . $post['thumb'];
|
||||||
|
|
||||||
|
if ($post['embed'] && preg_match('/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
|
||||||
|
$post['youtube'] = $matches[2];
|
||||||
|
}
|
||||||
|
|
||||||
$recent_posts[] = $post;
|
$recent_posts[] = $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user