From a3b1483052168d3c59efb212d96351b696a5f535 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 11 Oct 2011 13:08:14 -0700 Subject: [PATCH] Revert "Time formatting boost. God damn, that was easy." This reverts commit 2e43059f3e6d2c928e5ba8d5dd0924bed9957a0c. this kills firefox --- 4chan_x.user.js | 8 ++++++-- script.coffee | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 66daa984c..368b15673 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2196,12 +2196,16 @@ return g.callbacks.push(Time.node); }, node: function(root) { - var node, posttime, time; + var day, hour, min, month, node, posttime, time, year, _, _ref; if (root.className === 'inline') { return; } node = (posttime = $('.posttime', root)) ? posttime : $('span[id]', root).previousSibling; - Time.date = new Date(Date.parse(node.textContent) + g.chanOffset * HOUR); + _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) + ' ' }); diff --git a/script.coffee b/script.coffee index d96ee30b1..a7f225412 100644 --- a/script.coffee +++ b/script.coffee @@ -1663,7 +1663,14 @@ Time = node: (root) -> return if root.className is 'inline' node = if posttime = $('.posttime', root) then posttime else $('span[id]', root).previousSibling - Time.date = new Date Date.parse(node.textContent) + g.chanOffset*HOUR + [_, 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) + ' ' $.replace node, time