Lint JavaScript
This commit is contained in:
parent
dcc4a74155
commit
b503341791
|
@ -0,0 +1,24 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
"tab"
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
|
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Lint JavaScript.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Accessibility enhancements for Lunr search form.
|
- Accessibility enhancements for Lunr search form.
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ var menuItems = document.querySelectorAll('#sidebar li');
|
||||||
// Get vendor transition property
|
// Get vendor transition property
|
||||||
var docElemStyle = document.documentElement.style;
|
var docElemStyle = document.documentElement.style;
|
||||||
var transitionProp = typeof docElemStyle.transition == 'string' ?
|
var transitionProp = typeof docElemStyle.transition == 'string' ?
|
||||||
'transition' : 'WebkitTransition';
|
'transition' : 'WebkitTransition';
|
||||||
|
|
||||||
// Animate sidebar menu items
|
// Animate sidebar menu items
|
||||||
function animateMenuItems() {
|
function animateMenuItems() {
|
||||||
for ( var i=0; i < menuItems.length; i++ ) {
|
for (var i = 0; i < menuItems.length; i++) {
|
||||||
var item = menuItems[i];
|
var item = menuItems[i];
|
||||||
// Stagger transition with transitionDelay
|
// Stagger transition with transitionDelay
|
||||||
item.style[ transitionProp + 'Delay' ] = ( i * 75 ) + 'ms';
|
item.style[transitionProp + 'Delay'] = (i * 75) + 'ms';
|
||||||
item.classList.toggle('is--moved');
|
item.classList.toggle('is--moved');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,7 @@ var mySearchToggle = document.querySelector('.search-toggle');
|
||||||
// Toggle sidebar visibility
|
// Toggle sidebar visibility
|
||||||
function toggleClassMenu() {
|
function toggleClassMenu() {
|
||||||
myMenu.classList.add('is--animatable');
|
myMenu.classList.add('is--animatable');
|
||||||
if(!myMenu.classList.contains('is--visible')) {
|
if (!myMenu.classList.contains('is--visible')) {
|
||||||
myMenu.classList.add('is--visible');
|
myMenu.classList.add('is--visible');
|
||||||
myToggle.classList.add('open');
|
myToggle.classList.add('open');
|
||||||
myWrapper.classList.add('is--pushed');
|
myWrapper.classList.add('is--pushed');
|
||||||
|
@ -52,23 +52,23 @@ function OnTransitionEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
myMenu.addEventListener('transitionend', OnTransitionEnd, false);
|
myMenu.addEventListener('transitionend', OnTransitionEnd, false);
|
||||||
myToggle.addEventListener('click', function() {
|
myToggle.addEventListener('click', function () {
|
||||||
toggleClassMenu();
|
toggleClassMenu();
|
||||||
animateMenuItems();
|
animateMenuItems();
|
||||||
}, false);
|
}, false);
|
||||||
myMenu.addEventListener('click', function() {
|
myMenu.addEventListener('click', function () {
|
||||||
toggleClassMenu();
|
toggleClassMenu();
|
||||||
animateMenuItems();
|
animateMenuItems();
|
||||||
}, false);
|
}, false);
|
||||||
mySearchToggle.addEventListener('click', function() {
|
mySearchToggle.addEventListener('click', function () {
|
||||||
toggleClassSearch();
|
toggleClassSearch();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// Toggle search input and content visibility
|
// Toggle search input and content visibility
|
||||||
function toggleClassSearch() {
|
function toggleClassSearch() {
|
||||||
mySearchContent.classList.toggle("is--visible");
|
mySearchContent.classList.toggle('is--visible');
|
||||||
myInitialContent.classList.toggle("is--hidden");
|
myInitialContent.classList.toggle('is--hidden');
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
document.querySelector(".search-content input").focus();
|
document.querySelector('.search-content input').focus();
|
||||||
}, 400);
|
}, 400);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue