-
-
Save danbeam/545b33c9ff3140c3678b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name UTC to local time converter | |
// @namespace utc-to-local-time-converter | |
// @description Make times on chromium-status.appspot.com easier to read. | |
// @match http://chromium-status.appspot.com/* | |
// @match https://chromium-status.appspot.com/* | |
// @version 0.1 | |
// ==/UserScript== | |
(function(document) { | |
var y = ', ' + new Date().getFullYear(); | |
var j = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | |
var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
[].forEach.call(document.querySelectorAll('table[border] td:nth-of-type(2)'), function (el, i) { | |
if (i == 0) { | |
el.width = 160; | |
} else { | |
var d, p = el.textContent.split(','); | |
p.splice(1, 0, y); | |
d = new Date(p.join('')); | |
el.textContent = j[d.getDay()] + ' ' + m[d.getMonth()] + ' ' + | |
(d.getDate() < 10 ? '0' : '') + d.getDate() + ', ' + | |
(d.getHours() > 12 ? (d.getHours() - 12 == 0 ? '12' : d.getHours() - 12) : | |
(d.getHours() == 0 ? '12' : d.getHours())) + | |
':' + (d.getMinutes() < 10 ? '0' : '') + d.getMinutes() + ' ' + | |
(d.getHours() > 12 ? 'p' : 'a') + 'm'; | |
} | |
}); | |
}(unsafeWindow.document)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment