Moved $config['local_time'] to Tinyboard-Tools (local-time.js)
This commit is contained in:
parent
1769de4cdc
commit
14a2f97323
|
@ -464,9 +464,6 @@
|
||||||
// http://www.php.net/manual/en/function.strftime.php
|
// http://www.php.net/manual/en/function.strftime.php
|
||||||
$config['post_date'] = '%m/%d/%y (%a) %H:%M:%S';
|
$config['post_date'] = '%m/%d/%y (%a) %H:%M:%S';
|
||||||
|
|
||||||
// Automatically convert all post times to users' local time using Javascript.
|
|
||||||
$config['javascript_local_time'] = false;
|
|
||||||
|
|
||||||
// Same as above, but used for "you are banned' pages.
|
// Same as above, but used for "you are banned' pages.
|
||||||
$config['ban_date'] = '%A %e %B, %Y';
|
$config['ban_date'] = '%A %e %B, %Y';
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,6 @@
|
||||||
<input type="hidden" name="board" value="{{ board.uri }}" />
|
<input type="hidden" name="board" value="{{ board.uri }}" />
|
||||||
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
|
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
|
||||||
{{ body }}
|
{{ body }}
|
||||||
|
|
||||||
{% if config.javascript_local_time %}
|
|
||||||
<script>{% raw %}init_localtime();{% endraw %}</script>
|
|
||||||
{% endif %}
|
|
||||||
{% include 'report_delete.html' %}
|
{% include 'report_delete.html' %}
|
||||||
</form>
|
</form>
|
||||||
<div class="pages">{{ btn.prev }} {% for page in pages %}
|
<div class="pages">{{ btn.prev }} {% for page in pages %}
|
||||||
|
|
|
@ -168,41 +168,6 @@ function init_expanding() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endraw %}
|
|
||||||
{% if config.javascript_local_time %}
|
|
||||||
{% raw %}
|
|
||||||
function init_localtime(){
|
|
||||||
var iso8601 = function iso8601(s) {
|
|
||||||
s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
|
|
||||||
s = s.replace(/-/,"/").replace(/-/,"/");
|
|
||||||
s = s.replace(/T/," ").replace(/Z/," UTC");
|
|
||||||
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
|
|
||||||
return new Date(s);
|
|
||||||
};
|
|
||||||
var zeropad = function(num, count) {
|
|
||||||
return [Math.pow(10, count - num.toString().length), num].join('').substr(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
var times = document.getElementsByTagName('time');
|
|
||||||
for (var i = 0; i < times.length ; i++) {
|
|
||||||
if(!times[i].textContent.match(/^\d+\/\d+\/\d+ \(\w+\) \d+:\d+:\d+$/)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var t = iso8601(times[i].getAttribute('datetime'));
|
|
||||||
|
|
||||||
times[i].textContent =
|
|
||||||
// date
|
|
||||||
zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) +
|
|
||||||
" (" + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][t.getDay()] + ") " +
|
|
||||||
// time
|
|
||||||
zeropad(t.getHours(), 2) + ":" + zeropad(t.getMinutes(), 2) + ":" + zeropad(t.getSeconds(), 2);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
{% endraw %}
|
|
||||||
{% endif %}
|
|
||||||
{% raw %}
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
newElement = document.createElement('div');
|
newElement = document.createElement('div');
|
||||||
newElement.className = 'styles';
|
newElement.className = 'styles';
|
||||||
|
|
|
@ -48,9 +48,6 @@
|
||||||
<input type="hidden" name="board" value="{{ board.uri }}" />
|
<input type="hidden" name="board" value="{{ board.uri }}" />
|
||||||
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
|
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
|
||||||
{{ body }}
|
{{ body }}
|
||||||
{% if config.javascript_local_time %}
|
|
||||||
<script>{% raw %}init_localtime();{% endraw %}</script>
|
|
||||||
{% endif %}
|
|
||||||
{% include 'report_delete.html' %}
|
{% include 'report_delete.html' %}
|
||||||
</form>
|
</form>
|
||||||
<a href="{{ return }}">[{% trans %}Return{% endtrans %}]</a>
|
<a href="{{ return }}">[{% trans %}Return{% endtrans %}]</a>
|
||||||
|
|
Loading…
Reference in New Issue