-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from spacenomads/dev
Create a final PUG release
- Loading branch information
Showing
16 changed files
with
928 additions
and
705 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# 2 tabs indentation | ||
[*] | ||
indent_style = tab | ||
indent_size = 2 | ||
|
||
# 2 space indentation for .json and .md files | ||
[*.{json, md}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# urf-8 character set | ||
[*] | ||
charset = utf-8 | ||
|
||
# Remove any whitespace characters preceding newline characters | ||
[*] | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread":true | ||
} | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"indent": [2, "tab"], | ||
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }], | ||
"semi": [2, "always"], | ||
"eqeqeq": 2, | ||
"strict": [2, "global"], | ||
|
||
"no-console": 1, | ||
"array-callback-return": 1, | ||
"block-scoped-var": 1, | ||
"consistent-return": 1, | ||
"curly": [1, "multi-line", "consistent"], | ||
"no-empty-function": 1, | ||
"no-useless-return": 1, | ||
"vars-on-top": 1, | ||
"no-use-before-define": [1, "nofunc"], | ||
"global-require": 1, | ||
"camelcase": 1, | ||
"new-cap": 1, | ||
"no-lonely-if": 1, | ||
"no-multiple-empty-lines": [1, { "max": 5 }], | ||
"no-trailing-spaces": 1, | ||
|
||
"no-restricted-properties": [1, { | ||
"property": "lenght", | ||
"message": "Use length instead of lenght (notice the position of the h)" | ||
}] | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"MD013": false, | ||
"MD014": false, | ||
"MD033": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
/** | ||
* SN.Cache | ||
* Cache common objects | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
SN.cookies = { | ||
gaID : null, | ||
gaCode : null, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
/** | ||
* SN.ExternalLinks | ||
* Add target="_blank" attribute to external links | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
/** | ||
* SN Object | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
/** | ||
* SN.snitch | ||
* Show browser real width, FYI. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
'use strict'; | ||
/** | ||
* SN.collapsible | ||
* Manages Collapsible groups and accordion sections | ||
* | ||
*/ | ||
|
||
SN.collapsible = { | ||
visible: 'none', | ||
init: function(){ | ||
var $collapsible = SN.cache.$body.find('.js__collapsible'); | ||
var $collapsibleLabel = SN.cache.$body.find('.js__collapsible-label'); | ||
|
||
|
||
/** | ||
* Unfold every collapsible item | ||
* @param {object} $obj Collapsible object | ||
*/ | ||
var unfoldCollapsible = function($obj) { | ||
$obj.find('.js__collapsible-content').show().attr('aria-hidden', false).parent('.js__collapsible-item').addClass('js__collapsible-item--visible'); | ||
}; | ||
|
||
|
||
/** | ||
* Fold every collapsible item | ||
* @param {object} $obj Collapsible object | ||
*/ | ||
var foldCollapsible = function($obj) { | ||
$obj.find('.js__collapsible-content').hide().attr('aria-hidden', true).parent('.js__collapsible-item').removeClass('js__collapsible-item--visible'); | ||
}; | ||
|
||
|
||
/** | ||
* Unfold one collapsible item | ||
* @param {object} $obj Collapsible object | ||
* @param {integer} item Item index | ||
*/ | ||
var unfoldThis = function($obj, item) { | ||
$obj.find('.js__collapsible-item').eq( item ).children('.js__collapsible-content').slideDown('400').attr('aria-hidden', false).parent('.js__collapsible-item').addClass('js__collapsible-item--visible'); | ||
}; | ||
|
||
var foldThis = function($obj, item) { | ||
$obj.find('.js__collapsible-item').eq( item ).children('.js__collapsible-content').slideUp('200').attr('aria-hidden', true).parent('.js__collapsible-item').removeClass('js__collapsible-item--visible'); | ||
}; | ||
|
||
|
||
|
||
/** | ||
* Initialize collapsible object | ||
* @param {object} $el Collapsible object | ||
* @param {string} config Configuration string [all/none/number] | ||
*/ | ||
var adjustCollapsibleOnLoad = function($el, config) { | ||
var visibleItem; | ||
if ( config === 'none') { | ||
foldCollapsible( $el ); | ||
} else if ( config === 'all') { | ||
unfoldCollapsible( $el ); | ||
} else { | ||
visibleItem = parseInt(config); | ||
foldCollapsible( $el ); | ||
unfoldThis( $el, visibleItem ); | ||
} | ||
}; | ||
|
||
|
||
|
||
|
||
|
||
|
||
if ($collapsible.length) { | ||
|
||
// > Each collapsible | ||
$collapsible.each(function(index, el) { | ||
var initialState = ($(this).attr('data-visible')) ? $(this).attr('data-visible') : SN.collapsible.visible; | ||
|
||
$(this).find('.js__collapsible-item').each(function(index, el) { | ||
$(this).data('item', index); | ||
|
||
$(this).children('.js__collapsible-label').text( $(this).children('.js__collapsible-label').text() + ' ' + index); //delete | ||
$(this).children('.js__collapsible-content').text( $(this).children('.js__collapsible-content').text() + ' ' + index); //delete | ||
}); | ||
|
||
adjustCollapsibleOnLoad( $(this), initialState); | ||
}); | ||
|
||
|
||
// > Label click | ||
$collapsibleLabel.on('click', function(event) { | ||
event.preventDefault(); | ||
var $block = $(this).parents('.js__collapsible'); | ||
var prevItem; | ||
var item = $(this).parents('.js__collapsible-item').data('item'); | ||
|
||
if ( $(this).parents('.js__collapsible').hasClass('js__collapsible--accordion') ) { | ||
|
||
// Is this an accordion block? YES | ||
if ( $(this).parents('.js__collapsible-item').hasClass('js__collapsible-item--visible') ) { | ||
// I am already open -> Close me | ||
foldThis( $block, item ); | ||
} else { | ||
if ( $(this).parents('.js__collapsible').find('.js__collapsible-item--visible').length ) { | ||
// Another item is already open -> Close it and open me, Alice | ||
prevItem = $(this).parents('.js__collapsible').find('.js__collapsible-item--visible').data('item'); | ||
foldThis( $block, prevItem ); | ||
unfoldThis( $block, item ); | ||
} else { | ||
// No item is open -> Open me | ||
unfoldThis( $block, item ); | ||
} | ||
} | ||
} else { | ||
// Is this an accordion block? NOPE | ||
if ( $(this).parents('.js__collapsible-item').hasClass('js__collapsible-item--visible') ) { | ||
// I am already open -> Close me | ||
foldThis( $block, item ); | ||
} else { | ||
// I am closed -> Open me | ||
unfoldThis( $block, item ); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
}); | ||
|
||
} | ||
} | ||
}; |
Oops, something went wrong.