mirror of
https://github.com/Circlepuller/Tinyboard.git
synced 2025-01-17 13:28:31 +01:00
Added jQuery plugin tablesorter and data attrs
This commit is contained in:
parent
b2040b1bfc
commit
9cfd6daba0
@ -996,6 +996,7 @@
|
||||
// Additional Javascript files to include on board index and thread pages. See js/ for available scripts.
|
||||
$config['additional_javascript'][] = 'js/jquery.min.js';
|
||||
$config['additional_javascript'][] = 'js/jquery-migrate-3.0.0.min.js';
|
||||
$config['additional_javascript'][] = 'js/jquery.tablesorter.min.js';
|
||||
$config['additional_javascript'][] = 'js/inline-expanding.js';
|
||||
// $config['additional_javascript'][] = 'js/local-time.js';
|
||||
|
||||
@ -1011,7 +1012,7 @@
|
||||
// $config['additional_javascript'][] = 'js/style-select.js';
|
||||
|
||||
// Where these script files are located on the web. Defaults to $config['root'].
|
||||
// $config['additional_javascript_url'] = 'http://static.example.org/tinyboard-javascript-stuff/';
|
||||
// $config['url_additional_javascript'] = 'http://static.example.org/tinyboard-javascript-stuff/';
|
||||
|
||||
// Compile all additional scripts into one file ($config['file_script']) instead of including them seperately.
|
||||
$config['additional_javascript_compile'] = false;
|
||||
|
@ -233,8 +233,8 @@ function loadConfig() {
|
||||
$config['url_stylesheet'] = $config['uri_stylesheets'] . 'style.css';
|
||||
if (!isset($config['url_javascript']))
|
||||
$config['url_javascript'] = $config['root'] . $config['file_script'];
|
||||
if (!isset($config['additional_javascript_url']))
|
||||
$config['additional_javascript_url'] = $config['root'];
|
||||
if (!isset($config['url_additional_javascript']))
|
||||
$config['url_additional_javascript'] = $config['root'];
|
||||
if (!isset($config['uri_flags']))
|
||||
$config['uri_flags'] = $config['root'] . 'static/flags/%s.png';
|
||||
if (!isset($config['user_flag']))
|
||||
|
1
js/jquery.tablesorter.min.js
vendored
Normal file
1
js/jquery.tablesorter.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@
|
||||
{% if not nojavascript %}
|
||||
<script src="{{ config.url_javascript }}"></script>
|
||||
{% if not config.additional_javascript_compile %}
|
||||
{% for javascript in config.additional_javascript %}<script src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
||||
{% for javascript in config.additional_javascript %}<script src="{{ config.url_additional_javascript }}{{ javascript }}"></script>{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.recaptcha %}<script src="//www.google.com/recaptcha/api.js"></script>
|
||||
|
@ -41,28 +41,27 @@
|
||||
<em>{% trans 'all boards' %}</em>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="white-space: nowrap">
|
||||
<td style="white-space: nowrap" data-sort-value="{{ ban.created }}">
|
||||
<span title="{{ ban.created|date(config.post_date) }}">
|
||||
{{ ban.created|ago }} ago
|
||||
</span>
|
||||
</td>
|
||||
<td style="white-space: nowrap">
|
||||
{% if ban.expires == 0 %}
|
||||
-
|
||||
{% else %}
|
||||
{{ (ban.expires - ban.created + time()) | until }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="white-space: nowrap">-</td>
|
||||
<td style="white-space: nowrap">
|
||||
{% if ban.expires == 0 %}
|
||||
<em>{% trans 'never' %}</em>
|
||||
</td>
|
||||
{% else %}
|
||||
<td style="white-space: nowrap" data-sort-value="{{ ban.expires - ban.created + time() }}">
|
||||
{{ (ban.expires - ban.created + time())|until }}
|
||||
</td>
|
||||
<td style="white-space: nowrap" data-sort-value="{{ ban.expires }}">
|
||||
{{ ban.expires|date(config.post_date) }}
|
||||
{% if ban.expires > time() %}
|
||||
<small>(in {{ ban.expires|until }})</small>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if ban.seen %}
|
||||
{% trans 'Yes' %}
|
||||
@ -91,13 +90,25 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
if (typeof $ !== 'undefined' && $.tablesorter)
|
||||
$('table.mod').tablesorter({
|
||||
textExtraction: (node) => {
|
||||
let attr = $(node).data('sort-value');
|
||||
|
||||
if (typeof attr !== 'undefined' && attr !== false)
|
||||
return attr;
|
||||
|
||||
return $(node).text();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<p style="text-align:center">
|
||||
<input type="submit" name="unban" value="{% trans 'Unban selected' %}">
|
||||
</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if count > bans|length %}
|
||||
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
||||
{% for i in range(0, (count - 1) / config.mod.modlog_page) %}
|
||||
|
@ -35,7 +35,7 @@
|
||||
<em>hidden</em>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="minimal">
|
||||
<td class="minimal" data-sort-value="{{ log.time }}">
|
||||
<span title="{{ log.time|date(config.post_date) }}">{{ log.time|ago }}</span>
|
||||
</td>
|
||||
<td class="minimal">
|
||||
@ -52,6 +52,19 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
if (typeof $ !== 'undefined' && $.tablesorter)
|
||||
$('table.mod').tablesorter({
|
||||
textExtraction: (node) => {
|
||||
let attr = $(node).data('sort-value');
|
||||
|
||||
if (typeof attr !== 'undefined' && attr !== false)
|
||||
return attr;
|
||||
|
||||
return $(node).text();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{% if count > logs|length %}
|
||||
<p class="unimportant" style="text-align:center;word-wrap:break-word">
|
||||
|
Loading…
x
Reference in New Issue
Block a user