Differential D2483 Diff 10778 binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* This class wraps a string with a timestamp dating to when the message was sent. | |||||
*/ | |||||
class TimestampWrapper | |||||
{ | |||||
constructor() | |||||
{ | |||||
this.timeArgs = {}; | |||||
this.timestampArgs = {}; | |||||
} | |||||
format(text) | |||||
{ | |||||
this.timeArgs.time = | |||||
Engine.FormatMillisecondsIntoDateStringLocal(Date.now(), this.TimeFormat); | |||||
this.timestampArgs.time = sprintf(this.TimestampFormat, this.timeArgs), | |||||
this.timestampArgs.message = text; | |||||
return sprintf(this.TimestampedMessageFormat, this.timestampArgs); | |||||
} | |||||
} | |||||
TimestampWrapper.prototype.TimestampedMessageFormat = | |||||
translate("%(time)s %(message)s"); | |||||
TimestampWrapper.prototype.TimestampFormat = | |||||
translate("\\[%(time)s]"); | |||||
TimestampWrapper.prototype.TimeFormat = | |||||
translate("HH:mm"); |
Wildfire Games · Phabricator