From 991c88fc7511cb031e5b768a0a5331cd0948405a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Mar 2012 20:25:00 +0100 Subject: [PATCH] Close #343. --- 4chan_x.user.js | 3 ++- script.coffee | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a121df15f..de50674ef 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2847,7 +2847,7 @@ 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; + month--; hour = chanOffset + Number(hour); return new Date(year, month, day, hour, min); }; @@ -2861,6 +2861,7 @@ time = $.el('time', { textContent: ' ' + Time.funk(Time) + ' ' }); + time.setAttribute('datetime', Time.date.toISOString()); return $.replace(node, time); }, foo: function() { diff --git a/script.coffee b/script.coffee index d82d7d43c..5b97558aa 100644 --- a/script.coffee +++ b/script.coffee @@ -2408,7 +2408,7 @@ Time = [_, month, day, year, hour, min] = node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/ year = "20#{year}" - month -= 1 #months start at 0 + month-- # Months start at 0 hour = chanOffset + Number hour new Date year, month, day, hour, min @@ -2420,6 +2420,8 @@ Time = Time.date = Time.parse node time = $.el 'time', textContent: ' ' + Time.funk(Time) + ' ' + # Set the datetime attribute, ISO'd. + time.setAttribute 'datetime', Time.date.toISOString() $.replace node, time foo: -> code = conf['time'].replace /%([A-Za-z])/g, (s, c) ->