diff --git a/gulpfile.js b/gulpfile.js index 331596cf52..504989220f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,6 +12,7 @@ var buildLibraries = function() { // See https://gist.github.com/ktmud/9384509 return gulp.src(mainBowerFiles()) .pipe(filter('**/*.js')) // filter out CSS (bootstrap, etc.) + .pipe(uglify()) .pipe(concat('libraries.js')) .pipe(gulp.dest('web/')); } @@ -28,6 +29,7 @@ var buildJs = function() { 'src/web/js/url.js', 'src/web/js/script.js', ]) + .pipe(uglify()) .pipe(concat('script.js')) .pipe(gulp.dest('web/')); } diff --git a/src/web/js/script.js b/src/web/js/script.js index eaa8c2d24d..57c632ac65 100644 --- a/src/web/js/script.js +++ b/src/web/js/script.js @@ -87,6 +87,16 @@ var uiDictionaryLoadCallback = function(dictionary) { $('#wordcount').html(dictionary.words.length); + uiSetState(); + } + + var uiSetState = function() { + var rawSentence = $('input').val(); + if (Dictionary.checkSentence(rawSentence)) { + setState('ok'); + } else { + setState('error'); + } } /** Init the UI, possibly from a state passed in from the URL. */