From 2258fe14a16d21079cf7197c298a398005b916b0 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Jun 2011 20:04:48 -0700 Subject: [PATCH] use unix instead of php formatting --- 4chan_x.user.js | 44 ++++++++++++++++++++++---------------------- script.coffee | 14 +++++++------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8840751b4..777056810 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -114,7 +114,7 @@ } }, flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url='].join('\n'), - time: '%m/%d/%y(%D)%H:%i', + time: '%m/%d/%y(%a)%H:%M', updater: { checkbox: { 'Verbose': [true, 'Show countdown timer, new post count'], @@ -1675,13 +1675,13 @@ switch (c) { case '%': return '%'; - case 'A': - case 'D': - case 'H': case 'a': case 'd': - case 'i': + case 'H': case 'm': + case 'M': + case 'p': + case 'P': case 'y': return "' + time." + c + "() + '"; break; @@ -1714,35 +1714,35 @@ return n; } }, - A: function() { + a: function() { + return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][this.date.getDay()]; + }, + d: function() { + return this.zeroPad(this.date.getDate()); + }, + H: function() { + return this.zeroPad(this.date.getHours()); + }, + m: function() { + return this.zeroPad(this.date.getMonth() + 1); + }, + M: function() { + return this.zeroPad(this.date.getMinutes()); + }, + p: function() { if (this.date.getHours() < 12) { return 'AM'; } else { return 'PM'; } }, - D: function() { - return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][this.date.getDay()]; - }, - H: function() { - return this.zeroPad(this.date.getHours()); - }, - a: function() { + P: function() { if (this.date.getHours < 12) { return 'am'; } else { return 'pm'; } }, - d: function() { - return this.zeroPad(this.date.getDate()); - }, - i: function() { - return this.zeroPad(this.date.getMinutes()); - }, - m: function() { - return this.zeroPad(this.date.getMonth() + 1); - }, y: function() { return this.date.getFullYear() - 2000; } diff --git a/script.coffee b/script.coffee index 64944760e..976410576 100644 --- a/script.coffee +++ b/script.coffee @@ -49,7 +49,7 @@ config = 'http://tineye.com/search?url=' '#http://saucenao.com/search.php?db=999&url=' ].join '\n' - time: '%m/%d/%y(%D)%H:%i' + time: '%m/%d/%y(%a)%H:%M' updater: checkbox: 'Verbose': [true, 'Show countdown timer, new post count'] @@ -1322,7 +1322,7 @@ time = code = $.config('time').replace /%(.)/g, (s, c) -> switch c when '%' then '%' - when 'A', 'D', 'H', 'a', 'd', 'i', 'm', 'y' then "' + time.#{c}() + '" + when 'a', 'd', 'H', 'm', 'M', 'p', 'P', 'y' then "' + time.#{c}() + '" else s time.funk = Function 'time', "return '#{code}'" @@ -1342,8 +1342,7 @@ time = $.replace s, timeEl zeroPad: (n) -> if n < 10 then '0' + n else n - A: -> if @date.getHours() < 12 then 'AM' else 'PM' - D: -> [ + a: -> [ 'Sun' 'Mon' 'Tue' @@ -1352,11 +1351,12 @@ time = 'Fri' 'Sat' ][@date.getDay()] - H: -> @zeroPad @date.getHours() - a: -> if @date.getHours < 12 then 'am' else 'pm' d: -> @zeroPad @date.getDate() - i: -> @zeroPad @date.getMinutes() + H: -> @zeroPad @date.getHours() m: -> @zeroPad @date.getMonth() + 1 + M: -> @zeroPad @date.getMinutes() + p: -> if @date.getHours() < 12 then 'AM' else 'PM' + P: -> if @date.getHours < 12 then 'am' else 'pm' y: -> @date.getFullYear() - 2000 titlePost =