diff options
author | rvelices <rv-github@modusoptimus.com> | 2013-02-18 21:18:40 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2013-02-18 21:18:40 +0000 |
commit | 74373ea7175bcf6be2732e6d59f037f79f88ca96 (patch) | |
tree | e8799eea7707f9aae6ba3ccb2aa7ce315f0be383 /themes/default/js/ui/jquery.ui.selectable.js | |
parent | f2da009c0f744c9197c652c5012323e69dd96308 (diff) |
upgraded jquery ui from 1.9.0 to 1.10.1
git-svn-id: http://piwigo.org/svn/trunk@20824 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | themes/default/js/ui/jquery.ui.selectable.js | 118 |
1 files changed, 67 insertions, 51 deletions
diff --git a/themes/default/js/ui/jquery.ui.selectable.js b/themes/default/js/ui/jquery.ui.selectable.js index 5980e0ddb..7cc1f543c 100644 --- a/themes/default/js/ui/jquery.ui.selectable.js +++ b/themes/default/js/ui/jquery.ui.selectable.js @@ -1,8 +1,8 @@ /*! - * jQuery UI Selectable 1.9.0 + * jQuery UI Selectable 1.10.1 * http://jqueryui.com * - * Copyright 2012 jQuery Foundation and other contributors + * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * @@ -16,29 +16,37 @@ (function( $, undefined ) { $.widget("ui.selectable", $.ui.mouse, { - version: "1.9.0", + version: "1.10.1", options: { - appendTo: 'body', + appendTo: "body", autoRefresh: true, distance: 0, - filter: '*', - tolerance: 'touch' + filter: "*", + tolerance: "touch", + + // callbacks + selected: null, + selecting: null, + start: null, + stop: null, + unselected: null, + unselecting: null }, _create: function() { - var that = this; + var selectees, + that = this; this.element.addClass("ui-selectable"); this.dragged = false; // cache selectee children based on filter - var selectees; this.refresh = function() { selectees = $(that.options.filter, that.element[0]); selectees.addClass("ui-selectee"); selectees.each(function() { - var $this = $(this); - var pos = $this.offset(); + var $this = $(this), + pos = $this.offset(); $.data(this, "selectable-item", { element: this, $element: $this, @@ -47,9 +55,9 @@ $.widget("ui.selectable", $.ui.mouse, { right: pos.left + $this.outerWidth(), bottom: pos.top + $this.outerHeight(), startselected: false, - selected: $this.hasClass('ui-selected'), - selecting: $this.hasClass('ui-selecting'), - unselecting: $this.hasClass('ui-unselecting') + selected: $this.hasClass("ui-selected"), + selecting: $this.hasClass("ui-selecting"), + unselecting: $this.hasClass("ui-unselecting") }); }); }; @@ -72,14 +80,14 @@ $.widget("ui.selectable", $.ui.mouse, { }, _mouseStart: function(event) { - var that = this; + var that = this, + options = this.options; this.opos = [event.pageX, event.pageY]; - if (this.options.disabled) + if (this.options.disabled) { return; - - var options = this.options; + } this.selectees = $(options.filter, this.element[0]); @@ -88,8 +96,8 @@ $.widget("ui.selectable", $.ui.mouse, { $(options.appendTo).append(this.helper); // position helper (lasso) this.helper.css({ - "left": event.clientX, - "top": event.clientY, + "left": event.pageX, + "top": event.pageY, "width": 0, "height": 0 }); @@ -98,13 +106,13 @@ $.widget("ui.selectable", $.ui.mouse, { this.refresh(); } - this.selectees.filter('.ui-selected').each(function() { + this.selectees.filter(".ui-selected").each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; if (!event.metaKey && !event.ctrlKey) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { @@ -113,10 +121,11 @@ $.widget("ui.selectable", $.ui.mouse, { } }); - $(event.target).parents().andSelf().each(function() { - var selectee = $.data(this, "selectable-item"); + $(event.target).parents().addBack().each(function() { + var doSelect, + selectee = $.data(this, "selectable-item"); if (selectee) { - var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); + doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected"); selectee.$element .removeClass(doSelect ? "ui-unselecting" : "ui-selected") .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); @@ -140,43 +149,52 @@ $.widget("ui.selectable", $.ui.mouse, { }, _mouseDrag: function(event) { - var that = this; + this.dragged = true; - if (this.options.disabled) + if (this.options.disabled) { return; + } - var options = this.options; + var tmp, + that = this, + options = this.options, + x1 = this.opos[0], + y1 = this.opos[1], + x2 = event.pageX, + y2 = event.pageY; - var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; - if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } - if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); this.selectees.each(function() { - var selectee = $.data(this, "selectable-item"); + var selectee = $.data(this, "selectable-item"), + hit = false; + //prevent helper from being selected if appendTo: selectable - if (!selectee || selectee.element == that.element[0]) + if (!selectee || selectee.element === that.element[0]) { return; - var hit = false; - if (options.tolerance == 'touch') { + } + + if (options.tolerance === "touch") { hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); - } else if (options.tolerance == 'fit') { + } else if (options.tolerance === "fit") { hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); } if (hit) { // SELECT if (selectee.selected) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; } if (selectee.unselecting) { - selectee.$element.removeClass('ui-unselecting'); + selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; } if (!selectee.selecting) { - selectee.$element.addClass('ui-selecting'); + selectee.$element.addClass("ui-selecting"); selectee.selecting = true; // selectable SELECTING callback that._trigger("selecting", event, { @@ -187,15 +205,15 @@ $.widget("ui.selectable", $.ui.mouse, { // UNSELECT if (selectee.selecting) { if ((event.metaKey || event.ctrlKey) && selectee.startselected) { - selectee.$element.removeClass('ui-selecting'); + selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; - selectee.$element.addClass('ui-selected'); + selectee.$element.addClass("ui-selected"); selectee.selected = true; } else { - selectee.$element.removeClass('ui-selecting'); + selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; if (selectee.startselected) { - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; } // selectable UNSELECTING callback @@ -206,10 +224,10 @@ $.widget("ui.selectable", $.ui.mouse, { } if (selectee.selected) { if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { @@ -228,20 +246,18 @@ $.widget("ui.selectable", $.ui.mouse, { this.dragged = false; - var options = this.options; - - $('.ui-unselecting', this.element[0]).each(function() { + $(".ui-unselecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-unselecting'); + selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; selectee.startselected = false; that._trigger("unselected", event, { unselected: selectee.element }); }); - $('.ui-selecting', this.element[0]).each(function() { + $(".ui-selecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.$element.removeClass("ui-selecting").addClass("ui-selected"); selectee.selecting = false; selectee.selected = true; selectee.startselected = true; |