diff options
author | patdenice <patdenice@piwigo.org> | 2011-02-11 15:57:04 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-02-11 15:57:04 +0000 |
commit | d37ec3ddfd467f4b268086828440757133d0457e (patch) | |
tree | 39bea580f47578580151d334a2f9e3e23937a3ad /themes/default/js/ui/jquery.ui.selectable.js | |
parent | 1d6681d9b00024290ed565f60ba52e9a234474fc (diff) |
Update jQuery to 1.5 and jQuery UI to 1.8.9
git-svn-id: http://piwigo.org/svn/trunk@9172 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | themes/default/js/ui/jquery.ui.selectable.js (renamed from themes/default/js/ui/ui.selectable.js) | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/themes/default/js/ui/ui.selectable.js b/themes/default/js/ui/jquery.ui.selectable.js index 08f99cf4a..91fc1dec2 100644 --- a/themes/default/js/ui/ui.selectable.js +++ b/themes/default/js/ui/jquery.ui.selectable.js @@ -1,20 +1,28 @@ /* - * jQuery UI Selectable 1.7.2 + * jQuery UI Selectable 1.8.9 * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Selectables * * Depends: - * ui.core.js + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { -$.widget("ui.selectable", $.extend({}, $.ui.mouse, { - - _init: function() { +$.widget("ui.selectable", $.ui.mouse, { + options: { + appendTo: 'body', + autoRefresh: true, + distance: 0, + filter: '*', + tolerance: 'touch' + }, + _create: function() { var self = this; this.element.addClass("ui-selectable"); @@ -48,17 +56,20 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { this._mouseInit(); - this.helper = $(document.createElement('div')) - .css({border:'1px dotted black'}) - .addClass("ui-selectable-helper"); + this.helper = $("<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(event) { @@ -78,8 +89,6 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { $(options.appendTo).append(this.helper); // position helper (lasso) this.helper.css({ - "z-index": 100, - "position": "absolute", "left": event.clientX, "top": event.clientY, "width": 0, @@ -108,14 +117,23 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { $(event.target).parents().andSelf().each(function() { var selectee = $.data(this, "selectable-item"); if (selectee) { - selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting'); - selectee.unselecting = false; - selectee.selecting = true; - selectee.selected = true; - // selectable SELECTING callback - self._trigger("selecting", event, { - selecting: selectee.element - }); + var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected'); + selectee.$element + .removeClass(doSelect ? "ui-unselecting" : "ui-selected") + .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); + selectee.unselecting = !doSelect; + selectee.selecting = doSelect; + selectee.selected = doSelect; + // selectable (UN)SELECTING callback + if (doSelect) { + self._trigger("selecting", event, { + selecting: selectee.element + }); + } else { + self._trigger("unselecting", event, { + unselecting: selectee.element + }); + } return false; } }); @@ -239,19 +257,10 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { return false; } -})); +}); $.extend($.ui.selectable, { - version: "1.7.2", - defaults: { - appendTo: 'body', - autoRefresh: true, - cancel: ":input,option", - delay: 0, - distance: 0, - filter: '*', - tolerance: 'touch' - } + version: "1.8.9" }); })(jQuery); |