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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/platform/utilities.js

Issue 2651843003: DevTools: update console timestamp style (Closed)
Patch Set: nochange Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 * @param {number} x 397 * @param {number} x
398 * @return {string} 398 * @return {string}
399 */ 399 */
400 function leadZero(x) { 400 function leadZero(x) {
401 return (x > 9 ? '' : '0') + x; 401 return (x > 9 ? '' : '0') + x;
402 } 402 }
403 return this.getFullYear() + leadZero(this.getMonth() + 1) + leadZero(this.getD ate()) + 'T' + 403 return this.getFullYear() + leadZero(this.getMonth() + 1) + leadZero(this.getD ate()) + 'T' +
404 leadZero(this.getHours()) + leadZero(this.getMinutes()) + leadZero(this.ge tSeconds()); 404 leadZero(this.getHours()) + leadZero(this.getMinutes()) + leadZero(this.ge tSeconds());
405 }; 405 };
406 406
407 /**
408 * @return {string}
409 */
410 Date.prototype.toConsoleTime = function() {
411 /**
412 * @param {number} x
413 * @return {string}
414 */
415 function leadZero2(x) {
416 return (x > 9 ? '' : '0') + x;
417 }
418
419 /**
420 * @param {number} x
421 * @return {string}
422 */
423 function leadZero3(x) {
424 return '0'.repeat(3 - x.toString().length) + x;
425 }
426
427 return this.getFullYear() + '-' + leadZero2(this.getMonth() + 1) + '-' + leadZ ero2(this.getDate()) + ' ' +
428 leadZero2(this.getHours()) + ':' + leadZero2(this.getMinutes()) + ':' + le adZero2(this.getSeconds()) + '.' +
429 leadZero3(this.getMilliseconds());
430 };
431
432 Object.defineProperty(Array.prototype, 'remove', { 407 Object.defineProperty(Array.prototype, 'remove', {
433 /** 408 /**
434 * @param {!T} value 409 * @param {!T} value
435 * @param {boolean=} firstOnly 410 * @param {boolean=} firstOnly
436 * @return {boolean} 411 * @return {boolean}
437 * @this {Array.<!T>} 412 * @this {Array.<!T>}
438 * @template T 413 * @template T
439 */ 414 */
440 value: function(value, firstOnly) { 415 value: function(value, firstOnly) {
441 var index = this.indexOf(value); 416 var index = this.indexOf(value);
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 function windowLoaded() { 1429 function windowLoaded() {
1455 self.removeEventListener('DOMContentLoaded', windowLoaded, false); 1430 self.removeEventListener('DOMContentLoaded', windowLoaded, false);
1456 callback(); 1431 callback();
1457 } 1432 }
1458 1433
1459 if (document.readyState === 'complete' || document.readyState === 'interactive ') 1434 if (document.readyState === 'complete' || document.readyState === 'interactive ')
1460 callback(); 1435 callback();
1461 else 1436 else
1462 self.addEventListener('DOMContentLoaded', windowLoaded, false); 1437 self.addEventListener('DOMContentLoaded', windowLoaded, false);
1463 } 1438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698