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

Commit

Permalink
convert post day in days
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 17, 2015
1 parent 8834194 commit 8af7134
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 116 deletions.
16 changes: 10 additions & 6 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ module.exports = (grunt) ->
main : 'assets/scss/uno.scss'
files : ['assets/scss/**/*.scss']
js :
main : ['assets/js/init.open.js'
'assets/js/init.ghostHunter.js'
'assets/js/init.readingTime.js']
main : ['assets/js/src/__init.coffee'
'assets/js/src/cover.coffee'
'assets/js/src/search.coffee'
'assets/js/src/post.coffee']
vendor : ['assets/vendor/ghostHunter/jquery.ghostHunter.min.js'
'assets/vendor/pace/pace.min.js'
'assets/vendor/reading-time/build/readingTime.min.js']
css :
main : 'assets/css/uno.css'
vendor : []
vendor : ['assets/vendor/animate.css/animate.min.css']

dist :
css : 'assets/css/uno.css'
Expand All @@ -40,13 +41,16 @@ module.exports = (grunt) ->
# TASKS
# =============

coffee :
main : files: '<%=dist.js%>' : '<%=src.js.main%>'

sass :
main : files: '<%=dist.css%>' : '<%=src.sass.main%>'

concat :
options : stripBanners: true
css : src: ['<%=src.css.main%>', '<%=src.css.vendor%>'], dest: '<%=dist.css%>'
js : src: ['<%=src.js.main%>', '<%=src.js.vendor%>'], dest: '<%=dist.js%>'
js : src: ['<%=dist.js%>', '<%=src.js.vendor%>'], dest: '<%=dist.js%>'

autoprefixer :
main : files: '<%=dist.css%>' : '<%=src.css.main%>'
Expand Down Expand Up @@ -78,6 +82,6 @@ module.exports = (grunt) ->
# =============

grunt.registerTask 'css', ['sass', 'concat:css', 'autoprefixer', 'cssmin']
grunt.registerTask 'js', ['concat:js','uglify']
grunt.registerTask 'js', ['coffee', 'concat:js','uglify']
grunt.registerTask 'production', ['css', 'js']
grunt.registerTask 'default', ['css', 'js','watch']
14 changes: 6 additions & 8 deletions assets/css/uno.css

Large diffs are not rendered by default.

29 changes: 0 additions & 29 deletions assets/js/init.ghostHunter.js

This file was deleted.

55 changes: 0 additions & 55 deletions assets/js/init.open.js

This file was deleted.

13 changes: 0 additions & 13 deletions assets/js/init.readingTime.js

This file was deleted.

38 changes: 38 additions & 0 deletions assets/js/src/__init.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use strict"

$(document).ready ->

window.Uno = Uno =

version: '1.1.17'

cover:
width: -> $(".panel-cover").width()
isCollapsed: -> $(".panel-cover").hasClass("panel-cover--collapsed")

search:
container: -> $('#results')
form: (action) -> $("#search")[action]()

loadingBar: (action) -> $(".pace")[action]()

readTime: do ->

container = $('.content-wrapper')
readingTime = $(".post-reading-time")

if container.length > 0 and readingTime.length > 0
postDate = $('.post-meta > time').html()
postDateNow = new Date(Date.now())
postDateInDays = Math.floor((postDateNow - new Date(postDate)) / 86400000)

if postDateInDays is 0 then postDateInDays = 'today'
else if postDateInDays is 1 then postDateInDays = "yesterday"
else postDateInDays = "#{postDateInDays} days ago"

$('.post-meta > time').html(postDateInDays)
$('.post-meta > time').mouseover -> $(this).html(postDate)
$('.post-meta > time').mouseout -> $(this).html(postDateInDays)
container.readingTime readingTimeTarget: ".post-reading-time"

$("body").removeClass "no-js"
43 changes: 43 additions & 0 deletions assets/js/src/cover.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use strict"

$(document).ready ->

unless Uno.cover.isCollapsed()
$(".navigation--social").css "margin-left", "1.5em"
Uno.loadingBar 'hide'
Uno.search.form 'hide'

$("a.blog-button").click ->
Uno.search.form 'show'
$(".navigation--social").css "margin-left", "0px;"

unless Uno.cover.isCollapsed()
if Uno.cover.width() < 960
$(".panel-cover").addClass "panel-cover--collapsed"
$(".content-wrapper").addClass "animated slideInRight"
else
$(".navigation--social").css "margin-left", "0px"
$(".panel-cover").css "max-width", Uno.cover.width()
$(".panel-cover").animate
"max-width": "400px"
width: "28%"
, 400, swing = "swing", -> {}

if location.hash is "#open"
$(".navigation--social").css "margin-left", "0px"
$(".panel-cover").addClass "panel-cover--collapsed"
Uno.search.form 'show'

if window.location.pathname and window.location.pathname isnt "/"
Uno.search.form 'show'

if window.location.pathname.substring(0, 5) is "/tag/"
$(".panel-cover").addClass "panel-cover--collapsed"

$(".btn-mobile-menu").click ->
$(".navigation-wrapper").toggleClass "visible animated bounceInDown"
$(".btn-mobile-menu__icon").toggleClass "icon-list icon-x-circle animated fadeIn"

$(".navigation-wrapper .blog-button").click ->
$(".navigation-wrapper").toggleClass "visible"
$(".btn-mobile-menu__icon").toggleClass "icon-list icon-x-circle animated fadeIn"
24 changes: 24 additions & 0 deletions assets/js/src/search.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict"

## -- Private -----------------------------------------------------------------

showSearch = ->
$(".content-wrapper__inner").hide()
Uno.search.container.css "margin-top", "3rem"
Uno.search.container.css "margin-bottom", "9rem"

hideSearch = ->
$(".content-wrapper__inner").show()
Uno.search.container.css "padding-top", "0"
Uno.search.container.css "margin-bottom", "0"

## -- Main --------------------------------------------------------------------

$(document).ready ->
$("#search-field").ghostHunter
results : "#results"
zeroResultsInfo : false
onKeyUp : true
displaySearchInfo : true
onComplete : (query) ->
if query.length > 0 then showSearch() else hideSearch()
5 changes: 3 additions & 2 deletions assets/js/uno.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "uno-zen",
"description": "Minimalist and Elegant theme for Ghost",
"version": "1.1.8",
"version": "1.1.17",
"authors": [
"Kiko Beats <[email protected]>"
],
"dependencies": {
"ghostHunter": "git://github.com/i11ume/ghostHunter/"
"ghostHunter": "git://github.com/i11ume/ghostHunter/",
"animate.css": "~3.2.0"
},
"ignore": [
"**/.*",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uno-zen",
"description": "Minimalist and Elegant theme for Ghost",
"version": "1.1.8",
"version": "1.1.17",
"author": {
"name": "Kiko Beats",
"url": "https://github.com/kikobeats"
Expand All @@ -10,6 +10,7 @@
"grunt": "*",
"grunt-autoprefixer": "*",
"grunt-contrib-clean": "*",
"grunt-contrib-coffee": "^0.12.0",
"grunt-contrib-concat": "*",
"grunt-contrib-cssmin": "*",
"grunt-contrib-sass": "*",
Expand Down

0 comments on commit 8af7134

Please sign in to comment.