Permalink
Browse files

removing coffee files and replacing with js equivalents

  • Loading branch information...
1 parent 6d05403 commit 806f4728f17a8737cc5a66c79e62812a772a0872 @kelyvin committed Nov 16, 2015
View
@@ -0,0 +1,12 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
View
@@ -15,10 +15,10 @@ The code of the theme is divided in 3 main sections: static files (as HTML and i
│   ├── img # favicons and cover image
│   ├── js
│   │   ├── src
-│   │   │   ├── __init.coffee
-│   │   │   ├── cover.coffee
-│   │   │   ├── main.coffee
-│   │   │   └── search.coffee
+│   │   │   ├── __init.js
+│   │   │   ├── cover.js
+│   │   │   ├── main.js
+│   │   │   └── search.js
│   │   └── kelyvin-ghost-theme.js # the production js
│   └── scss
│   │ ├── components # specific stuff
@@ -44,7 +44,7 @@ The code of the theme is divided in 3 main sections: static files (as HTML and i
├── bower.json
├── default.hbs
├── error.hbs
-├── gulpfile.coffee
+├── gulpfile.js
├── index.hbs
├── node_modules
├── package.json
@@ -68,7 +68,7 @@ Putting the files in context:
- The SCSS (we use [SASS](http://sass-lang.com/)) inside `assets/scss` is compiled into `assets/css/kelyvin-ghost-theme.css`
- We have some static files like `post.hbs`, `tag.hbs`, `default.hbs`, `index.hbs`,... the partials views inside `assets/partials` is used in this views.
-For do it automatically and easily we use [Gulp](http://gulpjs.com/), check `gulpfile.coffee` for know how to we do it.
+For do it automatically and easily we use [Gulp](http://gulpjs.com/), check `gulpfile.js` for know how to we do it.
## First Steps
@@ -97,7 +97,7 @@ Just run `gulp` command in the theme terminal. Now you have a development scenar
With the `gulp` command you are automatically launching the task for compile the assets and reload the server when your assets change. For do it we uses [BrowserSync](http://www.browsersync.io) that is setup as middleware between the theme and the Ghost. You can connect different devices and try the responsive of the website as well.
-As the screenshot, you need to use for the proxying the same port as your Ghost server. If your Ghost server is in a different port than `2387` you need to modify `gulpfile.coffee` and put the correct port.
+As the screenshot, you need to use for the proxying the same port as your Ghost server. If your Ghost server is in a different port than `2387` you need to modify `gulpfile.js` and put the correct port.
## Customization
Oops, something went wrong.
View
Oops, something went wrong.
@@ -1,45 +0,0 @@
-'use strict'
-
-$ ->
-
- window.KelyvinTheme = KelyvinTheme =
- version: '0.1.0'
-
- search:
- container: -> $('#results')
- form: (action) -> $('#search-container')[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
-
- app: do -> document.body
-
- is: (property, value) -> this.app.dataset[property] is value
-
- readTime: ->
- DateInDays = (selector, cb) ->
- $(selector).each ->
- postDate = $(this).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"
-
- $(this).html(postDateInDays)
- $(this).mouseover -> $(this).html(postDate)
- $(this).mouseout -> $(this).html(postDateInDays)
- DateInDays '.post.meta > time'
-
- device: ->
- w = window.innerWidth
- h = window.innerHeight
- return 'mobile' if (w <= 480)
- return 'tablet' if (w <= 1024)
- 'desktop'
@@ -0,0 +1,72 @@
+'use strict';
+
+$(function() {
+ var KelyvinTheme;
+ return window.KelyvinTheme = KelyvinTheme = {
+ version: '0.1.0',
+ search: {
+ container: function() {
+ return $('#results');
+ },
+ form: function(action) {
+ return $('#search-container')[action]();
+ }
+ },
+ loadingBar: function(action) {
+ return $('.pace')[action]();
+ },
+ context: function() {
+ var className;
+ className = document.body.className.split(' ')[0].split('-')[0];
+ if (className === '') {
+ return 'error';
+ } else {
+ return className;
+ }
+ },
+ app: (function() {
+ return document.body;
+ })(),
+ is: function(property, value) {
+ return this.app.dataset[property] === value;
+ },
+ readTime: function() {
+ var DateInDays;
+ DateInDays = function(selector, cb) {
+ return $(selector).each(function() {
+ var postDate, postDateInDays, postDateNow;
+ postDate = $(this).html();
+ postDateNow = new Date(Date.now());
+ postDateInDays = Math.floor((postDateNow - new Date(postDate)) / 86400000);
+ if (postDateInDays === 0) {
+ postDateInDays = 'today';
+ } else if (postDateInDays === 1) {
+ postDateInDays = "yesterday";
+ } else {
+ postDateInDays = postDateInDays + " days ago";
+ }
+ $(this).html(postDateInDays);
+ $(this).mouseover(function() {
+ return $(this).html(postDate);
+ });
+ return $(this).mouseout(function() {
+ return $(this).html(postDateInDays);
+ });
+ });
+ };
+ return DateInDays('.post.meta > time');
+ },
+ device: function() {
+ var h, w;
+ w = window.innerWidth;
+ h = window.innerHeight;
+ if (w <= 480) {
+ return 'mobile';
+ }
+ if (w <= 1024) {
+ return 'tablet';
+ }
+ return 'desktop';
+ }
+ };
+});
@@ -1,28 +0,0 @@
-'use strict'
-
-$ ->
-
- isOpen = location.hash is '#open'
-
- _animate = ->
- setTimeout(->
- $('.cover').addClass 'animated'
- , 1000)
-
- _expand = (options)->
- $('main, .cover, .links > li, html').toggleClass 'expanded'
- KelyvinTheme.search.form options.form
-
- $('#menu-button').click ->
- $('.cover, main, #menu-button, html').toggleClass 'expanded'
-
- $('.nav-blog > a, #avatar-link').click (event) ->
- if KelyvinTheme.is 'page', 'home'
- event.preventDefault()
- location.hash = if location.hash is '' then '#open' else ''
- return $('#menu-button').trigger 'click' unless KelyvinTheme.is 'device', 'desktop'
- _expand form: 'toggle'
-
- if (KelyvinTheme.is 'device', 'desktop') and (KelyvinTheme.is 'page', 'home')
- _animate()
- _expand form: 'hide' if !isOpen
@@ -0,0 +1,38 @@
+'use strict';
+
+$(function() {
+ var _animate, _expand, isOpen;
+ isOpen = location.hash === '#open';
+ _animate = function() {
+ return setTimeout(function() {
+ return $('.cover').addClass('animated');
+ }, 1000);
+ };
+ _expand = function(options) {
+ $('main, .cover, .links > li, html').toggleClass('expanded');
+ return KelyvinTheme.search.form(options.form);
+ };
+ $('#menu-button').click(function() {
+ return $('.cover, main, #menu-button, html').toggleClass('expanded');
+ });
+ $('.nav-blog > a, #avatar-link').click(function(event) {
+ if (KelyvinTheme.is('page', 'home')) {
+ event.preventDefault();
+ location.hash = location.hash === '' ? '#open' : '';
+ if (!KelyvinTheme.is('device', 'desktop')) {
+ return $('#menu-button').trigger('click');
+ }
+ return _expand({
+ form: 'toggle'
+ });
+ }
+ });
+ if ((KelyvinTheme.is('device', 'desktop')) && (KelyvinTheme.is('page', 'home'))) {
+ _animate();
+ if (!isOpen) {
+ return _expand({
+ form: 'hide'
+ });
+ }
+ }
+});
@@ -1,29 +0,0 @@
-'use strict'
-
-$ ->
-
- el = KelyvinTheme.app
- el.dataset.page = KelyvinTheme.context()
- el.dataset.device = KelyvinTheme.device()
-
- KelyvinTheme.readTime()
- FastClick.attach el unless KelyvinTheme.is 'device', 'desktop'
-
- $('#profile-title').text window.profile_title if window.profile_title
- $('#profile-resume').text window.profile_resume if window.profile_resume
-
- if KelyvinTheme.is 'device', 'desktop'
- $('a').not('[href*="mailto:"]').click ->
- if this.href.indexOf(location.hostname) is -1
- window.open $(this).attr 'href'
- false
-
- if KelyvinTheme.is 'page', 'post'
- $('main').readingTime readingTimeTarget: '.post.reading-time > span'
- $('.content').fitVids()
-
- if KelyvinTheme.is 'page', 'error'
- $('#panic-button').click ->
- s = document.createElement 'script'
- s.setAttribute 'src','https://nthitz.github.io/turndownforwhatjs/tdfw.js'
- document.body.appendChild s
View
@@ -0,0 +1,41 @@
+'use strict';
+
+$(function() {
+ var el;
+ el = KelyvinTheme.app;
+ el.dataset.page = KelyvinTheme.context();
+ el.dataset.device = KelyvinTheme.device();
+ KelyvinTheme.readTime();
+ if (!KelyvinTheme.is('device', 'desktop')) {
+ FastClick.attach(el);
+ }
+ if (window.profile_title) {
+ $('#profile-title').text(window.profile_title);
+ }
+ if (window.profile_resume) {
+ $('#profile-resume').text(window.profile_resume);
+ }
+ if (KelyvinTheme.is('device', 'desktop')) {
+ $('a').not('[href*="mailto:"]').click(function() {
+ if (this.href.indexOf(location.hostname) === -1) {
+ window.open($(this).attr('href'));
+ return false;
+ }
+ });
+ }
+ if (KelyvinTheme.is('page', 'post')) {
+ $('main').readingTime({
+ readingTimeTarget: '.post.reading-time > span'
+ });
+ $('.content').fitVids();
+ }
+ if (KelyvinTheme.is('page', 'error')) {
+ return $('#panic-button').click(function() {
+ var s;
+ s = document.createElement('script');
+ s.setAttribute('src', 'https://nthitz.github.io/turndownforwhatjs/tdfw.js');
+ return document.body.appendChild(s);
+ });
+ }
+});
+RunLink
@@ -1,26 +0,0 @@
-'use strict'
-
-$ ->
-
- showSearch = ->
- $(".content").hide()
- $('#search-results').addClass('active')
-
- hideSearch = ->
- $(".content").show()
- $('#search-results').removeClass('active')
-
- $("#search-field").ghostHunter
- results : "#search-results"
- zeroResultsInfo : false
- onKeyUp : true
- displaySearchInfo : true
- result_template :
- """
- <a class="result" href='{{link}}'>
- <h2>{{title}}</h2>
- <h4>{{pubDate}}</h4>
- </a>
- """
- onComplete : (query) ->
- if query.length > 0 then showSearch() else hideSearch()
@@ -0,0 +1,27 @@
+'use strict';
+
+$(function() {
+ var hideSearch, showSearch;
+ showSearch = function() {
+ $(".content").hide();
+ return $('#search-results').addClass('active');
+ };
+ hideSearch = function() {
+ $(".content").show();
+ return $('#search-results').removeClass('active');
+ };
+ return $("#search-field").ghostHunter({
+ results: "#search-results",
+ zeroResultsInfo: false,
+ onKeyUp: true,
+ displaySearchInfo: true,
+ result_template: "<a class=\"result\" href='{{link}}'>\n <h2>{{title}}</h2>\n <h4>{{pubDate}}</h4>\n</a>",
+ onComplete: function(query) {
+ if (query.length > 0) {
+ return showSearch();
+ } else {
+ return hideSearch();
+ }
+ }
+ });
+});
Oops, something went wrong.

0 comments on commit 806f472

Please sign in to comment.