explicit Time.node

This commit is contained in:
James Campos 2011-06-16 11:40:14 -07:00
parent fcff8bc70a
commit 34c37c719a
2 changed files with 30 additions and 29 deletions

View File

@ -1705,22 +1705,23 @@
Time = {
init: function() {
Time.foo();
return g.callbacks.push(function(root) {
var day, hour, min, month, s, time, year, _, _ref;
if (root.className === 'inline') {
return;
}
s = $('span[id^=no]', root).previousSibling;
_ref = s.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) + ' '
});
return $.replace(s, time);
return g.callbacks.push(Time.node);
},
node: function(root) {
var day, hour, min, month, s, time, year, _, _ref;
if (root.className === 'inline') {
return;
}
s = $('span[id^=no]', root).previousSibling;
_ref = s.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) + ' '
});
return $.replace(s, time);
},
foo: function() {
var code;

View File

@ -1364,21 +1364,21 @@ sauce =
Time =
init: ->
Time.foo()
g.callbacks.push (root) ->
return if root.className is 'inline'
s = $('span[id^=no]', root).previousSibling
[_, month, day, year, hour, min] =
s.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) + ' '
$.replace s, time
g.callbacks.push Time.node
node: (root) ->
return if root.className is 'inline'
s = $('span[id^=no]', root).previousSibling
[_, month, day, year, hour, min] =
s.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) + ' '
$.replace s, time
foo: ->
code = $.config('time').replace /%([A-Za-z])/g, (s, c) ->
switch c