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

Commit

Permalink
little improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Oct 7, 2015
1 parent f46c266 commit 30cad77
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
14 changes: 8 additions & 6 deletions assets/js/src/__init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ $ ->

search:
container: -> $('#results')
form: (action) -> $("#search-container")[action]()
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
className = document.body.className.split(' ')[0].split('-')[0]
if className is '' then 'error' else className

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

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

readTime: ->
DateInDays = (selector, cb) ->
Expand All @@ -33,7 +35,7 @@ $ ->
$(this).html(postDateInDays)
$(this).mouseover -> $(this).html(postDate)
$(this).mouseout -> $(this).html(postDateInDays)
DateInDays ".post.meta > time"
DateInDays '.post.meta > time'

device: ->
w = window.innerWidth
Expand Down
14 changes: 8 additions & 6 deletions assets/js/src/cover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

$ ->

el = document.body
isOpen = location.hash is '#open'

_animate = ->
Expand All @@ -14,12 +13,15 @@ $ ->
$('main, .cover, .links > li').toggleClass 'expanded'
Uno.search.form options.form

$('.nav-blog > a, #avatar-link').click ->
return $('#menu-button').trigger 'click' unless Uno.is 'device', 'desktop'
_expand form: 'toggle'
$('#menu-button').click ->
$('.cover, main, #menu-button').toggleClass 'expanded'

$("#menu-button").click ->
$('main, .cover, #menu-button').toggleClass 'expanded'
$('.nav-blog > a, #avatar-link').click (event) ->
if Uno.is 'page', 'home'
event.preventDefault()
location.hash = if location.hash is '' then '#open' else ''
return $('#menu-button').trigger 'click' unless Uno.is 'device', 'desktop'
_expand form: 'toggle'

if (Uno.is 'device', 'desktop') and (Uno.is 'page', 'home')
_animate()
Expand Down
2 changes: 1 addition & 1 deletion assets/js/src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$ ->

el = document.body
el = Uno.app
el.dataset.page = Uno.context()
el.dataset.device = Uno.device()

Expand Down
4 changes: 2 additions & 2 deletions default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
{{ghost_head}}
</head>
<body class="{{body_class}}">
<section id="menu-button" class="expanded">
<header id="menu-button" class="expanded">
<a><i class="icon icon-list"></i></a>
</section>
</header>
{{> aside}}
<main>
<section id="search-results"></section>
Expand Down

0 comments on commit 30cad77

Please sign in to comment.