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..2d881eae0e4ef544aa5e0ddc95f0743162fce828 100644 |
| --- a/Source/devtools/front_end/ConsoleViewMessage.js |
| +++ b/Source/devtools/front_end/ConsoleViewMessage.js |
| @@ -50,8 +50,11 @@ WebInspector.ConsoleViewMessage = function(consoleMessage, linkifier) |
| "node": this._formatParameterAsNode, |
| "string": this._formatParameterAsString |
| }; |
| + |
| + WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._consoleTimestampsSettingChanged.bind(this)); |
|
apavlov
2014/03/21 09:30:46
WebInspector.settings.consoleTimestampsEnabled.add
|
| } |
| + |
|
apavlov
2014/03/21 09:30:46
extra line added
|
| WebInspector.ConsoleViewMessage.prototype = { |
| wasShown: function() |
| { |
| @@ -843,6 +846,31 @@ WebInspector.ConsoleViewMessage.prototype = { |
| return regexObject.test(this._formattedMessageText()) || (!!this._anchorElement && regexObject.test(this._anchorElement.textContent)); |
| }, |
| + _updateTimestamp: function(show) |
| + { |
| + if (!this._element) |
| + return; |
| + |
| + if (!this.timestampElement) { |
|
apavlov
2014/03/21 09:30:46
don't we want the timestampElements to be lazily c
|
| + this.timestampElement = this._element.createChild("span", "console-timestamp"); |
| + this._element.insertBefore(this.timestampElement, this._element.firstChild); |
| + } |
| + |
| + if (show) { |
| + this.timestampElement.textContent = (new Date(this._message.timestamp)).toConsoleTime(); |
| + this.timestampElement.classList.remove("hidden"); |
| + } else { |
| + this.timestampElement.textContent = ""; |
|
apavlov
2014/03/21 09:30:46
...and removed when no longer needed?
That can sa
|
| + this.timestampElement.classList.add("hidden"); |
| + } |
| + }, |
| + |
| + _consoleTimestampsSettingChanged: function(event) |
| + { |
| + var enabled = /** @type {boolean} */ (event.data); |
| + this._updateTimestamp(enabled); |
| + }, |
| + |
| /** |
| * @return {!Element} |
| */ |
| @@ -882,6 +910,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
| if (this._message.repeatCount > 1) |
| this.updateRepeatCount(); |
| + this._updateTimestamp(WebInspector.settings.consoleTimestampsEnabled.get()); |
| return element; |
| }, |