Use Date.parse() on modern browsers.
See what I did there? I implied that Firefox is the new IE and you should upgrade.
This commit is contained in:
parent
090ef475ed
commit
eba2ef90c9
@ -2196,16 +2196,20 @@
|
||||
return g.callbacks.push(Time.node);
|
||||
},
|
||||
node: function(root) {
|
||||
var day, hour, min, month, node, posttime, time, year, _, _ref;
|
||||
var day, hour, min, month, node, parse, posttime, time, year, _, _ref;
|
||||
if (root.className === 'inline') {
|
||||
return;
|
||||
}
|
||||
node = (posttime = $('.posttime', root)) ? posttime : $('span[id]', root).previousSibling;
|
||||
_ref = node.textContent.match(/(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/), _ = _ref[0], month = _ref[1], day = _ref[2], year = _ref[3], hour = _ref[4], min = _ref[5];
|
||||
year = "20" + year;
|
||||
month -= 1;
|
||||
hour = g.chanOffset + Number(hour);
|
||||
Time.date = new Date(year, month, day, hour, min);
|
||||
if (parse = Date.parse(node.textContent)) {
|
||||
Time.date = new Date(parse + g.chanOffset * HOUR);
|
||||
} else {
|
||||
_ref = node.textContent.match(/(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/), _ = _ref[0], month = _ref[1], day = _ref[2], year = _ref[3], hour = _ref[4], min = _ref[5];
|
||||
year = "20" + year;
|
||||
month -= 1;
|
||||
hour = g.chanOffset + Number(hour);
|
||||
Time.date = new Date(year, month, day, hour, min);
|
||||
}
|
||||
time = $.el('time', {
|
||||
textContent: ' ' + Time.funk(Time) + ' '
|
||||
});
|
||||
|
||||
@ -1663,13 +1663,16 @@ Time =
|
||||
node: (root) ->
|
||||
return if root.className is 'inline'
|
||||
node = if posttime = $('.posttime', root) then posttime else $('span[id]', root).previousSibling
|
||||
[_, month, day, year, hour, min] =
|
||||
node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/
|
||||
year = "20#{year}"
|
||||
month -= 1 #months start at 0
|
||||
hour = g.chanOffset + Number hour
|
||||
Time.date = new Date year, month, day, hour, min
|
||||
#XXX /b/ will have seconds cut off
|
||||
if parse = Date.parse node.textContent
|
||||
Time.date = new Date parse + g.chanOffset*HOUR
|
||||
else # Firefox the Archaic cannot parse 4chan's time
|
||||
[_, month, day, year, hour, min] =
|
||||
node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/
|
||||
year = "20#{year}"
|
||||
month -= 1 #months start at 0
|
||||
hour = g.chanOffset + Number hour
|
||||
Time.date = new Date year, month, day, hour, min
|
||||
#XXX /b/ will have seconds cut off
|
||||
|
||||
time = $.el 'time',
|
||||
textContent: ' ' + Time.funk(Time) + ' '
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user