diff options
| author | czaks <marcin@6irc.net> | 2014-05-05 17:29:34 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-05-05 17:29:34 +0200 |
| commit | 855618b2a0d367b2e2d46b2fce1926cf13e0e94e (patch) | |
| tree | 3b1e5688b86091984fcc3578a051928db07c2df4 /templates/themes | |
| parent | ab52741a5f6a34a81f5a0e066c95f08a4e470261 (diff) | |
| parent | 81b0612d5699f504440eb477fd9952bf4cb49525 (diff) | |
Merge branch 'master' of github.com:vichan-devel/Tinyboard
Conflicts:
templates/themes/catalog/catalog.html
templates/themes/catalog/theme.php
Diffstat (limited to 'templates/themes')
| -rw-r--r-- | templates/themes/catalog/catalog.html | 8 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 1df38287..2b8649e4 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -21,6 +21,7 @@ <h1>{{ settings.title }} (<a href="{{link}}">/{{ board }}/</a>)</h1> <div class="subtitle">{{ settings.subtitle }}</div> </header> + <ul style="display: none"> <li id="sort-bump-order" class="sort" data-sort="data-bump" data-order="asc">{% trans 'Bump order' %}</li> <li id="sort-last-reply" class="sort" data-sort="data-lastreply" data-order="asc">{% trans 'Last reply' %}</li> @@ -49,7 +50,12 @@ <li class="mix" data-reply="{{ post.reply_count }}" data-bump="{{ post.bump }}" data-lastreply="{{ post.last_reply }}" data-time="{{ post.time }}"> <div class="thread grid-li grid-size-small"> <a href="{{post.link}}"> - <img id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject }}{% endif %}" data-name="{{ post.name }}" data-muhdifference="{{ post.muhdifference }}" data-last-reply="{% if post.last_reply %}{{ post.last_reply }}{% endif %}" data-last-subject="{% if post.last_reply_subject %}{{ post.last_reply_subject }}{% endif %}" data-last-name="{% if post.last_reply %}{{ post.last_reply_name }}{% endif %}" data-last-difference="{% if post.last_reply %}{{ post.last_reply_difference }}{% endif %}" src="{{post.file}}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}"> + {% if post.youtube %} + <img src="http://img.youtube.com/vi/{{ post.youtube }}/0.jpg" + {% else %} + <img src="{{post.file}}" + {% endif %} + id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject }}{% endif %}" data-name="{{ post.name }}" data-muhdifference="{{ post.muhdifference }}" data-last-reply="{% if post.last_reply %}{{ post.last_reply }}{% endif %}" data-last-subject="{% if post.last_reply_subject %}{{ post.last_reply_subject }}{% endif %}" data-last-name="{% if post.last_reply %}{{ post.last_reply_name }}{% endif %}" data-last-difference="{% if post.last_reply %}{{ post.last_reply_difference }}{% endif %}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}"> </a> <p> <span class="replies"> diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index e3a45d64..cf2095d0 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -40,9 +40,14 @@ while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])); $post['board_name'] = $board['name']; + + 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]; + } + if (isset($post['files'])) $files = json_decode($post['files']); - if ($files[0]->file == 'deleted') continue; + if ($files[0]->file == 'deleted') continue; $post['file'] = $config['uri_thumb'] . $files[0]->thumb; if ($settings['use_tooltipster']) { @@ -52,7 +57,6 @@ $post['last_reply_difference'] = ago(time() - $post['last_reply']); } - $recent_posts[] = $post; } |
