Detect strftime year/month/day specifiers in weechat.look.buffer_time_format

Accodingly include year/month/day into our time format.
This commit is contained in:
Csaba Henk 2016-08-29 14:50:01 +02:00
parent a20a9b7dfb
commit 02a3fbb876

View file

@ -77,6 +77,10 @@ weechat.factory('connection',
);
};
var _timeDelimiter = function(delim) {
return "'<span class=\"cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters\">" + delim + "</span>'";
};
var _parseWeechatTimeFormat = function() {
// Fetch the buffer time format from weechat
var timeFormat = models.wconfig['weechat.look.buffer_time_format'];
@ -88,7 +92,7 @@ weechat.factory('connection',
// one of four formats, (short|long) (12|24)-hour time
var angularFormat = "";
var timeDelimiter = "'<span class=\"cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters\">:</span>'";
var timeDelimiter = _timeDelimiter(":");
var left12 = "hh" + timeDelimiter + "mm";
var right12 = "'&nbsp;'a";
@ -132,6 +136,19 @@ weechat.factory('connection',
angularFormat = short24;
}
if (timeFormat.indexOf("%d") > -1) {
angularFormat = "dd" + _timeDelimiter("&nbsp;") + angularFormat;
if (timeFormat.indexOf("%m") > -1) {
angularFormat = "MM" + _timeDelimiter("-") + angularFormat;
if (timeFormat.indexOf("%y") > -1) {
angularFormat = "yy" + _timeDelimiter("-") + angularFormat;
}
if (timeFormat.indexOf("%Y") > -1) {
angularFormat = "yyyy" + _timeDelimiter("-") + angularFormat;
}
}
}
$rootScope.angularTimeFormat = angularFormat;
};