diff --git a/bower.json b/bower.json index bf96319..4c8dacc 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquery.otherdropdown", - "version": "1.0.2", + "version": "1.1.0", "authors": [ "TheBox193 " ], diff --git a/demo.html b/demo.html index 2c65833..a4379d4 100644 --- a/demo.html +++ b/demo.html @@ -1,33 +1,19 @@ - - - + + + + - + -jquery.otherdropdown v1.0.x +jquery.otherdropdown v1.1.x # jquery.otherdropdown diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..4b2b52b --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,12 @@ +var gulp = require('gulp'); +var uglify = require('gulp-uglify'); +var rename = require('gulp-rename'); + +gulp.task('default', function() { + return gulp.src('src/jquery.otherdropdown.js') + .pipe(uglify({preserveComments: "some"})) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest('src')); +}); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..645d521 --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "jquery.otherdropdown", + "version": "1.0.2", + "description": "A dropdown select box where choosing 'other' prompts the user for an alternate response.", + "main": "jquery.otherdropdown.js", + "scripts": { + "test": "" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/TheBox193/jquery.otherdropdown.git" + }, + "keywords": [ + "other", + "select", + "dropdown", + "text", + "input", + "option", + "textbox" + ], + "author": "Jonathan Stassen", + "license": "MIT", + "bugs": { + "url": "https://github.com/TheBox193/jquery.otherdropdown/issues" + }, + "homepage": "https://github.com/TheBox193/jquery.otherdropdown#readme", + "devDependencies": { + "gulp": "^3.9.0", + "gulp-rename": "^1.2.2", + "gulp-uglify": "^1.2.0" + } +} diff --git a/jquery.otherdropdown.js b/src/jquery.otherdropdown.js similarity index 98% rename from jquery.otherdropdown.js rename to src/jquery.otherdropdown.js index f768fd1..79dadfe 100644 --- a/jquery.otherdropdown.js +++ b/src/jquery.otherdropdown.js @@ -1,7 +1,8 @@ /** + * @license * @name jquery.otherdropdown * @description A small jQuery plugin to support a text area when selecting an 'Other' option in a dropdown - * @version 1.0.2 + * @version 1.1.0 * @author Jonathan Stassen <jstassen.com> * @see https://github.com/TheBox193/jquery.otherdropdown */ diff --git a/src/jquery.otherdropdown.min.js b/src/jquery.otherdropdown.min.js new file mode 100644 index 0000000..f3fb9c4 --- /dev/null +++ b/src/jquery.otherdropdown.min.js @@ -0,0 +1,9 @@ +/** + * @license + * @name jquery.otherdropdown + * @description A small jQuery plugin to support a text area when selecting an 'Other' option in a dropdown + * @version 1.1.0 + * @author Jonathan Stassen <jstassen.com> + * @see https://github.com/TheBox193/jquery.otherdropdown + */ +$.fn.otherDropdown=function(e){var a=this,l=$.extend({},{value:"other"},e);l.name_lower=l.value.toLowerCase(),l.name_upper=l.value.charAt(0).toUpperCase()+l.value.slice(1),l.placeholder=l.placeholder||l.name_upper,a.change(function(e){(this.value===l.name_lower||this.value===l.name_upper)&&(a.hide().after(r),r.focus())});var r=$('<input type="text" class="otherdropdown" placeholder="'+l.placeholder+'" />');l.classes&&r.addClass(l.classes),r.blur(function(e){var r=this.value;if(this.value="",this.remove(),a.show(),""!==r&&r!==l.name_lower&&r!==l.name_upper){var o=a.children('[value="'+r+'"]');if(o.length<1){var n=$('<option value="'+r+'">'+r+"</option>");a.append(n)}a.val(r)}})}; \ No newline at end of file