Browse Source

Merge pull request #377 from miguelfreitas/blaster

sync with blaster
master master-1.0
miguelfreitas 7 years ago committed by GitHub
parent
commit
f4f120c234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      LICENSE
  2. 27
      js/interface_common.js
  3. 6
      js/options.js

2
LICENSE

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013-2015 Miguel Freitas, Lucas Leal and twister project developers. Copyright (c) 2013-2018 Miguel Freitas, Lucas Leal and twister project developers.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

27
js/interface_common.js

@ -19,6 +19,11 @@ var twister = {
modal: {}, modal: {},
res: {}, // reses for various reqs are cached here res: {}, // reses for various reqs are cached here
var: { var: {
dateFormatter: {
format: function (req) {
return req.toString().replace(/GMT.*/g, '');
}
},
localAccounts: [], localAccounts: [],
updatesCheckClient: {} updatesCheckClient: {}
} }
@ -406,7 +411,26 @@ function timeGmtToText(t) {
if (t == 0) return '-'; if (t == 0) return '-';
var d = new Date(0); var d = new Date(0);
d.setUTCSeconds(t); d.setUTCSeconds(t);
return d.toString().replace(/GMT.*/g, ''); return twister.var.dateFormatter.format(d);
}
function setupTimeGmtToText(lang) {
if (typeof window.Intl !== 'object' || typeof window.Intl.DateTimeFormat !== 'function')
return;
twister.var.dateFormatter = new Intl.DateTimeFormat(
knownLanguages.indexOf(lang) !== -1 ? lang : undefined,
{
hour12: false,
weekday: 'short',
year: 'numeric',
month: 'short',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
}
);
} }
function timeSincePost(t) { function timeSincePost(t) {
@ -2889,6 +2913,7 @@ function setTextcompleteDropdownListPos(position) {
} }
$(document).ready(function () { $(document).ready(function () {
setupTimeGmtToText($.Options.locLang.val);
if ($.localStorage.isSet('twistaURIs')) if ($.localStorage.isSet('twistaURIs'))
twister.URIs = $.localStorage.get('twistaURIs'); twister.URIs = $.localStorage.get('twistaURIs');
twister.html.blanka.appendTo('body').hide(); twister.html.blanka.appendTo('body').hide();

6
js/options.js

@ -7,6 +7,12 @@ function twisterOptions() {
if (elem.value !== 'auto') if (elem.value !== 'auto')
twisterRpc('setpreferredspamlang', [elem.value]); twisterRpc('setpreferredspamlang', [elem.value]);
location.reload(); location.reload();
/*
if (elem.value !== 'auto') {
setupTimeGmtToText(elem.value);
TODO redraw all timestamps
}
*/
}, },
tickNotOnInit: 1 tickNotOnInit: 1
}); });

Loading…
Cancel
Save