Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Commit

Permalink
Removed wait for DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Dec 26, 2015
1 parent 06cf240 commit 6f5e8f2
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions assets/js/src/__init.coffee
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
'use strict'

$ ->
window.Uno = Uno =
version: '2.6.5'

window.Uno = Uno =
version: '2.6.4'
search:
container: -> $('#results')
form: (action) -> $('#search-container')[action]()

search:
container: -> $('#results')
form: (action) -> $('#search-container')[action]()
loadingBar: (action) -> $('.pace')[action]()

loadingBar: (action) -> $('.pace')[action]()
context: ->
# get the context from the first class name of body
# https://github.com/TryGhost/Ghost/wiki/Context-aware-Filters-and-Helpers
className = document.body.className.split(' ')[0].split('-')[0]
if className is '' then 'error' else className

context: ->
# get the context from the first class name of body
# https://github.com/TryGhost/Ghost/wiki/Context-aware-Filters-and-Helpers
className = document.body.className.split(' ')[0].split('-')[0]
if className is '' then 'error' else className
app: do -> document.body

app: do -> document.body
is: (property, value) -> this.app.dataset[property] is value

is: (property, value) -> this.app.dataset[property] is value
timeAgo: (selector) ->
$(selector).each ->
postDate = $(this).html()
postDateInDays = Math.floor((Date.now() - new Date(postDate)) / 86400000)

timeAgo: (selector) ->
$(selector).each ->
postDate = $(this).html()
postDateInDays = Math.floor((Date.now() - new Date(postDate)) / 86400000)
if postDateInDays is 0 then postDateInDays = 'today'
else if postDateInDays is 1 then postDateInDays = 'yesterday'
else postDateInDays = "#{postDateInDays} days ago"

if postDateInDays is 0 then postDateInDays = 'today'
else if postDateInDays is 1 then postDateInDays = 'yesterday'
else postDateInDays = "#{postDateInDays} days ago"
$(this).html(postDateInDays)
$(this).mouseover -> $(this).html postDate
$(this).mouseout -> $(this).html postDateInDays

$(this).html(postDateInDays)
$(this).mouseover -> $(this).html postDate
$(this).mouseout -> $(this).html postDateInDays

device: ->
w = window.innerWidth
h = window.innerHeight
return 'mobile' if (w <= 480)
return 'tablet' if (w <= 1024)
'desktop'
device: ->
w = window.innerWidth
h = window.innerHeight
return 'mobile' if (w <= 480)
return 'tablet' if (w <= 1024)
'desktop'

0 comments on commit 6f5e8f2

Please sign in to comment.