r715 - trunk/ui
r715 - trunk/ui
Author: rdworth
Date: Fri Sep 19 19:43:18 2008
New Revision: 715
Modified:
trunk/ui/ui.accordion.js
trunk/ui/ui.autocomplete.js
trunk/ui/ui.colorpicker.js
trunk/ui/ui.datepicker.js
trunk/ui/ui.draggable.js
trunk/ui/ui.droppable.js
trunk/ui/ui.progressbar.js
trunk/ui/ui.resizable.js
trunk/ui/ui.selectable.js
trunk/ui/ui.slider.js
trunk/ui/ui.sortable.js
trunk/ui/ui.spinner.js
trunk/ui/ui.tabs.js
Log:
whitespace
Modified: trunk/ui/ui.accordion.js
==============================================================================
--- trunk/ui/ui.accordion.js (original)
+++ trunk/ui/ui.accordion.js Fri Sep 19 19:43:18 2008
@@ -60,7 +60,7 @@
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight);
}
-
+
options.headers
.not(options.active || "")
.next()
@@ -214,7 +214,7 @@
options.active = clickedActive ? $([]) : clicked;
toggle.call(this, toShow, toHide, data, clickedActive, down );
-
+
return false;
};
Modified: trunk/ui/ui.autocomplete.js
==============================================================================
--- trunk/ui/ui.autocomplete.js (original)
+++ trunk/ui/ui.autocomplete.js Fri Sep 19 19:43:18 2008
@@ -15,7 +15,7 @@
$.widget("ui.autocomplete", {
_init: function() {
-
+
$.extend(this.options, {
delay: this.options.url ? $.Autocompleter.defaults.delay : 10,
max: !this.options.scroll ? 10 : 150,
@@ -46,7 +46,7 @@
});
$.Autocompleter = function(input, options) {
-
+
var KEY = {
UP: 38,
DOWN: 40,
@@ -59,11 +59,11 @@
PAGEDOWN: 34,
BACKSPACE: 8
};
-
+
// Create $ object for input element
var $input =
$(input).attr("autocomplete", "off").addClass(options.inputClass);
if(options.result) $input.bind('result.autocomplete', options.result);
-
+
var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
@@ -89,7 +89,7 @@
// track last key pressed
lastKeyPressCode = event.keyCode;
switch(event.keyCode) {
-
+
case KEY.UP:
event.preventDefault();
if ( select.visible() ) {
@@ -98,7 +98,7 @@
onChange(0, true);
}
break;
-
+
case KEY.DOWN:
event.preventDefault();
if ( select.visible() ) {
@@ -107,7 +107,7 @@
onChange(0, true);
}
break;
-
+
case KEY.PAGEUP:
event.preventDefault();
if ( select.visible() ) {
@@ -116,7 +116,7 @@
onChange(0, true);
}
break;
-
+
case KEY.PAGEDOWN:
event.preventDefault();
if ( select.visible() ) {
@@ -137,11 +137,11 @@
return false;
}
break;
-
+
case KEY.ESC:
select.hide();
break;
-
+
default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
@@ -193,7 +193,6 @@
$(input.form).unbind(".autocomplete");
});
-
function selectCurrent() {
var selected = select.selected();
if( !selected )
@@ -274,12 +273,12 @@
$.Autocompleter.Selection(input, previousValue.length,
previousValue.length + sValue.length);
}
};
-
+
function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};
-
+
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
@@ -304,7 +303,7 @@
// position cursor at end of input field
$.Autocompleter.Selection(input, input.value.length,
input.value.length);
};
-
+
function receiveData(q, data) {
if ( data && data.length && hasFocus ) {
stopLoading();
@@ -315,7 +314,7 @@
hideResultsNow();
}
};
-
+
function request(term, success, failure) {
if (!options.matchCase)
term = term.toLowerCase();
@@ -352,11 +351,11 @@
}
});
}
-
+
else if (options.source && typeof options.source == 'function') {
var resultData = options.source(term);
var parsed = (options.parse) ? options.parse(resultData) : resultData;
-
+
cache.add(term, parsed);
success(term, parsed);
} else {
@@ -382,11 +381,11 @@
}
return parsed;
};
-
+
function stopLoading() {
$input.removeClass(options.loadingClass);
};
-
+
};
$.Autocompleter.defaults = {
@@ -421,7 +420,7 @@
});
$.Autocompleter.Cache = function(options) {
-
+
var data = {};
var length = 0;
@@ -448,7 +447,7 @@
// track the matches
var stMatchSets = {},
nullData = 0;
-
+
// no url was specified, we need to adjust the cache length to make sure
it fits the local data store
if( !options.url ) options.cacheLength = 1;
@@ -464,12 +463,12 @@
var value = options.formatMatch(rawValue, i+1, options.data.length);
if ( value === false )
continue;
-
+
var firstChar = value.charAt(0).toLowerCase();
// if no lookup array for this character exists, look it up now
if( !stMatchSets[firstChar] )
stMatchSets[firstChar] = [];
-
+
// if the match is a string
var row = {
value: value,
@@ -479,13 +478,13 @@
// push the current match into the set list
stMatchSets[firstChar].push(row);
-
+
// keep track of minChars zero items
if ( nullData++ < options.max ) {
stMatchSets[""].push(row);
}
};
-
+
// add the data items to the cache
$.each(stMatchSets, function(i, value) {
// increase the cache size
@@ -578,7 +577,7 @@
.addClass(options.resultsClass)
.css("position", "absolute")
.appendTo(document.body);
-
+
list = $("<ul/>").appendTo(element).mouseover( function(event) {
if(target(event).nodeName && target(event).nodeName.toUpperCase()
== 'LI') {
active = $("li",
list).removeClass(CLASSES.ACTIVE).index(target(event));
@@ -598,7 +597,7 @@
if( options.width > 0 )
element.css("width", options.width);
-
+
needsInit = false;
}
@@ -611,7 +610,7 @@
return [];
return element;
}
-
+
function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
Modified: trunk/ui/ui.colorpicker.js
==============================================================================
--- trunk/ui/ui.colorpicker.js (original)
+++ trunk/ui/ui.colorpicker.js Fri Sep 19 19:43:18 2008
@@ -13,13 +13,13 @@
(function($) {
$.widget("ui.colorpicker", {
-
+
_init: function() {
-
+
this.charMin = 65;
var o = this.options, self = this,
tpl = '<div class="ui-colorpicker clearfix"><div
class="ui-colorpicker-color"><div><div></div></div></div><div
class="ui-colorpicker-hue"><div></div></div><div
class="ui-colorpicker-new-color"></div><div
class="ui-colorpicker-current-color"></div><div
class="ui-colorpicker-hex"><label for="ui-colorpicker-hex"
title="hex"></label><input type="text" maxlength="6" size="6" /></div><div
class="ui-colorpicker-rgb-r ui-colorpicker-field"><label
for="ui-colorpicker-rgb-r"></label><input type="text" maxlength="3"
size="2" /><span></span></div><div class="ui-colorpicker-rgb-g
ui-colorpicker-field"><label for="ui-colorpicker-rgb-g"></label><input
type="text" maxlength="3" size="2" /><span></span></div><div
class="ui-colorpicker-rgb-b ui-colorpicker-field"><label
for="ui-colorpicker-rgb-b"</label><input type="text" maxlength="3" size="2"
/><span></span></div><div class="ui-colorpicker-hsb-h
ui-colorpicker-field"><label for="ui-colorpicker-hsb-h"></label><input
type="text" maxlength="3" size="2" /><span></span></div><div
class="ui-colorpicker-hsb-s ui-colorpicker-field"><label
for="ui-colorpicker-hsb-s"></label><input type="text" maxlength="3"
size="2" /><span></span></div><div class="ui-colorpicker-hsb-b
ui-colorpicker-field"><label for="ui-colorpicker-hsb-b"></label><input
type="text" maxlength="3" size="2" /><span></span></div><button
class="ui-colorpicker-submit ui-default-state" name="submit"
type="button">Done</button></div>';
-
+
if (typeof o.color == 'string') {
this.color = this._HexToHSB(o.color);
} else if (o.color.r != undefined && o.color.g != undefined &&
o.color.b != undefined) {
@@ -29,37 +29,37 @@
} else {
return this;
}
-
+
this.origColor = this.color;
this.picker = $(tpl);
-
+
if (o.flat) {
this.picker.appendTo(this.element).show();
} else {
this.picker.appendTo(document.body);
}
-
+
this.fields = this.picker.find('input')
.bind('keydown', function(e) { return self._keyDown.call(self, e); })
.bind('change', function(e) { return self._change.call(self, e); })
.bind('blur', function(e) { return self._blur.call(self, e); })
.bind('focus', function(e) { return self._focus.call(self, e); });
-
+
this.picker.find('span').bind('mousedown', function(e) { return
self._downIncrement.call(self, e); });
-
+
this.selector =
this.picker.find('div.ui-colorpicker-color').bind('mousedown', function(e)
{ return self._downSelector.call(self, e); });
this.selectorIndic = this.selector.find('div div');
this.hue = this.picker.find('div.ui-colorpicker-hue div');
this.picker.find('div.ui-colorpicker-hue').bind('mousedown', function(e)
{ return self._downHue.call(self, e); });
-
+
this.newColor = this.picker.find('div.ui-colorpicker-new-color');
this.currentColor = this.picker.find('div.ui-colorpicker-current-color');
-
+
this.picker.find('.ui-colorpicker-submit')
.bind('mouseenter', function(e) { return self._enterSubmit.call(self,
e); })
.bind('mouseleave', function(e) { return self._leaveSubmit.call(self,
e); })
.bind('click', function(e) { return self._clickSubmit.call(self, e); });
-
+
this._fillRGBFields(this.color);
this._fillHSBFields(this.color);
this._fillHexFields(this.color);
@@ -67,7 +67,7 @@
this._setSelector(this.color);
this._setCurrentColor(this.color);
this._setNewColor(this.color);
-
+
if (o.flat) {
this.picker.css({
position: 'relative',
@@ -76,16 +76,16 @@
} else {
$(this.element).bind(o.eventName+".colorpicker", function(e) { return
self._show.call(self, e); });
}
-
+
},
-
+
destroy: function() {
-
+
this.picker.remove();
this.element.removeData("colorpicker").unbind(".colorpicker");
-
+
},
-
+
_fillRGBFields: function(hsb) {
var rgb = this._HSBToRGB(hsb);
this.fields
@@ -126,7 +126,7 @@
}
},
_change: function(e, target) {
-
+
var col;
target = target || e.target;
if (target.parentNode.className.indexOf('-hex') > 0) {
@@ -153,11 +153,11 @@
this._setSelector(col);
this._setHue(col);
this._setNewColor(col);
-
+
this._trigger('change', e, { options: this.options, hsb: col, hex:
this._HSBToHex(col), rgb: this._HSBToRGB(col) });
},
_blur: function(e) {
-
+
var col = this.color;
this._fillRGBFields(col);
this._fillHSBFields(col);
@@ -166,17 +166,17 @@
this._setSelector(col);
this._setNewColor(col);
this.fields.parent().removeClass('ui-colorpicker-focus');
-
+
},
_focus: function(e) {
-
+
this.charMin = e.target.parentNode.className.indexOf('-hex') > 0 ? 70 :
65;
this.fields.parent().removeClass('ui-colorpicker-focus');
$(e.target.parentNode).addClass('ui-colorpicker-focus');
-
+
},
_downIncrement: function(e) {
-
+
var field = $(e.target).parent().find('input').focus(), self = this;
this.currentIncrement = {
el: $(e.target).parent().addClass('ui-colorpicker-slider'),
@@ -188,7 +188,7 @@
$(document).bind('mouseup.cpSlider', function(e) { return
self._upIncrement.call(self, e); });
$(document).bind('mousemove.cpSlider', function(e) { return
self._moveIncrement.call(self, e); });
return false;
-
+
},
_moveIncrement: function(e) {
this.currentIncrement.field.val(Math.max(0,
Math.min(this.currentIncrement.max, parseInt(this.currentIncrement.val +
e.pageY - this.currentIncrement.y, 10))));
@@ -203,25 +203,25 @@
return false;
},
_downHue: function(e) {
-
+
this.currentHue = {
y: this.picker.find('div.ui-colorpicker-hue').offset().top
};
-
+
this._change.apply(this, [e, this
.fields
.eq(4)
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(e.pageY -
this.currentHue.y))))/150, 10))
.get(0)]);
-
+
var self = this;
$(document).bind('mouseup.cpSlider', function(e) { return
self._upHue.call(self, e); });
$(document).bind('mousemove.cpSlider', function(e) { return
self._moveHue.call(self, e); });
return false;
-
+
},
_moveHue: function(e) {
-
+
this._change.apply(this, [e, this
.fields
.eq(4)
@@ -229,7 +229,7 @@
.get(0)]);
return false;
-
+
},
_upHue: function(e) {
$(document).unbind('mouseup.cpSlider');
@@ -237,12 +237,12 @@
return false;
},
_downSelector: function(e) {
-
+
var self = this;
this.currentSelector = {
pos: this.picker.find('div.ui-colorpicker-color').offset()
};
-
+
this._change.apply(this, [e, this
.fields
.eq(6)
@@ -255,10 +255,10 @@
$(document).bind('mouseup.cpSlider', function(e) { return
self._upSelector.call(self, e); });
$(document).bind('mousemove.cpSlider', function(e) { return
self._moveSelector.call(self, e); });
return false;
-
+
},
_moveSelector: function(e) {
-
+
this._change.apply(this, [e, this
.fields
.eq(6)
@@ -269,7 +269,7 @@
.get(0)
]);
return false;
-
+
},
_upSelector: function(e) {
$(document).unbind('mouseup.cpSlider');
@@ -283,19 +283,19 @@
this.picker.find('.ui-colorpicker-submit').removeClass('ui-colorpicker-focus');
},
_clickSubmit: function(e) {
-
+
var col = this.color;
this.origColor = col;
this._setCurrentColor(col);
-
+
this._trigger("submit", e, { options: this.options, hsb: col, hex:
this._HSBToHex(col), rgb: this._HSBToRGB(col) });
return false;
-
+
},
_show: function(e) {
-
+
this._trigger("beforeShow", e, { options: this.options, hsb: this.color,
hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) });
-
+
var pos = this.element.offset();
var viewPort = this._getScroll();
var top = pos.top + this.element[0].offsetHeight;
@@ -310,21 +310,21 @@
if (this._trigger("show", e, { options: this.options, hsb: this.color,
hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) !=
false) {
this.picker.show();
}
-
+
var self = this;
$(document).bind('mousedown.colorpicker', function(e) { return
self._hide.call(self, e); });
return false;
-
+
},
_hide: function(e) {
-
+
if (!this._isChildOf(this.picker[0], e.target, this.picker[0])) {
if (this._trigger("hide", e, { options: this.options, hsb: this.color,
hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) !=
false) {
this.picker.hide();
}
$(document).unbind('mousedown.colorpicker');
}
-
+
},
_isChildOf: function(parentEl, el, container) {
if (parentEl == el) {
@@ -446,7 +446,7 @@
} else {
return this;
}
-
+
this.color = col;
this.origColor = col;
this._fillRGBFields(col);
@@ -456,9 +456,9 @@