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

Side by Side Diff: static/js/common/utc-to-local-time.js

Issue 17953003: Make UTC times into local times for eroman@ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-status/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | templates/main.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mime-type
+ text/javascript
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 (function(doc) {
2
3 function filter(list, predicate) {
4 var filtered = [];
5 for (var i = 0; i < list.length; ++i) {
6 if (predicate(list[i]))
7 filtered.push(list[i]);
8 }
9 return filtered;
10 }
11
12 function hasBorder(el) {
13 return !!el.border;
14 }
15
16 function elementType(node) {
17 return node.nodeType == 1; // Node.ELEMENT_NODE
18 }
19
20 var indexOf = Array.prototype.indexOf;
21 function secondKid(el) {
22 return indexOf.call(filter(el.parentNode.childNodes, elementType), el) == 1;
23 }
24
25 var on = window.attachEvent ? 'on' : '';
26 (window.addEventListener || window.attachEvent)(on + 'load', function() {
27 var tables = filter(doc.getElementsByTagName('table'), hasBorder);
28 if (!tables.length)
29 return;
30
31 var whens = filter(tables[0].getElementsByTagName('td'), secondKid).slice(1);
32 if (!whens.length)
33 return;
34
35 for (var i = 0; i < whens.length; ++i) {
36 var when = whens[i];
37 var time = new Date(when.innerText || when.textContent).toLocaleString();
38 when.textContent = when.innerText = time.replace(':00 ', '');
39 }
40 });
41
42 }(this.document));
OLDNEW
« no previous file with comments | « no previous file | templates/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698