Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 2651843003: DevTools: update console timestamp style (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
index 368bce0f601c397bd11c32bc910e31eaa0b388a2..ffe187b280ba0be24d28c8b55f2dd457484cb82f 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -816,20 +816,24 @@ Console.ConsoleViewMessage = class {
}
/**
- * @param {boolean} show
+ * @param {!Console.ConsoleViewMessage.TimestampFormat} format
*/
- updateTimestamp(show) {
+ updateTimestamp(format) {
if (!this._contentElement)
return;
- if (show && !this.timestampElement) {
- this.timestampElement = createElementWithClass('span', 'console-timestamp');
- this.timestampElement.textContent = (new Date(this._message.timestamp)).toConsoleTime() + ' ';
+ var show = format !== Console.ConsoleViewMessage.TimestampFormat.None;
+ if (show) {
+ var timestamp = (new Date(this._message.timestamp)).toConsoleTime();
chenwilliam 2017/01/24 03:32:13 Instead of extending the Date prototype... you can
luoe 2017/01/24 23:16:19 Done.
+ var timestampText = timestamp.hourMinuteSecond;
+ if (format === Console.ConsoleViewMessage.TimestampFormat.Full)
+ timestampText = timestamp.yearMonthDay + ' ' + timestampText;
+ if (!this.timestampElement)
+ this.timestampElement = createElementWithClass('span', 'console-timestamp');
+ this.timestampElement.textContent = timestampText + ' ';
+ this.timestampElement.title = timestampText;
this._contentElement.insertBefore(this.timestampElement, this._contentElement.firstChild);
- return;
- }
-
- if (!show && this.timestampElement) {
+ } else if (!show && this.timestampElement) {
this.timestampElement.remove();
delete this.timestampElement;
}
@@ -895,7 +899,7 @@ Console.ConsoleViewMessage = class {
formattedMessage = this._buildMessage(consoleMessage);
contentElement.appendChild(formattedMessage);
- this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get());
+ this.updateTimestamp(Common.moduleSetting('consoleTimestampFormat').get());
return this._contentElement;
}
@@ -983,6 +987,8 @@ Console.ConsoleViewMessage = class {
return;
this._repeatCountElement.remove();
+ if (this._contentElement)
+ this._contentElement.classList.remove('repeated-message');
delete this._repeatCountElement;
}
@@ -1169,6 +1175,15 @@ Console.ConsoleViewMessage = class {
};
/**
+ * @enum {string}
+ */
+Console.ConsoleViewMessage.TimestampFormat = {
+ None: 'none',
+ Full: 'full',
+ Short: 'short'
+};
+
+/**
* @unrestricted
*/
Console.ConsoleGroupViewMessage = class extends Console.ConsoleViewMessage {

Powered by Google App Engine
This is Rietveld 408576698