From 9a60bfff08173cd934c9ac87dc06a343b5767d62 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Sep 2011 13:01:47 +0200 Subject: [PATCH] Fix time formatting for inlined cross OPs; eventually future-proof? --- 4chan_x.user.js | 4 ++-- script.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 0d471ed0e..d96ebf0b8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2035,11 +2035,11 @@ return g.callbacks.push(Time.node); }, node: function(root) { - var day, hour, min, month, node, time, year, _, _ref; + var day, hour, min, month, node, posttime, time, year, _, _ref; if (root.className === 'inline') { return; } - node = root.className === 'op' ? $('.posttime', root) : $('span[id]', root).previousSibling; + 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; diff --git a/script.coffee b/script.coffee index e61687339..990e30bfa 100644 --- a/script.coffee +++ b/script.coffee @@ -1614,7 +1614,7 @@ Time = g.callbacks.push Time.node node: (root) -> return if root.className is 'inline' - node = if root.className is 'op' then $('.posttime', root) else $('span[id]', root).previousSibling + 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}"