Skip to content

Commit

Permalink
Merge pull request Robdel12#206 from Robdel12/version-1.5.1
Browse files Browse the repository at this point in the history
Version 1.5.1
  • Loading branch information
Robert DeLuca committed May 27, 2014
2 parents fcd2875 + e05cdec commit 87e07dc
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
2 changes: 0 additions & 2 deletions blank_theme.css → css/blank_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
float: left; }
.dk_container a {
outline: 0; }
.dk_container[disabled] a {
cursor: not-allowed; }

.dk_toggle {
display: -moz-inline-stack;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dropkick.css → css/dropkick.css
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
-moz-appearance: none;
-webkit-appearance: none; }

/* Here we reflect some of the styles from .dk_container to achieve the same visual also when without javascript */
/* Here we reflect some of the styles from .dk_container to achieve the same visual also when without javascript */
.dk_wrap {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -249,7 +249,7 @@
display: none;
}

/* Firefox only */
/* Firefox only */
@-moz-document url-prefix() {
.dk_wrap select { padding: 7px 49px 5px 6px; }
}
Expand Down
File renamed without changes.
13 changes: 11 additions & 2 deletions example/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<title>Robdel12/DropKick @ GitHub</title>
<link rel="stylesheet" href="example.css" type="text/css">
<link rel="stylesheet" href="../dropkick.css" type="text/css">
<link rel="stylesheet" href="../css/dropkick.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Carter+One&v1' rel='stylesheet' type='text/css'>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
Expand Down Expand Up @@ -278,13 +278,22 @@ <h2>Disabled &lt;option&gt;</h2>
<option value="GB">United Kingdom</option>
<option value="US" disabled>United States</option>
</select>
<select name="country-optall-disabled" class="default" tabindex="8">
<option value="" disabled>All options disabled</option>
<option value="AU" disabled>Australia</option>
<option value="CA" disabled>Canada</option>
<option value="DE" disabled>Germany</option>
<option value="JP" disabled>Japan</option>
<option value="GB" disabled>United Kingdom</option>
<option value="US" disabled>United States</option>
</select>
</div>
</fieldset>

<fieldset class="example">
<h2>With &lt;optgroup&gt;</h2>
<div class="fields">
<select name="country-opt-disabled" class="default" tabindex="8">
<select name="country-optgroup-disabled" class="default" tabindex="8">
<option value="" selected disabled>Try optgroup support!</option>
<optgroup label="America">
<option value="CA">Canada</option>
Expand Down
8 changes: 3 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var rename = require('gulp-rename');

// Lint Task
gulp.task('lint', function() {
return gulp.src('*.js')
return gulp.src('jquery.dropkick.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
Expand All @@ -25,11 +25,9 @@ gulp.task('sass', function() {
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('dist'))
.pipe(rename('all.min.js'))
.pipe(rename('jquery.dropkick-min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
.pipe(gulp.dest(''));
});

// Watch Files For Changes
Expand Down
11 changes: 1 addition & 10 deletions jquery.dropkick-min.js
100755 → 100644

Large diffs are not rendered by default.

46 changes: 25 additions & 21 deletions jquery.dropkick.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* DropKick 1.5
* DropKick 1.5.1
*
* Highly customizable <select> lists
* https://github.com/robdel12/DropKick
Expand Down Expand Up @@ -34,7 +34,7 @@
if(!$value.hasClass('disabled') && !$value.closest('.dk_optgroup',$dk).hasClass('disabled')){
if (!$value.hasClass('dk_option_current')) { // Also check if this isn't the selected option
updateFields($option, $dk);
setCurrent($option.parent(), $dk); // IE8+, iOS4 and some Android [4.0] Browsers back to scrollTop 0 when an option is clicked and the dropdown is opened again
setCurrent($option.parent(), $dk); // IE8+, iOS4 and some Android [4.0] Browsers back to scrollTop 0 when an option is clicked and the dropdown is opened again
}
closeDropdown($dk);
}
Expand Down Expand Up @@ -130,15 +130,16 @@
// private
// Update the <select> value, and the dropdown label
updateFields = function(option, $dk, reset) {
var
value = option.attr('data-dk-dropdown-value'),
label = option.text(),
var
data = $dk.data('dropkick'),
$select = data.$select
$select = data.$select,
$option = option.length ? option : data.$original,
value = $option.attr('data-dk-dropdown-value') || option.attr('value'),
label = $option.text()
;

$dk.find('.dk_label').text(!!label?label:'&nbsp;');
$dk.find('.dk_label').html(!!label?label:'&nbsp;');

!reset ? $select.val(value).trigger('change') : $select.val(value); // Let it act like a normal select when needed

data.settings.change && !reset && !data.settings.syncReverse && data.settings.change.call($select, value, label);
Expand Down Expand Up @@ -306,10 +307,15 @@
var
// Template for the dropdown
buildOption = function($el) {
return optionTemplate.replace('{{ value }}', $el.val())
.replace('{{ current }}', (notBlank($el.val()) === view.value) ? 'dk_option_current' : '')
.replace('{{ disabled }}', ($el.attr('disabled') !== undefined) ? 'disabled' : '')
.replace('{{ text }}', !!$.trim($el.html()) ? $.trim($el.html()) : '&nbsp;' )
var
value = $el.val(),
html = $el.html(),
disabled = $el.attr('disabled') !== undefined
;
return optionTemplate.replace('{{ value }}', value)
.replace('{{ current }}', (notBlank(value) === view.value && !disabled) ? 'dk_option_current' : '')
.replace('{{ disabled }}', (disabled) ? 'disabled' : '')
.replace('{{ text }}', !!$.trim(html) ? $.trim(html) : '&nbsp;' )
;
},
template = tpl.replace('{{ id }}', view.id).replace('{{ label }}', view.label).replace('{{ tabindex }}', view.tabindex),
Expand All @@ -325,7 +331,7 @@
if (view.options && view.options.length) {
for (i = 0, l = view.options.length; i < l; i++) {
$option = $(view.options[i]);

if ($option.is('option')) {
oTemplate = (i === 0 && $option.attr('selected') !== undefined && $option.attr('disabled') !== undefined) ? null : buildOption($option);
} else if ($option.is('optgroup')) {
Expand All @@ -339,7 +345,7 @@
oTemplate += '</ul>';
}
oTemplate += '</li>';

}

options[options.length] = oTemplate;
Expand Down Expand Up @@ -398,8 +404,6 @@
// The completed dk_container element
$dk = false,

theme,

// The form relative to the select
$form
;
Expand Down Expand Up @@ -430,13 +434,13 @@
// Hide the <select> list and place our new one in front of it
// $dk = $('div[id="dk_container_' + id + '"]').fadeIn(settings.startSpeed);
// To permite cloning methods, will no more need to update the reference to $dk
$select.before($dk).appendTo($dk.addClass('dk_theme_' + theme));
$select.before($dk).appendTo($dk.addClass('dk_theme_' + data.theme));

if ($wrap.length) {
$wrap.removeClass('dk_wrap');
$dk.show();
} else {
$dk.fadeIn(settings.startSpeed)
$dk.fadeIn(settings.startSpeed);
}

// Save the updated $dk reference into our data object
Expand Down Expand Up @@ -471,7 +475,7 @@
label = option.text()
;

$dk.find('.dk_label').text(!!label?label:'&nbsp;');
$dk.find('.dk_label').html(!!label?label:'&nbsp;');
setCurrent(option.parent(), $dk, e);
data.settings.change && data.settings.change.call($select, value, label);
});
Expand Down Expand Up @@ -539,7 +543,7 @@
$current,
$dkopts
;
// Update data options
// Update data options
data.options = $select.children();
// Rebuild options list. filter options inner and replace
$dkopts = build(dropdownTemplate, data).find('.dk_options_inner');
Expand Down Expand Up @@ -594,7 +598,7 @@
$clone.dropkick(settings);
toReturn[i] = $clone.data('dropkick').$dk[0];
}

});
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DropKick",
"version": "1.5.0",
"version": "1.5.1",
"description": "A jQuery plugin for creating beautiful, graceful, and painless custom dropdowns.",
"main": "jquery.dropkick-min.js",
"directories": {
Expand Down

0 comments on commit 87e07dc

Please sign in to comment.