diff --git a/app/scripts/main.js b/app/scripts/main.js index 24450982..4170889d 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -16,9 +16,8 @@ * limitations under the License * */ -(function () { +(function() { 'use strict'; - var querySelector = document.querySelector.bind(document); - + // TODO: Do we still need this file? })(); diff --git a/app/styleguide/button/button.js b/app/styleguide/button/button.js index c680ae5a..08e96105 100644 --- a/app/styleguide/button/button.js +++ b/app/styleguide/button/button.js @@ -3,9 +3,11 @@ function PaperButton(el) { var buttonElement = el; var rippleElement = buttonElement.querySelector('.PaperButton-ripple'); - var frameCount = 0, x, y; + var frameCount = 0; + var x; + var y; - if(rippleElement) { + if (rippleElement) { var bound = buttonElement.getBoundingClientRect(); var rippleSize = Math.max(bound.width, bound.height) * 2; @@ -28,7 +30,8 @@ function PaperButton(el) { }; this.setRippleXY = function(newX, newY) { - x = newX, y = newY; + x = newX; + y = newY; }; this.animFrameHandler = function() { @@ -58,7 +61,8 @@ PaperButton.prototype.onClickHandler = function(evt) { this.setFrameCount(1); var bound = evt.currentTarget.getBoundingClientRect(); - var x, y; + var x; + var y; // Check if we are handling a keyboard click if (event.clientX === 0 && event.clientY === 0) { x = Math.round(bound.width / 2); @@ -71,7 +75,7 @@ PaperButton.prototype.onClickHandler = function(evt) { var transformString = 'translate(-50%, -50%) ' + 'translate(' + x + 'px, ' + y + 'px) ' + 'scale(0.0001, 0.0001)'; - + var rippleElement = this.getRippleElement(); if (rippleElement) { rippleElement.style.webkitTransform = transformString; diff --git a/app/styleguide/navigation/sidenav.js b/app/styleguide/navigation/sidenav.js index 2f05e42e..8ad61b51 100644 --- a/app/styleguide/navigation/sidenav.js +++ b/app/styleguide/navigation/sidenav.js @@ -102,7 +102,6 @@ sidenav.close(); }); - menuButton.addEventListener('click', function(evt) { sidenav.toggle(); }); diff --git a/app/styleguide/radio/radio.js b/app/styleguide/radio/radio.js index 1c4eb929..8ab9ed78 100644 --- a/app/styleguide/radio/radio.js +++ b/app/styleguide/radio/radio.js @@ -27,14 +27,17 @@ function RadioButton(btnElement, labelElement) { }; labelElement.addEventListener('click', this.onClick.bind(this)); - ripple.addEventListener('webkitTransitionEnd', this.onEndOfRippleTransition.bind(this)); - ripple.addEventListener('oTransitionEnd', this.onEndOfRippleTransition.bind(this)); - ripple.addEventListener('transitionEnd', this.onEndOfRippleTransition.bind(this)); + ripple.addEventListener('webkitTransitionEnd', + this.onEndOfRippleTransition.bind(this)); + ripple.addEventListener('oTransitionEnd', + this.onEndOfRippleTransition.bind(this)); + ripple.addEventListener('transitionEnd', + this.onEndOfRippleTransition.bind(this)); } window.addEventListener('load', function() { var radioLabels = document.querySelectorAll('.RadioButton-label'); - for(var i = 0; i < radioLabels.length; i++) { + for (var i = 0; i < radioLabels.length; i++) { var radioButton = radioLabels[i].querySelector('.RadioButton'); new RadioButton(radioButton, radioLabels[i]); } diff --git a/app/styleguide/slider/slider.js b/app/styleguide/slider/slider.js index 0bd55832..0e0aa307 100644 --- a/app/styleguide/slider/slider.js +++ b/app/styleguide/slider/slider.js @@ -24,9 +24,9 @@ function Slider(element) { this.updateValue(); } -window.addEventListener('load', function(){ +window.addEventListener('load', function() { var sliders = document.querySelectorAll('input[type="range"]'); - for(var i = 0; i < sliders.length; i++) { + for (var i = 0; i < sliders.length; i++) { new Slider(sliders[i]); } -}); \ No newline at end of file +}); diff --git a/app/styleguide/textfield/textfield.js b/app/styleguide/textfield/textfield.js index 7f6ab2fb..5151d189 100644 --- a/app/styleguide/textfield/textfield.js +++ b/app/styleguide/textfield/textfield.js @@ -8,8 +8,9 @@ function TextField(element) { if (inputElement.hasAttribute('maxrows')) { maxRows = parseInt(inputElement.getAttribute('maxrows'), 10); - if(isNaN(maxRows)) { - console.log('maxrows attribute provided, but wasn\'t a number: '+maxRows); + if (isNaN(maxRows)) { + console.log( + 'maxrows attribute provided, but wasn\'t a number: ' + maxRows); maxRows = NO_MAX_ROWS; } } @@ -24,15 +25,15 @@ function TextField(element) { this.onKeyDown = function(evt) { var currentRowCount = evt.target.value.split('\n').length; - if(evt.keyCode === 13) { - if(currentRowCount >= maxRows) { + if (evt.keyCode === 13) { + if (currentRowCount >= maxRows) { evt.preventDefault(); } } }; inputElement.addEventListener('input', this.onInputChange.bind(this)); - if(maxRows !== NO_MAX_ROWS) { + if (maxRows !== NO_MAX_ROWS) { // TODO: This should handle pasting multi line text // Currently doesn't inputElement.addEventListener('keydown', this.onKeyDown.bind(this)); diff --git a/app/styleguide/third_party/rAF.js b/app/styleguide/third_party/rAF.js index 27eaff27..9d43a83e 100644 --- a/app/styleguide/third_party/rAF.js +++ b/app/styleguide/third_party/rAF.js @@ -1,3 +1,5 @@ +'use strict'; + // From: http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ // shim layer with setTimeout fallback window.requestAnimFrame = (function() { diff --git a/gulpfile.js b/gulpfile.js index 2c6391a5..d85d0f17 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -41,8 +41,8 @@ var AUTOPREFIXER_BROWSERS = [ ]; // Lint JavaScript -gulp.task('jshint', function () { - return gulp.src('app/scripts/**/*.js') +gulp.task('jshint', function() { + return gulp.src(['app/scripts/**/*.js', 'app/styleguide/**/*.js']) .pipe(reload({stream: true, once: true})) .pipe($.jshint()) .pipe($.jshint.reporter('jshint-stylish')) @@ -50,7 +50,7 @@ gulp.task('jshint', function () { }); // Optimize Images -gulp.task('images', function () { +gulp.task('images', function() { return gulp.src('app/images/**/*') .pipe($.cache($.imagemin({ progressive: true, @@ -61,7 +61,7 @@ gulp.task('images', function () { }); // Copy All Files At The Root Level (app) -gulp.task('copy', function () { +gulp.task('copy', function() { return gulp.src([ 'app/*', '!app/*.html', @@ -73,26 +73,25 @@ gulp.task('copy', function () { }); // Copy Web Fonts To Dist -gulp.task('fonts', function () { +gulp.task('fonts', function() { return gulp.src(['app/fonts/**']) .pipe(gulp.dest('dist/fonts')) .pipe($.size({title: 'fonts'})); }); // Compile and Automatically Prefix Stylesheets -gulp.task('styles', function () { +gulp.task('styles', function() { // For best performance, don't add Sass partials to `gulp.src` return gulp.src([ - 'app/**/*.scss', - 'app/styles/**/*.css' - ]) + 'app/**/*.scss', + 'app/styles/**/*.css' + ]) .pipe($.changed('styles', {extension: '.scss'})) .pipe($.rubySass({ - style: 'expanded', - precision: 10 - }) - .on('error', console.error.bind(console)) - ) + style: 'expanded', + precision: 10 + }) + .on('error', console.error.bind(console))) .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS)) .pipe(gulp.dest('.tmp')) // Concatenate And Minify Styles @@ -102,7 +101,7 @@ gulp.task('styles', function () { }); // Scan Your HTML For Assets & Optimize Them -gulp.task('html', function () { +gulp.task('html', function() { var assets = $.useref.assets({searchPath: '{.tmp,app}'}); return gulp.src('app/**/*.html') @@ -141,7 +140,7 @@ gulp.task('html', function () { gulp.task('clean', del.bind(null, ['.tmp', 'dist'])); // Watch Files For Changes & Reload -gulp.task('serve', ['styles'], function () { +gulp.task('serve', ['styles'], function() { browserSync({ notify: false, // Customize the BrowserSync console logging prefix @@ -160,7 +159,7 @@ gulp.task('serve', ['styles'], function () { }); // Build and serve the output from the dist build -gulp.task('serve:dist', ['default'], function () { +gulp.task('serve:dist', ['default'], function() { browserSync({ notify: false, logPrefix: 'WSK', @@ -173,7 +172,7 @@ gulp.task('serve:dist', ['default'], function () { }); // Build Production Files, the Default Task -gulp.task('default', ['clean'], function (cb) { +gulp.task('default', ['clean'], function(cb) { runSequence('styles', ['jshint', 'html', 'images', 'fonts', 'copy'], cb); });