r1753 - trunk/ui
r1753 - trunk/ui
Author: rdworth
Date: Thu Jan 22 05:10:18 2009
New Revision: 1753
Modified:
trunk/ui/effects.core.js
trunk/ui/effects.pulsate.js
trunk/ui/ui.accordion.js
trunk/ui/ui.core.js
trunk/ui/ui.datepicker.js
trunk/ui/ui.draggable.js
trunk/ui/ui.resizable.js
trunk/ui/ui.slider.js
trunk/ui/ui.sortable.js
trunk/ui/ui.tabs.js
Log:
whitespace
Modified: trunk/ui/effects.core.js
==============================================================================
--- trunk/ui/effects.core.js (original)
+++ trunk/ui/effects.core.js Thu Jan 22 05:10:18 2009
@@ -13,26 +13,26 @@
$.extend($.effects, {
version: "@VERSION",
-
+
// Saves a set of properties in a data storage
save: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.data("ec.storage."+set[i],
element[0].style[set[i]]);
}
},
-
+
// Restores a set of previously saved properties from a data storage
restore: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.css(set[i],
element.data("ec.storage."+set[i]));
}
},
-
+
setMode: function(el, mode) {
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set
for toggle
return mode;
},
-
+
getBaseline: function(origin, original) { // Translates a [top,left]
array into a baseline value
// this should be a little more flexible in the future to handle a
string & hash
var y, x;
@@ -50,7 +50,7 @@
};
return {x: x, y: y};
},
-
+
// Wraps the element around a wrapper that copies position properties
createWrapper: function(element) {
@@ -134,7 +134,7 @@
//Extend the methods of jQuery
$.fn.extend({
-
+
//Save old methods
_show: $.fn.show,
_hide: $.fn.hide,
@@ -142,12 +142,12 @@
_addClass: $.fn.addClass,
_removeClass: $.fn.removeClass,
_toggleClass: $.fn.toggleClass,
-
+
// New effect methods
effect: function(fx, options, speed, callback) {
return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options:
options || {}, duration: speed, callback: callback }) : null;
},
-
+
show: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|
normal|fast)/).test(arguments[0])))
return this._show.apply(this, arguments);
@@ -156,7 +156,7 @@
return this.effect.apply(this, [arguments[0], o, arguments[2] ||
o.duration, arguments[3] || o.callback]);
}
},
-
+
hide: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|
normal|fast)/).test(arguments[0])))
return this._hide.apply(this, arguments);
@@ -165,7 +165,7 @@
return this.effect.apply(this, [arguments[0], o, arguments[2] ||
o.duration, arguments[3] || o.callback]);
}
},
-
+
toggle: function(){
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|
normal|fast)/).test(arguments[0])) || (arguments[0].constructor ==
Function))
return this.__toggle.apply(this, arguments);
@@ -174,7 +174,7 @@
return this.effect.apply(this, [arguments[0], o, arguments[2] ||
o.duration, arguments[3] || o.callback]);
}
},
-
+
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add: classNames
},speed,easing,callback]) : this._addClass(classNames);
},
@@ -190,7 +190,7 @@
switchClass: function() {
return this.morph.apply(this, arguments);
},
-
+
// helper functions
cssUnit: function(key) {
var style = this.css(key), val = [];
Modified: trunk/ui/effects.pulsate.js
==============================================================================
--- trunk/ui/effects.pulsate.js (original)
+++ trunk/ui/effects.pulsate.js Thu Jan 22 05:10:18 2009
@@ -23,7 +23,7 @@
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var times = o.options.times || 5; // Default # of times
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
-
+
// Adjust
if (mode == 'hide') times--;
if (el.is(':hidden')) { // Show fadeIn
Modified: trunk/ui/ui.accordion.js
==============================================================================
--- trunk/ui/ui.accordion.js (original)
+++ trunk/ui/ui.accordion.js Thu Jan 22 05:10:18 2009
@@ -15,7 +15,7 @@
$.widget("ui.accordion", {
_init: function() {
-
+
var o = this.options, self = this;
this.running = 0;
@@ -32,12 +32,12 @@
}
this.element.addClass("ui-accordion ui-widget ui-helper-reset");
-
+
this.groups = this.element.children().addClass("ui-accordion-group");
this.headers =
this.groups.find("> :first-child").addClass("ui-accordion-header
ui-helper-reset ui-state-default ui-corner-all")
.bind("mouseenter.accordion", function(){
$(this).addClass('ui-state-hover'); })
.bind("mouseleave.accordion", function(){
$(this).removeClass('ui-state-hover'); });
-
+
// wrap content elements in div against animation issues
this.headers
.next()
@@ -48,7 +48,7 @@
this.active = this._findActive(this.active ||
o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.parent().addClass('ui-accordion-selected');
-
+
//Append icon elements
$("<span/>").addClass("ui-icon " +
o.icons.header).prependTo(this.headers);
this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
@@ -92,11 +92,11 @@
if (o.event) {
this.element.bind((o.event) + ".accordion", function(event) { return
self._clickHandler.call(self, event); });
}
-
+
},
destroy: function() {
-
+
this.element
.removeClass("ui-accordion ui-widget ui-helper-reset")
.removeAttr("role")
@@ -108,19 +108,19 @@
.unbind(".accordion")
.removeClass("ui-accordion-header ui-helper-reset ui-state-default
ui-corner-all ui-state-active ui-corner-top")
.removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
-
+
this.headers.find("a").removeAttr("tabindex");
this.headers.children(".ui-icon").remove();
this.headers.next().children().removeClass("ui-accordion-content").each(function()
{
$(this).parent().replaceWith(this);
});
-
+
},
_keydown: function(event) {
-
+
var o = this.options, keyCode = $.ui.keyCode;
-
+
if (o.disabled || event.altKey || event.ctrlKey)
return;
@@ -154,36 +154,36 @@
},
resize: function() {
-
+
var o = this.options, maxHeight;
if (o.fillSpace) {
-
+
maxHeight = this.element.parent().height();
this.headers.each(function() {
maxHeight -= $(this).outerHeight();
});
-
+
var maxPadding = 0;
this.headers.next().each(function() {
maxPadding = Math.max(maxPadding, $(this).innerHeight() -
$(this).height());
}).height(maxHeight - maxPadding)
.css('overflow', 'auto');
-
+
} else if ( o.autoHeight ) {
maxHeight = 0;
this.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight);
}
-
+
},
activate: function(index) {
// call clickHandler with custom event
this._clickHandler({ target: this._findActive(index)[0] });
},
-
+
_findActive: function(selector) {
return selector
? typeof selector == "number"
@@ -193,12 +193,12 @@
? $([])
: this.headers.filter(":eq(0)");
},
-
+
_clickHandler: function(event) {
-
+
var o = this.options;
if (o.disabled) return false;
-
+
// called only when using activate(false) to close all parts
programmatically
if (!event.target && !o.alwaysOpen) {
this.active.parent().toggleClass('ui-accordion-selected');
@@ -216,16 +216,16 @@
this._toggle(toShow, toHide, data);
return false;
}
-
+
// get the click target
var clicked = $(event.target);
-
+
// due to the event delegation model, we have to check if one
// of the parent elements is our actual header, and find that
// otherwise stick with the initial target
clicked = $( clicked.parents(o.header)[0] || clicked );
var clickedIsActive = clicked[0] == this.active[0];
-
+
// if animations are still active, or the active header is the target,
ignore click
if (this.running || (o.alwaysOpen && clickedIsActive)) {
return false;
@@ -233,7 +233,7 @@
if (!clicked.is(o.header)) {
return;
}
-
+
// switch classes
this.active.parent().toggleClass('ui-accordion-selected');
this.active.removeClass("ui-state-active
ui-corner-top").addClass("ui-state-default ui-corner-all")
@@ -243,7 +243,7 @@
clicked.removeClass("ui-state-default
ui-corner-all").addClass("ui-state-active ui-corner-top")
.find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
}
-
+
// find elements to show and hide
var toShow = clicked.next(),
toHide = this.active.next(),
@@ -255,22 +255,22 @@
oldContent: toHide
},
down = this.headers.index( this.active[0] ) > this.headers.index(
clicked[0] );
-
+
this.active = clickedIsActive ? $([]) : clicked;
this._toggle(toShow, toHide, data, clickedIsActive, down);
-
+
return false;
-
+
},
-
+
_toggle: function(toShow, toHide, data, clickedIsActive, down) {
var o = this.options, self = this;
-
+
this.toShow = toShow;
this.toHide = toHide;
this.data = data;
-
+
var complete = function() { if(!self) return; return
self._completed.apply(self, arguments); };
// trigger changestart event
@@ -280,9 +280,9 @@
this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
if (o.animated) {
-
+
var animOptions = {};
-
+
if ( !o.alwaysOpen && clickedIsActive ) {
animOptions = {
toShow: $([]),
@@ -300,25 +300,25 @@
autoHeight: o.autoHeight || o.fillSpace
};
}
-
+
if (!o.proxied) {
o.proxied = o.animated;
}
-
+
if (!o.proxiedDuration) {
o.proxiedDuration = o.duration;
}
-
+
o.animated = $.isFunction(o.proxied) ?
o.proxied(animOptions) : o.proxied;
-
+
o.duration = $.isFunction(o.proxiedDuration) ?
o.proxiedDuration(animOptions) : o.proxiedDuration;
-
+
var animations = $.ui.accordion.animations,
duration = o.duration,
easing = o.animated;
-
+
if (!animations[easing]) {
animations[easing] = function(options) {
this.slide(options, {
@@ -327,43 +327,43 @@
});
};
}
-
+
animations[easing](animOptions);
-
+
} else {
-
+
if (!o.alwaysOpen && clickedIsActive) {
toShow.toggle();
} else {
toHide.hide();
toShow.show();
}
-
+
complete(true);
-
+
}
-
+
toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1");
toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
},
-
+
_completed: function(cancel) {
var o = this.options;
-
+
this.running = cancel ? 0 : --this.running;
if (this.running) return;
-
+
if (o.clearStyle) {
this.toShow.add(this.toHide).css({
height: "",
overflow: ""
});
}
-
+
this._trigger('change', null, this.data);
-
+
}
});
Modified: trunk/ui/ui.core.js
==============================================================================
--- trunk/ui/ui.core.js (original)
+++ trunk/ui/ui.core.js Thu Jan 22 05:10:18 2009
@@ -454,7 +454,7 @@
// however, in Safari, this causes select boxes not to be selectable
// anymore, so this fix is needed
($.browser.safari || event.preventDefault());
-
+
return true;
},
Modified: trunk/ui/ui.datepicker.js
==============================================================================
--- trunk/ui/ui.datepicker.js (original)
+++ trunk/ui/ui.datepicker.js Thu Jan 22 05:10:18 2009
@@ -610,26 +610,26 @@
if (inst.input && inst.input[0].type != 'hidden' && inst ==
$.datepicker._curInst)
$(inst.input[0]).focus();
},
-
+
/* Check positioning to remain on screen. */
- _checkOffset: function(inst, offset, isFixed) {
+ _checkOffset: function(inst, offset, isFixed) {
var dpWidth = inst.dpDiv.outerWidth();
var dpHeight = inst.dpDiv.outerHeight();
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
var viewWidth = window.innerWidth ||
document.documentElement.clientWidth || document.body.clientWidth;
var viewHeight = window.innerHeight ||
document.documentElement.clientHeight || document.body.clientHeight;
-
+
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
offset.left -= (isFixed && offset.left == inst.input.offset().left) ?
$(document).scrollLeft() : 0;
offset.top -= (isFixed && offset.top == (inst.input.offset().top +
inputHeight)) ? $(document).scrollTop() : 0;
-
+
// now check if datepicker is showing outside window viewpoint - move to
a better place if so.
offset.left -= (offset.left + dpWidth > viewWidth && viewWidth >
dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
offset.top -= (offset.top + dpHeight > viewHeight && viewHeight >
dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) :
0;
-
+
return offset;
- },
+ },
/* Find an object's position on the screen. */
_findPos: function(obj) {
Modified: trunk/ui/ui.draggable.js
==============================================================================
--- trunk/ui/ui.draggable.js (original)
+++ trunk/ui/ui.draggable.js Thu Jan 22 05:10:18 2009
@@ -144,7 +144,7 @@
var dropped = false;
if ($.ui.ddmanager && !this.options.dropBehaviour)
dropped = $.ui.ddmanager.drop(this, event);
-
+
//if a drop comes from outside (a sortable)
if(this.dropped) {
dropped = this.dropped;
@@ -206,7 +206,7 @@
//Get the offsetParent and cache its position
this.offsetParent = this.helper.offsetParent();
var po = this.offsetParent.offset();
-
+
// This is a special case where we need to modify a offset calculated on
start, since the following happened:
// 1. The position of the helper is absolute, so it's position is
calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the
scroll parent isn't the document, which means that
@@ -303,7 +303,7 @@
- ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() :
scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod
)
};
-
+
},
_generatePosition: function(event) {
@@ -317,7 +317,7 @@
if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document
&& this.scrollParent[0] != this.offsetParent[0])) {
this.offset.relative = this._getRelativeOffset();
}
-
+
var pageX = event.pageX;
var pageY = event.pageY;
@@ -325,7 +325,7 @@
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
-
+
if(this.originalPosition) { //If we are not dragging yet, we won't check
for options
if(this.containment) {
@@ -334,7 +334,7 @@
if(event.pageX - this.offset.click.left > this.containment[2]) pageX =
this.containment[2] + this.offset.click.left;
if(event.pageY - this.offset.click.top > this.containment[3]) pageY =
this.containment[3] + this.offset.click.top;
}
-
+
if(o.grid) {
var top = this.originalPageY + Math.round((pageY - this.originalPageY)
/ o.grid[1]) * o.grid[1];
pageY = this.containment ? (!(top - this.offset.click.top <
this.containment[1] || top - this.offset.click.top > this.containment[3]) ?
top : (!(top - this.offset.click.top < this.containment[1]) ? top -
o.grid[1] : top + o.grid[1])) : top;
@@ -457,18 +457,18 @@
$.each(inst.sortables, function() {
if(this.instance.isOver) {
-
+
this.instance.isOver = 0;
-
+
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)
-
+
//The sortable revert is supported, and we have to set a temporary
dropped variable on the draggable to support revert: 'valid/invalid'
if(this.shouldRevert) this.instance.options.revert = true;
-
+
//Trigger the stop of the sortable
this.instance._mouseStop(event);
-
+
this.instance.options.helper = this.instance.options._helper;
//If the helper has been the original item, restore properties in the
sortable
Modified: trunk/ui/ui.resizable.js
==============================================================================
--- trunk/ui/ui.resizable.js (original)
+++ trunk/ui/ui.resizable.js Thu Jan 22 05:10:18 2009
@@ -520,7 +520,7 @@
_propagate: function(n, event) {
$.ui.plugin.call(this, n, [event, this.ui()]);
-
+
(n != "resize" && this._trigger(n, event, this.ui()));
},
Modified: trunk/ui/ui.slider.js
===============================================================