Conflicts: CHANGELOG.md Gruntfile.coffee css/burichan.css css/futaba.css css/photon.css css/style.css css/tomorrow.css css/yotsuba-b.css css/yotsuba.css html/General/Index-navlinks.html html/General/Settings-section-Rice.html html/General/Settings.html html/Posting/QR.html json/archives.json package.json src/Filtering/PostHiding.coffee src/Filtering/Recursive.coffee src/Filtering/ThreadHiding.coffee src/General/Build.coffee src/General/Config.coffee src/General/Get.coffee src/General/Header.coffee src/General/Index.coffee src/General/Main.coffee src/General/Settings.coffee src/General/UI.coffee src/General/lib/$.coffee src/General/lib/databoard.class src/General/lib/post.class src/General/lib/thread.class src/Images/ImageExpand.coffee src/Images/RevealSpoilers.coffee src/Linkification/Linkify.coffee src/Menu/Menu.coffee src/Miscellaneous/ExpandThread.coffee src/Miscellaneous/IDColor.coffee src/Miscellaneous/Keybinds.coffee src/Monitoring/ThreadUpdater.coffee src/Monitoring/Unread.coffee src/Posting/QR.captcha.coffee src/Posting/QR.coffee src/Posting/QR.cooldown.coffee src/Quotelinks/QuoteBacklink.coffee src/Quotelinks/QuoteCT.coffee src/Quotelinks/QuoteOP.coffee src/Quotelinks/QuoteStrikeThrough.coffee src/Quotelinks/QuoteYou.coffee src/Quotelinks/Quotify.coffee
61 lines
1.4 KiB
CoffeeScript
Executable File
61 lines
1.4 KiB
CoffeeScript
Executable File
Time =
|
|
init: ->
|
|
return if !Conf['Time Formatting']
|
|
|
|
@funk = @createFunc Conf['time']
|
|
Post.callbacks.push
|
|
name: 'Time Formatting'
|
|
cb: @node
|
|
node: ->
|
|
return if @isClone
|
|
@nodes.date.textContent = Time.funk Time, @info.date
|
|
createFunc: (format) ->
|
|
code = format.replace /%([A-Za-z])/g, (s, c) ->
|
|
if c of Time.formatters
|
|
"' + Time.formatters.#{c}.call(date) + '"
|
|
else
|
|
s
|
|
Function 'Time', 'date', "return '#{code}'"
|
|
day: [
|
|
'Sunday'
|
|
'Monday'
|
|
'Tuesday'
|
|
'Wednesday'
|
|
'Thursday'
|
|
'Friday'
|
|
'Saturday'
|
|
]
|
|
month: [
|
|
'January'
|
|
'February'
|
|
'March'
|
|
'April'
|
|
'May'
|
|
'June'
|
|
'July'
|
|
'August'
|
|
'September'
|
|
'October'
|
|
'November'
|
|
'December'
|
|
]
|
|
zeroPad: (n) -> if n < 10 then "0#{n}" else n
|
|
formatters:
|
|
a: -> Time.day[@getDay()][...3]
|
|
A: -> Time.day[@getDay()]
|
|
b: -> Time.month[@getMonth()][...3]
|
|
B: -> Time.month[@getMonth()]
|
|
d: -> Time.zeroPad @getDate()
|
|
e: -> @getDate()
|
|
H: -> Time.zeroPad @getHours()
|
|
I: -> Time.zeroPad @getHours() % 12 or 12
|
|
k: -> @getHours()
|
|
l: -> @getHours() % 12 or 12
|
|
m: -> Time.zeroPad @getMonth() + 1
|
|
M: -> Time.zeroPad @getMinutes()
|
|
p: -> if @getHours() < 12 then 'AM' else 'PM'
|
|
P: -> if @getHours() < 12 then 'am' else 'pm'
|
|
S: -> Time.zeroPad @getSeconds()
|
|
y: -> @getFullYear().toString()[2..]
|
|
Y: -> @getFullYear()
|