Chromium Code Reviews| Index: Source/devtools/front_end/ConsoleViewMessage.js |
| diff --git a/Source/devtools/front_end/ConsoleViewMessage.js b/Source/devtools/front_end/ConsoleViewMessage.js |
| index dddeab7444566183073b925614cb308b15d357b9..e5346dcabd3e99fe41716e09c6d4640fa9e4ae62 100644 |
| --- a/Source/devtools/front_end/ConsoleViewMessage.js |
| +++ b/Source/devtools/front_end/ConsoleViewMessage.js |
| @@ -50,6 +50,8 @@ WebInspector.ConsoleViewMessage = function(consoleMessage, linkifier) |
| "node": this._formatParameterAsNode, |
| "string": this._formatParameterAsString |
| }; |
| + |
| + WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._consoleTimestampsSettingChanged, this); |
| } |
| WebInspector.ConsoleViewMessage.prototype = { |
| @@ -843,6 +845,28 @@ WebInspector.ConsoleViewMessage.prototype = { |
| return regexObject.test(this._formattedMessageText()) || (!!this._anchorElement && regexObject.test(this._anchorElement.textContent)); |
| }, |
| + _updateTimestamp: function(show) |
| + { |
| + if (!this._element) |
| + return; |
| + |
| + if (show && !this.timestampElement) { |
| + this.timestampElement = this._element.createChild("span", "console-timestamp"); |
| + this.timestampElement.textContent = (new Date(this._message.timestamp)).toConsoleTime(); |
| + var afterRepeatCountChild = this.repeatCountElement && this.repeatCountElement.nextSibling; |
| + this._element.insertBefore(this.timestampElement, afterRepeatCountChild || this._element.firstChild); |
|
apavlov
2014/03/21 14:47:58
you can add a return; after this line, since the r
|
| + } |
| + |
| + if (!show && this.timestampElement) |
| + this.timestampElement.remove(); |
| + }, |
| + |
| + _consoleTimestampsSettingChanged: function(event) |
| + { |
| + var enabled = /** @type {boolean} */ (event.data); |
| + this._updateTimestamp(enabled); |
| + }, |
| + |
| /** |
| * @return {!Element} |
| */ |
| @@ -882,6 +906,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
| if (this._message.repeatCount > 1) |
| this.updateRepeatCount(); |
| + this._updateTimestamp(WebInspector.settings.consoleTimestampsEnabled.get()); |
| return element; |
| }, |