integrate favelog into catalog theme; needs more work, code cleanup etc.
This commit is contained in:
@@ -5,6 +5,12 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<script type='text/javascript'>
|
||||
active_page = "catalog";
|
||||
|
||||
{% if settings.use_tooltipster %}
|
||||
var use_tooltipster = true;
|
||||
{% else %}
|
||||
var use_tooltipster = false;
|
||||
{% endif %}
|
||||
</script>
|
||||
{% include 'header.html' %}
|
||||
<title>{{ settings.title }}</title>
|
||||
@@ -15,20 +21,47 @@
|
||||
<h1>{{ settings.title }} (<a href="{{link}}">/{{ board }}/</a>)</h1>
|
||||
<div class="subtitle">{{ settings.subtitle }}</div>
|
||||
</header>
|
||||
<hr/>
|
||||
<ul>
|
||||
{% for post in recent_posts %}
|
||||
<div class="thread">
|
||||
<a href="{{post.link}}">
|
||||
<img src="{{post.file}}" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}">
|
||||
</a>
|
||||
<span class="replies">
|
||||
<strong>{% trans %}1 reply{% plural post.reply_count %}{{ count }} replies{% endtrans %}</strong><br/>
|
||||
{{ post.body }}
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<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>
|
||||
<li id="sort-creation-date" class="sort" data-sort="data-time" data-order="asc">{% trans 'Creation date' %}</li>
|
||||
<li id="sort-reply-count" class="sort" data-sort="data-reply" data-order="asc">{% trans 'Reply count' %}</li>
|
||||
<li id="sort-random" class="sort" data-sort="random">{% trans 'Random' %}</li>
|
||||
</ul>
|
||||
|
||||
<span>{% trans 'Sort by' %}: </span>
|
||||
<select id="selectorzilla" style="display: inline-block">
|
||||
<option selected value="bump-order">{% trans 'Bump order' %}</option>
|
||||
<option value="last-reply">{% trans 'Last reply' %}</option>
|
||||
<option value="creation-date">{% trans 'Creation date' %}</option>
|
||||
<option value="reply-count">{% trans 'Reply count' %}</option>
|
||||
<option value="random">{% trans 'Random' %}</option>
|
||||
</select>
|
||||
|
||||
<span>{% trans 'Image size' %}: </span>
|
||||
<select id="imgurzilla" style="display: inline-block">
|
||||
<option selected value="small">{% trans 'Small' %}</option>
|
||||
<option value="large">{% trans 'Large' %}</option>
|
||||
</select>
|
||||
<div class="threads">
|
||||
<ul id="Grid">
|
||||
{% for post in recent_posts %}
|
||||
<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')}}">
|
||||
</a>
|
||||
<p>
|
||||
<span class="replies">
|
||||
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}</strong><br/>
|
||||
{{ post.body }}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<footer>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
$theme['name'] = 'Catalog';
|
||||
// Description (you can use Tinyboard markup here)
|
||||
$theme['description'] = 'Show a post catalog.';
|
||||
$theme['version'] = 'v0.1';
|
||||
$theme['version'] = 'v0.2';
|
||||
|
||||
// Theme configuration
|
||||
$theme['config'] = Array();
|
||||
@@ -38,5 +38,14 @@
|
||||
'comment' => 'Without this checked, the catalog only updates on new threads.'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Use tooltipster',
|
||||
'name' => 'use_tooltipster',
|
||||
'type' => 'checkbox',
|
||||
'default' => true,
|
||||
'comment' => 'Check this if you wish to show a nice tooltip with info about the thread on mouse over.'
|
||||
);
|
||||
|
||||
|
||||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'catalog_build';
|
||||
|
@@ -35,7 +35,7 @@
|
||||
$recent_posts = array();
|
||||
$stats = array();
|
||||
|
||||
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
|
||||
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `filehash` IS NOT NULL) AS `image_count`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply`, (SELECT `name` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_name`, (SELECT `subject` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_subject`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error());
|
||||
|
||||
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']));
|
||||
@@ -44,6 +44,15 @@
|
||||
$files = json_decode($post['files']);
|
||||
if ($files[0]->file == 'deleted') continue;
|
||||
$post['file'] = $config['uri_thumb'] . $files[0]->thumb;
|
||||
|
||||
if ($settings['use_tooltipster']) {
|
||||
$post['muhdifference'] = ago(time() - $post['time']);
|
||||
|
||||
if ($post['last_reply'])
|
||||
$post['last_reply_difference'] = ago(time() - $post['last_reply']);
|
||||
}
|
||||
|
||||
|
||||
$recent_posts[] = $post;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user