From da8c51961239a7d41accd8fc14b4c14695ea0b9a Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 11 Jun 2011 10:33:23 -0700 Subject: [PATCH] time: %A --- 4chan_x.user.js | 9 +++++++-- script.coffee | 25 ++++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8f3389457..d8bed307b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -958,7 +958,7 @@ var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, link, main, obj, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html = "
Options X

main | sauce | time
Donate
support throd | github | uso

"; + html = "
Options X

main | sauce | time
Donate
support throd | github | uso

"; dialog = ui.dialog('options', { top: '25%', left: '25%' @@ -1697,6 +1697,7 @@ code = $.config('time').replace(/%([A-Za-z])/g, function(s, c) { switch (c) { case 'a': + case 'A': case 'b': case 'B': case 'd': @@ -1715,6 +1716,7 @@ }); return time.funk = Function('time', "return '" + code + "'"); }, + day: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], zeroPad: function(n) { if (n < 10) { @@ -1724,7 +1726,10 @@ } }, a: function() { - return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][this.date.getDay()]; + return this.day[this.date.getDay()].slice(0, 3); + }, + A: function() { + return this.day[this.date.getDay()]; }, b: function() { return this.month[this.date.getMonth()].slice(0, 3); diff --git a/script.coffee b/script.coffee index 47d95365c..26eea3c22 100644 --- a/script.coffee +++ b/script.coffee @@ -742,7 +742,8 @@ options = Format specifiers (source) SpecifierDescriptionValues/Example - %aweekday, abbreviatedFri + %aweekday, abbreviatedSat + %Aweekday, fullSaturday %bmonth, abbreviatedJun %Bmonth, full lengthJune %dday of the month, zero padded03 @@ -1360,9 +1361,18 @@ time = foo: -> code = $.config('time').replace /%([A-Za-z])/g, (s, c) -> switch c - when 'a', 'b', 'B', 'd', 'H', 'I', 'm', 'M', 'p', 'P', 'y' then "' + time.#{c}() + '" + when 'a', 'A', 'b', 'B', 'd', 'H', 'I', 'm', 'M', 'p', 'P', 'y' then "' + time.#{c}() + '" else s time.funk = Function 'time', "return '#{code}'" + day: [ + 'Sunday' + 'Monday' + 'Tuesday' + 'Wednesday' + 'Thursday' + 'Friday' + 'Saturday' + ] month: [ 'January' 'February' @@ -1378,15 +1388,8 @@ time = 'December' ] zeroPad: (n) -> if n < 10 then '0' + n else n - a: -> [ - 'Sun' - 'Mon' - 'Tue' - 'Wed' - 'Thu' - 'Fri' - 'Sat' - ][@date.getDay()] + a: -> @day[@date.getDay()][...3] + A: -> @day[@date.getDay()] b: -> @month[@date.getMonth()][...3] B: -> @month[@date.getMonth()] d: -> @zeroPad @date.getDate()