diff options
| -rw-r--r-- | js/catalog.js | 56 | ||||
| -rw-r--r-- | templates/themes/catalog/catalog.html | 18 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 15 |
3 files changed, 18 insertions, 71 deletions
diff --git a/js/catalog.js b/js/catalog.js index 0c41103c..4a4eae37 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -1,64 +1,22 @@ if (active_page == 'catalog') $(function(){
- $("#selectorzilla").change(function(){
- sheit = this.value;
- $("#sort-"+sheit).trigger("click");
+ $("#sort_by").change(function(){
+ var value = this.value;
+ $("#sort-"+value).trigger("click");
});
- $("#imgurzilla").change(function(){
- sheit = this.value;
- if (sheit == "small") {
+ $("#image_size").change(function(){
+ var value = this.value, old;
+ if (value == "small") {
old = "large";
} else {
old = "small";
}
$(".grid-li").removeClass("grid-size-"+old);
- $(".grid-li").addClass("grid-size-"+sheit);
+ $(".grid-li").addClass("grid-size-"+value);
});
$('#Grid').mixitup({
- onMixEnd: function(){
- if(use_tooltipster) {
- buildTooltipster();
- }
- }
});
- if(use_tooltipster) {
- buildTooltipster();
- }
-
});
-
-function buildTooltipster(){
- $(".thread-image").each(function(){
- subject = $(this).attr('data-subject');
- name = $(this).attr('data-name');
- muhdifference = $(this).attr('data-muhdifference');
- last_reply = $(this).attr('data-last-reply');
- last_subject = $(this).attr('data-last-subject');
- last_name = $(this).attr('data-last-name');
- last_difference = $(this).attr('data-last-difference');
- muh_body = '<span="poster-span">';
-
- if (subject) {
- muh_body = muh_body + subject + ' por';
- } else {
- muh_body = muh_body + 'Postado por';
- };
- muh_body = muh_body + ' <span class="poster-name">' + name + ' </span>' + muhdifference + '</span>';
-
- if (last_reply) {
- muh_body = muh_body + '<br><span class="last-reply-span">';
- if (last_subject) {
- muh_body = muh_body + last_subject + ' por';
- } else{
- muh_body = muh_body + 'Ăšltima resposta por';
- };
- muh_body = muh_body + ' <span class="poster-name">' + last_name + ' </span>' + last_difference + '</span>';
- }
- $(this).tooltipster({
- content: $(muh_body)
- });
- });
-}
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 2b8649e4..a4cb3933 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -5,12 +5,6 @@ <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> @@ -24,30 +18,32 @@ <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"> + <select id="sort_by" 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"> + <select id="image_size" 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 }}"> + <li class="mix" + data-reply="{{ post.reply_count }}" + data-bump="{{ post.bump }}" + data-time="{{ post.time }}" + > <div class="thread grid-li grid-size-small"> <a href="{{post.link}}"> {% if post.youtube %} diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index cc767789..f6c4d8e5 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -36,9 +36,8 @@ $stats = array(); $query = query(sprintf("SELECT *, `id` AS `thread_id`, - (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, + (SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, (SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `image_count`, - (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error()); @@ -50,22 +49,16 @@ $post['youtube'] = $matches[2]; } - if (isset($post['files'])) + if (isset($post['files'])) { $files = json_decode($post['files']); if ($files[0]->file == 'deleted') continue; $post['file'] = $config['uri_thumb'] . $files[0]->thumb; - - if (isset($settings['use_tooltipster']) && $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; } - $required_scripts = array('js/jquery.min.js', 'js/jquery.mixitup.min.js', 'js/jquery.tooltipster.min.js', 'js/catalog.js'); + $required_scripts = array('js/jquery.min.js', 'js/jquery.mixitup.min.js', 'js/catalog.js'); foreach($required_scripts as $i => $s) { if (!in_array($s, $config['additional_javascript'])) |
