Skip to content

Commit

Permalink
select module fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey authored and Sergey committed Nov 3, 2014
1 parent 154a6bc commit 856e1d5
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion js/jcf.button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.file.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.scrollable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down
33 changes: 24 additions & 9 deletions js/jcf.select.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down Expand Up @@ -149,7 +149,7 @@
onKeyDown: function(e) {
if(e.which === 13) {
this.toggleDropdown();
} else {
} else if(this.dropActive) {
this.delayedRefresh();
}
},
Expand Down Expand Up @@ -319,6 +319,11 @@
this.dropdown.add(this.fakeElement).toggleClass(this.options.flipDropClass, this.options.flipDropToFit && needFlipDrop);
},
showDropdown: function() {
// do not show empty custom dropdown
if(!this.realElement.prop('options').length) {
return;
}

// create options list if not created
if(!this.dropdown) {
this.createDropdown();
Expand Down Expand Up @@ -358,11 +363,16 @@
// redraw selected area
var selectedIndex = this.realElement.prop('selectedIndex'),
selectedOption = this.realElement.prop('options')[selectedIndex],
selectedOptionImage = selectedOption.getAttribute('data-image'),
selectedOptionImage = selectedOption ? selectedOption.getAttribute('data-image') : null,
selectedOptionClasses,
selectedFakeElement;

if(this.currentSelectedText !== selectedOption.innerHTML || this.currentSelectedImage !== selectedOptionImage) {
if(!selectedOption) {
if(this.selectImage) {
this.selectImage.hide();
}
this.selectText.removeAttr('class').empty();
} else if(this.currentSelectedText !== selectedOption.innerHTML || this.currentSelectedImage !== selectedOptionImage) {
selectedOptionClasses = getPrefixedClasses(selectedOption.className, this.options.optionClassPrefix);
this.selectText.attr('class', selectedOptionClasses).html(selectedOption.innerHTML);

Expand Down Expand Up @@ -457,11 +467,16 @@
attachEvents: function() {
// delayed refresh handler
var self = this;
this.delayedRefresh = function() {
clearTimeout(self.refreshTimer);
self.refreshTimer = setTimeout(function() {
self.refresh();
}, 1);
this.delayedRefresh = function(e) {
if(e && e.keyCode == 16) {
// ignore SHIFT key
return;
} else {
clearTimeout(self.refreshTimer);
self.refreshTimer = setTimeout(function() {
self.refresh();
}, 1);
}
};

// other event handlers
Expand Down
2 changes: 1 addition & 1 deletion js/jcf.textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2014 PSD2HTML (http://psd2html.com)
* Released under the MIT license (LICENSE.txt)
*
* Version: 1.0.0
* Version: 1.0.1
*/
;(function($, window) {
'use strict';
Expand Down

0 comments on commit 856e1d5

Please sign in to comment.