Merge branch 'master' of github.com:aeosynth/4chan-x
This commit is contained in:
commit
d95764e87a
@ -2193,19 +2193,25 @@
|
||||
Time = {
|
||||
init: function() {
|
||||
Time.foo();
|
||||
this.parse = Date.parse('10/11/11(Tue)18:53') ? function(node) {
|
||||
return new Date(Date.parse(node.textContent) + g.chanOffset * HOUR);
|
||||
} : function(node) {
|
||||
var day, hour, min, month, year, _, _ref;
|
||||
_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);
|
||||
return new Date(year, month, day, hour, min);
|
||||
};
|
||||
return g.callbacks.push(Time.node);
|
||||
},
|
||||
node: function(root) {
|
||||
var day, hour, min, month, node, posttime, time, year, _, _ref;
|
||||
var node, posttime, time;
|
||||
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);
|
||||
Time.date = Time.parse(node);
|
||||
time = $.el('time', {
|
||||
textContent: ' ' + Time.funk(Time) + ' '
|
||||
});
|
||||
|
||||
@ -1659,18 +1659,24 @@ revealSpoilers =
|
||||
Time =
|
||||
init: ->
|
||||
Time.foo()
|
||||
|
||||
@parse =
|
||||
if Date.parse '10/11/11(Tue)18:53'
|
||||
(node) -> new Date Date.parse(node.textContent) + g.chanOffset*HOUR
|
||||
else # Firefox the Archaic cannot parse 4chan's time
|
||||
(node) ->
|
||||
[_, 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
|
||||
new Date year, month, day, hour, min
|
||||
|
||||
g.callbacks.push Time.node
|
||||
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
|
||||
|
||||
Time.date = Time.parse node
|
||||
time = $.el 'time',
|
||||
textContent: ' ' + Time.funk(Time) + ' '
|
||||
$.replace node, time
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user