Skip to content

Commit

Permalink
Split date format and time format in Psi webkit themes
Browse files Browse the repository at this point in the history
Ri0n committed Oct 12, 2024
1 parent b29c1f4 commit 9ddd60f
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion themes/chatview/psi/LunnaCat_Classic/index.html
Original file line number Diff line number Diff line change
@@ -190,7 +190,7 @@
: "<div class='infmsg'>%icon%<b>*** %usertext%</b></div>",
trackbar: '<hr class="trackbar" />'
},
dateFormat : "HH:mm:ss",
timeFormat : "HH:mm:ss",
proxy : function() { //optional
if (shared.cdata.type == "settings") {
applyPsiSettings();
15 changes: 8 additions & 7 deletions themes/chatview/psi/adapter.js
Original file line number Diff line number Diff line change
@@ -79,7 +79,9 @@ function psiThemeAdapter(chat) {
session : session,
isMuc : session.isMuc,
accountId : window.srvSession.account,
dateFormat : "HH:MM:SS",
timeFormat : "HH:mm:ss",
dateFormat : "LL",
dateTimeFormat: "LL HH:mm:ss",
scroller : null,
varHandlers : {},
prevGrouppingData : null,
@@ -94,7 +96,7 @@ function psiThemeAdapter(chat) {

TemplateTimeVar : function(name, format) {
this.name = name;
this.formatter = new chat.DateTimeFormatter(format || shared.dateFormat);
this.formatter = new chat.DateTimeFormatter(format || (name == "date"? shared.dateFormat : shared.timeFormat));
},

TemplateTemplateVar : function(template_name) {
@@ -155,7 +157,9 @@ function psiThemeAdapter(chat) {
}
var t = shared.templates;
shared.chatElement = config.chatElement;
shared.timeFormat = config.timeFormat || shared.timeFormat;
shared.dateFormat = config.dateFormat || shared.dateFormat;
shared.dateTimeFormat = config.dateTimeFormat || shared.dateTimeFormat;
shared.scroller = config.scroller || new chat.WindowScroller(false);
shared.groupping = config.groupping || shared.groupping;
proxy = config.proxy;
@@ -231,11 +235,8 @@ function psiThemeAdapter(chat) {
if (this.name == "sender") { //may not be html
d = chat.util.escapeHtml(d);
} else if (d instanceof Date) {
if (this.name == "time") {
d = chat.util.dateFormat(d, shared.dateFormat);
} else { // last message date ?
d = chat.util.dateFormat(d, "LL");
}
// "date" and "time" variables use TemplateTimeVar. this is something unknown
d = chat.util.dateFormat(d, shared.dateTimeFormat);
} else if (this.name == "avatarurl") {
var url;
if (shared.cdata.local) {
4 changes: 2 additions & 2 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
@@ -56,12 +56,12 @@
messageGroupping: messageGroupping,
sys: `<div class="sysmsg" title="%time{LL}%">%message%</div>`,
sysMessageUT: `<div class="sysmsg" title="%time{LL}%">%message%<div class="usertext">%usertext%</div></div>`,
lastMsgDate: `<div class="sysmsg">%date{LL}%</div>`,
lastMsgDate: `<div class="sysmsg">%date%</div>`,
subject: shared.isMuc?
"<div class='sysmsg' title='%time{LL}%'>%message%<div class='usertext'><b>%usertext%</b></div></div>"
: "<div class='sysmsg'><b>%usertext%</b></div>",
},
dateFormat : "HH:mm",
timeFormat : "HH:mm",
proxy : function() { //optional
if (shared.cdata.type == "reactions") {
renderReactions(shared.cdata);
1 change: 0 additions & 1 deletion themes/chatview/psi/classic/index.html
Original file line number Diff line number Diff line change
@@ -105,7 +105,6 @@
: "<div class='infmsg'>%icon%<b>*** %usertext%</b></div>",
trackbar: '<hr class="trackbar" />'
},
dateFormat : "HH:mm:ss",
proxy : function() { //optional
if (shared.cdata.type == "settings") {
applyPsiSettings();
2 changes: 1 addition & 1 deletion themes/chatview/psi/new_classic/index.html
Original file line number Diff line number Diff line change
@@ -181,7 +181,7 @@

left_time: '<div class="left_time"><div>%time%</div></div>'
},
dateFormat : "HH:mm",
timeFormat : "HH:mm",
proxy : function() { //optional
if (shared.cdata.mtype == "message") {
return shared.cdata.emote && shared.templates.messageNC || null;
2 changes: 1 addition & 1 deletion themes/chatview/psi/stylized_classic/index.html
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@
: "<div class='infmsg'>%icon%<b>*** %usertext%</b></div>",
trackbar: '<hr style="height:1px; border:1px solid black; border-color:#2d2d2d #5b5b5b #5b5b5b #2d2d2d" />'
},
dateFormat : "HH:mm",
timeFormat : "HH:mm",
proxy : function() { //optional
if (shared.cdata.mtype == "message") {
return shared.cdata.emote && shared.templates.messageNC ||

0 comments on commit 9ddd60f

Please sign in to comment.