Merge branch 'assets-refactoring' into dev

Conflicts:
	app/controllers/issues_controller.rb
	app/views/issues/index.html.haml
This commit is contained in:
Nihad Abbasov 2011-10-26 23:35:17 +05:00
commit f1e6d9be90
116 changed files with 1431 additions and 1455 deletions

View file

@ -5,11 +5,14 @@
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.ui.selectmenu
//= require jquery.cookie
//= require_tree .
$(function(){
$(".one_click_select").click(function(){
$(".one_click_select").live("click", function(){
$(this).select();
});

View file

@ -1,845 +0,0 @@
/*
* jQuery UI selectmenu dev version
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
* https://github.com/fnagel/jquery-ui/wiki/Selectmenu
*/
(function($) {
$.widget("ui.selectmenu", {
getter: "value",
version: "1.8",
eventPrefix: "selectmenu",
options: {
transferClasses: true,
typeAhead: "sequential",
style: 'dropdown',
positionOptions: {
my: "left top",
at: "left bottom",
offset: null
},
width: null,
menuWidth: null,
handleWidth: 26,
maxHeight: null,
icons: null,
format: null,
bgImage: function() {},
wrapperElement: "<div />"
},
_create: function() {
var self = this, o = this.options;
// set a default id value, generate a new random one if not set by developer
var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );
// quick array of button and menu id's
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
// define safe mouseup for future toggling
this._safemouseup = true;
// create menu button wrapper
this.newelement = $( '<a />', {
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
'id' : this.ids[ 0 ],
'role': 'button',
'href': '#nogo',
'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
'aria-haspopup': true,
'aria-owns': this.ids[ 1 ]
});
this.newelementWrap = $( o.wrapperElement )
.append( this.newelement )
.insertAfter( this.element );
// transfer tabindex
var tabindex = this.element.attr( 'tabindex' );
if ( tabindex ) {
this.newelement.attr( 'tabindex', tabindex );
}
// save reference to select in data for ease in calling methods
this.newelement.data( 'selectelement', this.element );
// menu icon
this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' )
.prependTo( this.newelement );
// append status span to button
this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' );
// make associated form label trigger focus
$( 'label[for="' + selectmenuId + '"]' )
.attr( 'for', this.ids[0] )
.bind( 'click.selectmenu', function() {
self.newelement[0].focus();
return false;
});
// click toggle for menu visibility
this.newelement
.bind('mousedown.selectmenu', function(event) {
self._toggle(event, true);
// make sure a click won't open/close instantly
if (o.style == "popup") {
self._safemouseup = false;
setTimeout(function() { self._safemouseup = true; }, 300);
}
return false;
})
.bind('click.selectmenu', function() {
return false;
})
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.ENTER:
ret = true;
break;
case $.ui.keyCode.SPACE:
self._toggle(event);
break;
case $.ui.keyCode.UP:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveSelection(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveSelection(1);
break;
case $.ui.keyCode.TAB:
ret = true;
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'mouseup');
return true;
})
.bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if (!o.disabled) {
$(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
}
});
// document click closes menu
$(document).bind("mousedown.selectmenu", function(event) {
self.close(event);
});
// change event on original selectmenu
this.element
.bind("click.selectmenu", function() {
self._refreshValue();
})
// FIXME: newelement can be null under unclear circumstances in IE8
// TODO not sure if this is still a problem (fnagel 20.03.11)
.bind("focus.selectmenu", function() {
if (self.newelement) {
self.newelement[0].focus();
}
});
// set width when not set via options
if (!o.width) {
o.width = this.element.outerWidth();
}
// set menu button width
this.newelement.width(o.width);
// hide original selectmenu element
this.element.hide();
// create menu portion, append to body
this.list = $( '<ul />', {
'class': 'ui-widget ui-widget-content',
'aria-hidden': true,
'role': 'listbox',
'aria-labelledby': this.ids[0],
'id': this.ids[1]
});
this.listWrap = $( o.wrapperElement )
.addClass( self.widgetBaseClass + '-menu' )
.append( this.list )
.appendTo( 'body' );
// transfer menu click to menu button
this.list
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.UP:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveFocus(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveFocus(1);
break;
case $.ui.keyCode.HOME:
self._moveFocus(':first');
break;
case $.ui.keyCode.PAGE_UP:
self._scrollPage('up');
break;
case $.ui.keyCode.PAGE_DOWN:
self._scrollPage('down');
break;
case $.ui.keyCode.END:
self._moveFocus(':last');
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.TAB:
ret = true;
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.ESCAPE:
self.close(event, true);
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'focus');
return true;
})
// this allows for using the scrollbar in an overflowed list
.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });
// needed when window is resized
// TODO seems to be useless, but causes errors (fnagel 01.08.11)
// see: https://github.com/fnagel/jquery-ui/issues/147
// $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) );
},
_init: function() {
var self = this, o = this.options;
// serialize selectmenu element options
var selectOptionData = [];
this.element
.find('option')
.each(function() {
var opt = $(this);
selectOptionData.push({
value: opt.attr('value'),
text: self._formatText(opt.text()),
selected: opt.attr('selected'),
disabled: opt.attr('disabled'),
classes: opt.attr('class'),
typeahead: opt.attr('typeahead'),
parentOptGroup: opt.parent('optgroup'),
bgImage: o.bgImage.call(opt)
});
});
// active state class is only used in popup style
var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
// empty list so we can refresh the selectmenu via selectmenu()
this.list.html("");
// write li's
if (selectOptionData.length) {
for (var i = 0; i < selectOptionData.length; i++) {
var thisLiAttr = { role : 'presentation' };
if ( selectOptionData[ i ].disabled ) {
thisLiAttr[ 'class' ] = this.namespace + '-state-disabled';
}
var thisAAttr = {
html: selectOptionData[i].text,
href : '#nogo',
tabindex : -1,
role : 'option',
'aria-selected' : false
};
if ( selectOptionData[ i ].disabled ) {
thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
}
if ( selectOptionData[ i ].typeahead ) {
thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
}
var thisA = $('<a/>', thisAAttr);
var thisLi = $('<li/>', thisLiAttr)
.append(thisA)
.data('index', i)
.addClass(selectOptionData[i].classes)
.data('optionClasses', selectOptionData[i].classes || '')
.bind("mouseup.selectmenu", function(event) {
if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) {
var changed = $(this).data('index') != self._selectedIndex();
self.index($(this).data('index'));
self.select(event);
if (changed) {
self.change(event);
}
self.close(event, true);
}
return false;
})
.bind("click.selectmenu", function() {
return false;
})
.bind('mouseover.selectmenu focus.selectmenu', function(e) {
// no hover if diabled
if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) {
self._selectedOptionLi().addClass(activeClass);
self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
$(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if ($(this).is(self._selectedOptionLi().selector)) {
$(this).addClass(activeClass);
}
$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
});
// optgroup or not...
if ( selectOptionData[i].parentOptGroup.length ) {
var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup );
if (this.list.find( 'li.' + optGroupName ).length ) {
this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
} else {
$(' <li role="presentation" class="' + self.widgetBaseClass + '-group ' + optGroupName + (selectOptionData[i].parentOptGroup.attr("disabled") ? ' ' + this.namespace + '-state-disabled" aria-disabled="true"' : '"' ) + '><span class="' + self.widgetBaseClass + '-group-label">' + selectOptionData[i].parentOptGroup.attr('label') + '</span><ul></ul></li> ')
.appendTo( this.list )
.find( 'ul' )
.append( thisLi );
}
} else {
thisLi.appendTo(this.list);
}
// append icon if option is specified
if (o.icons) {
for (var j in o.icons) {
if (thisLi.is(o.icons[j].find)) {
thisLi
.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
.addClass(self.widgetBaseClass + '-hasIcon');
var iconClass = o.icons[j].icon || "";
thisLi
.find('a:eq(0)')
.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
if (selectOptionData[i].bgImage) {
thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
}
}
}
}
}
} else {
$('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list);
}
// we need to set and unset the CSS classes for dropdown and popup style
var isDropDown = ( o.style == 'dropdown' );
this.newelement
.toggleClass( self.widgetBaseClass + '-dropdown', isDropDown )
.toggleClass( self.widgetBaseClass + '-popup', !isDropDown );
this.list
.toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown )
.toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown )
// add corners to top and bottom menu items
.find( 'li:first' )
.toggleClass( 'ui-corner-top', !isDropDown )
.end().find( 'li:last' )
.addClass( 'ui-corner-bottom' );
this.selectmenuIcon
.toggleClass( 'ui-icon-triangle-1-s', isDropDown )
.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );
// transfer classes to selectmenu and list
if ( o.transferClasses ) {
var transferClasses = this.element.attr( 'class' ) || '';
this.newelement.add( this.list ).addClass( transferClasses );
}
// set menu width to either menuWidth option value, width option value, or select width
if ( o.style == 'dropdown' ) {
this.list.width( o.menuWidth ? o.menuWidth : o.width );
} else {
this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
}
// reset height to auto
this.list.css( 'height', 'auto' );
var listH = this.listWrap.height();
// calculate default max height
if ( o.maxHeight && o.maxHeight < listH ) {
this.list.height( o.maxHeight );
} else {
var winH = $( window ).height() / 3;
if ( winH < listH ) this.list.height( winH );
}
// save reference to actionable li's (not group label li's)
this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' );
// transfer disabled state
if ( this.element.attr( 'disabled' ) ) {
this.disable();
} else {
this.enable()
}
// update value
this.index( this._selectedIndex() );
// needed when selectmenu is placed at the very bottom / top of the page
window.setTimeout( function() {
self._refreshPosition();
}, 200 );
},
destroy: function() {
this.element.removeData( this.widgetName )
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
.removeAttr( 'aria-disabled' )
.unbind( ".selectmenu" );
// TODO unneded as event binding has been disabled
// $( window ).unbind( ".selectmenu" );
$( document ).unbind( ".selectmenu" );
// unbind click on label, reset its for attr
$( 'label[for=' + this.newelement.attr('id') + ']' )
.attr( 'for', this.element.attr( 'id' ) )
.unbind( '.selectmenu' );
this.newelementWrap.remove();
this.listWrap.remove();
this.element.show();
// call widget destroy function
$.Widget.prototype.destroy.apply(this, arguments);
},
_typeAhead: function( code, eventType ){
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase();
if ( self.options.typeAhead == 'sequential' ) {
// clear the timeout so we can use _prevChar
window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
// define our find var
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
function focusOptSeq( elem, ind, c ){
focusFound = true;
$( elem ).trigger( eventType );
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
}
this.list.find( 'li a' ).each( function( i ) {
if ( !focusFound ) {
// allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
if ( thisText.indexOf( find + C ) === 0 ) {
focusOptSeq( this, i, C );
} else if (thisText.indexOf(find+c) === 0 ) {
focusOptSeq( this, i, c );
}
}
});
// set a 1 second timeout for sequenctial typeahead
// keep this set even if we have no matches so it doesnt typeahead somewhere else
window.setTimeout( function( el ) {
self._prevChar = undefined;
}, 1000, self );
} else {
// define self._prevChar if needed
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
focusFound = false;
function focusOpt( elem, ind ){
focusFound = true;
$( elem ).trigger( eventType );
self._prevChar[ 1 ] = ind;
}
this.list.find( 'li a' ).each(function( i ){
if (!focusFound){
var thisText = $(this).text();
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
if (self._prevChar[0] == C){
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
} else{
focusOpt( this, i );
}
}
}
});
this._prevChar[ 0 ] = C;
}
},
// returns some usefull information, called by callbacks only
_uiHash: function() {
var index = this.index();
return {
index: index,
option: $("option", this.element).get(index),
value: this.element[0].value
};
},
open: function(event) {
var self = this, o = this.options;
if ( self.newelement.attr("aria-disabled") != 'true' ) {
self._closeOthers(event);
self.newelement.addClass('ui-state-active');
self.listWrap.appendTo( o.appendTo );
self.list.attr('aria-hidden', false);
if ( o.style == "dropdown" ) {
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
}
self.listWrap.addClass( self.widgetBaseClass + '-open' );
// positioning needed for IE7 (tested 01.08.11 on MS VPC Image)
// see https://github.com/fnagel/jquery-ui/issues/147
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
self._refreshPosition();
}
var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a');
if (selected.length) selected[0].focus();
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
self._refreshPosition();
self._trigger("open", event, self._uiHash());
}
},
close: function(event, retainFocus) {
if ( this.newelement.is('.ui-state-active') ) {
this.newelement
.removeClass('ui-state-active');
this.listWrap.removeClass(this.widgetBaseClass + '-open');
this.list.attr('aria-hidden', true);
if ( this.options.style == "dropdown" ) {
this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');
}
if ( retainFocus ) {
this.newelement.focus();
}
this._trigger("close", event, this._uiHash());
}
},
change: function(event) {
this.element.trigger("change");
this._trigger("change", event, this._uiHash());
},
select: function(event) {
if (this._disabled(event.currentTarget)) { return false; }
this._trigger("select", event, this._uiHash());
},
_closeOthers: function(event) {
$('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() {
$(this).data('selectelement').selectmenu('close', event);
});
$('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
},
_toggle: function(event, retainFocus) {
if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) {
this.close(event, retainFocus);
} else {
this.open(event);
}
},
_formatText: function(text) {
return (this.options.format ? this.options.format(text) : text);
},
_selectedIndex: function() {
return this.element[0].selectedIndex;
},
_selectedOptionLi: function() {
return this._optionLis.eq(this._selectedIndex());
},
_focusedOptionLi: function() {
return this.list.find('.' + this.widgetBaseClass + '-item-focus');
},
_moveSelection: function(amt, recIndex) {
// do nothing if disabled
if (!this.options.disabled) {
var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
// do not loop when using up key
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
// Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveSelection(amt, newIndex);
} else {
return this._optionLis.eq(newIndex).trigger('mouseup');
}
}
},
_moveFocus: function(amt, recIndex) {
if (!isNaN(amt)) {
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
} else {
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
}
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
//Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
this._focusedOptionLi().find('a:eq(0)').attr('id', '');
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveFocus(amt, newIndex);
} else {
this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
}
this.list.attr('aria-activedescendant', activeID);
},
_scrollPage: function(direction) {
var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
numPerPage = (direction == 'up' ? -numPerPage : numPerPage);
this._moveFocus(numPerPage);
},
_setOption: function(key, value) {
this.options[key] = value;
// set
if (key == 'disabled') {
this.close();
this.element
.add(this.newelement)
.add(this.list)[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled')
.attr("aria-disabled", value);
}
},
disable: function(index, type){
// if options is not provided, call the parents disable function
if ( typeof( index ) == 'undefined' ) {
this._setOption( 'disabled', true );
} else {
if ( type == "optgroup" ) {
this._disableOptgroup(index);
} else {
this._disableOption(index);
}
}
},
enable: function(index, type) {
// if options is not provided, call the parents enable function
if ( typeof( index ) == 'undefined' ) {
this._setOption('disabled', false);
} else {
if ( type == "optgroup" ) {
this._enableOptgroup(index);
} else {
this._enableOption(index);
}
}
},
_disabled: function(elem) {
return $(elem).hasClass( this.namespace + '-state-disabled' );
},
_disableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.addClass(this.namespace + '-state-disabled')
.find("a").attr("aria-disabled", true);
this.element.find("option").eq(index).attr("disabled", "disabled");
}
},
_enableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.removeClass( this.namespace + '-state-disabled' )
.find("a").attr("aria-disabled", false);
this.element.find("option").eq(index).removeAttr("disabled");
}
},
_disableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.addClass(this.namespace + '-state-disabled')
.attr("aria-disabled", true);
this.element.find("optgroup").eq(index).attr("disabled", "disabled");
}
},
_enableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.removeClass(this.namespace + '-state-disabled')
.attr("aria-disabled", false);
this.element.find("optgroup").eq(index).removeAttr("disabled");
}
},
index: function(newValue) {
if (arguments.length) {
if (!this._disabled($(this._optionLis[newValue]))) {
this.element[0].selectedIndex = newValue;
this._refreshValue();
} else {
return false;
}
} else {
return this._selectedIndex();
}
},
value: function(newValue) {
if (arguments.length) {
this.element[0].value = newValue;
this._refreshValue();
} else {
return this.element[0].value;
}
},
_refreshValue: function() {
var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
// deselect previous
this.list
.find('.' + this.widgetBaseClass + '-item-selected')
.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'false')
.attr('id', '');
// select new
this._selectedOptionLi()
.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'true')
.attr('id', activeID);
// toggle any class brought in from option
var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "");
var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "");
this.newelement
.removeClass(currentOptionClasses)
.data('optionClasses', newOptionClasses)
.addClass( newOptionClasses )
.find('.' + this.widgetBaseClass + '-status')
.html(
this._selectedOptionLi()
.find('a:eq(0)')
.html()
);
this.list.attr('aria-activedescendant', activeID);
},
_refreshPosition: function() {
var o = this.options;
// if its a native pop-up we need to calculate the position of the selected li
if ( o.style == "popup" && !o.positionOptions.offset ) {
var selected = this._selectedOptionLi();
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
}
// update zIndex if jQuery UI is able to process
var zIndexElement = this.element.zIndex();
if ( zIndexElement ) {
this.listWrap.css( 'zIndex', zIndexElement );
}
this.listWrap.position({
// set options for position plugin
of: o.positionOptions.of || this.newelement,
my: o.positionOptions.my,
at: o.positionOptions.at,
offset: o.positionOptions.offset || _offset,
collision: o.positionOptions.collision || 'flip'
});
}
});
})(jQuery);

View file

@ -2,6 +2,8 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require jquery-ui/jquery-ui
*= require jquery-ui/jquery.ui.selectmenu
*= require_self
*= require_tree .
*/

View file

@ -53,7 +53,6 @@ table.highlighttable pre{
text-align:left;
}
.git-empty .highlight {
@include round-borders-all(4px);
background:#eee;
@ -74,7 +73,6 @@ table.highlighttable pre{
box-shadow:0 5px 15px #000;
}
.hll { background-color: #ffffff }
.c { color: #888888; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */

View file

@ -157,7 +157,6 @@ table.round-borders {
background: transparent 9 !important;
}
#header-panel {
@include panel-color;
height:40px;
@ -230,7 +229,6 @@ a {
}
}
.view_file_content{
.old_line, .new_line {
background:#ECECEC;
@ -281,8 +279,6 @@ input.ssh_project_url {
text-align:center;
}
.day-commits-table li.commit {
cursor:pointer;
@ -599,7 +595,6 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
}
}
span{
border: 1px solid #aaa;
color:black;

View file

@ -57,7 +57,6 @@ class IssuesController < ApplicationController
end
end
def destroy
return access_denied! unless can?(current_user, :admin_issue, @issue)

View file

@ -15,7 +15,6 @@ class NotesController < ApplicationController
notify if params[:notify] == '1'
end
respond_to do |format|
format.html {redirect_to :back}
format.js

View file

@ -22,7 +22,6 @@ class Snippet < ActiveRecord::Base
:presence => true,
:length => { :within => 0..10000 }
def self.content_types
[
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",

View file

@ -23,7 +23,6 @@
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"}
:javascript
$(function() {
$( "#accordion" ).accordion(); });

View file

@ -11,7 +11,6 @@
%b Since:
= @admin_team_member.updated_at
.span-10
.span-6
%b Access:

View file

@ -2,5 +2,4 @@
= render 'form'
= link_to 'Back', admin_users_path, :class => "right lbutton"

View file

@ -24,7 +24,6 @@
%b Twitter:
= @admin_user.twitter
.clear
= link_to 'Edit', edit_admin_user_path(@admin_user)
\|

View file

@ -39,6 +39,5 @@
- else
= check_box_tag "closed", 1, @issue.closed, :disabled => true
.clear

View file

@ -22,7 +22,6 @@
</div>
</div>
<% if current_user %>
<%= javascript_tag do %>
$(function() {

View file

@ -20,7 +20,6 @@
$("#submit_note").removeAttr("disabled");
})
- if ["issues", "projects"].include?(controller.controller_name)
:javascript
$(function(){

View file

@ -25,4 +25,3 @@
%b Twitter:
= user.twitter

View file

@ -58,7 +58,6 @@ Gitlab::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :sendmail
# Defaults to:
# # config.action_mailer.sendmail_settings = {

View file

@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.timestamps
end

View file

@ -25,7 +25,6 @@
text-decoration: none;
}
#page {
background-color: #f0f0f0;
width: 750px;
@ -57,7 +56,6 @@
padding-right: 30px;
}
#header {
background-image: url("/assets/rails.png");
background-repeat: no-repeat;
@ -71,7 +69,6 @@
font-size: 16px;
}
#about h3 {
margin: 0;
margin-bottom: 10px;
@ -112,7 +109,6 @@
padding: 10px;
}
#getting-started {
border-top: 1px solid #ccc;
margin-top: 25px;
@ -149,7 +145,6 @@
font-size: 13px;
}
#sidebar ul {
margin-left: 0;
padding-left: 0;

View file

@ -29,7 +29,6 @@ describe "Profile" do
it { @user.twitter.should == 'testtwitter' }
end
describe "Password update" do
before do
visit profile_password_path

View file

@ -11,7 +11,6 @@ require 'capybara/dsl'
require 'factories'
require 'monkeypatch'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

View file

@ -6,7 +6,6 @@ shared_examples_for :project_side_pane do
it { should have_content("Tree") }
end
shared_examples_for :tree_view do
subject { page }

View file

@ -41,7 +41,7 @@ c);return this},enable:function(){return this._setOption("disabled",false)},disa
* http://docs.jquery.com/UI/Mouse
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.widget.js
*/
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
@ -74,9 +74,9 @@ g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"lef
* http://docs.jquery.com/UI/Draggables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
@ -124,10 +124,10 @@ p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.
* http://docs.jquery.com/UI/Droppables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.mouse.js
* jquery.ui.draggable.js
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.mouse.js
* jquery.ui.draggable.js
*/
(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
@ -151,9 +151,9 @@ a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)}}})(jQuery);
* http://docs.jquery.com/UI/Resizables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
@ -200,9 +200,9 @@ d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f
* http://docs.jquery.com/UI/Selectables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
@ -222,9 +222,9 @@ e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("
* http://docs.jquery.com/UI/Sortables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable");
this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a===
@ -282,8 +282,8 @@ _uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placehold
* http://docs.jquery.com/UI/Accordion
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
@ -312,9 +312,9 @@ paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",
* http://docs.jquery.com/UI/Autocomplete
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.position.js
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.position.js
*/
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
@ -344,8 +344,8 @@ this.first()?":last":":first"))},hasScroll:function(){return this.element.height
* http://docs.jquery.com/UI/Button
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!==
"boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover");
@ -371,13 +371,13 @@ b.Widget.prototype.destroy.call(this)}})})(jQuery);
* http://docs.jquery.com/UI/Dialog
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.button.js
* jquery.ui.draggable.js
* jquery.ui.mouse.js
* jquery.ui.position.js
* jquery.ui.resizable.js
* jquery.ui.draggable.js
* jquery.ui.mouse.js
* jquery.ui.position.js
* jquery.ui.resizable.js
*/
(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
@ -411,9 +411,9 @@ c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.b
* http://docs.jquery.com/UI/Slider
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
@ -444,8 +444,8 @@ b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":
* http://docs.jquery.com/UI/Tabs
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
@ -479,7 +479,7 @@ a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow"
* http://docs.jquery.com/UI/Datepicker
*
* Depends:
* jquery.ui.core.js
* jquery.ui.core.js
*/
(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
@ -609,7 +609,7 @@ a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
* http://docs.jquery.com/UI/Effects/Blind
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
@ -623,7 +623,7 @@ g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.deq
* http://docs.jquery.com/UI/Effects/Bounce
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
@ -638,7 +638,7 @@ b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=
* http://docs.jquery.com/UI/Effects/Clip
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
@ -652,7 +652,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,
* http://docs.jquery.com/UI/Effects/Drop
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
@ -666,7 +666,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,
* http://docs.jquery.com/UI/Effects/Explode
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
@ -681,7 +681,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m
* http://docs.jquery.com/UI/Effects/Fade
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
;/*
@ -694,7 +694,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m
* http://docs.jquery.com/UI/Effects/Fold
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
@ -708,7 +708,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m
* http://docs.jquery.com/UI/Effects/Highlight
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
@ -722,7 +722,7 @@ this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments
* http://docs.jquery.com/UI/Effects/Pulsate
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
@ -736,7 +736,7 @@ a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(
* http://docs.jquery.com/UI/Effects/Scale
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
@ -756,7 +756,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a
* http://docs.jquery.com/UI/Effects/Shake
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
@ -770,7 +770,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a
* http://docs.jquery.com/UI/Effects/Slide
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
@ -784,7 +784,7 @@ var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{q
* http://docs.jquery.com/UI/Effects/Transfer
*
* Depends:
* jquery.effects.core.js
* jquery.effects.core.js
*/
(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
b.dequeue()})})}})(jQuery);

View file

@ -0,0 +1,844 @@
/*
* jQuery UI selectmenu dev version
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
* https://github.com/fnagel/jquery-ui/wiki/Selectmenu
*/
(function($) {
$.widget("ui.selectmenu", {
getter: "value",
version: "1.8",
eventPrefix: "selectmenu",
options: {
transferClasses: true,
typeAhead: "sequential",
style: 'dropdown',
positionOptions: {
my: "left top",
at: "left bottom",
offset: null
},
width: null,
menuWidth: null,
handleWidth: 26,
maxHeight: null,
icons: null,
format: null,
bgImage: function() {},
wrapperElement: "<div />"
},
_create: function() {
var self = this, o = this.options;
// set a default id value, generate a new random one if not set by developer
var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );
// quick array of button and menu id's
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
// define safe mouseup for future toggling
this._safemouseup = true;
// create menu button wrapper
this.newelement = $( '<a />', {
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
'id' : this.ids[ 0 ],
'role': 'button',
'href': '#nogo',
'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
'aria-haspopup': true,
'aria-owns': this.ids[ 1 ]
});
this.newelementWrap = $( o.wrapperElement )
.append( this.newelement )
.insertAfter( this.element );
// transfer tabindex
var tabindex = this.element.attr( 'tabindex' );
if ( tabindex ) {
this.newelement.attr( 'tabindex', tabindex );
}
// save reference to select in data for ease in calling methods
this.newelement.data( 'selectelement', this.element );
// menu icon
this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' )
.prependTo( this.newelement );
// append status span to button
this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' );
// make associated form label trigger focus
$( 'label[for="' + selectmenuId + '"]' )
.attr( 'for', this.ids[0] )
.bind( 'click.selectmenu', function() {
self.newelement[0].focus();
return false;
});
// click toggle for menu visibility
this.newelement
.bind('mousedown.selectmenu', function(event) {
self._toggle(event, true);
// make sure a click won't open/close instantly
if (o.style == "popup") {
self._safemouseup = false;
setTimeout(function() { self._safemouseup = true; }, 300);
}
return false;
})
.bind('click.selectmenu', function() {
return false;
})
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.ENTER:
ret = true;
break;
case $.ui.keyCode.SPACE:
self._toggle(event);
break;
case $.ui.keyCode.UP:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveSelection(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveSelection(1);
break;
case $.ui.keyCode.TAB:
ret = true;
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'mouseup');
return true;
})
.bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if (!o.disabled) {
$(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
}
});
// document click closes menu
$(document).bind("mousedown.selectmenu", function(event) {
self.close(event);
});
// change event on original selectmenu
this.element
.bind("click.selectmenu", function() {
self._refreshValue();
})
// FIXME: newelement can be null under unclear circumstances in IE8
// TODO not sure if this is still a problem (fnagel 20.03.11)
.bind("focus.selectmenu", function() {
if (self.newelement) {
self.newelement[0].focus();
}
});
// set width when not set via options
if (!o.width) {
o.width = this.element.outerWidth();
}
// set menu button width
this.newelement.width(o.width);
// hide original selectmenu element
this.element.hide();
// create menu portion, append to body
this.list = $( '<ul />', {
'class': 'ui-widget ui-widget-content',
'aria-hidden': true,
'role': 'listbox',
'aria-labelledby': this.ids[0],
'id': this.ids[1]
});
this.listWrap = $( o.wrapperElement )
.addClass( self.widgetBaseClass + '-menu' )
.append( this.list )
.appendTo( 'body' );
// transfer menu click to menu button
this.list
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.UP:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveFocus(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveFocus(1);
break;
case $.ui.keyCode.HOME:
self._moveFocus(':first');
break;
case $.ui.keyCode.PAGE_UP:
self._scrollPage('up');
break;
case $.ui.keyCode.PAGE_DOWN:
self._scrollPage('down');
break;
case $.ui.keyCode.END:
self._moveFocus(':last');
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.TAB:
ret = true;
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.ESCAPE:
self.close(event, true);
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'focus');
return true;
})
// this allows for using the scrollbar in an overflowed list
.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });
// needed when window is resized
// TODO seems to be useless, but causes errors (fnagel 01.08.11)
// see: https://github.com/fnagel/jquery-ui/issues/147
// $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) );
},
_init: function() {
var self = this, o = this.options;
// serialize selectmenu element options
var selectOptionData = [];
this.element
.find('option')
.each(function() {
var opt = $(this);
selectOptionData.push({
value: opt.attr('value'),
text: self._formatText(opt.text()),
selected: opt.attr('selected'),
disabled: opt.attr('disabled'),
classes: opt.attr('class'),
typeahead: opt.attr('typeahead'),
parentOptGroup: opt.parent('optgroup'),
bgImage: o.bgImage.call(opt)
});
});
// active state class is only used in popup style
var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
// empty list so we can refresh the selectmenu via selectmenu()
this.list.html("");
// write li's
if (selectOptionData.length) {
for (var i = 0; i < selectOptionData.length; i++) {
var thisLiAttr = { role : 'presentation' };
if ( selectOptionData[ i ].disabled ) {
thisLiAttr[ 'class' ] = this.namespace + '-state-disabled';
}
var thisAAttr = {
html: selectOptionData[i].text,
href : '#nogo',
tabindex : -1,
role : 'option',
'aria-selected' : false
};
if ( selectOptionData[ i ].disabled ) {
thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
}
if ( selectOptionData[ i ].typeahead ) {
thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
}
var thisA = $('<a/>', thisAAttr);
var thisLi = $('<li/>', thisLiAttr)
.append(thisA)
.data('index', i)
.addClass(selectOptionData[i].classes)
.data('optionClasses', selectOptionData[i].classes || '')
.bind("mouseup.selectmenu", function(event) {
if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) {
var changed = $(this).data('index') != self._selectedIndex();
self.index($(this).data('index'));
self.select(event);
if (changed) {
self.change(event);
}
self.close(event, true);
}
return false;
})
.bind("click.selectmenu", function() {
return false;
})
.bind('mouseover.selectmenu focus.selectmenu', function(e) {
// no hover if diabled
if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) {
self._selectedOptionLi().addClass(activeClass);
self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
$(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if ($(this).is(self._selectedOptionLi().selector)) {
$(this).addClass(activeClass);
}
$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
});
// optgroup or not...
if ( selectOptionData[i].parentOptGroup.length ) {
var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup );
if (this.list.find( 'li.' + optGroupName ).length ) {
this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
} else {
$(' <li role="presentation" class="' + self.widgetBaseClass + '-group ' + optGroupName + (selectOptionData[i].parentOptGroup.attr("disabled") ? ' ' + this.namespace + '-state-disabled" aria-disabled="true"' : '"' ) + '><span class="' + self.widgetBaseClass + '-group-label">' + selectOptionData[i].parentOptGroup.attr('label') + '</span><ul></ul></li> ')
.appendTo( this.list )
.find( 'ul' )
.append( thisLi );
}
} else {
thisLi.appendTo(this.list);
}
// append icon if option is specified
if (o.icons) {
for (var j in o.icons) {
if (thisLi.is(o.icons[j].find)) {
thisLi
.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
.addClass(self.widgetBaseClass + '-hasIcon');
var iconClass = o.icons[j].icon || "";
thisLi
.find('a:eq(0)')
.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
if (selectOptionData[i].bgImage) {
thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
}
}
}
}
}
} else {
$('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list);
}
// we need to set and unset the CSS classes for dropdown and popup style
var isDropDown = ( o.style == 'dropdown' );
this.newelement
.toggleClass( self.widgetBaseClass + '-dropdown', isDropDown )
.toggleClass( self.widgetBaseClass + '-popup', !isDropDown );
this.list
.toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown )
.toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown )
// add corners to top and bottom menu items
.find( 'li:first' )
.toggleClass( 'ui-corner-top', !isDropDown )
.end().find( 'li:last' )
.addClass( 'ui-corner-bottom' );
this.selectmenuIcon
.toggleClass( 'ui-icon-triangle-1-s', isDropDown )
.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );
// transfer classes to selectmenu and list
if ( o.transferClasses ) {
var transferClasses = this.element.attr( 'class' ) || '';
this.newelement.add( this.list ).addClass( transferClasses );
}
// set menu width to either menuWidth option value, width option value, or select width
if ( o.style == 'dropdown' ) {
this.list.width( o.menuWidth ? o.menuWidth : o.width );
} else {
this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
}
// reset height to auto
this.list.css( 'height', 'auto' );
var listH = this.listWrap.height();
// calculate default max height
if ( o.maxHeight && o.maxHeight < listH ) {
this.list.height( o.maxHeight );
} else {
var winH = $( window ).height() / 3;
if ( winH < listH ) this.list.height( winH );
}
// save reference to actionable li's (not group label li's)
this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' );
// transfer disabled state
if ( this.element.attr( 'disabled' ) ) {
this.disable();
} else {
this.enable()
}
// update value
this.index( this._selectedIndex() );
// needed when selectmenu is placed at the very bottom / top of the page
window.setTimeout( function() {
self._refreshPosition();
}, 200 );
},
destroy: function() {
this.element.removeData( this.widgetName )
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
.removeAttr( 'aria-disabled' )
.unbind( ".selectmenu" );
// TODO unneded as event binding has been disabled
// $( window ).unbind( ".selectmenu" );
$( document ).unbind( ".selectmenu" );
// unbind click on label, reset its for attr
$( 'label[for=' + this.newelement.attr('id') + ']' )
.attr( 'for', this.element.attr( 'id' ) )
.unbind( '.selectmenu' );
this.newelementWrap.remove();
this.listWrap.remove();
this.element.show();
// call widget destroy function
$.Widget.prototype.destroy.apply(this, arguments);
},
_typeAhead: function( code, eventType ){
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase();
if ( self.options.typeAhead == 'sequential' ) {
// clear the timeout so we can use _prevChar
window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
// define our find var
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
function focusOptSeq( elem, ind, c ){
focusFound = true;
$( elem ).trigger( eventType );
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
}
this.list.find( 'li a' ).each( function( i ) {
if ( !focusFound ) {
// allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
if ( thisText.indexOf( find + C ) === 0 ) {
focusOptSeq( this, i, C );
} else if (thisText.indexOf(find+c) === 0 ) {
focusOptSeq( this, i, c );
}
}
});
// set a 1 second timeout for sequenctial typeahead
// keep this set even if we have no matches so it doesnt typeahead somewhere else
window.setTimeout( function( el ) {
self._prevChar = undefined;
}, 1000, self );
} else {
// define self._prevChar if needed
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
focusFound = false;
function focusOpt( elem, ind ){
focusFound = true;
$( elem ).trigger( eventType );
self._prevChar[ 1 ] = ind;
}
this.list.find( 'li a' ).each(function( i ){
if (!focusFound){
var thisText = $(this).text();
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
if (self._prevChar[0] == C){
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
} else{
focusOpt( this, i );
}
}
}
});
this._prevChar[ 0 ] = C;
}
},
// returns some usefull information, called by callbacks only
_uiHash: function() {
var index = this.index();
return {
index: index,
option: $("option", this.element).get(index),
value: this.element[0].value
};
},
open: function(event) {
var self = this, o = this.options;
if ( self.newelement.attr("aria-disabled") != 'true' ) {
self._closeOthers(event);
self.newelement.addClass('ui-state-active');
self.listWrap.appendTo( o.appendTo );
self.list.attr('aria-hidden', false);
if ( o.style == "dropdown" ) {
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
}
self.listWrap.addClass( self.widgetBaseClass + '-open' );
// positioning needed for IE7 (tested 01.08.11 on MS VPC Image)
// see https://github.com/fnagel/jquery-ui/issues/147
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
self._refreshPosition();
}
var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a');
if (selected.length) selected[0].focus();
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
self._refreshPosition();
self._trigger("open", event, self._uiHash());
}
},
close: function(event, retainFocus) {
if ( this.newelement.is('.ui-state-active') ) {
this.newelement
.removeClass('ui-state-active');
this.listWrap.removeClass(this.widgetBaseClass + '-open');
this.list.attr('aria-hidden', true);
if ( this.options.style == "dropdown" ) {
this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');
}
if ( retainFocus ) {
this.newelement.focus();
}
this._trigger("close", event, this._uiHash());
}
},
change: function(event) {
this.element.trigger("change");
this._trigger("change", event, this._uiHash());
},
select: function(event) {
if (this._disabled(event.currentTarget)) { return false; }
this._trigger("select", event, this._uiHash());
},
_closeOthers: function(event) {
$('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() {
$(this).data('selectelement').selectmenu('close', event);
});
$('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
},
_toggle: function(event, retainFocus) {
if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) {
this.close(event, retainFocus);
} else {
this.open(event);
}
},
_formatText: function(text) {
return (this.options.format ? this.options.format(text) : text);
},
_selectedIndex: function() {
return this.element[0].selectedIndex;
},
_selectedOptionLi: function() {
return this._optionLis.eq(this._selectedIndex());
},
_focusedOptionLi: function() {
return this.list.find('.' + this.widgetBaseClass + '-item-focus');
},
_moveSelection: function(amt, recIndex) {
// do nothing if disabled
if (!this.options.disabled) {
var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
// do not loop when using up key
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
// Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveSelection(amt, newIndex);
} else {
return this._optionLis.eq(newIndex).trigger('mouseup');
}
}
},
_moveFocus: function(amt, recIndex) {
if (!isNaN(amt)) {
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
} else {
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
}
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
//Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
this._focusedOptionLi().find('a:eq(0)').attr('id', '');
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveFocus(amt, newIndex);
} else {
this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
}
this.list.attr('aria-activedescendant', activeID);
},
_scrollPage: function(direction) {
var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
numPerPage = (direction == 'up' ? -numPerPage : numPerPage);
this._moveFocus(numPerPage);
},
_setOption: function(key, value) {
this.options[key] = value;
// set
if (key == 'disabled') {
this.close();
this.element
.add(this.newelement)
.add(this.list)[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled')
.attr("aria-disabled", value);
}
},
disable: function(index, type){
// if options is not provided, call the parents disable function
if ( typeof( index ) == 'undefined' ) {
this._setOption( 'disabled', true );
} else {
if ( type == "optgroup" ) {
this._disableOptgroup(index);
} else {
this._disableOption(index);
}
}
},
enable: function(index, type) {
// if options is not provided, call the parents enable function
if ( typeof( index ) == 'undefined' ) {
this._setOption('disabled', false);
} else {
if ( type == "optgroup" ) {
this._enableOptgroup(index);
} else {
this._enableOption(index);
}
}
},
_disabled: function(elem) {
return $(elem).hasClass( this.namespace + '-state-disabled' );
},
_disableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.addClass(this.namespace + '-state-disabled')
.find("a").attr("aria-disabled", true);
this.element.find("option").eq(index).attr("disabled", "disabled");
}
},
_enableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.removeClass( this.namespace + '-state-disabled' )
.find("a").attr("aria-disabled", false);
this.element.find("option").eq(index).removeAttr("disabled");
}
},
_disableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.addClass(this.namespace + '-state-disabled')
.attr("aria-disabled", true);
this.element.find("optgroup").eq(index).attr("disabled", "disabled");
}
},
_enableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.removeClass(this.namespace + '-state-disabled')
.attr("aria-disabled", false);
this.element.find("optgroup").eq(index).removeAttr("disabled");
}
},
index: function(newValue) {
if (arguments.length) {
if (!this._disabled($(this._optionLis[newValue]))) {
this.element[0].selectedIndex = newValue;
this._refreshValue();
} else {
return false;
}
} else {
return this._selectedIndex();
}
},
value: function(newValue) {
if (arguments.length) {
this.element[0].value = newValue;
this._refreshValue();
} else {
return this.element[0].value;
}
},
_refreshValue: function() {
var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
// deselect previous
this.list
.find('.' + this.widgetBaseClass + '-item-selected')
.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'false')
.attr('id', '');
// select new
this._selectedOptionLi()
.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'true')
.attr('id', activeID);
// toggle any class brought in from option
var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "");
var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "");
this.newelement
.removeClass(currentOptionClasses)
.data('optionClasses', newOptionClasses)
.addClass( newOptionClasses )
.find('.' + this.widgetBaseClass + '-status')
.html(
this._selectedOptionLi()
.find('a:eq(0)')
.html()
);
this.list.attr('aria-activedescendant', activeID);
},
_refreshPosition: function() {
var o = this.options;
// if its a native pop-up we need to calculate the position of the selected li
if ( o.style == "popup" && !o.positionOptions.offset ) {
var selected = this._selectedOptionLi();
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
}
// update zIndex if jQuery UI is able to process
var zIndexElement = this.element.zIndex();
if ( zIndexElement ) {
this.listWrap.css( 'zIndex', zIndexElement );
}
this.listWrap.position({
// set options for position plugin
of: o.positionOptions.of || this.newelement,
my: o.positionOptions.my,
at: o.positionOptions.at,
offset: o.positionOptions.offset || _offset,
collision: o.positionOptions.collision || 'flip'
});
}
});
})(jQuery);