czaks
10 years ago
13 changed files with 106 additions and 361 deletions
@ -1,75 +0,0 @@ |
|||
img { |
|||
float:none!important; |
|||
margin: auto; |
|||
margin-bottom: 12px; |
|||
/*max-height: 150px; |
|||
max-width: 200px;*/ |
|||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.55); |
|||
border: 2px solid rgba(153, 153, 153, 0); |
|||
} |
|||
|
|||
/* |
|||
img:hover { |
|||
border: 2px solid rgba(153, 153, 153, 0.27); |
|||
} |
|||
*/ |
|||
|
|||
div.threads{ |
|||
text-align: center; |
|||
margin-left: -20px; |
|||
} |
|||
|
|||
div.thread { |
|||
display: inline-block; |
|||
vertical-align: top; |
|||
margin-bottom:25px; |
|||
margin-left: 20px; |
|||
margin-right: 15px; |
|||
text-align:center; |
|||
font-weight:normal; |
|||
width:205px; |
|||
overflow:hidden; |
|||
position: relative; |
|||
font-size:11px; |
|||
padding: 15px; |
|||
background: rgba(182, 182, 182, 0.12); |
|||
border: 2px solid rgba(111, 111, 111, 0.34); |
|||
max-height:300px; |
|||
} |
|||
|
|||
div.thread:hover { |
|||
background: #D6DAF0; |
|||
border-color: #B7C5D9; |
|||
} |
|||
|
|||
div.grid-size-small { |
|||
width: 200px; |
|||
max-width: 200px; |
|||
max-height: 350px; |
|||
} |
|||
|
|||
div.grid-size-large { |
|||
width: 300px; |
|||
max-width: 300px; |
|||
max-height: 450px; |
|||
} |
|||
|
|||
img.thread-image { |
|||
height: auto; |
|||
max-width: 100%; |
|||
} |
|||
|
|||
@media (max-width: 420px) { |
|||
ul#Grid { |
|||
padding-left: 18px; |
|||
} |
|||
div.thread { |
|||
width: auto; |
|||
margin-left: 0; |
|||
margin-right: 0; |
|||
|
|||
} |
|||
div.threads { |
|||
overflow: hidden; |
|||
} |
|||
} |
@ -1,79 +0,0 @@ |
|||
{% filter remove_whitespace %} |
|||
<!doctype html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
|||
<title>{{ settings.title }}</title> |
|||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/> |
|||
<link rel="stylesheet" media="screen" href="{{ config.root }}stylesheets/{{ settings.css }}"/> |
|||
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %} |
|||
{% if settings.use_tooltipster %}<link rel="stylesheet" media="screen" href="{{ config.root }}stylesheets/tooltipster.css"/>{% endif %} |
|||
<script type="text/javascript" src="{{ config.additional_javascript_url }}js/jquery.min.js"></script> |
|||
<script type="text/javascript" src="{{ config.additional_javascript_url }}js/jquery.mixitup.min.js"></script> |
|||
{% if settings.use_tooltipster %}<script type="text/javascript" src="{{ config.additional_javascript_url }}js/jquery.tooltipster.min.js"></script> |
|||
<script type="text/javascript"> |
|||
var use_tooltipster = true; |
|||
</script>{% else %} |
|||
<script type="text/javascript"> |
|||
var use_tooltipster = false; |
|||
</script> |
|||
{% endif %} |
|||
<script type="text/javascript" src="{{ config.additional_javascript_url }}js/favelog.js"></script> |
|||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %} |
|||
{% if config.font_awesome %}<link rel="stylesheet" media="screen" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %} |
|||
<script type="text/javascript" src="{{ config.url_javascript }}"></script> |
|||
</head> |
|||
<body> |
|||
{{ boardlist.top }} |
|||
<header> |
|||
<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> |
|||
<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/> |
|||
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> {{ config.version }} | <a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2013 Tinyboard Development Group</p> |
|||
</body> |
|||
</html> |
|||
{% endfilter %} |
@ -1,58 +0,0 @@ |
|||
<?php |
|||
$theme = array(); |
|||
|
|||
// Theme name |
|||
$theme['name'] = 'Favelog'; |
|||
// Description (you can use Tinyboard markup here) |
|||
$theme['description'] = 'Show a post favelog.'; |
|||
$theme['version'] = 'v0.1'; |
|||
|
|||
// Theme configuration |
|||
$theme['config'] = Array(); |
|||
|
|||
$theme['config'][] = Array( |
|||
'title' => 'Title', |
|||
'name' => 'title', |
|||
'type' => 'text', |
|||
'default' => 'Favelog' |
|||
); |
|||
|
|||
$__boards = listBoards(); |
|||
$__default_boards = Array(); |
|||
foreach ($__boards as $__board) |
|||
$__default_boards[] = $__board['uri']; |
|||
|
|||
$theme['config'][] = Array( |
|||
'title' => 'Included boards', |
|||
'name' => 'boards', |
|||
'type' => 'text', |
|||
'comment' => '(space seperated)', |
|||
'default' => implode(' ', $__default_boards) |
|||
); |
|||
|
|||
$theme['config'][] = Array( |
|||
'title' => 'CSS file', |
|||
'name' => 'css', |
|||
'type' => 'text', |
|||
'default' => 'catalog.css', |
|||
'comment' => '(eg. "catalog.css")' |
|||
); |
|||
|
|||
$theme['config'][] = Array( |
|||
'title' => 'Update on new posts', |
|||
'name' => 'update_on_posts', |
|||
'type' => 'checkbox', |
|||
'default' => true, |
|||
'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. Texts only available in PT-br.' |
|||
); |
|||
|
|||
// Unique function name for building everything |
|||
$theme['build_function'] = 'favelog_build'; |
@ -1,133 +0,0 @@ |
|||
<?php |
|||
require 'info.php'; |
|||
|
|||
function favelog_build($action, $settings, $board) { |
|||
global $config; |
|||
|
|||
// Possible values for $action: |
|||
// - all (rebuild everything, initialization) |
|||
// - news (news has been updated) |
|||
// - boards (board list changed) |
|||
// - post (a reply has been made) |
|||
// - post-thread (a thread has been made) |
|||
|
|||
$boards = explode(' ', $settings['boards']); |
|||
|
|||
if ($action == 'all') { |
|||
copy('templates/themes/favelog/catalog.css', 'stylesheets/' . $settings['css']); |
|||
|
|||
if($settings['use_tooltipster']) { |
|||
copy('templates/themes/favelog/tooltipster.css', 'stylesheets/tooltipster.css'); |
|||
copy('templates/themes/favelog/jquery.tooltipster.min.js', 'js/jquery.tooltipster.min.js'); |
|||
} |
|||
|
|||
copy('templates/themes/favelog/jquery.mixitup.min.js', 'js/jquery.mixitup.min.js'); |
|||
copy('templates/themes/favelog/favelog.js', 'js/favelog.js'); |
|||
|
|||
foreach ($boards as $board) { |
|||
$b = new Favelog(); |
|||
$b->build($settings, $board); |
|||
} |
|||
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete') && in_array($board, $boards)) { |
|||
$b = new Favelog(); |
|||
$b->build($settings, $board); |
|||
} |
|||
} |
|||
|
|||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations |
|||
class Favelog { |
|||
public function build($settings, $board_name) { |
|||
global $config, $board; |
|||
|
|||
openBoard($board_name); |
|||
|
|||
$recent_images = array(); |
|||
$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`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `filesize` 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'])); |
|||
$post['board_name'] = $board['name']; |
|||
$post['file'] = $config['uri_thumb'] . $post['thumb']; |
|||
|
|||
if ($settings['use_tooltipster']) { |
|||
$post['muhdifference'] = $this->getDiferenca($post['time']); |
|||
|
|||
if ($post['last_reply']) |
|||
$post['last_reply_difference'] = $this->getDiferenca($post['last_reply']); |
|||
} |
|||
|
|||
$recent_posts[] = $post; |
|||
} |
|||
|
|||
file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/favelog/catalog.html', Array( |
|||
'settings' => $settings, |
|||
'config' => $config, |
|||
'boardlist' => createBoardlist(), |
|||
'recent_images' => $recent_images, |
|||
'recent_posts' => $recent_posts, |
|||
'stats' => $stats, |
|||
'board' => $board_name, |
|||
'link' => $config['root'] . $board['dir'] |
|||
))); |
|||
} |
|||
|
|||
public function getDiferenca($muhtime) |
|||
{ |
|||
$postagem = new DateTime(date("Y-m-d H:i:s", $muhtime)); |
|||
$agora = new DateTime(date("Y-m-d H:i:s")); |
|||
$intervalo = $postagem->diff($agora); |
|||
$anos = $intervalo->format('%y'); |
|||
$meses = $intervalo->format('%m'); |
|||
$dias = $intervalo->format('%d'); |
|||
$horas = $intervalo->format('%h'); |
|||
$minutos = $intervalo->format('%i'); |
|||
$segundos = $intervalo->format('%s'); |
|||
|
|||
$diferenca = ""; // adicionar o 'há' depois |
|||
if ($anos) { |
|||
if ($meses) { |
|||
$diferenca.= ($anos>1)? $anos.' anos e ' : $anos.' ano e '; |
|||
$diferenca.= ($meses>1)? $meses.' meses.' : $meses.' mês.'; |
|||
} else { |
|||
$diferenca.= ($anos>1)? $anos.' anos.' : $anos.' ano.'; |
|||
} |
|||
} elseif($meses) { |
|||
if ($dias) { |
|||
$diferenca.= ($meses>1)? $meses.' meses e ' : $meses.' mês e '; |
|||
$diferenca.= ($dias>1)? $dias.' dias.' : $dias.' dia.'; |
|||
} else { |
|||
$diferenca.= ($meses>1)? $meses.' meses.' : $meses.' mês.'; |
|||
} |
|||
} elseif ($dias) { |
|||
if ($horas) { |
|||
$diferenca.= ($dias>1)? $dias.' dias e ' : $dias.' dia e '; |
|||
$diferenca.= ($horas>1)? $horas.' horas.' : $horas.' hora.'; |
|||
} else { |
|||
$diferenca.= ($dias>1)? $dias.' dias.' : $dias.' dia.'; |
|||
} |
|||
} elseif ($horas) { |
|||
if ($minutos) { |
|||
$diferenca.= ($horas>1)? $horas.' horas e ' : $horas.' hora e '; |
|||
$diferenca.= ($minutos>1)? $minutos.' minutos.' : $minutos.' minuto.'; |
|||
} else { |
|||
$diferenca.= ($horas>1)? $horas.' horas.' : $horas.' hora.'; |
|||
} |
|||
} elseif ($minutos) { |
|||
if ($segundos) { |
|||
$diferenca.= ($minutos>1)? $minutos.' minutos e ' : $minutos.' minuto e '; |
|||
$diferenca.= ($segundos>1)? $segundos.' segundos.' : $segundos.' segundo.'; |
|||
} else { |
|||
$diferenca.= ($minutos>1)? $minutos.' minutos.' : $minutos.' minuto.'; |
|||
} |
|||
} elseif ($segundos) { |
|||
$diferenca.= ($segundos>1)? $segundos.' segundos.' : $segundos.' segundo.'; |
|||
} |
|||
|
|||
if (!empty($diferenca)) |
|||
$diferenca = 'há '.$diferenca; |
|||
return $diferenca; |
|||
} |
|||
}; |
Before Width: | Height: | Size: 11 KiB |
Loading…
Reference in new issue