test/dummy/tmp/cache/assets/D6E/3E0/sprockets%2F1be4cbdc9c19703c546405f087aee92d in cytoplasm-0.1.7 vs test/dummy/tmp/cache/assets/D6E/3E0/sprockets%2F1be4cbdc9c19703c546405f087aee92d in cytoplasm-0.1.8
- old
+ new
@@ -1,8 +1,8 @@
-o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357576208.317813:@value"†O{I"
+o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1358893654.724947:@value"´S{I"
class:EFI"BundledAsset; FI"logical_path; FI"cytoplasm/cytoSelect.js; FI"
pathname; FI"g/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoSelect.js.erb; FI"content_type; FI"application/javascript; FI"
-mtime; FI"2013-01-07T11:30:08-05:00; FI"length; Fi—MI"digest; F"%0fd3349e4fd3e1d23e3a6bdcd361ccd0I"source; FI"—M// CytoSelect v3.0
+mtime; FI"2013-01-22T17:27:32-05:00; FI"length; FiÅQI"digest; F"%0c8722c5370eeb49519cd79443fd8522I"source; FI"ÅQ// CytoSelect v3.0
// By MacKinley Smith
(function($){
var defaults = {
widget:{
arrowButton:{
@@ -35,11 +35,12 @@
height:30,
'white-space':'nowrap',
overflow:'hidden',
'border-top-right-radius':0,
'border-bottom-right-radius':0
- }
+ },
+ searchInterval:1000
},
label:{
css:{
float:'left',
font:'12px/30px Verdana',
@@ -270,51 +271,74 @@
var scrollTop = active.offset().top - settings.widget.optionsList.element.offset().top + settings.widget.optionsList.element.scrollTop();
var new_y = scrollTop - (settings.widget.optionsList.element.height()/2);
settings.widget.optionsList.element.scrollTop(new_y);
// Globalized bindings
+ var searchTimeout;
$(document).bind({
"click.cytoSelect-menu":function(){methods.hideMenu.apply($this);},
"keydown.cytoSelect-menu":function(e){
+ // Tab Key
if (e.which == 9) {
methods.hideMenu.apply($this);
return true;
}
if (e.ctrlKey || e.metaKey) return true;
e.preventDefault();
var active = settings.widget.optionsList.element.find('li.active');
- if (e.which == 38) var target = (settings.widget.optionsList.li.elements.length == 1) ? settings.widget.optionsList.li.elements : ((active.prev().is('*')) ? active.prev() : active.siblings(':last-child'));
- else if (e.which == 40) var target = (settings.widget.optionsList.li.elements.length == 1) ? settings.widget.optionsList.li.elements : ((active.next().is('*')) ? active.next() : active.siblings(':first-child'));
- else {
- // Search menu
- var s = String.fromCharCode(e.which);
- if (s.match(/\w/)) {
+ var target = active;
+ switch (e.which) {
+ case 13: // Enter key
+ methods.hideMenu.apply($this);
+ settings.events.change.apply($this,[settings,e]);
+ break;
+ case 27: // Escape key
+ methods.hideMenu.apply($this);
+ break;
+ case 38: // Up arrow
+ target = (settings.widget.optionsList.li.elements.length == 1) ? settings.widget.optionsList.li.elements : ((active.prev().is('*')) ? active.prev() : active.siblings(':last-child'));
+ break;
+ case 40: // Down arrow
+ target = (settings.widget.optionsList.li.elements.length == 1) ? settings.widget.optionsList.li.elements : ((active.next().is('*')) ? active.next() : active.siblings(':first-child'));
+ break;
+ default: // Anything else
+ var query = ($this.data('cytoSelect-searchquery')==null) ? "" : $this.data('cytoSelect-searchquery');
+ var s = String.fromCharCode(e.which);
+ if (!s.match(/\w/)) break; // Exit if s is a character key
+ query += s;
+ settings.widget.valueButton.element.html(query.toLowerCase());
+ $this.data('cytoSelect-searchquery',query);
+ var t = setTimeout(function(){
+ $this.data('cytoSelect-searchquery',null);
+ $(document).unbind('keydown.cytoSelect-search');
+ },settings.widget.valueButton.searchInterval);
+ $(document).bind('keydown.cytoSelect-search',function(e2){
+ clearTimeout(t);
+ $(document).unbind(e2);
+ });
+ // Search menu
$.each(settings.widget.optionsList.li.elements,function(){
- if (s == $(this).html().substr(0,1)) {
+ if (query == $(this).html().substr(0,query.length).toUpperCase()) {
target = $(this);
return false;
}
});
- } else target = active;
+ break;
}
active.removeClass('active').trigger("mouseout");
target.addClass('active').trigger("mouseover");
- settings.widget.valueButton.element.html(target.html());
+ if (searchTimeout!=null) clearTimeout(searchTimeout);
+ searchTimeout = setTimeout(function(){settings.widget.valueButton.element.html(target.html());},settings.widget.valueButton.searchInterval);
// Handle Scrolling
var activeTop = active.offset().top - settings.widget.optionsList.element.offset().top + settings.widget.optionsList.element.scrollTop();
var activeBottom = activeTop+settings.widget.optionsList.element.height()-active.height();
var targetPos = target.offset().top - settings.widget.optionsList.element.offset().top + settings.widget.optionsList.element.scrollTop() + (settings.widget.optionsList.element.height()/2);
var new_y = targetPos - settings.widget.optionsList.element.height();
if (targetPos >= activeTop && targetPos <= activeBottom) settings.widget.optionsList.element.scrollTop(new_y);
else settings.widget.optionsList.element.animate({scrollTop:new_y},settings.widget.optionsList.animationSpeed);
- // Enter key
- if (e.which == 13) {
- methods.hideMenu.apply($this);
- settings.events.change.apply($this,[settings,e]);
- }
return false;
}
});
});
});
@@ -439,6 +463,6 @@
};
$(window).resize(function(){$('select.cytoSelect').cytoSelect("resize");});
$.Cytoplasm("ready",function(){$('select.cytoSelect').cytoSelect();});
})(jQuery);
-; FI"required_assets_digest; F"%f2d3de88dacb40f9bd921c446efa9148I"
_version; F"%6776f581a4329e299531e1d52aa59832
+; FI"required_assets_digest; F"%06d2f66bc300173ca90696423f962594I"
_version; F"%6776f581a4329e299531e1d52aa59832
\ No newline at end of file