diff options
author | Richard Worth <rdworth@gmail.com> | 2008-11-14 03:00:16 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2008-11-14 03:00:16 +0000 |
commit | 7ea535fa1df43e8259ab9987a0e8e08866cfb1f5 (patch) | |
tree | de1237434696e0f094e2cfb35d7fd5880b8a72bb /ui | |
parent | ed4f58c6d3c914baafaf07ab1d168e6c199b8693 (diff) | |
download | jquery-ui-7ea535fa1df43e8259ab9987a0e8e08866cfb1f5.tar.gz jquery-ui-7ea535fa1df43e8259ab9987a0e8e08866cfb1f5.zip |
fixed #3578 - ALL CODE: e, ui should be changed to event, ui
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.accordion.js | 14 | ||||
-rw-r--r-- | ui/ui.core.js | 88 | ||||
-rw-r--r-- | ui/ui.datepicker.js | 58 | ||||
-rw-r--r-- | ui/ui.dialog.js | 16 | ||||
-rw-r--r-- | ui/ui.draggable.js | 132 | ||||
-rw-r--r-- | ui/ui.droppable.js | 64 | ||||
-rw-r--r-- | ui/ui.progressbar.js | 8 | ||||
-rw-r--r-- | ui/ui.resizable.js | 94 | ||||
-rw-r--r-- | ui/ui.selectable.js | 38 | ||||
-rw-r--r-- | ui/ui.slider.js | 58 | ||||
-rw-r--r-- | ui/ui.sortable.js | 138 | ||||
-rw-r--r-- | ui/ui.spinner.js | 144 | ||||
-rw-r--r-- | ui/ui.tabs.js | 8 |
13 files changed, 430 insertions, 430 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js index 2b2da9f21..87141a4c6 100644 --- a/ui/ui.accordion.js +++ b/ui/ui.accordion.js @@ -66,7 +66,7 @@ $.widget("ui.accordion", { var self=this; options.headers .attr('role','tab') - .bind('keydown', function(e) { return self._keydown(e); }) + .bind('keydown', function(event) { return self._keydown(event); }) .next() .attr('role','tabpanel'); @@ -96,17 +96,17 @@ $.widget("ui.accordion", { } }, - _keydown: function(e) { - if (this.options.disabled || e.altKey || e.ctrlKey) + _keydown: function(event) { + if (this.options.disabled || event.altKey || event.ctrlKey) return; var keyCode = $.keyCode; var length = this.options.headers.length; - var currentIndex = this.options.headers.index(e.target); + var currentIndex = this.options.headers.index(event.target); var toFocus = false; - switch(e.keyCode) { + switch(event.keyCode) { case keyCode.RIGHT: case keyCode.DOWN: toFocus = this.options.headers[(currentIndex + 1) % length]; @@ -117,11 +117,11 @@ $.widget("ui.accordion", { break; case keyCode.SPACE: case keyCode.ENTER: - return clickHandler.call(this.element[0], { target: e.target }); + return clickHandler.call(this.element[0], { target: event.target }); } if (toFocus) { - $(e.target).attr('tabIndex','-1'); + $(event.target).attr('tabIndex','-1'); $(toFocus).attr('tabIndex','0'); toFocus.focus(); return false; diff --git a/ui/ui.core.js b/ui/ui.core.js index 4e93c6b21..3b6beb329 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -99,22 +99,22 @@ $.ui = { return $.ui.cssCache[name]; }, - hasScroll: function(e, a) { + hasScroll: function(el, a) { //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ($(e).css('overflow') == 'hidden') { return false; } + if ($(el).css('overflow') == 'hidden') { return false; } var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', has = false; - if (e[scroll] > 0) { return true; } + if (el[scroll] > 0) { return true; } // TODO: determine which cases actually cause this to happen // if the element doesn't have the scroll set, see if it's possible to // set the scroll - e[scroll] = 1; - has = (e[scroll] > 0); - e[scroll] = 0; + el[scroll] = 1; + has = (el[scroll] > 0); + el[scroll] = 0; return has; }, @@ -297,10 +297,10 @@ $.widget = function(name, prototype) { options); this.element = $(element) - .bind('setData.' + name, function(e, key, value) { + .bind('setData.' + name, function(event, key, value) { return self._setData(key, value); }) - .bind('getData.' + name, function(e, key) { + .bind('getData.' + name, function(event, key) { return self._getData(key); }) .bind('remove', function() { @@ -359,11 +359,11 @@ $.widget.prototype = { this._setData('disabled', true); }, - _trigger: function(type, e, data) { + _trigger: function(type, event, data) { var eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix + type); - e = e || $.event.fix({ type: eventName, target: this.element[0] }); - return this.element.triggerHandler(eventName, [e, data], this.options[type]); + event = event || $.event.fix({ type: eventName, target: this.element[0] }); + return this.element.triggerHandler(eventName, [event, data], this.options[type]); } }; @@ -379,10 +379,10 @@ $.ui.mouse = { var self = this; this.element - .bind('mousedown.'+this.widgetName, function(e) { - return self._mouseDown(e); + .bind('mousedown.'+this.widgetName, function(event) { + return self._mouseDown(event); }) - .bind('click.'+this.widgetName, function(e) { + .bind('click.'+this.widgetName, function(event) { if(self._preventClickEvent) { self._preventClickEvent = false; return false; @@ -408,16 +408,16 @@ $.ui.mouse = { && this.element.attr('unselectable', this._mouseUnselectable)); }, - _mouseDown: function(e) { + _mouseDown: function(event) { // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(e)); + (this._mouseStarted && this._mouseUp(event)); - this._mouseDownEvent = e; + this._mouseDownEvent = event; var self = this, - btnIsLeft = (e.which == 1), - elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) { + btnIsLeft = (event.which == 1), + elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); + if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } @@ -428,20 +428,20 @@ $.ui.mouse = { }, this.options.delay); } - if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { - this._mouseStarted = (this._mouseStart(e) !== false); + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { + this._mouseStarted = (this._mouseStart(event) !== false); if (!this._mouseStarted) { - e.preventDefault(); + event.preventDefault(); return true; } } // these delegates are required to keep context - this._mouseMoveDelegate = function(e) { - return self._mouseMove(e); + this._mouseMoveDelegate = function(event) { + return self._mouseMove(event); }; - this._mouseUpDelegate = function(e) { - return self._mouseUp(e); + this._mouseUpDelegate = function(event) { + return self._mouseUp(event); }; $(document) .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) @@ -450,27 +450,27 @@ $.ui.mouse = { return false; }, - _mouseMove: function(e) { + _mouseMove: function(event) { // IE mouseup check - mouseup happened when mouse was out of window - if ($.browser.msie && !e.button) { - return this._mouseUp(e); + if ($.browser.msie && !event.button) { + return this._mouseUp(event); } if (this._mouseStarted) { - this._mouseDrag(e); + this._mouseDrag(event); return false; } - if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, e) !== false); - (this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e)); + (this._mouseStart(this._mouseDownEvent, event) !== false); + (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); } return !this._mouseStarted; }, - _mouseUp: function(e) { + _mouseUp: function(event) { $(document) .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); @@ -478,29 +478,29 @@ $.ui.mouse = { if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = true; - this._mouseStop(e); + this._mouseStop(event); } return false; }, - _mouseDistanceMet: function(e) { + _mouseDistanceMet: function(event) { return (Math.max( - Math.abs(this._mouseDownEvent.pageX - e.pageX), - Math.abs(this._mouseDownEvent.pageY - e.pageY) + Math.abs(this._mouseDownEvent.pageX - event.pageX), + Math.abs(this._mouseDownEvent.pageY - event.pageY) ) >= this.options.distance ); }, - _mouseDelayMet: function(e) { + _mouseDelayMet: function(event) { return this.mouseDelayMet; }, // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(e) {}, - _mouseDrag: function(e) {}, - _mouseStop: function(e) {}, - _mouseCapture: function(e) { return true; } + _mouseStart: function(event) {}, + _mouseDrag: function(event) {}, + _mouseStop: function(event) {}, + _mouseCapture: function(event) { return true; } }; $.ui.mouse.defaults = { diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index 0c5d09e10..26d04bec9 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -475,80 +475,80 @@ $.extend(Datepicker.prototype, { }, /* Handle keystrokes. */ - _doKeyDown: function(e) { - var inst = $.datepicker._getInst(e.target); + _doKeyDown: function(event) { + var inst = $.datepicker._getInst(event.target); var handled = true; inst._keyEvent = true; if ($.datepicker._datepickerShowing) - switch (e.keyCode) { + switch (event.keyCode) { case 9: $.datepicker._hideDatepicker(null, ''); break; // hide on tab out case 13: var sel = $('td.' + $.datepicker._dayOverClass + ', td.' + $.datepicker._currentClass, inst.dpDiv); if (sel[0]) - $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear, sel[0]); + $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); else $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); return false; // don't submit the form break; // select the value on enter case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); break; // hide on escape - case 33: $.datepicker._adjustDate(e.target, (e.ctrlKey ? + case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, 'stepBigMonths') : -$.datepicker._get(inst, 'stepMonths')), 'M'); break; // previous month/year on page up/+ ctrl - case 34: $.datepicker._adjustDate(e.target, (e.ctrlKey ? + case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, 'stepBigMonths') : +$.datepicker._get(inst, 'stepMonths')), 'M'); break; // next month/year on page down/+ ctrl - case 35: if (e.ctrlKey || e.metaKey) $.datepicker._clearDate(e.target); - handled = e.ctrlKey || e.metaKey; + case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); + handled = event.ctrlKey || event.metaKey; break; // clear on ctrl or command +end - case 36: if (e.ctrlKey || e.metaKey) $.datepicker._gotoToday(e.target); - handled = e.ctrlKey || e.metaKey; + case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); + handled = event.ctrlKey || event.metaKey; break; // current on ctrl or command +home - case 37: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -1, 'D'); - handled = e.ctrlKey || e.metaKey; + case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -1, 'D'); + handled = event.ctrlKey || event.metaKey; // -1 day on ctrl or command +left - if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ? + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, 'stepBigMonths') : -$.datepicker._get(inst, 'stepMonths')), 'M'); // next month/year on alt +left on Mac break; - case 38: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -7, 'D'); - handled = e.ctrlKey || e.metaKey; + case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); + handled = event.ctrlKey || event.metaKey; break; // -1 week on ctrl or command +up - case 39: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +1, 'D'); - handled = e.ctrlKey || e.metaKey; + case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +1, 'D'); + handled = event.ctrlKey || event.metaKey; // +1 day on ctrl or command +right - if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ? + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, 'stepBigMonths') : +$.datepicker._get(inst, 'stepMonths')), 'M'); // next month/year on alt +right break; - case 40: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +7, 'D'); - handled = e.ctrlKey || e.metaKey; + case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); + handled = event.ctrlKey || event.metaKey; break; // +1 week on ctrl or command +down default: handled = false; } - else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home + else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home $.datepicker._showDatepicker(this); else { handled = false; } if (handled) { - e.preventDefault(); - e.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); } }, /* Filter entered characters - based on date format. */ - _doKeyPress: function(e) { - var inst = $.datepicker._getInst(e.target); + _doKeyPress: function(event) { + var inst = $.datepicker._getInst(event.target); if ($.datepicker._get(inst, 'constrainInput')) { var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); - var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode); - return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); + var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); + return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); } }, @@ -1222,8 +1222,8 @@ $.extend(Datepicker.prototype, { } try { date = this.parseDate(dateFormat, dates[0], settings) || defaultDate; - } catch (e) { - this.log(e); + } catch (event) { + this.log(event); date = defaultDate; } } diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 354c696f7..81d2730c5 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -195,8 +195,8 @@ $.widget("ui.dialog", { this.moveToTop(true); // prevent tabbing out of modal dialogs - (this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(e) { - if (e.keyCode != $.keyCode.TAB) { + (this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(event) { + if (event.keyCode != $.keyCode.TAB) { return; } @@ -204,11 +204,11 @@ $.widget("ui.dialog", { first = tabbables.filter(':first')[0], last = tabbables.filter(':last')[0]; - if (e.target == last && !e.shiftKey) { + if (event.target == last && !event.shiftKey) { setTimeout(function() { first.focus(); }, 1); - } else if (e.target == first && e.shiftKey) { + } else if (event.target == first && event.shiftKey) { setTimeout(function() { last.focus(); }, 1); @@ -436,7 +436,7 @@ $.extend($.ui.dialog, { $.extend($.ui.dialog.overlay, { instances: [], events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), - function(e) { return e + '.dialog-overlay'; }).join(' '), + function(event) { return event + '.dialog-overlay'; }).join(' '), create: function(dialog) { if (this.instances.length === 0) { // prevent use of anchors and inputs @@ -466,9 +466,9 @@ $.extend($.ui.dialog.overlay, { }, 1); // allow closing by pressing the escape key - $(document).bind('keydown.dialog-overlay', function(e) { - (dialog.options.closeOnEscape && e.keyCode - && e.keyCode == $.keyCode.ESCAPE && dialog.close()); + $(document).bind('keydown.dialog-overlay', function(event) { + (dialog.options.closeOnEscape && event.keyCode + && event.keyCode == $.keyCode.ESCAPE && dialog.close()); }); // handle window resize diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index 98934fdf2..3e2d112dc 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -14,24 +14,24 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { - getHandle: function(e) { + getHandle: function(event) { var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; $(this.options.handle, this.element) .find("*") .andSelf() .each(function() { - if(this == e.target) handle = true; + if(this == event.target) handle = true; }); return handle; }, - createHelper: function(e) { + createHelper: function(event) { var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element); + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element); if(!helper.parents('body').length) helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); @@ -55,15 +55,15 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { }, - _mouseCapture: function(e) { + _mouseCapture: function(event) { var o = this.options; - if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) return false; //Quit if we're not on a valid handle - this.handle = this.getHandle(e); + this.handle = this.getHandle(event); if (!this.handle) return false; @@ -71,12 +71,12 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { }, - _mouseStart: function(e) { + _mouseStart: function(event) { var o = this.options; //Create and append the visible helper - this.helper = this.createHelper(e); + this.helper = this.createHelper(event); //If ddmanager is used for droppables, set the global draggable if($.ui.ddmanager) @@ -100,8 +100,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { }; this.offset.click = { //Where the click happened, relative to the element - left: e.pageX - this.offset.left, - top: e.pageY - this.offset.top + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top }; //Calling this method cached the next parents that have scrollTop / scrollLeft attached @@ -128,7 +128,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { } //Generate the original position - this.originalPosition = this._generatePosition(e); + this.originalPosition = this._generatePosition(event); //Cache the helper size this.cacheHelperProportions(); @@ -149,17 +149,17 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { this.setContainment(); //Call plugins and callbacks - this._propagate("start", e); + this._propagate("start", event); //Recache the helper size this.cacheHelperProportions(); //Prepare the droppable offsets if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, e); + $.ui.ddmanager.prepareOffsets(this, event); this.helper.addClass("ui-draggable-dragging"); - this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position return true; }, @@ -240,12 +240,12 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { ) }; }, - _generatePosition: function(e) { + _generatePosition: function(event) { var o = this.options; var position = { top: ( - e.pageY // The absolute mouse position + event.pageY // The absolute mouse position - this.offset.click.top // Click offset (relative to the element) - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.top // The offsetParent's offset without borders (offset + border) @@ -253,7 +253,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { - (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) ), left: ( - e.pageX // The absolute mouse position + event.pageX // The absolute mouse position - this.offset.click.left // Click offset (relative to the element) - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.left // The offsetParent's offset without borders (offset + border) @@ -285,36 +285,36 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { return position; }, - _mouseDrag: function(e) { + _mouseDrag: function(event) { //Compute the helpers position - this.position = this._generatePosition(e); + this.position = this._generatePosition(event); this.positionAbs = this._convertPositionTo("absolute"); //Call plugins and callbacks and use the resulting position if something is returned - this.position = this._propagate("drag", e) || this.position; + this.position = this._propagate("drag", event) || this.position; if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); return false; }, - _mouseStop: function(e) { + _mouseStop: function(event) { //If we are using droppables, inform the manager about the drop var dropped = false; if ($.ui.ddmanager && !this.options.dropBehaviour) - var dropped = $.ui.ddmanager.drop(this, e); + var dropped = $.ui.ddmanager.drop(this, event); if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { var self = this; $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - self._propagate("stop", e); + self._propagate("stop", event); self._clear(); }); } else { - this._propagate("stop", e); + this._propagate("stop", event); this._clear(); } @@ -330,7 +330,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { // From now on bulk stuff - mainly helpers plugins: {}, - uiHash: function(e) { + uiHash: function(event) { return { helper: this.helper, position: this.position, @@ -338,10 +338,10 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { options: this.options }; }, - _propagate: function(n,e) { - $.ui.plugin.call(this, n, [e, this.uiHash()]); + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.uiHash()]); if(n == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins - return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]); + return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [event, this.uiHash()], this.options[n]); }, destroy: function() { if(!this.element.data('draggable')) return; @@ -382,40 +382,40 @@ $.extend($.ui.draggable, { }); $.ui.plugin.add("draggable", "cursor", { - start: function(e, ui) { + start: function(event, ui) { var t = $('body'); if (t.css("cursor")) ui.options._cursor = t.css("cursor"); t.css("cursor", ui.options.cursor); }, - stop: function(e, ui) { + stop: function(event, ui) { if (ui.options._cursor) $('body').css("cursor", ui.options._cursor); } }); $.ui.plugin.add("draggable", "zIndex", { - start: function(e, ui) { + start: function(event, ui) { var t = $(ui.helper); if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); t.css('zIndex', ui.options.zIndex); }, - stop: function(e, ui) { + stop: function(event, ui) { if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex); } }); $.ui.plugin.add("draggable", "opacity", { - start: function(e, ui) { + start: function(event, ui) { var t = $(ui.helper); if(t.css("opacity")) ui.options._opacity = t.css("opacity"); t.css('opacity', ui.options.opacity); }, - stop: function(e, ui) { + stop: function(event, ui) { if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity); } }); $.ui.plugin.add("draggable", "iframeFix", { - start: function(e, ui) { + start: function(event, ui) { $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() { $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') .css({ @@ -426,13 +426,13 @@ $.ui.plugin.add("draggable", "iframeFix", { .appendTo("body"); }); }, - stop: function(e, ui) { + stop: function(event, ui) { $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers } }); $.ui.plugin.add("draggable", "scroll", { - start: function(e, ui) { + start: function(event, ui) { var o = ui.options; var i = $(this).data("draggable"); @@ -449,43 +449,43 @@ $.ui.plugin.add("draggable", "scroll", { if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset(); }, - drag: function(e, ui) { + drag: function(event, ui) { var o = ui.options, scrolled = false; var i = $(this).data("draggable"); if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') { - if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity) + if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - event.pageY < o.scrollSensitivity) i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed; - if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity) + if(event.pageY - i.overflowYOffset.top < o.scrollSensitivity) i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed; } else { - if(e.pageY - $(document).scrollTop() < o.scrollSensitivity) + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) + if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); } if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { - if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) + if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - event.pageX < o.scrollSensitivity) i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft + o.scrollSpeed; - if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity) + if(event.pageX - i.overflowXOffset.left < o.scrollSensitivity) i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft - o.scrollSpeed; } else { - if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity) + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); } if(scrolled !== false) - $.ui.ddmanager.prepareOffsets(i, e); + $.ui.ddmanager.prepareOffsets(i, event); } }); $.ui.plugin.add("draggable", "snap", { - start: function(e, ui) { + start: function(event, ui) { var inst = $(this).data("draggable"); inst.snapElements = []; @@ -500,7 +500,7 @@ $.ui.plugin.add("draggable", "snap", { }); }, - drag: function(e, ui) { + drag: function(event, ui) { var inst = $(this).data("draggable"); var d = ui.options.snapTolerance; @@ -554,7 +554,7 @@ $.ui.plugin.add("draggable", "snap", { }); $.ui.plugin.add("draggable", "connectToSortable", { - start: function(e,ui) { + start: function(event,ui) { var inst = $(this).data("draggable"); inst.sortables = []; @@ -566,12 +566,12 @@ $.ui.plugin.add("draggable", "connectToSortable", { shouldRevert: sortable.options.revert }); sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache - sortable._propagate("activate", e, inst); + sortable._propagate("activate", event, inst); } }); }, - stop: function(e,ui) { + stop: function(event,ui) { //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper var inst = $(this).data("draggable"); @@ -582,21 +582,21 @@ $.ui.plugin.add("draggable", "connectToSortable", { inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) if(this.shouldRevert) this.instance.options.revert = true; //revert here - this.instance._mouseStop(e); + this.instance._mouseStop(event); //Also propagate receive event, since the sortable is actually receiving a element - this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance._ui(), { sender: inst.element })], this.instance.options["receive"]); + this.instance.element.triggerHandler("sortreceive", [event, $.extend(this.instance._ui(), { sender: inst.element })], this.instance.options["receive"]); this.instance.options.helper = this.instance.options._helper; } else { this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance - this.instance._propagate("deactivate", e, inst); + this.instance._propagate("deactivate", event, inst); } }); }, - drag: function(e,ui) { + drag: function(event, ui) { var inst = $(this).data("draggable"), self = this; @@ -623,9 +623,9 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it this.instance.options.helper = function() { return ui.helper[0]; }; - e.target = this.instance.currentItem[0]; - this.instance._mouseCapture(e, true); - this.instance._mouseStart(e, true, true); + event.target = this.instance.currentItem[0]; + this.instance._mouseCapture(event, true); + this.instance._mouseStart(event, true, true); //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes this.instance.offset.click.top = inst.offset.click.top; @@ -633,12 +633,12 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; - inst._propagate("toSortable", e); + inst._propagate("toSortable", event); } //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable - if(this.instance.currentItem) this.instance._mouseDrag(e); + if(this.instance.currentItem) this.instance._mouseDrag(event); } else { @@ -648,14 +648,14 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; this.instance.options.revert = false; //No revert here - this.instance._mouseStop(e, true); + this.instance._mouseStop(event, true); this.instance.options.helper = this.instance.options._helper; //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size this.instance.currentItem.remove(); if(this.instance.placeholder) this.instance.placeholder.remove(); - inst._propagate("fromSortable", e); + inst._propagate("fromSortable", event); } }; @@ -666,7 +666,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { }); $.ui.plugin.add("draggable", "stack", { - start: function(e,ui) { + start: function(event,ui) { var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) { return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min); }); diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js index 92a779611..7a6fe7ac8 100644 --- a/ui/ui.droppable.js +++ b/ui/ui.droppable.js @@ -68,29 +68,29 @@ $.widget("ui.droppable", { .removeData("droppable") .unbind(".droppable"); }, - _over: function(e) { + _over: function(event) { var draggable = $.ui.ddmanager.current; if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { - $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]); - this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over); + $.ui.plugin.call(this, 'over', [event, this.ui(draggable)]); + this.element.triggerHandler("dropover", [event, this.ui(draggable)], this.options.over); } }, - _out: function(e) { + _out: function(event) { var draggable = $.ui.ddmanager.current; if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { - $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]); - this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out); + $.ui.plugin.call(this, 'out', [event, this.ui(draggable)]); + this.element.triggerHandler("dropout", [event, this.ui(draggable)], this.options.out); } }, - _drop: function(e,custom) { + _drop: function(event,custom) { var draggable = custom || $.ui.ddmanager.current; if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element @@ -105,26 +105,26 @@ $.widget("ui.droppable", { if(childrenIntersection) return false; if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { - $.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]); - this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop); + $.ui.plugin.call(this, 'drop', [event, this.ui(draggable)]); + this.element.triggerHandler("drop", [event, this.ui(draggable)], this.options.drop); return this.element; } return false; }, - _activate: function(e) { + _activate: function(event) { var draggable = $.ui.ddmanager.current; - $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]); - if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate); + $.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]); + if(draggable) this.element.triggerHandler("dropactivate", [event, this.ui(draggable)], this.options.activate); }, - _deactivate: function(e) { + _deactivate: function(event) { var draggable = $.ui.ddmanager.current; - $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]); - if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate); + $.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]); + if(draggable) this.element.triggerHandler("dropdeactivate", [event, this.ui(draggable)], this.options.deactivate); } }); @@ -192,10 +192,10 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { $.ui.ddmanager = { current: null, droppables: { 'default': [] }, - prepareOffsets: function(t, e) { + prepareOffsets: function(t, event) { var m = $.ui.ddmanager.droppables[t.options.scope]; - var type = e ? e.type : null; // workaround for #2317 + var type = event ? event.type : null; // workaround for #2317 var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); droppablesLoop: for (var i = 0; i < m.length; i++) { @@ -207,33 +207,33 @@ $.ui.ddmanager = { m[i].offset = m[i].element.offset(); m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; - if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], e); //Activate the droppable if used directly from draggables + if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables } }, - drop: function(draggable, e) { + drop: function(draggable, event) { var dropped = false; $.each($.ui.ddmanager.droppables[draggable.options.scope], function() { if(!this.options) return; if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) - dropped = this._drop.call(this, e); + dropped = this._drop.call(this, event); if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { this.isout = 1; this.isover = 0; - this._deactivate.call(this, e); + this._deactivate.call(this, event); } }); return dropped; }, - drag: function(draggable, e) { + drag: function(draggable, event) { //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. - if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e); + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); //Run through all droppables and check their positions based on specific tolerance options @@ -258,17 +258,17 @@ $.ui.ddmanager = { if (parentInstance && c == 'isover') { parentInstance['isover'] = 0; parentInstance['isout'] = 1; - parentInstance._out.call(parentInstance, e); + parentInstance._out.call(parentInstance, event); } this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; - this[c == "isover" ? "_over" : "_out"].call(this, e); + this[c == "isover" ? "_over" : "_out"].call(this, event); // we just moved out of a greedy child if (parentInstance && c == 'isout') { parentInstance['isout'] = 0; parentInstance['isover'] = 1; - parentInstance._over.call(parentInstance, e); + parentInstance._over.call(parentInstance, event); } }); @@ -280,25 +280,25 @@ $.ui.ddmanager = { */ $.ui.plugin.add("droppable", "activeClass", { - activate: function(e, ui) { + activate: function(event, ui) { $(this).addClass(ui.options.activeClass); }, - deactivate: function(e, ui) { + deactivate: function(event, ui) { $(this).removeClass(ui.options.activeClass); }, - drop: function(e, ui) { + drop: function(event, ui) { $(this).removeClass(ui.options.activeClass); } }); $.ui.plugin.add("droppable", "hoverClass", { - over: function(e, ui) { + over: function(event, ui) { $(this).addClass(ui.options.hoverClass); }, - out: function(e, ui) { + out: function(event, ui) { $(this).removeClass(ui.options.hoverClass); }, - drop: function(e, ui) { + drop: function(event, ui) { $(this).removeClass(ui.options.hoverClass); } }); diff --git a/ui/ui.progressbar.js b/ui/ui.progressbar.js index 16b7b8967..880dbc403 100644 --- a/ui/ui.progressbar.js +++ b/ui/ui.progressbar.js @@ -86,9 +86,9 @@ $.widget("ui.progressbar", { ); }, - _propagate: function(n,e) { - $.ui.plugin.call(this, n, [e, this.ui()]); - this.element.triggerHandler(n == "progressbar" ? n : ["progressbar", n].join(""), [e, this.ui()], this.options[n]); + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + this.element.triggerHandler(n == "progressbar" ? n : ["progressbar", n].join(""), [event, this.ui()], this.options[n]); }, destroy: function() { @@ -186,7 +186,7 @@ $.widget("ui.progressbar", { this.textBg.html(text); }, - ui: function(e) { + ui: function(event) { return { identifier: this.identifier, options: this.options, diff --git a/ui/ui.resizable.js b/ui/ui.resizable.js index 3e25bf25a..0e6e760e3 100644 --- a/ui/ui.resizable.js +++ b/ui/ui.resizable.js @@ -227,9 +227,9 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { originalPosition: this.originalPosition }; }, - _propagate: function(n,e) { - $.ui.plugin.call(this, n, [e, this.ui()]); - if (n != "resize") this.element.triggerHandler(["resize", n].join(""), [e, this.ui()], this.options[n]); + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + if (n != "resize") this.element.triggerHandler(["resize", n].join(""), [event, this.ui()], this.options[n]); }, destroy: function() { var el = this.element, wrapped = el.children(".ui-resizable").get(0); @@ -258,13 +258,13 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { } }, - _mouseCapture: function(e) { + _mouseCapture: function(event) { if(this.options.disabled) return false; var handle = false; for(var i in this.options.handles) { - if($(this.options.handles[i])[0] == e.target) handle = true; + if($(this.options.handles[i])[0] == event.target) handle = true; } if (!handle) return false; @@ -272,7 +272,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { }, - _mouseStart: function(e) { + _mouseStart: function(event) { var o = this.options, iniPos = this.element.position(), el = this.element, num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7; @@ -309,7 +309,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { this.originalSize = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; this.originalPosition = { left: curleft, top: curtop }; this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; - this.originalMousePosition = { left: e.pageX, top: e.pageY }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; //Aspect Ratio o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1); @@ -317,29 +317,29 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { if (o.preserveCursor) $('body').css('cursor', this.axis + '-resize'); - this._propagate("start", e); + this._propagate("start", event); return true; }, - _mouseDrag: function(e) { + _mouseDrag: function(event) { //Increase performance, avoid regex var el = this.helper, o = this.options, props = {}, self = this, smp = this.originalMousePosition, a = this.axis; - var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0; + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; var trigger = this._change[a]; if (!trigger) return false; // Calculate the attrs that will be change - var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; + var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; - if (o._aspectRatio || e.shiftKey) - data = this._updateRatio(data, e); + if (o._aspectRatio || event.shiftKey) + data = this._updateRatio(data, event); - data = this._respectSize(data, e); + data = this._respectSize(data, event); // plugins callbacks need to be called first - this._propagate("resize", e); + this._propagate("resize", event); el.css({ top: this.position.top + "px", left: this.position.left + "px", @@ -352,11 +352,11 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { this._updateCache(data); // calling the user callback at the end - this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]); + this.element.triggerHandler("resize", [event, this.ui()], this.options["resize"]); return false; }, - _mouseStop: function(e) { + _mouseStop: function(event) { this.options.resizing = false; var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this; @@ -379,7 +379,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { if (o.preserveCursor) $('body').css('cursor', 'auto'); - this._propagate("stop", e); + this._propagate("stop", event); if (o.helper) this.helper.remove(); @@ -393,7 +393,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { if (data.height) this.size.height = data.height; if (data.width) this.size.width = data.width; }, - _updateRatio: function(data, e) { + _updateRatio: function(data, event) { var o = this.options, cpos = this.position, csize = this.size, a = this.axis; @@ -411,9 +411,9 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { return data; }, - _respectSize: function(data, e) { + _respectSize: function(data, event) { - var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis, + var el = this.helper, o = this.options, pRatio = o._aspectRatio || event.shiftKey, a = this.axis, ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height, isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height; @@ -486,31 +486,31 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { } }, _change: { - e: function(e, dx, dy) { + e: function(event, dx, dy) { return { width: this.originalSize.width + dx }; }, - w: function(e, dx, dy) { + w: function(event, dx, dy) { var o = this.options, cs = this.originalSize, sp = this.originalPosition; return { left: sp.left + dx, width: cs.width - dx }; }, - n: function(e, dx, dy) { + n: function(event, dx, dy) { var o = this.options, cs = this.originalSize, sp = this.originalPosition; return { top: sp.top + dy, height: cs.height - dy }; }, - s: function(e, dx, dy) { + s: function(event, dx, dy) { return { height: this.originalSize.height + dy }; }, - se: function(e, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [e, dx, dy])); + se: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); }, - sw: function(e, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [e, dx, dy])); + sw: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); }, - ne: function(e, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [e, dx, dy])); + ne: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); }, - nw: function(e, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [e, dx, dy])); + nw: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); } } })); @@ -549,7 +549,7 @@ $.extend($.ui.resizable, { $.ui.plugin.add("resizable", "containment", { - start: function(e, ui) { + start: function(event, ui) { var o = ui.options, self = $(this).data("resizable"), el = self.element; var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; if (!ce) return; @@ -581,10 +581,10 @@ $.ui.plugin.add("resizable", "containment", { } }, - resize: function(e, ui) { + resize: function(event, ui) { var o = ui.options, self = $(this).data("resizable"), ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, - pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; + pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; if (ce[0] != document && (/static/).test(ce.css('position'))) cop = self.containerPosition; @@ -615,7 +615,7 @@ $.ui.plugin.add("resizable", "containment", { } }, - stop: function(e, ui){ + stop: function(event, ui){ var o = ui.options, self = $(this).data("resizable"), cp = self.position, co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; @@ -632,8 +632,8 @@ $.ui.plugin.add("resizable", "containment", { $.ui.plugin.add("resizable", "grid", { - resize: function(e, ui) { - var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey; + resize: function(event, ui) { + var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); @@ -663,7 +663,7 @@ $.ui.plugin.add("resizable", "grid", { $.ui.plugin.add("resizable", "animate", { - stop: function(e, ui) { + stop: function(event, ui) { var o = ui.options, self = $(this).data("resizable"); var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), @@ -691,7 +691,7 @@ $.ui.plugin.add("resizable", "animate", { // propagating resize, and updating values for each animation step self._updateCache(data); - self._propagate("animate", e); + self._propagate("animate", event); } } @@ -702,7 +702,7 @@ $.ui.plugin.add("resizable", "animate", { $.ui.plugin.add("resizable", "ghost", { - start: function(e, ui) { + start: function(event, ui) { var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size; if (!pr) self.ghost = self.element.clone(); @@ -717,14 +717,14 @@ $.ui.plugin.add("resizable", "ghost", { }, - resize: function(e, ui){ + resize: function(event, ui){ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize; if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); }, - stop: function(e, ui){ + stop: function(event, ui){ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize; if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); } @@ -733,7 +733,7 @@ $.ui.plugin.add("resizable", "ghost", { $.ui.plugin.add("resizable", "alsoResize", { - start: function(e, ui) { + start: function(event, ui) { var o = ui.options, self = $(this).data("resizable"), _store = function(exp) { @@ -753,7 +753,7 @@ $.ui.plugin.add("resizable", "alsoResize", { } }, - resize: function(e, ui){ + resize: function(event, ui){ var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition; var delta = { @@ -781,7 +781,7 @@ $.ui.plugin.add("resizable", "alsoResize", { } }, - stop: function(e, ui){ + stop: function(event, ui){ $(this).removeData("resizable-alsoresize-start"); } }); diff --git a/ui/ui.selectable.js b/ui/ui.selectable.js index 090ca7f28..d551566bf 100644 --- a/ui/ui.selectable.js +++ b/ui/ui.selectable.js @@ -65,10 +65,10 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { .unbind(".selectable"); this._mouseDestroy(); }, - _mouseStart: function(e) { + _mouseStart: function(event) { var self = this; - this.opos = [e.pageX, e.pageY]; + this.opos = [event.pageX, event.pageY]; if (this.options.disabled) return; @@ -78,7 +78,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { this.selectees = $(options.filter, this.element[0]); // selectable START callback - this.element.triggerHandler("selectablestart", [e, { + this.element.triggerHandler("selectablestart", [event, { "selectable": this.element[0], "options": options }], options.start); @@ -88,8 +88,8 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { this.helper.css({ "z-index": 100, "position": "absolute", - "left": e.clientX, - "top": e.clientY, + "left": event.clientX, + "top": event.clientY, "width": 0, "height": 0 }); @@ -101,13 +101,13 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { this.selectees.filter('.ui-selected').each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; - if (!e.metaKey) { + if (!event.metaKey) { selectee.$element.removeClass('ui-selected'); selectee.selected = false; selectee.$element.addClass('ui-unselecting'); selectee.unselecting = true; // selectable UNSELECTING callback - self.element.triggerHandler("selectableunselecting", [e, { + self.element.triggerHandler("selectableunselecting", [event, { selectable: self.element[0], unselecting: selectee.element, options: options @@ -116,12 +116,12 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { }); var isSelectee = false; - $(e.target).parents().andSelf().each(function() { + $(event.target).parents().andSelf().each(function() { if($.data(this, "selectable-item")) isSelectee = true; }); return this.options.keyboard ? !isSelectee : true; }, - _mouseDrag: function(e) { + _mouseDrag: function(event) { var self = this; this.dragged = true; @@ -130,7 +130,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { var options = this.options; - var x1 = this.opos[0], y1 = this.opos[1], x2 = e.pageX, y2 = e.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; } this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); @@ -161,7 +161,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { selectee.$element.addClass('ui-selecting'); selectee.selecting = true; // selectable SELECTING callback - self.element.triggerHandler("selectableselecting", [e, { + self.element.triggerHandler("selectableselecting", [event, { selectable: self.element[0], selecting: selectee.element, options: options @@ -170,7 +170,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { } else { // UNSELECT if (selectee.selecting) { - if (e.metaKey && selectee.startselected) { + if (event.metaKey && selectee.startselected) { selectee.$element.removeClass('ui-selecting'); selectee.selecting = false; selectee.$element.addClass('ui-selected'); @@ -183,7 +183,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { selectee.unselecting = true; } // selectable UNSELECTING callback - self.element.triggerHandler("selectableunselecting", [e, { + self.element.triggerHandler("selectableunselecting", [event, { selectable: self.element[0], unselecting: selectee.element, options: options @@ -191,14 +191,14 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { } } if (selectee.selected) { - if (!e.metaKey && !selectee.startselected) { + if (!event.metaKey && !selectee.startselected) { selectee.$element.removeClass('ui-selected'); selectee.selected = false; selectee.$element.addClass('ui-unselecting'); selectee.unselecting = true; // selectable UNSELECTING callback - self.element.triggerHandler("selectableunselecting", [e, { + self.element.triggerHandler("selectableunselecting", [event, { selectable: self.element[0], unselecting: selectee.element, options: options @@ -210,7 +210,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { return false; }, - _mouseStop: function(e) { + _mouseStop: function(event) { var self = this; this.dragged = false; @@ -222,7 +222,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { selectee.$element.removeClass('ui-unselecting'); selectee.unselecting = false; selectee.startselected = false; - self.element.triggerHandler("selectableunselected", [e, { + self.element.triggerHandler("selectableunselected", [event, { selectable: self.element[0], unselected: selectee.element, options: options @@ -234,13 +234,13 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, { selectee.selecting = false; selectee.selected = true; selectee.startselected = true; - self.element.triggerHandler("selectableselected", [e, { + self.element.triggerHandler("selectableselected", [event, { selectable: self.element[0], selected: selectee.element, options: options }], options.selected); }); - this.element.triggerHandler("selectablestop", [e, { + this.element.triggerHandler("selectablestop", [event, { selectable: self.element[0], options: this.options }], this.options.stop); diff --git a/ui/ui.slider.js b/ui/ui.slider.js index bee87a1ec..b485fb75e 100644 --- a/ui/ui.slider.js +++ b/ui/ui.slider.js @@ -20,7 +20,7 @@ $.fn.unwrap = $.fn.unwrap || function(expr) { $.widget("ui.slider", { plugins: {}, - ui: function(e) { + ui: function(event) { return { options: this.options, handle: this.currentHandle, @@ -31,9 +31,9 @@ $.widget("ui.slider", { range: this._getRange() }; }, - _propagate: function(n,e) { - $.ui.plugin.call(this, n, [e, this.ui()]); - this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]); + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + this.element.triggerHandler(n == "slide" ? n : "slide"+n, [event, this.ui()], this.options[n]); }, destroy: function() { @@ -97,11 +97,11 @@ $.widget("ui.slider", { }; $.extend(handleclass.prototype, $.ui.mouse, { - _mouseStart: function(e) { return self._start.call(self, e, this.element[0]); }, - _mouseStop: function(e) { return self._stop.call(self, e, this.element[0]); }, - _mouseDrag: function(e) { return self._drag.call(self, e, this.element[0]); }, + _mouseStart: function(event) { return self._start.call(self, event, this.element[0]); }, + _mouseStop: function(event) { return self._stop.call(self, event, this.element[0]); }, + _mouseDrag: function(event) { return self._drag.call(self, event, this.element[0]); }, _mouseCapture: function() { return true; }, - trigger: function(e) { this._mouseDown(e); } + trigger: function(event) { this._mouseDown(event); } }); $(this.handle) @@ -111,15 +111,15 @@ $.widget("ui.slider", { .wrap('<a href="#" style="outline:none;border:none;"></a>') .parent() .bind('click', function() { return false; }) - .bind('focus', function(e) { self._focus(this.firstChild); }) - .bind('blur', function(e) { self._blur(this.firstChild); }) - .bind('keydown', function(e) { if(!self.options.noKeyboard) return self._keydown(e.keyCode, this.firstChild); }) + .bind('focus', function(event) { self._focus(this.firstChild); }) + .bind('blur', function(event) { self._blur(this.firstChild); }) + .bind('keydown', function(event) { if(!self.options.noKeyboard) return self._keydown(event.keyCode, this.firstChild); }) ; // Bind the click to the slider itself - this.element.bind('mousedown.slider', function(e) { - self._click.apply(self, [e]); - self.currentHandle.data("mouse").trigger(e); + this.element.bind('mousedown.slider', function(event) { + self._click.apply(self, [event]); + self.currentHandle.data("mouse").trigger(event); self.firstValue = self.firstValue + 1; //This is for always triggering the change event }); @@ -188,17 +188,17 @@ $.widget("ui.slider", { $(handle).removeClass('ui-slider-handle-active'); if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; }; }, - _click: function(e) { + _click: function(event) { // This method is only used if: // - The user didn't click a handle // - The Slider is not disabled // - There is a current, or previous selected handle (otherwise we wouldn't know which one to move) - var pointer = [e.pageX,e.pageY]; + var pointer = [event.pageX, event.pageY]; var clickedHandle = false; this.handle.each(function() { - if(this == e.target) + if(this == event.target) clickedHandle = true; }); if (clickedHandle || this.options.disabled || !(this.currentHandle || this.previousHandle)) @@ -212,8 +212,8 @@ $.widget("ui.slider", { this.offset = this.element.offset(); this.moveTo({ - y: this._convertValue(e.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"), - x: this._convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x") + y: this._convertValue(event.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"), + x: this._convertValue(event.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x") }, null, !this.options.distance); }, @@ -296,7 +296,7 @@ $.widget("ui.slider", { return /* this.options.paging[axis] ||*/ 10; }, - _start: function(e, handle) { + _start: function(event, handle) { var o = this.options; if(o.disabled) return false; @@ -311,27 +311,27 @@ $.widget("ui.slider", { this.offset = this.element.offset(); this.handleOffset = this.currentHandle.offset(); - this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left }; + this.clickOffset = { top: event.pageY - this.handleOffset.top, left: event.pageX - this.handleOffset.left }; this.firstValue = this.value(); - this._propagate('start', e); - this._drag(e, handle); + this._propagate('start', event); + this._drag(event, handle); return true; }, - _stop: function(e) { - this._propagate('stop', e); + _stop: function(event) { + this._propagate('stop', event); if (this.firstValue != this.value()) - this._propagate('change', e); + this._propagate('change', event); // This is a especially ugly fix for strange blur events happening on mousemove events this._focus(this.currentHandle, true); return false; }, - _drag: function(e, handle) { + _drag: function(event, handle) { var o = this.options; - var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left}; + var position = { top: event.pageY - this.offset.top - this.clickOffset.top, left: event.pageX - this.offset.left - this.clickOffset.left}; if(!this.currentHandle) this._focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events position.left = this._translateLimits(position.left, "x"); @@ -362,7 +362,7 @@ $.widget("ui.slider", { if (this.rangeElement) this._updateRange(); - this._propagate('slide', e); + this._propagate('slide', event); return false; }, diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index b11bf7357..4b4d928ef 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -90,9 +90,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _propagate: function(n,e,inst, noPropagation) { - $.ui.plugin.call(this, n, [e, this._ui(inst)]); - var dontCancel = !noPropagation ? this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this._ui(inst)], this.options[n]) : true; + _propagate: function(n, event, inst, noPropagation) { + $.ui.plugin.call(this, n, [event, this._ui(inst)]); + var dontCancel = !noPropagation ? this.element.triggerHandler(n == "sort" ? n : "sort"+n, [event, this._ui(inst)], this.options[n]) : true; if(dontCancel === false) this.cancel(); }, @@ -396,7 +396,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _contactContainers: function(e) { + _contactContainers: function(event) { for (var i = this.containers.length - 1; i >= 0; i--){ if(this._intersectsWith(this.containers[i].containerCache)) { @@ -418,21 +418,21 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { continue; this.currentContainer = this.containers[i]; - itemWithLeastDistance ? this.options.sortIndicator.call(this, e, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, e, null, this.containers[i].element, true); - this._propagate("change", e); //Call plugins and callbacks - this.containers[i]._propagate("change", e, this); //Call plugins and callbacks + itemWithLeastDistance ? this.options.sortIndicator.call(this, event, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, event, null, this.containers[i].element, true); + this._propagate("change", event); //Call plugins and callbacks + this.containers[i]._propagate("change", event, this); //Call plugins and callbacks //Update the placeholder this.options.placeholder.update(this.currentContainer, this.placeholder); } - this.containers[i]._propagate("over", e, this); + this.containers[i]._propagate("over", event, this); this.containers[i].containerCache.over = 1; } } else { if(this.containers[i].containerCache.over) { - this.containers[i]._propagate("out", e, this); + this.containers[i]._propagate("out", event, this); this.containers[i].containerCache.over = 0; } } @@ -440,7 +440,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }; }, - _mouseCapture: function(e, overrideHandle) { + _mouseCapture: function(event, overrideHandle) { if (this.reverting) { return false; @@ -452,19 +452,19 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this._refreshItems(); //Find out if the clicked node (or one of its parents) is a actual item in this.items - var currentItem = null, self = this, nodes = $(e.target).parents().each(function() { + var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { if($.data(this, 'sortable-item') == self) { currentItem = $(this); return false; } }); - if($.data(e.target, 'sortable-item') == self) currentItem = $(e.target); + if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target); if(!currentItem) return false; if(this.options.handle && !overrideHandle) { var validHandle = false; - $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; }); + $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); if(!validHandle) return false; } @@ -474,10 +474,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - createHelper: function(e) { + createHelper: function(event) { var o = this.options; - var helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : (o.helper == "original" ? this.currentItem : this.currentItem.clone()); + var helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == "original" ? this.currentItem : this.currentItem.clone()); if (!helper.parents('body').length) $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); //Add the helper to the DOM if that didn't happen already @@ -486,7 +486,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _mouseStart: function(e, overrideHandle, noActivation) { + _mouseStart: function(event, overrideHandle, noActivation) { var o = this.options; this.currentContainer = this; @@ -495,7 +495,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this.refreshPositions(); //Create and append the visible helper - this.helper = this.createHelper(e); + this.helper = this.createHelper(event); /* * - Position generation - @@ -514,8 +514,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }; this.offset.click = { //Where the click happened, relative to the element - left: e.pageX - this.offset.left, - top: e.pageY - this.offset.top + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top }; this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position @@ -531,7 +531,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { left: po.left + this.offsetParentBorders.left }; - this.originalPosition = this._generatePosition(e); //Generate the original position + this.originalPosition = this._generatePosition(event); //Generate the original position this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //Cache the former DOM position //If o.placeholder is used, create a new element at the given position with the class @@ -552,7 +552,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this._createPlaceholder(); //Call plugins and callbacks - this._propagate("start", e); + this._propagate("start", event); //Recache the helper size if(!this._preserveHelperProportions) @@ -595,7 +595,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { //Post 'activate' events to possible containers if(!noActivation) { - for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); } + for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", event, this); } } //Prepare possible droppables @@ -603,11 +603,11 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { $.ui.ddmanager.current = this; if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, e); + $.ui.ddmanager.prepareOffsets(this, event); this.dragging = true; - this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position return true; }, @@ -631,18 +631,18 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }; }, - _generatePosition: function(e) { + _generatePosition: function(event) { var o = this.options; var position = { top: ( - e.pageY // The absolute mouse position + event.pageY // The absolute mouse position - this.offset.click.top // Click offset (relative to the element) - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed ), left: ( - e.pageX // The absolute mouse position + event.pageX // The absolute mouse position - this.offset.click.left // Click offset (relative to the element) - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed @@ -673,10 +673,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { return position; }, - _mouseDrag: function(e) { + _mouseDrag: function(event) { //Compute the helpers position - this.position = this._generatePosition(e); + this.position = this._generatePosition(event); this.positionAbs = this._convertPositionTo("absolute"); if (!this.lastPositionAbs) { @@ -684,7 +684,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { } //Call the internal plugins - $.ui.plugin.call(this, "sort", [e, this._ui()]); + $.ui.plugin.call(this, "sort", [event, this._ui()]); //Regenerate the absolute position used for position checks this.positionAbs = this._convertPositionTo("absolute"); @@ -710,20 +710,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { ) { this.direction = intersection == 1 ? "down" : "up"; - this.options.sortIndicator.call(this, e, this.items[i]); - this._propagate("change", e); //Call plugins and callbacks + this.options.sortIndicator.call(this, event, this.items[i]); + this._propagate("change", event); //Call plugins and callbacks break; } } //Post events to containers - this._contactContainers(e); + this._contactContainers(event); //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); //Call callbacks - this.element.triggerHandler("sort", [e, this._ui()], this.options["sort"]); + this.element.triggerHandler("sort", [event, this._ui()], this.options["sort"]); this.lastPositionAbs = this.positionAbs; @@ -731,7 +731,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _rearrange: function(e, i, a, hardRefresh) { + _rearrange: function(event, i, a, hardRefresh) { a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); @@ -749,13 +749,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _mouseStop: function(e, noPropagation) { + _mouseStop: function(event, noPropagation) { - if(!e) return; + if(!event) return; //If we are using droppables, inform the manager about the drop if ($.ui.ddmanager && !this.options.dropBehaviour) - $.ui.ddmanager.drop(this, e); + $.ui.ddmanager.drop(this, event); if(this.options.revert) { var self = this; @@ -767,17 +767,17 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) }, parseInt(this.options.revert, 10) || 500, function() { - self._clear(e); + self._clear(event); }); } else { - this._clear(e, noPropagation); + this._clear(event, noPropagation); } return false; }, - _clear: function(e, noPropagation) { + _clear: function(event, noPropagation) { this.reverting = false; @@ -790,40 +790,40 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { else this.currentItem.show(); - if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed + if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", event, null, noPropagation); //Trigger update callback if the DOM position has changed if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element - this._propagate("remove", e, null, noPropagation); + this._propagate("remove", event, null, noPropagation); for (var i = this.containers.length - 1; i >= 0; i--){ if($.ui.contains(this.containers[i].element[0], this.currentItem[0])) { - this.containers[i]._propagate("update", e, this, noPropagation); - this.containers[i]._propagate("receive", e, this, noPropagation); + this.containers[i]._propagate("update", event, this, noPropagation); + this.containers[i]._propagate("receive", event, this, noPropagation); } }; }; //Post events to containers for (var i = this.containers.length - 1; i >= 0; i--){ - this.containers[i]._propagate("deactivate", e, this, noPropagation); + this.containers[i]._propagate("deactivate", event, this, noPropagation); if(this.containers[i].containerCache.over) { - this.containers[i]._propagate("out", e, this); + this.containers[i]._propagate("out", event, this); this.containers[i].containerCache.over = 0; } } this.dragging = false; if(this.cancelHelperRemoval) { - this._propagate("beforeStop", e, null, noPropagation); - this._propagate("stop", e, null, noPropagation); + this._propagate("beforeStop", event, null, noPropagation); + this._propagate("stop", event, null, noPropagation); return false; } - this._propagate("beforeStop", e, null, noPropagation); + this._propagate("beforeStop", event, null, noPropagation); //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! this.placeholder[0].parentNode.removeChild(this.placeholder[0]); if(this.options.helper != "original") this.helper.remove(); this.helper = null; - this._propagate("stop", e, null, noPropagation); + this._propagate("stop", event, null, noPropagation); return true; @@ -858,40 +858,40 @@ $.extend($.ui.sortable, { */ $.ui.plugin.add("sortable", "cursor", { - start: function(e, ui) { + start: function(event, ui) { var t = $('body'); if (t.css("cursor")) ui.options._cursor = t.css("cursor"); t.css("cursor", ui.options.cursor); }, - beforeStop: function(e, ui) { + beforeStop: function(event, ui) { if (ui.options._cursor) $('body').css("cursor", ui.options._cursor); } }); $.ui.plugin.add("sortable", "zIndex", { - start: function(e, ui) { + start: function(event, ui) { var t = ui.helper; if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); t.css('zIndex', ui.options.zIndex); }, - beforeStop: function(e, ui) { + beforeStop: function(event, ui) { if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex); } }); $.ui.plugin.add("sortable", "opacity", { - start: function(e, ui) { + start: function(event, ui) { var t = ui.helper; if(t.css("opacity")) ui.options._opacity = t.css("opacity"); t.css('opacity', ui.options.opacity); }, - beforeStop: function(e, ui) { + beforeStop: function(event, ui) { if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity); } }); $.ui.plugin.add("sortable", "scroll", { - start: function(e, ui) { + start: function(event, ui) { var o = ui.options; var i = $(this).data("sortable"); @@ -908,32 +908,32 @@ $.ui.plugin.add("sortable", "scroll", { if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset(); }, - sort: function(e, ui) { + sort: function(event, ui) { var o = ui.options; var i = $(this).data("sortable"); if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') { - if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity) + if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - event.pageY < o.scrollSensitivity) i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed; - if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity) + if(event.pageY - i.overflowYOffset.top < o.scrollSensitivity) i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed; } else { - if(e.pageY - $(document).scrollTop() < o.scrollSensitivity) + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) + if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); } if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { - if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) + if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - event.pageX < o.scrollSensitivity) i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed; - if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity) + if(event.pageX - i.overflowXOffset.left < o.scrollSensitivity) i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed; } else { - if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity) + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); } @@ -941,7 +941,7 @@ $.ui.plugin.add("sortable", "scroll", { }); $.ui.plugin.add("sortable", "axis", { - sort: function(e, ui) { + sort: function(event, ui) { var i = $(this).data("sortable"); if(ui.options.axis == "y") i.position.left = i.originalPosition.left; diff --git a/ui/ui.spinner.js b/ui/ui.spinner.js index 17f264021..93bd96ba8 100644 --- a/ui/ui.spinner.js +++ b/ui/ui.spinner.js @@ -45,96 +45,96 @@ $.widget('ui.spinner', { .addClass('ui-spinner') .append('<button class="ui-spinner-up" type="button">▲</button>') .find('.ui-spinner-up') - .bind('mousedown', function(e) { + .bind('mousedown', function(event) { $(this).addClass('ui-spinner-pressed'); if (!self.counter) { self.counter = 1; } - self._mousedown(100, '_up', e); + self._mousedown(100, '_up', event); }) - .bind('mouseup', function(e) { + .bind('mouseup', function(event) { $(this).removeClass('ui-spinner-pressed'); if (self.counter == 1) { - self._up(e); + self._up(event); } - self._mouseup(e); + self._mouseup(event); }) - .bind('mouseout', function(e) { + .bind('mouseout', function(event) { $(this).removeClass('ui-spinner-pressed'); if (self.timer) { - self._mouseup(e); + self._mouseup(event); } }) // mousedown/mouseup capture first click, now handle second click - .bind('dblclick', function(e) { + .bind('dblclick', function(event) { $(this).removeClass('ui-spinner-pressed'); - self._up(e); - self._mouseup(e); + self._up(event); + self._mouseup(event); }) - .bind('keydown.spinner', function(e) { + .bind('keydown.spinner', function(event) { var KEYS = $.keyCode; - if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.ENTER) { + if (event.keyCode == KEYS.SPACE || event.keyCode == KEYS.ENTER) { $(this).addClass('ui-spinner-pressed'); if (!self.counter) { self.counter = 1; } - self._up.call(self, e); - } else if (e.keyCode == KEYS.DOWN || e.keyCode == KEYS.RIGHT) { + self._up.call(self, event); + } else if (event.keyCode == KEYS.DOWN || event.keyCode == KEYS.RIGHT) { self.element.siblings('.ui-spinner-down').focus(); - } else if (e.keyCode == KEYS.LEFT) { + } else if (event.keyCode == KEYS.LEFT) { self.element.focus(); } }) - .bind('keyup.spinner', function(e) { + .bind('keyup.spinner', function(event) { $(this).removeClass('ui-spinner-pressed'); self.counter = 0; - self._propagate('change', e); + self._propagate('change', event); }) .end() .append('<button class="ui-spinner-down" type="button">▼</button>') .find('.ui-spinner-down') - .bind('mousedown', function(e) { + .bind('mousedown', function(event) { $(this).addClass('ui-spinner-pressed'); if (!self.counter) { self.counter = 1; } - self._mousedown(100, '_down', e); + self._mousedown(100, '_down', event); }) - .bind('mouseup', function(e) { + .bind('mouseup', function(event) { $(this).removeClass('ui-spinner-pressed'); if (self.counter == 1) { self._down(); } - self._mouseup(e); + self._mouseup(event); }) - .bind('mouseout', function(e) { + .bind('mouseout', function(event) { $(this).removeClass('ui-spinner-pressed'); if (self.timer) { - self._mouseup(e); + self._mouseup(event); } }) // mousedown/mouseup capture first click, now handle second click - .bind('dblclick', function(e) { + .bind('dblclick', function(event) { $(this).removeClass('ui-spinner-pressed'); - self._down(e); - self._mouseup(e); + self._down(event); + self._mouseup(event); }) - .bind('keydown.spinner', function(e) { + .bind('keydown.spinner', function(event) { var KEYS = $.keyCode; - if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.ENTER) { + if (event.keyCode == KEYS.SPACE || event.keyCode == KEYS.ENTER) { $(this).addClass('ui-spinner-pressed'); if (!self.counter) { self.counter = 1; } - self._down.call(self, e); - } else if (e.keyCode == KEYS.UP || e.keyCode == KEYS.LEFT) { + self._down.call(self, event); + } else if (event.keyCode == KEYS.UP || event.keyCode == KEYS.LEFT) { self.element.siblings('.ui-spinner-up').focus(); } }) - .bind('keyup.spinner', function(e) { + .bind('keyup.spinner', function(event) { $(this).removeClass('ui-spinner-pressed'); self.counter = 0; - self._propagate('change', e); + self._propagate('change', event); }) .end(); @@ -168,23 +168,23 @@ $.widget('ui.spinner', { } this.element - .bind('keydown.spinner', function(e) { + .bind('keydown.spinner', function(event) { if (!self.counter) { self.counter = 1; } - return self._keydown.call(self, e); + return self._keydown.call(self, event); }) - .bind('keyup.spinner', function(e) { + .bind('keyup.spinner', function(event) { self.counter = 0; - self._propagate('change', e); + self._propagate('change', event); }) - .bind('blur.spinner', function(e) { + .bind('blur.spinner', function(event) { self._cleanUp(); }); if ($.fn.mousewheel) { - this.element.mousewheel(function(e, delta) { - self._mousewheel(e, delta); + this.element.mousewheel(function(event, delta) { + self._mousewheel(event, delta); }); } }, @@ -201,7 +201,7 @@ $.widget('ui.spinner', { this._setValue(this._getValue()); this._constrain(); }, - _spin: function(d, e) { + _spin: function(d, event) { if (this.disabled) { return; } @@ -215,17 +215,17 @@ $.widget('ui.spinner', { if (this.counter) { this.counter++; } - this._propagate('spin', e); + this._propagate('spin', event); }, - _down: function(e) { - this._spin('down', e); - this._propagate('down', e); + _down: function(event) { + this._spin('down', event); + this._propagate('down', event); }, - _up: function(e) { - this._spin('up', e); - this._propagate('up', e); + _up: function(event) { + this._spin('up', event); + this._propagate('up', event); }, - _mousedown: function(i, d, e) { + _mousedown: function(i, d, event) { var self = this; i = i || 100; if (this.timer) { @@ -233,54 +233,54 @@ $.widget('ui.spinner', { this.timer = 0; } this.timer = window.setInterval(function() { - self[d](e); + self[d](event); if (self.options.incremental && self.counter > 20) { - self._mousedown(20, d, e); + self._mousedown(20, d, event); } }, i); }, - _mouseup: function(e) { + _mouseup: function(event) { this.counter = 0; if (this.timer) { window.clearInterval(this.timer); this.timer = 0; } this.element[0].focus(); - this._propagate('change', e); + this._propagate('change', event); }, - _keydown: function(e) { + _keydown: function(event) { var KEYS = $.keyCode; - if (e.keyCode == KEYS.UP) { - this._up(e); + if (event.keyCode == KEYS.UP) { + this._up(event); } - if (e.keyCode == KEYS.DOWN) { - this._down(e); + if (event.keyCode == KEYS.DOWN) { + this._down(event); } - if (e.keyCode == KEYS.HOME) { + if (event.keyCode == KEYS.HOME) { //Home key goes to min, if defined, else to start this._setValue(this.options.min || this.options.start); } - if (e.keyCode == KEYS.END && this.options.max != undefined) { + if (event.keyCode == KEYS.END && this.options.max != undefined) { //End key goes to maximum this._setValue(this.options.max); } - return (e.keyCode == KEYS.TAB || e.keyCode == KEYS.BACKSPACE || - e.keyCode == KEYS.LEFT || e.keyCode == KEYS.RIGHT || e.keyCode == KEYS.PERIOD || - e.keyCode == KEYS.NUMPAD_DECIMAL || e.keyCode == KEYS.NUMPAD_SUBTRACT || - (e.keyCode >= 96 && e.keyCode <= 105) || // add support for numeric keypad 0-9 - (/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false; + return (event.keyCode == KEYS.TAB || event.keyCode == KEYS.BACKSPACE || + event.keyCode == KEYS.LEFT || event.keyCode == KEYS.RIGHT || event.keyCode == KEYS.PERIOD || + event.keyCode == KEYS.NUMPAD_DECIMAL || event.keyCode == KEYS.NUMPAD_SUBTRACT || + (event.keyCode >= 96 && event.keyCode <= 105) || // add support for numeric keypad 0-9 + (/[0-9\-\.]/).test(String.fromCharCode(event.keyCode))) ? true : false; }, - _mousewheel: function(e, delta) { + _mousewheel: function(event, delta) { var self = this; delta = ($.browser.opera ? -delta / Math.abs(delta) : delta); - (delta > 0 ? self._up(e) : self._down(e)); + (delta > 0 ? self._up(event) : self._down(event)); if (self.timeout) { window.clearTimeout(self.timeout); self.timeout = 0; } - self.timeout = window.setTimeout(function(){self._propagate('change', e);}, 400); - e.preventDefault(); + self.timeout = window.setTimeout(function(){self._propagate('change', event);}, 400); + event.preventDefault(); }, _getValue: function() { var val = this.element.val().replace(this.options.point, '.'); @@ -337,7 +337,7 @@ $.widget('ui.spinner', { }, plugins: {}, - ui: function(e) { + ui: function(event) { return { options: this.options, element: this.element, @@ -345,9 +345,9 @@ $.widget('ui.spinner', { add: this._addItem }; }, - _propagate: function(n,e) { - $.ui.plugin.call(this, n, [e, this.ui()]); - return this.element.triggerHandler(n == 'spin' ? n : 'spin'+n, [e, this.ui()], this.options[n]); + _propagate: function(n,event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + return this.element.triggerHandler(n == 'spin' ? n : 'spin'+n, [event, this.ui()], this.options[n]); }, destroy: function() { if (!$.data(this.element[0], 'spinner')) { diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index 1a878be02..d75b2ab9f 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -217,7 +217,7 @@ $.widget("ui.tabs", { // attach tab event handler, unbind to avoid duplicates from former tabifying... this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() { - //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click + //var trueClick = event.clientX; // add to history only if true click occured, not a triggered click var $li = $(this).parents('li:eq(0)'), $hide = self.$panels.filter(':visible'), $show = $(self._sanitizeSelector(this.hash)); @@ -435,7 +435,7 @@ $.widget("ui.tabs", { try { o.ajaxOptions.success(r, s); } - catch (e) {} + catch (event) {} // This callback is required because the switch has to take // place after loading has completed. Call last in order to @@ -531,8 +531,8 @@ $.extend($.ui.tabs.prototype, { }, ms); } - function stop(e) { - if (!e || e.clientX) { // only in case of a true click + function stop(event) { + if (!event || event.clientX) { // only in case of a true click clearInterval(self.rotation); } } |