From 38bf3276e4ffd4b82c4a7bc9eb8e1cf692147bb2 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 5 May 2016 09:39:23 +0200 Subject: update copyright years; remove a link to tinyboard (website is dead) --- templates/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index fc3ded76..41e4867d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -76,10 +76,10 @@ {{ config.ad.bottom }} -- cgit v1.3 From 02c3c28a16127511a785e428547f8a4dc60abaf7 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 5 May 2016 14:38:24 +0200 Subject: main.js: a bit more sane code --- js/thread-watcher.js | 4 ++-- templates/index.html | 6 ++++-- templates/main.js | 11 ++++------- templates/page.html | 2 +- templates/themes/catalog/catalog.html | 3 ++- templates/thread.html | 4 +++- 6 files changed, 16 insertions(+), 14 deletions(-) (limited to 'templates/index.html') diff --git a/js/thread-watcher.js b/js/thread-watcher.js index 960aa59f..c31a6e74 100644 --- a/js/thread-watcher.js +++ b/js/thread-watcher.js @@ -79,8 +79,8 @@ watchlist.add = function(sel) { } else { postCount = $(sel).parents('.op').siblings('.post').length+1; } - //Grab the reply link. - var threadLink = $(sel).siblings('a:contains("['+_('Reply')+']")').attr('href'); + //Grab the reply link.; + var threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href'); //Figure out the thread name. If anon, use the thread id. if ($(sel).parent().find('.subject').length) { threadName = $(sel).parent().find('.subject').text().substring(0,20); diff --git a/templates/index.html b/templates/index.html index 41e4867d..d4c56707 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,10 +4,12 @@ diff --git a/templates/main.js b/templates/main.js index 7e3b2dc1..c2a6f6c0 100644 --- a/templates/main.js +++ b/templates/main.js @@ -115,7 +115,10 @@ var styles = { {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}', {% endraw %}{% endfor %}{% raw %} }; -var board_name = false; + +if (typeof board_name === 'undefined') { + var board_name = false; +} function changeStyle(styleName, link) { {% endraw %} @@ -159,13 +162,7 @@ function changeStyle(styleName, link) { {% endraw %} {% if config.stylesheets_board %} - {# This is such an unacceptable mess. There needs to be an easier way. #} - {# Needs fix for slugify #} - var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/); {% raw %} - if (matches) { - board_name = matches[1]; - } if (!localStorage.board_stylesheets) { localStorage.board_stylesheets = '{}'; diff --git a/templates/page.html b/templates/page.html index 3522702f..816bb72b 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,7 +3,7 @@ {% include 'header.html' %} {{ title }} diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 1011fdaf..1f5e8b05 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -4,7 +4,8 @@ {% include 'header.html' %} {{ settings.title }} diff --git a/templates/thread.html b/templates/thread.html index b7bb5f6b..506b9cc2 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -4,7 +4,9 @@ {% include 'header.html' %} -- cgit v1.3 From 293543878a10e1ef93990acb373f8f22ca655f64 Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 6 May 2016 12:10:50 +0200 Subject: backport parts of 2d6d449bd2d72, in particular html classes --- stylesheets/style.css | 2 +- templates/generic_page.html | 2 +- templates/index.html | 2 +- templates/page.html | 2 +- templates/post_thread.html | 2 +- templates/themes/basic/index.html | 2 +- templates/thread.html | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'templates/index.html') diff --git a/stylesheets/style.css b/stylesheets/style.css index 6b4b19d9..2c5663bd 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -666,7 +666,7 @@ pre { margin-left: -20px; } -div.thread:hover { +.theme-catalog div.thread:hover { background: #D6DAF0; border-color: #B7C5D9; } diff --git a/templates/generic_page.html b/templates/generic_page.html index 35b58df3..fbfc3c50 100644 --- a/templates/generic_page.html +++ b/templates/generic_page.html @@ -6,7 +6,7 @@ {{ board.url }} - {{ board.name }} {% endblock %} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} {% if config.url_banner %}{% endif %} diff --git a/templates/index.html b/templates/index.html index d4c56707..1eea6e6b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -16,7 +16,7 @@ {% include 'header.html' %} {{ board.url }} - {{ board.title|e }} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} diff --git a/templates/page.html b/templates/page.html index 816bb72b..296b517e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -8,7 +8,7 @@ {% include 'header.html' %} {{ title }} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} diff --git a/templates/post_thread.html b/templates/post_thread.html index 61146491..72ca2998 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -1,7 +1,7 @@ {% filter remove_whitespace %} {# tabs and new lines will be ignored #} -
+
{% if not index %}{% endif %} {% include 'post/fileinfo.html' %} diff --git a/templates/themes/basic/index.html b/templates/themes/basic/index.html index 8cdaf182..9d7a2c41 100644 --- a/templates/themes/basic/index.html +++ b/templates/themes/basic/index.html @@ -11,7 +11,7 @@ {% if config.default_stylesheet.1 != '' %}{% endif %} {% if config.font_awesome %}{% endif %} - + {{ boardlist.top }}

{{ settings.title }}

diff --git a/templates/thread.html b/templates/thread.html index c909f843..425394bb 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -12,7 +12,7 @@ {% include 'header.html' %} {{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} {% if config.url_banner %}{% endif %} -- cgit v1.3 From 33ef1d2123749db43bba372cbc0aa7ab3df4839a Mon Sep 17 00:00:00 2001 From: Bui Date: Sat, 26 Sep 2015 00:17:05 +0900 Subject: add active page classes to body; czaks: go to bottom @ thread: fixes --- templates/index.html | 2 +- templates/page.html | 2 +- templates/themes/catalog/catalog.html | 2 +- templates/thread.html | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index 1eea6e6b..d1871fc8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -16,7 +16,7 @@ {% include 'header.html' %} {{ board.url }} - {{ board.title|e }} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} diff --git a/templates/page.html b/templates/page.html index 296b517e..027ed3b9 100644 --- a/templates/page.html +++ b/templates/page.html @@ -8,7 +8,7 @@ {% include 'header.html' %} {{ title }} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 226c00d3..0626b376 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -10,7 +10,7 @@ {% include 'header.html' %} {{ board }} - Catalog - + {{ boardlist.top }}

{{ settings.title }} (/{{ board }}/)

diff --git a/templates/thread.html b/templates/thread.html index 1cbb6d20..2d4ae262 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -23,7 +23,7 @@ {{ board.url }} - {{ meta_subject }} - + {{ boardlist.top }} {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} @@ -44,8 +44,7 @@ {% include 'attention_bar.html' %} - + {{ config.ad.top }} @@ -53,9 +52,6 @@ {% if config.global_message %}
{{ config.global_message }}
{% endif %}
- [{% trans %}Return{% endtrans %}] - [{% trans %}Go to bottom{% endtrans %}] -
{% if mod %}{% endif %} -- cgit v1.3 From 3571670b98b2e6293e429f3e629510ab9f38e70a Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 6 May 2016 16:51:34 +0200 Subject: fix catalog link someone? --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index d1871fc8..1be614e3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -69,7 +69,7 @@ [{{ page.num }}]{% if loop.last %} {% endif %} {% endfor %} {{ btn.next }} {% if config.catalog_link %} - | Catalog + | {% trans %}Catalog{% endtrans %} {% endif %}
-- cgit v1.3 From 31b69902bbfdccffd0ed7ba32f04aaf1479d41b7 Mon Sep 17 00:00:00 2001 From: Benjamin Southall Date: Fri, 23 Sep 2016 22:38:24 +0900 Subject: Add catalog support to all of rand, semi,rand and ukko themes --- templates/index.html | 9 +++++-- templates/themes/catalog/info.php | 7 ++++++ templates/themes/catalog/theme.php | 47 +++++++++++++++++++++++++++++++++++++ templates/themes/rand/theme.php | 1 + templates/themes/semirand/theme.php | 1 + templates/themes/ukko/theme.php | 1 + 6 files changed, 64 insertions(+), 2 deletions(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index 1878d455..2241b13c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -58,6 +58,11 @@ {% if config.global_message %}
{{ config.global_message }}
{% endif %}
+ {% if config.catalog_link %} + | Catalog + {% endif %} +
+ {% if mod %}{% endif %} @@ -72,8 +77,8 @@ vichan + lainchan {{ config.version }} -
Tinyboard Copyright © 2010-2014 Tinyboard Development Group -
vichan Copyright © 2012-2015 vichan-devel -
lainchan Copyright © 2014-2015 lainchan Administration

+
vichan Copyright © 2012-2016 vichan-devel +
lainchan Copyright © 2014-2016 lainchan Administration

{% for footer in config.footer %}

{{ footer }}

{% endfor %} diff --git a/templates/themes/catalog/info.php b/templates/themes/catalog/info.php index e2b13307..66c45082 100644 --- a/templates/themes/catalog/info.php +++ b/templates/themes/catalog/info.php @@ -46,6 +46,13 @@ 'comment' => 'Enable catalog for the Ukko theme. This requires the Ukko theme to be enabled.' ); + $theme['config'][] = Array( + 'title' => 'Enable Rand catalog', + 'name' => 'enable_rand', + 'type' => 'checkbox', + 'default' => false, + 'comment' => 'Enable catalog for the Rand theme. This requires the Rand theme to be enabled.' + ); $theme['config'][] = Array( 'title' => 'Use tooltipster', 'name' => 'use_tooltipster', diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 9ecdb9d1..1199b54a 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -40,6 +40,14 @@ { $b->buildUkko(); } + + // FIXME: Check that Rand is actually enabled + if ($settings['enable_rand'] && ( + $action === 'all' || $action === 'post' || + $action === 'post-thread' || $action === 'post-delete')) + { + $b->buildRand(); + } } // Wrap functions in a class so they don't interfere with normal Tinyboard operations @@ -90,6 +98,45 @@ $this->saveForBoard($ukkoSettings['uri'], $recent_posts, $config['root'] . $ukkoSettings['uri']); } + + /** + * Build and save the HTML of the catalog for the Rand theme + */ + public function buildRand() { + global $config; + + $randSettings = themeSettings('rand'); + $queries = array(); + $threads = array(); + + $exclusions = explode(' ', $randSettings['exclude']); + $boards = array_diff(listBoards(true), $exclusions); + + foreach ($boards as $b) { + if (array_key_exists($b, $this->threadsCache)) { + $threads = array_merge($threads, $this->threadsCache[$b]); + } else { + $queries[] = $this->buildThreadsQuery($b); + } + } + + // Fetch threads from boards that haven't beenp processed yet + if (!empty($queries)) { + $sql = implode(' UNION ALL ', $queries); + $res = query($sql) or error(db_error()); + $threads = array_merge($threads, $res->fetchAll(PDO::FETCH_ASSOC)); + } + + // Sort in bump order + usort($threads, function($a, $b) { + return strcmp($b['bump'], $a['bump']); + }); + // Generate data for the template + $recent_posts = $this->generateRecentPosts($threads); + + $this->saveForBoard($randSettings['uri'], $recent_posts, + $config['root'] . $randSettings['uri']); + } /** * Build and save the HTML of the catalog for the given board diff --git a/templates/themes/rand/theme.php b/templates/themes/rand/theme.php index b4cfb4ff..e3814c4e 100644 --- a/templates/themes/rand/theme.php +++ b/templates/themes/rand/theme.php @@ -18,6 +18,7 @@ $body = ''; $overflow = array(); $board = array( + 'dir' => $this->settings['uri'] . "/", 'url' => $this->settings['uri'], 'name' => $this->settings['title'], 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit']) diff --git a/templates/themes/semirand/theme.php b/templates/themes/semirand/theme.php index 1acecbfb..e8d3e56c 100644 --- a/templates/themes/semirand/theme.php +++ b/templates/themes/semirand/theme.php @@ -225,6 +225,7 @@ return Element('index.html', array( 'config' => $config, 'board' => array( + 'dir' => $this->settings['uri'] . "/", 'url' => $this->settings['uri'], 'title' => $this->settings['title'], 'subtitle' => str_replace('%s', $this->settings['thread_limit'], diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php index 05525299..92dfb317 100644 --- a/templates/themes/ukko/theme.php +++ b/templates/themes/ukko/theme.php @@ -28,6 +28,7 @@ $body = ''; $overflow = array(); $board = array( + 'dir' => $this->settings['uri'] . "/", 'url' => $this->settings['uri'], 'uri' => $this->settings['uri'], 'name' => $this->settings['title'], -- cgit v1.3 From 243c1a3a524aaff3e60acc34890c62fe11dfcd2e Mon Sep 17 00:00:00 2001 From: Benjamin Southall Date: Tue, 13 Dec 2016 01:09:25 +0900 Subject: Removing duplicate page numbers and Catalog link from index page template --- templates/index.html | 8 -------- 1 file changed, 8 deletions(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index 52c7419b..ae9af59a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -72,14 +72,6 @@ {% include 'report_delete.html' %} -
- {{ btn.prev }} {% for page in pages %} - [{{ page.num }}]{% if loop.last %} {% endif %} - {% endfor %} {{ btn.next }} - {% if config.catalog_link %} - | {% trans %}Catalog{% endtrans %} - {% endif %} -
{{ boardlist.bottom }} -- cgit v1.3