Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 /** | 392 /** |
| 393 * @return {string} | 393 * @return {string} |
| 394 */ | 394 */ |
| 395 Date.prototype.toISO8601Compact = function() { | 395 Date.prototype.toISO8601Compact = function() { |
| 396 /** | 396 /** |
| 397 * @param {number} x | 397 * @param {number} x |
| 398 * @return {string} | 398 * @return {string} |
| 399 */ | 399 */ |
| 400 function leadZero(x) { | 400 function leadZero(x) { |
|
chenwilliam
2017/01/24 03:32:13
Not related to your change, but why is this called
luoe
2017/01/24 23:16:19
Doesn't seem to have a good reason. I left this o
| |
| 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 /** | 407 /** |
| 408 * @return {string} | 408 * @return {!Object<string, string>} |
| 409 */ | 409 */ |
| 410 Date.prototype.toConsoleTime = function() { | 410 Date.prototype.toConsoleTime = function() { |
|
chenwilliam
2017/01/24 03:32:13
I would just remove this method and create a utili
luoe
2017/01/24 23:16:19
No other need right now. Moved inline into Consol
| |
| 411 /** | 411 /** |
| 412 * @param {number} x | 412 * @param {number} x |
| 413 * @return {string} | 413 * @return {string} |
| 414 */ | 414 */ |
| 415 function leadZero2(x) { | 415 function leadZero2(x) { |
| 416 return (x > 9 ? '' : '0') + x; | 416 return (x > 9 ? '' : '0') + x; |
| 417 } | 417 } |
| 418 | 418 |
| 419 /** | 419 /** |
| 420 * @param {number} x | 420 * @param {number} x |
| 421 * @return {string} | 421 * @return {string} |
| 422 */ | 422 */ |
| 423 function leadZero3(x) { | 423 function leadZero3(x) { |
| 424 return '0'.repeat(3 - x.toString().length) + x; | 424 return '0'.repeat(3 - x.toString().length) + x; |
| 425 } | 425 } |
| 426 | 426 |
| 427 return this.getFullYear() + '-' + leadZero2(this.getMonth() + 1) + '-' + leadZ ero2(this.getDate()) + ' ' + | 427 var yearMonthDay = this.getFullYear() + '-' + leadZero2(this.getMonth() + 1) + '-' + leadZero2(this.getDate()); |
| 428 leadZero2(this.getHours()) + ':' + leadZero2(this.getMinutes()) + ':' + le adZero2(this.getSeconds()) + '.' + | 428 var hourMinuteSecond = leadZero2(this.getHours()) + ':' + leadZero2(this.getMi nutes()) + ':' + |
| 429 leadZero3(this.getMilliseconds()); | 429 leadZero2(this.getSeconds()) + '.' + leadZero3(this.getMilliseconds()); |
| 430 return {yearMonthDay: yearMonthDay, hourMinuteSecond: hourMinuteSecond}; | |
| 430 }; | 431 }; |
| 431 | 432 |
| 432 Object.defineProperty(Array.prototype, 'remove', { | 433 Object.defineProperty(Array.prototype, 'remove', { |
| 433 /** | 434 /** |
| 434 * @param {!T} value | 435 * @param {!T} value |
| 435 * @param {boolean=} firstOnly | 436 * @param {boolean=} firstOnly |
| 436 * @return {boolean} | 437 * @return {boolean} |
| 437 * @this {Array.<!T>} | 438 * @this {Array.<!T>} |
| 438 * @template T | 439 * @template T |
| 439 */ | 440 */ |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1454 function windowLoaded() { | 1455 function windowLoaded() { |
| 1455 self.removeEventListener('DOMContentLoaded', windowLoaded, false); | 1456 self.removeEventListener('DOMContentLoaded', windowLoaded, false); |
| 1456 callback(); | 1457 callback(); |
| 1457 } | 1458 } |
| 1458 | 1459 |
| 1459 if (document.readyState === 'complete' || document.readyState === 'interactive ') | 1460 if (document.readyState === 'complete' || document.readyState === 'interactive ') |
| 1460 callback(); | 1461 callback(); |
| 1461 else | 1462 else |
| 1462 self.addEventListener('DOMContentLoaded', windowLoaded, false); | 1463 self.addEventListener('DOMContentLoaded', windowLoaded, false); |
| 1463 } | 1464 } |
| OLD | NEW |