Skip to content

Commit

Permalink
Add gulp for min build, move script to src folder, bump to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBox193 committed Jul 8, 2015
1 parent aa8cb9b commit faa6ccb
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.otherdropdown",
"version": "1.0.2",
"version": "1.1.0",
"authors": [
"TheBox193 <[email protected]>"
],
Expand Down
40 changes: 13 additions & 27 deletions demo.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
<html><head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="jquery.otherdropdown.js"></script>
<html>
<head>
<script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/src/jquery.otherdropdown.js"></script>
<script type="text/javascript">

$(function(){
// Binding the otherDropdowns listeners to our form
$('[name="Test-1"]').otherDropdown();
$('[name="Test-2"]').otherDropdown({value:'Something'});
$('[name="Test-3"]').otherDropdown({classes:'noborder'});
$('[name="Test-4"]').otherDropdown({placeholder:'Type your reason'});
});

$(function(){
// Binding the otherDropdowns listeners to our form
$('[name="Test-1"]').otherDropdown();
$('[name="Test-2"]').otherDropdown({value:'Something'});
$('[name="Test-3"]').otherDropdown({classes:'noborder'});
$('[name="Test-4"]').otherDropdown({placeholder:'Type your reason'});
});
</script>
<style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
.en-markup-crop-options {
top: 18px !important;
left: 50% !important;
margin-left: -100px !important;
width: 200px !important;
border: 2px rgba(255,255,255,.38) solid !important;
border-radius: 4px !important;
}

.en-markup-crop-options div div:first-of-type {
margin-left: 0px !important;
}
</style></head>
</head>
<body style="display:none">
<title>jquery.otherdropdown v1.0.x</title>
<title>jquery.otherdropdown v1.1.x</title>

<xmp theme="united" style="display:none;">
# jquery.otherdropdown
Expand Down
12 changes: 12 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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'));
});
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
3 changes: 2 additions & 1 deletion jquery.otherdropdown.js → src/jquery.otherdropdown.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
9 changes: 9 additions & 0 deletions src/jquery.otherdropdown.min.js
Original file line number Diff line number Diff line change
@@ -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)}})};

0 comments on commit faa6ccb

Please sign in to comment.