2016-04-07 13:00:19 -04:00
|
|
|
((w) ->
|
|
|
|
|
|
|
|
w.gl ?= {}
|
|
|
|
w.gl.utils ?= {}
|
2016-07-04 07:38:01 -04:00
|
|
|
w.gl.utils.days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
|
2016-04-07 13:00:19 -04:00
|
|
|
|
|
|
|
w.gl.utils.formatDate = (datetime) ->
|
|
|
|
dateFormat(datetime, 'mmm d, yyyy h:MMtt Z')
|
|
|
|
|
2016-07-04 07:38:01 -04:00
|
|
|
w.gl.utils.getDayName = (date) ->
|
|
|
|
this.days[date.getDay()]
|
|
|
|
|
2016-04-11 17:45:03 -04:00
|
|
|
w.gl.utils.localTimeAgo = ($timeagoEls, setTimeago = true) ->
|
2016-04-07 13:00:19 -04:00
|
|
|
$timeagoEls.each( ->
|
|
|
|
$el = $(@)
|
|
|
|
$el.attr('title', gl.utils.formatDate($el.attr('datetime')))
|
|
|
|
)
|
|
|
|
|
2016-05-24 19:40:27 -04:00
|
|
|
if setTimeago
|
|
|
|
$timeagoEls.timeago()
|
|
|
|
$timeagoEls.tooltip('destroy')
|
|
|
|
|
|
|
|
# Recreate with custom template
|
|
|
|
$timeagoEls.tooltip(
|
|
|
|
template: '<div class="tooltip local-timeago" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
|
|
|
)
|
2016-04-11 17:45:03 -04:00
|
|
|
|
2016-04-07 13:00:19 -04:00
|
|
|
) window
|