Skip to content
Browse files

applied Yanick's patches

  • Loading branch information...
2 parents 95ee3ee + e7bb0fa commit b0a4f6e0c7104d3a4d68f1b33c03dd080bbe39f2 michael committed May 18, 2009
View
2 css/common.css
@@ -43,7 +43,7 @@
/* multiselect styles */
.multiselect {
width: 460px;
- height: 150px;
+ height: 200px;
}
#switcher {
View
24 css/ui.multiselect.css
@@ -3,26 +3,28 @@
.ui-multiselect { border: solid 1px; font-size: 0.8em; }
.ui-multiselect ul { -moz-user-select: none; }
-.ui-multiselect ul li { cursor: default; line-height: 20px; height: 20px; font-size: 11px; }
-.ui-multiselect ul li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
-.ui-multiselect div.selected { padding: 0; margin: 0; border: 0; float:left; position: relative; }
+.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
+.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
+.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
-.ui-multiselect ul.selected { padding: 0; overflow: auto; /*makes IE6 happy*/ overflow-y: auto; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
+.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
+.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
.ui-multiselect ul.selected li { }
-.ui-multiselect div.available { padding: 0; margin: 0; border: 0; float:left; position: relative; border-left: 1px solid; }
-.ui-multiselect ul.available { padding: 0; overflow: auto; /*makes IE6 happy*/ overflow-y: auto; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
-.ui-multiselect ul.available li { padding-left: 10px; }
+.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
+.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
+.ui-multiselect ul.available li { padding-left: 10px; }
+
.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
.ui-multiselect .ui-state-hover { border: none; }
.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
-
+
.ui-multiselect .add-all { float: right; padding: 7px;}
.ui-multiselect .remove-all { float: right; padding: 7px;}
.ui-multiselect .search { float: left; padding: 4px;}
.ui-multiselect .count { float: left; padding: 7px;}
-.ui-multiselect ul li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
-.ui-multiselect ul li a.action { position: absolute; right: 2px; top: 2px; }
-
+.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
+.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
+
.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
View
17 index.html
@@ -13,13 +13,13 @@
<script type="text/javascript" src="js/ui.multiselect.js"></script>
<script type="text/javascript">
$(function(){
- $.localise('ui-multiselect', {language: 'en', path: 'js/locale/'});
- $(".multiselect").multiselect();
- $('#switcher').themeswitcher();
- });
- </script>
-</head>
-<body>
+ $.localise('ui-multiselect', {/*language: 'en',*/ path: 'js/locale/'});
+ $(".multiselect").multiselect();
+ $('#switcher').themeswitcher();
+ });
+ </script>
+</head>
+<body>
<a href="http://github.com/michael/multiselect"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub" /></a>
<div id="wrapper">
@@ -32,9 +32,10 @@
<ul id="nav">
<li><a href="http://quasipartikel.at/2009/05/10/jqueryui-multiselect/">Blogpost</a></li>
<li><a href="http://github.com/michael/multiselect">Source</a></li>
+ <li><a href="http://github.com/michael/multiselect/zipball/master">Download</a></li>
<li><a href="http://github.com/michael/multiselect/issues">Bugs</a></li>
</ul>
- </div>
+ </div>
<div id="content">
<p>
View
99 js/plugins/jquery.localisation.js
@@ -1,99 +0,0 @@
-/* http://keith-wood.name/localisation.html
- Localisation assistance for jQuery v1.0.4.
- Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
- Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
- MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
- Please attribute the author if you use it. */
-
-(function($) { // Hide scope, no $ conflict
-
-/* Load applicable localisation package(s) for one or more jQuery packages.
- Assumes that the localisations are named <base>-<lang>.js
- and loads them in order from least to most specific.
- For example, $.localise('mypackage');
- with the browser set to 'en-US' would attempt to load
- mypackage-en.js and mypackage-en-US.js.
- Also accepts an array of package names to process.
- Optionally specify whether or not to include the base file,
- the desired language, and/or the timeout period, e.g.
- $.localise(['mypackage1', 'yourpackage'],
- {loadBase: true; language: 'en-AU', timeout: 300});
- @param packages (string or string[]) names of package(s) to load
- @param settings omit for the current browser language or
- (string) code for the language to load (aa[-AA]) or
- (object} options for the call with
- language (string) the code for the language
- loadBase (boolean) true to also load the base package or false (default) to not
- path (string or string[2]) the paths to the JavaScript,
- either as both or [base, localisations]
- timeout (number) the time period in milliseconds (default 500)
- @param loadBase (boolean, optional) true to also load the base package or false (default) to not -
- omit this if settings is an object
- @param path (string or string[2], optional) the paths to the JavaScript,
- either as both or [base, localisations] -
- omit this if settings is an object
- @param timeout (number, optional) the time period in milliseconds (default 500) -
- omit this if settings is an object */
-$.localise = function(packages, settings, loadBase, path, timeout) {
- if (typeof settings != 'object' && typeof settings != 'string') {
- timeout = path;
- path = loadBase;
- loadBase = settings;
- settings = '';
- }
- if (typeof loadBase != 'boolean') {
- timeout = path;
- path = loadBase;
- loadBase = false;
- }
- if (typeof path != 'string' && !isArray(path)) {
- timeout = path;
- path = ['', ''];
- }
- var saveSettings = {async: $.ajaxSettings.async, timeout: $.ajaxSettings.timeout};
- settings = (typeof settings != 'string' ? settings || {} :
- {language: settings, loadBase: loadBase, path: path, timeout: timeout});
- var paths = (!settings.path ? ['', ''] :
- (isArray(settings.path) ? settings.path : [settings.path, settings.path]));
- $.ajaxSetup({async: false, timeout: (settings.timeout || 500)});
- var localiseOne = function(package, lang) {
- if (settings.loadBase) {
- $.getScript(paths[0] + package + '.js');
- }
- if (lang.length >= 2) {
- $.getScript(paths[1] + package + '-' + lang.substring(0, 2) + '.js');
- }
- if (lang.length >= 5) {
- $.getScript(paths[1] + package + '-' + lang.substring(0, 5) + '.js');
- }
- };
- var lang = normaliseLang(settings.language || $.localise.defaultLanguage);
- packages = (isArray(packages) ? packages : [packages]);
- for (i = 0; i < packages.length; i++) {
- localiseOne(packages[i], lang);
- }
- $.ajaxSetup(saveSettings);
-};
-
-// Localise it!
-$.localize = $.localise;
-
-/* Retrieve the default language set for the browser. */
-$.localise.defaultLanguage = normaliseLang(navigator.language /* Mozilla */ ||
- navigator.userLanguage /* IE */);
-
-/* Ensure language code is in the format aa-AA. */
-function normaliseLang(lang) {
- lang = lang.replace(/_/, '-').toLowerCase();
- if (lang.length > 3) {
- lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
- }
- return lang;
-}
-
-/* Determine whether an object is an array. */
-function isArray(a) {
- return (a && a.constructor == Array);
-}
-
-})(jQuery);
View
7 js/plugins/jquery.localisation.min.js
@@ -1,7 +0,0 @@
-/* http://keith-wood.name/localisation.html
- Localisation assistance for jQuery v1.0.4.
- Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
- Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
- MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
- Please attribute the author if you use it. */
-(function($){$.localise=function(c,d,e,f,g){if(typeof d!='object'&&typeof d!='string'){g=f;f=e;e=d;d=''}if(typeof e!='boolean'){g=f;f=e;e=false}if(typeof f!='string'&&!isArray(f)){g=f;f=['','']}var h={async:$.ajaxSettings.async,timeout:$.ajaxSettings.timeout};d=(typeof d!='string'?d||{}:{language:d,loadBase:e,path:f,timeout:g});var j=(!d.path?['','']:(isArray(d.path)?d.path:[d.path,d.path]));$.ajaxSetup({async:false,timeout:(d.timeout||500)});var k=function(a,b){if(d.loadBase){$.getScript(j[0]+a+'.js')}if(b.length>=2){$.getScript(j[1]+a+'-'+b.substring(0,2)+'.js')}if(b.length>=5){$.getScript(j[1]+a+'-'+b.substring(0,5)+'.js')}};var l=normaliseLang(d.language||$.localise.defaultLanguage);c=(isArray(c)?c:[c]);for(i=0;i<c.length;i++){k(c[i],l)}$.ajaxSetup(h)};$.localize=$.localise;$.localise.defaultLanguage=normaliseLang(navigator.language||navigator.userLanguage);function normaliseLang(a){a=a.replace(/_/,'-').toLowerCase();if(a.length>3){a=a.substring(0,3)+a.substring(3).toUpperCase()}return a}function isArray(a){return(a&&a.constructor==Array)}})(jQuery);
View
7 js/plugins/jquery.localisation.pack.js
@@ -1,7 +0,0 @@
-/* http://keith-wood.name/localisation.html
- Localisation assistance for jQuery v1.0.4.
- Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
- Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
- MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
- Please attribute the author if you use it. */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.m=7(c,d,e,f,g){4(8 d!=\'E\'&&8 d!=\'r\'){g=f;f=e;e=d;d=\'\'}4(8 e!=\'F\'){g=f;f=e;e=x}4(8 f!=\'r\'&&!n(f)){g=f;f=[\'\',\'\']}o h={s:$.y.s,9:$.y.9};d=(8 d!=\'r\'?d||{}:{t:d,z:e,6:f,9:g});o j=(!d.6?[\'\',\'\']:(n(d.6)?d.6:[d.6,d.6]));$.A({s:x,9:(d.9||G)});o k=7(a,b){4(d.z){$.u(j[0]+a+\'.v\')}4(b.p>=2){$.u(j[1]+a+\'-\'+b.q(0,2)+\'.v\')}4(b.p>=5){$.u(j[1]+a+\'-\'+b.q(0,5)+\'.v\')}};o l=w(d.t||$.m.B);c=(n(c)?c:[c]);H(i=0;i<c.p;i++){k(c[i],l)}$.A(h)};$.I=$.m;$.m.B=w(C.t||C.J);7 w(a){a=a.K(/L/,\'-\').M();4(a.p>3){a=a.q(0,3)+a.q(3).N()}D a}7 n(a){D(a&&a.O==P)}})(Q);',53,53,'||||if||path|function|typeof|timeout|||||||||||||localise|isArray|var|length|substring|string|async|language|getScript|js|normaliseLang|false|ajaxSettings|loadBase|ajaxSetup|defaultLanguage|navigator|return|object|boolean|500|for|localize|userLanguage|replace|_|toLowerCase|toUpperCase|constructor|Array|jQuery'.split('|'),0,{}))
View
30 js/ui.multiselect.js
@@ -53,8 +53,9 @@ $.widget("ui.multiselect", {
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
- this.selectedList.height(this.element.height());
- this.availableList.height(this.element.height());
+ // fix list height to match <option> depending on their individual header's heights
+ this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
+ this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
if ( !this.options.animated ) {
this.options.show = 'show';
@@ -253,19 +254,19 @@ $.widget("ui.multiselect", {
that.count += 1;
that._updateCount();
return false;
- });
-
+ })
// make draggable
- elements.each(function() {
+ .each(function() {
$(this).parent().draggable({
connectToSortable: 'ul.selected',
helper: function() {
- var selectedItem = that._cloneWithData($(this));
+ var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
selectedItem.width($(this).width());
return selectedItem;
},
- revert: 'invalid',
- containment: '.ui-multiselect'
+ appendTo: '.ui-multiselect',
+ containment: '.ui-multiselect',
+ revert: 'invalid'
});
});
},
@@ -280,18 +281,13 @@ $.widget("ui.multiselect", {
},
_registerSearchEvents: function(input) {
var that = this;
- var defaultValue = $.trim(input.val());
- var timer;
input.focus(function() {
$(this).addClass('ui-state-active');
})
.blur(function() {
$(this).removeClass('ui-state-active');
})
- .keyup(function() {
- that._filter.apply(this, [that.availableList]);
- }).keyup()
.parents('form').submit(function(){
return false;
});
@@ -302,11 +298,6 @@ $.extend($.ui.multiselect, {
defaults: {
sortable: true,
searchable: true,
- ajaxSearch: {
- url: null,
- params: {},
- overrideLocal: false
- },
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
@@ -315,8 +306,7 @@ $.extend($.ui.multiselect, {
var text1 = node1.text(),
text2 = node2.text();
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
- },
- nodeInserted: function(event,ui,data) {}
+ }
},
locale: {
addAll:'Add all',
View
2 version.txt
@@ -1 +1 @@
-0.2
+0.3

0 comments on commit b0a4f6e

Please sign in to comment.
Something went wrong with that request. Please try again.