aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-01-07 03:19:50 +0000
committerScott González <scott.gonzalez@gmail.com>2010-01-07 03:19:50 +0000
commit90fb45dffafc2e891b1ebca948ad33e6b94de112 (patch)
tree6bd09ea116ef2cdd86ec0fa70bf740617f67d441 /ui
parent975b02a82cdff29fd8469bfe4324472c2ae3f954 (diff)
downloadjquery-ui-90fb45dffafc2e891b1ebca948ad33e6b94de112.tar.gz
jquery-ui-90fb45dffafc2e891b1ebca948ad33e6b94de112.zip
Merged in /branches/dev r3251:3620 (excluding autocomplete, modal, tooltip, menu; including menu static tests).
Diffstat (limited to 'ui')
-rw-r--r--ui/i18n/jquery.ui.datepicker-eu.js44
-rw-r--r--ui/i18n/jquery.ui.datepicker-fr-CH.js44
-rw-r--r--ui/i18n/jquery.ui.datepicker-vi.js46
-rw-r--r--ui/jquery.ui.accordion.js41
-rw-r--r--ui/jquery.ui.button.js247
-rw-r--r--ui/jquery.ui.datepicker.js7
-rw-r--r--ui/jquery.ui.dialog.js114
-rw-r--r--ui/jquery.ui.draggable.js61
-rw-r--r--ui/jquery.ui.droppable.js26
-rw-r--r--ui/jquery.ui.mouse.js16
-rw-r--r--ui/jquery.ui.position.js444
-rw-r--r--ui/jquery.ui.progressbar.js17
-rw-r--r--ui/jquery.ui.resizable.js43
-rw-r--r--ui/jquery.ui.selectable.js21
-rw-r--r--ui/jquery.ui.slider.js33
-rw-r--r--ui/jquery.ui.sortable.js56
-rw-r--r--ui/jquery.ui.tabs.js45
-rw-r--r--ui/jquery.ui.widget.js148
18 files changed, 854 insertions, 599 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-eu.js b/ui/i18n/jquery.ui.datepicker-eu.js
index 1d7609a24..9ba6ee22e 100644
--- a/ui/i18n/jquery.ui.datepicker-eu.js
+++ b/ui/i18n/jquery.ui.datepicker-eu.js
@@ -1,23 +1,23 @@
-/* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
-/* Karrikas-ek itzulia (karrikas@karrikas.com) */
-jQuery(function($){
- $.datepicker.regional['eu'] = {
- closeText: 'Egina',
- prevText: '&#x3c;Aur',
- nextText: 'Hur&#x3e;',
- currentText: 'Gaur',
- monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina',
- 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'],
- monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka',
- 'Uzt','Abu','Ira','Urr','Aza','Abe'],
- dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'],
- dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'],
- dayNamesMin: ['Ig','As','As','As','Os','Os','La'],
- weekHeader: 'Wk',
- dateFormat: 'yy/mm/dd',
- firstDay: 1,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''};
- $.datepicker.setDefaults($.datepicker.regional['eu']);
+/* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
+/* Karrikas-ek itzulia (karrikas@karrikas.com) */
+jQuery(function($){
+ $.datepicker.regional['eu'] = {
+ closeText: 'Egina',
+ prevText: '&#x3c;Aur',
+ nextText: 'Hur&#x3e;',
+ currentText: 'Gaur',
+ monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina',
+ 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'],
+ monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka',
+ 'Uzt','Abu','Ira','Urr','Aza','Abe'],
+ dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'],
+ dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'],
+ dayNamesMin: ['Ig','As','As','As','Os','Os','La'],
+ weekHeader: 'Wk',
+ dateFormat: 'yy/mm/dd',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+ $.datepicker.setDefaults($.datepicker.regional['eu']);
}); \ No newline at end of file
diff --git a/ui/i18n/jquery.ui.datepicker-fr-CH.js b/ui/i18n/jquery.ui.datepicker-fr-CH.js
index 9b7234375..dafef16ff 100644
--- a/ui/i18n/jquery.ui.datepicker-fr-CH.js
+++ b/ui/i18n/jquery.ui.datepicker-fr-CH.js
@@ -1,23 +1,23 @@
-/* Swiss-French initialisation for the jQuery UI date picker plugin. */
-/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */
-jQuery(function($){
- $.datepicker.regional['fr-CH'] = {
- closeText: 'Fermer',
- prevText: '&#x3c;Prc',
- nextText: 'Suiv&#x3e;',
- currentText: 'Courant',
- monthNames: ['Janvier','Fvrier','Mars','Avril','Mai','Juin',
- 'Juillet','Aot','Septembre','Octobre','Novembre','Dcembre'],
- monthNamesShort: ['Jan','Fv','Mar','Avr','Mai','Jun',
- 'Jul','Ao','Sep','Oct','Nov','Dc'],
- dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
- dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
- dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
- weekHeader: 'Sm',
- dateFormat: 'dd.mm.yy',
- firstDay: 1,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''};
- $.datepicker.setDefaults($.datepicker.regional['fr-CH']);
+/* Swiss-French initialisation for the jQuery UI date picker plugin. */
+/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */
+jQuery(function($){
+ $.datepicker.regional['fr-CH'] = {
+ closeText: 'Fermer',
+ prevText: '&#x3c;Prc',
+ nextText: 'Suiv&#x3e;',
+ currentText: 'Courant',
+ monthNames: ['Janvier','Fvrier','Mars','Avril','Mai','Juin',
+ 'Juillet','Aot','Septembre','Octobre','Novembre','Dcembre'],
+ monthNamesShort: ['Jan','Fv','Mar','Avr','Mai','Jun',
+ 'Jul','Ao','Sep','Oct','Nov','Dc'],
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
+ weekHeader: 'Sm',
+ dateFormat: 'dd.mm.yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+ $.datepicker.setDefaults($.datepicker.regional['fr-CH']);
}); \ No newline at end of file
diff --git a/ui/i18n/jquery.ui.datepicker-vi.js b/ui/i18n/jquery.ui.datepicker-vi.js
index fa97af5fa..9813a59e0 100644
--- a/ui/i18n/jquery.ui.datepicker-vi.js
+++ b/ui/i18n/jquery.ui.datepicker-vi.js
@@ -1,23 +1,23 @@
-/* Vietnamese initialisation for the jQuery UI date picker plugin. */
-/* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */
-jQuery(function($){
- $.datepicker.regional['vi'] = {
- closeText: 'Đóng',
- prevText: '&#x3c;Trước',
- nextText: 'Tiếp&#x3e;',
- currentText: 'Hôm nay',
- monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
- 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
- monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
- 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],
- dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
- dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
- weekHeader: 'Tu',
- dateFormat: 'dd/mm/yy',
- firstDay: 0,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''};
- $.datepicker.setDefaults($.datepicker.regional['vi']);
-});
+/* Vietnamese initialisation for the jQuery UI date picker plugin. */
+/* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */
+jQuery(function($){
+ $.datepicker.regional['vi'] = {
+ closeText: 'Đóng',
+ prevText: '&#x3c;Trước',
+ nextText: 'Tiếp&#x3e;',
+ currentText: 'Hôm nay',
+ monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
+ 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
+ monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
+ 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],
+ dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
+ dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
+ dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
+ weekHeader: 'Tu',
+ dateFormat: 'dd/mm/yy',
+ firstDay: 0,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+ $.datepicker.setDefaults($.datepicker.regional['vi']);
+});
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 8340c0f1f..885174c8a 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -14,7 +14,24 @@
(function($) {
$.widget("ui.accordion", {
-
+ options: {
+ active: 0,
+ animated: 'slide',
+ autoHeight: true,
+ clearStyle: false,
+ collapsible: false,
+ event: "click",
+ fillSpace: false,
+ header: "> li > :first-child,> :not(li):even",
+ icons: {
+ header: "ui-icon-triangle-1-e",
+ headerSelected: "ui-icon-triangle-1-s"
+ },
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() == location.href.toLowerCase();
+ }
+ },
_init: function() {
var o = this.options, self = this;
@@ -140,8 +157,8 @@ $.widget("ui.accordion", {
return this;
},
- _setData: function(key, value) {
- $.widget.prototype._setData.apply(this, arguments);
+ _setOption: function(key, value) {
+ $.Widget.prototype._setOption.apply(this, arguments);
if (key == "active") {
this.activate(value);
@@ -422,24 +439,6 @@ $.widget("ui.accordion", {
$.extend($.ui.accordion, {
version: "@VERSION",
- defaults: {
- active: 0,
- animated: 'slide',
- autoHeight: true,
- clearStyle: false,
- collapsible: false,
- event: "click",
- fillSpace: false,
- header: "> li > :first-child,> :not(li):even",
- icons: {
- header: "ui-icon-triangle-1-e",
- headerSelected: "ui-icon-triangle-1-s"
- },
- navigation: false,
- navigationFilter: function() {
- return this.href.toLowerCase() == location.href.toLowerCase();
- }
- },
animations: {
slide: function(options, additions) {
options = $.extend({
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
new file mode 100644
index 000000000..f104f890d
--- /dev/null
+++ b/ui/jquery.ui.button.js
@@ -0,0 +1,247 @@
+/*
+ * jQuery UI Button @VERSION
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Button
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function($) {
+
+var lastActive,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ otherClasses = "ui-state-hover ui-state-active " +
+ "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only";
+
+$.widget("ui.button", {
+ options: {
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _init: function() {
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr('title');
+
+ var self = this,
+ options = this.options,
+ toggleButton = this.type == 'checkbox' || this.type == 'radio',
+ hoverClass = 'ui-state-hover' + (!toggleButton ? ' ui-state-active' : '');
+
+ if (options.label === null) {
+ options.label = this.buttonElement.html();
+ }
+
+ this.buttonElement
+ .addClass(baseClasses)
+ .attr('role', 'button')
+ .bind("mouseenter.button", function() {
+ if (options.disabled) { return; }
+ $(this).addClass("ui-state-hover");
+ if (this == lastActive) {
+ $(this).addClass("ui-state-active");
+ }
+ })
+ .bind("mouseleave.button", function() {
+ if (options.disabled) { return; }
+ $(this).removeClass(hoverClass);
+ });
+
+ switch (this.type) {
+ case 'checkbox':
+ this.buttonElement.bind('click.button', function() {
+ if (options.disabled) { return; }
+ $(this).toggleClass("ui-state-active");
+ self.element
+ .attr("checked", !self.element[0].checked)
+ .click();
+ self.buttonElement.attr('aria-pressed', self.element[0].checked);
+ });
+ break;
+ case 'radio':
+ this.buttonElement.bind('click.button', function() {
+ if (options.disabled) { return; }
+ $(this).addClass("ui-state-active");
+ self.element
+ .attr("checked", true)
+ .click();
+ self.buttonElement.attr('aria-pressed', true);
+
+ var radio = self.element[0],
+ name = radio.name,
+ form = radio.form,
+ radios;
+ if (name) {
+ if (form) {
+ radios = $(form).find('[name=' + name + ']');
+ } else {
+ radios = $('[name=' + name + ']', radio.ownerDocument)
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ radios
+ .not(radio)
+ .map(function() {
+ return $(this).button('widget')[0];
+ })
+ .removeClass('ui-state-active')
+ .attr('aria-pressed', false);
+ }
+ });
+ break;
+ default:
+ this.buttonElement
+ .bind("mousedown.button", function() {
+ if (options.disabled) { return; }
+ $(this).addClass("ui-state-active");
+ lastActive = this;
+ $(document).one('mouseup', function() {
+ lastActive = null;
+ });
+ })
+ .bind("mouseup.button", function() {
+ if (options.disabled) { return; }
+ $(this).removeClass("ui-state-active");
+ });
+ break;
+ }
+
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+ this.type = this.element.is(':checkbox')
+ ? 'checkbox'
+ : this.element.is(':radio')
+ ? 'radio'
+ : this.element.is('input')
+ ? 'input'
+ : 'button';
+
+ if (this.type == 'checkbox' || this.type == 'radio') {
+ this.buttonElement = $("[for=" + this.element.attr("id") + "]");
+ this.element.hide();
+
+ var checked = this.element.is(':checked');
+ if (checked) {
+ this.buttonElement.addClass('ui-state-active');
+ }
+ this.buttonElement.attr('aria-pressed', checked)
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ destroy: function() {
+ this.buttonElement
+ .removeClass(baseClasses + " " + otherClasses)
+ .removeAttr('role')
+ .removeAttr('aria-pressed')
+ .html(this.buttonElement.find(".ui-button-text").html());
+
+ if (!this.hasTitle) {
+ this.buttonElement.removeAttr('title');
+ }
+
+ if (this.type == 'checkbox' || this.type == 'radio') {
+ this.element.show();
+ }
+
+ $.Widget.prototype.destroy.call(this);
+ },
+
+ _setOption: function(key, value) {
+ $.Widget.prototype._setOption.apply(this, arguments);
+ this._resetButton();
+ },
+
+ _resetButton: function() {
+ if (this.type == 'input') {
+ if (this.options.label) {
+ this.element.val(this.options.label);
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement,
+ buttonText = $("<span></span>")
+ .addClass("ui-button-text")
+ .html(this.options.label)
+ .appendTo(buttonElement.empty())
+ .text();
+
+ var icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary;
+ if (icons.primary || icons.secondary) {
+ buttonElement.addClass("ui-button-text-icon" +
+ (multipleIcons ? "s" : ""));
+ if (icons.primary) {
+ buttonElement.prepend("<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>");
+ }
+ if (icons.secondary) {
+ buttonElement.append("<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>");
+ }
+ if (!this.options.text) {
+ buttonElement
+ .addClass(multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only")
+ .removeClass("ui-button-text-icons ui-button-text-icon");
+ if (!this.hasTitle) {
+ buttonElement.attr("title", buttonText);
+ }
+ }
+ } else {
+ buttonElement.addClass("ui-button-text-only");
+ }
+ }
+});
+
+$.widget("ui.buttonset", {
+ _init: function() {
+ this.element.addClass("ui-button-set");
+ this.buttons = this.element.find(':button, :submit, :reset, :checkbox, :radio, a, .ui-button')
+ .button()
+ .map(function() {
+ return $(this).button('widget')[0];
+ })
+ .removeClass('ui-corner-all')
+ .filter(':first')
+ .addClass('ui-corner-left')
+ .end()
+ .filter(':last')
+ .addClass('ui-corner-right')
+ .end()
+ .end();
+ },
+
+ _setOption: function(key, value) {
+ if (key == 'disabled') {
+ this.buttons.button('option', key, value);
+ }
+
+ $.Widget.prototype._setOption.apply(this, arguments);
+ },
+
+ destroy: function() {
+ this.element.removeClass('ui-button-set');
+ this.buttons
+ .button("destroy")
+ .removeClass("ui-corner-left ui-corner-right");
+
+ $.Widget.prototype.destroy.call(this);
+ }
+});
+
+
+})(jQuery);
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index e2ed856a4..9b39983b4 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -121,6 +121,11 @@ $.extend(Datepicker.prototype, {
if (this.debug)
console.log.apply('', arguments);
},
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
/* Override the default settings for all instances of the date picker.
@param settings object - the new settings to use as defaults (anonymous object)
@@ -1674,7 +1679,7 @@ $.fn.datepicker = function(options){
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index bd5ac04a8..5664e9b09 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -9,6 +9,7 @@
*
* Depends:
* jquery.ui.core.js
+ * jquery.ui.widget.js
* jquery.ui.draggable.js
* jquery.ui.mouse.js
* jquery.ui.position.js
@@ -17,20 +18,36 @@
*/
(function($) {
-var setDataSwitch = {
- maxHeight: "maxHeight.resizable",
- maxWidth: "maxWidth.resizable",
- minWidth: "minWidth.resizable"
- },
-
- uiDialogClasses =
- 'ui-dialog ' +
- 'ui-widget ' +
- 'ui-widget-content ' +
- 'ui-corner-all ';
+var uiDialogClasses =
+ 'ui-dialog ' +
+ 'ui-widget ' +
+ 'ui-widget-content ' +
+ 'ui-corner-all ';
$.widget("ui.dialog", {
-
+ options: {
+ autoOpen: true,
+ stackfix: false,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: 'close',
+ dialogClass: '',
+ draggable: true,
+ hide: null,
+ height: 'auto',
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: 'center',
+ resizable: true,
+ show: null,
+ stack: true,
+ title: '',
+ width: 300,
+ zIndex: 1000
+ },
_init: function() {
this.originalTitle = this.element.attr('title');
@@ -149,6 +166,10 @@ $.widget("ui.dialog", {
return self;
},
+
+ widget: function() {
+ return this.uiDialog;
+ },
close: function(event) {
var self = this;
@@ -279,28 +300,11 @@ $.widget("ui.dialog", {
$.each(buttons, function() { return !(hasButtons = true); }));
if (hasButtons) {
$.each(buttons, function(name, fn) {
- $('<button type="button"></button>')
- .addClass(
- 'ui-state-default ' +
- 'ui-corner-all'
- )
+ var button = $('<button type="button"></button>')
.text(name)
.click(function() { fn.apply(self.element[0], arguments); })
- .hover(
- function() {
- $(this).addClass('ui-state-hover');
- },
- function() {
- $(this).removeClass('ui-state-hover');
- }
- )
- .focus(function() {
- $(this).addClass('ui-state-focus');
- })
- .blur(function() {
- $(this).removeClass('ui-state-focus');
- })
.appendTo(uiDialogButtonPane);
+ ($.fn.button && button.button());
});
uiDialogButtonPane.appendTo(self.uiDialog);
}
@@ -381,7 +385,7 @@ $.widget("ui.dialog", {
var myAt = [],
offset = [0, 0];
- position = position || $.ui.dialog.defaults.position;
+ position = position || $.ui.dialog.prototype.options.position;
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
// if (typeof position == 'string' || $.isArray(position)) {
@@ -426,18 +430,18 @@ $.widget("ui.dialog", {
});
},
- _setData: function(key, value){
+ _setOption: function(key, value){
var self = this,
uiDialog = self.uiDialog,
+ isResizable = uiDialog.is(':data(resizable)'),
resize = false;
- (setDataSwitch[key] && uiDialog.data(setDataSwitch[key], value));
switch (key) {
case "buttons":
self._createButtons(value);
break;
case "closeText":
- // convert whatever was passed in o a string, for text() to not throw up
+ // convert whatever was passed in to a string, for text() to not throw up
self.uiDialogTitlebarCloseText.text("" + value);
break;
case "dialogClass":
@@ -458,15 +462,26 @@ $.widget("ui.dialog", {
case "height":
resize = true;
break;
+ case "maxHeight":
+ (isResizable && uiDialog.resizable('option', 'maxHeight', value));
+ resize = true;
+ break;
+ case "maxWidth":
+ (isResizable && uiDialog.resizable('option', 'maxWidth', value));
+ resize = true;
+ break;
case "minHeight":
+ (isResizable && uiDialog.resizable('option', 'minHeight', value));
+ resize = true;
+ break;
+ case "minWidth":
+ (isResizable && uiDialog.resizable('option', 'minWidth', value));
resize = true;
break;
case "position":
self._position(value);
break;
case "resizable":
- var isResizable = uiDialog.is(':data(resizable)');
-
// currently resizable, becoming non-resizable
(isResizable && !value && uiDialog.resizable('destroy'));
@@ -486,7 +501,7 @@ $.widget("ui.dialog", {
break;
}
- $.widget.prototype._setData.apply(self, arguments);
+ $.Widget.prototype._setOption.apply(self, arguments);
(resize && self._size());
},
@@ -527,29 +542,6 @@ $.widget("ui.dialog", {
$.extend($.ui.dialog, {
version: "@VERSION",
- defaults: {
- autoOpen: true,
- stackfix: false,
- buttons: {},
- closeOnEscape: true,
- closeText: 'close',
- dialogClass: '',
- draggable: true,
- hide: null,
- height: 'auto',
- maxHeight: false,
- maxWidth: false,
- minHeight: 150,
- minWidth: 150,
- modal: false,
- position: 'center',
- resizable: true,
- show: null,
- stack: true,
- title: '',
- width: 300,
- zIndex: 1000
- },
uuid: 0,
maxZ: 0,
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 8aa52ac5e..fcbf328db 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -14,8 +14,33 @@
*/
(function($) {
-$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
-
+$.widget("ui.draggable", $.ui.mouse, {
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false
+ },
_init: function() {
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
@@ -405,7 +430,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
ui = ui || this._uiHash();
$.ui.plugin.call(this, type, [event, ui]);
if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
- return $.widget.prototype._trigger.call(this, type, event, ui);
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
},
plugins: {},
@@ -419,37 +444,11 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
};
}
-}));
+});
$.extend($.ui.draggable, {
version: "@VERSION",
- eventPrefix: "drag",
- defaults: $.extend({}, $.ui.mouse.defaults, {
- addClasses: true,
- appendTo: "parent",
- axis: false,
- connectToSortable: false,
- containment: false,
- cursor: "auto",
- cursorAt: false,
- grid: false,
- handle: false,
- helper: "original",
- iframeFix: false,
- opacity: false,
- refreshPositions: false,
- revert: false,
- revertDuration: 500,
- scope: "default",
- scroll: true,
- scrollSensitivity: 20,
- scrollSpeed: 20,
- snap: false,
- snapMode: "both",
- snapTolerance: 20,
- stack: false,
- zIndex: false
- })
+ eventPrefix: "drag"
});
$.ui.plugin.add("draggable", "connectToSortable", {
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index f9a9e8672..3c8c88b96 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -9,6 +9,7 @@
*
* Depends:
* jquery.ui.core.js
+ * jquery.ui.widget.js
* jquery.ui.draggable.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
@@ -16,7 +17,15 @@
(function($) {
$.widget("ui.droppable", {
-
+ options: {
+ accept: '*',
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: 'default',
+ tolerance: 'intersect'
+ },
_init: function() {
var o = this.options, accept = o.accept;
@@ -51,14 +60,14 @@ $.widget("ui.droppable", {
return this;
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
if(key == 'accept') {
this.accept = $.isFunction(value) ? value : function(d) {
return d.is(value);
};
}
- $.widget.prototype._setData.apply(this, arguments);
+ $.Widget.prototype._setOption.apply(this, arguments);
},
_activate: function(event) {
@@ -139,16 +148,7 @@ $.widget("ui.droppable", {
$.extend($.ui.droppable, {
version: "@VERSION",
- eventPrefix: 'drop',
- defaults: {
- accept: '*',
- activeClass: false,
- addClasses: true,
- greedy: false,
- hoverClass: false,
- scope: 'default',
- tolerance: 'intersect'
- }
+ eventPrefix: 'drop'
});
$.ui.intersect = function(draggable, droppable, toleranceMode) {
diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js
index f115b3334..601fc2c02 100644
--- a/ui/jquery.ui.mouse.js
+++ b/ui/jquery.ui.mouse.js
@@ -12,7 +12,12 @@
*/
(function($) {
-$.ui.mouse = {
+$.widget("ui.mouse", {
+ options: {
+ cancel: ':input,option',
+ distance: 1,
+ delay: 0
+ },
_mouseInit: function() {
var self = this;
@@ -141,13 +146,6 @@ $.ui.mouse = {
_mouseDrag: function(event) {},
_mouseStop: function(event) {},
_mouseCapture: function(event) { return true; }
-};
-
-$.ui.mouse.defaults = {
- cancel: ':input,option',
- distance: 1,
- delay: 0
-};
+});
})(jQuery);
-
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index e28295aa5..eb632fcce 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -1,227 +1,217 @@
-/*
- * jQuery UI Position @VERSION
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Position
- */
-(function($) {
-
-$.ui = $.ui || {};
-
-var horizontalPositions = /left|center|right/,
- horizontalDefault = 'center',
- verticalPositions = /top|center|bottom/,
- verticalDefault = 'center',
- _position = $.fn.position;
-
-$.fn.position = function(options) {
- if (!options || !options.of) {
- return _position.apply(this, arguments);
- }
-
- var target = $(options.of),
- collision = (options.collision || 'flip').split(' '),
- offset = options.offset ? options.offset.split(' ') : [0, 0],
- targetWidth,
- targetHeight,
- basePosition;
-
- if (options.of.nodeType === 9) {
- targetWidth = target.width();
- targetHeight = target.height();
- basePosition = { top: 0, left: 0 };
- } else if (options.of.scrollTo && options.of.document) {
- targetWidth = target.width();
- targetHeight = target.height();
- basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
- } else if (options.of.preventDefault) {
- // force left top to allow flipping
- options.at = 'left top';
- targetWidth = targetHeight = 0;
- basePosition = { top: options.of.pageY, left: options.of.pageX };
- } else {
- targetWidth = target.outerWidth();
- targetHeight = target.outerHeight();
- basePosition = target.offset();
- }
-
- // force my and at to have valid horizontal and veritcal positions
- // if a value is missing or invalid, it will be converted to center
- $.each(['my', 'at'], function() {
- var pos = (options[this] || '').split(' ');
- pos = pos.length == 1
- ? horizontalPositions.test(pos[0])
- ? pos.concat([verticalDefault])
- : verticalPositions.test(pos[0])
- ? [horizontalDefault].concat(pos)
- : [horizontalDefault, verticalDefault]
- : pos;
- pos[0] = horizontalPositions.test(pos[0]) ? pos[0] : horizontalDefault;
- pos[1] = verticalPositions.test(pos[1]) ? pos[1] : verticalDefault;
- options[this] = pos;
- });
-
- // normalize collision option
- if (collision.length == 1) {
- collision[1] = collision[0];
- }
-
- // normalize offset option
- offset[0] = parseInt(offset[0], 10) || 0;
- if (offset.length == 1) {
- offset[1] = offset[0];
- }
- offset[1] = parseInt(offset[1], 10) || 0;
-
- switch (options.at[0]) {
- case 'right':
- basePosition.left += targetWidth;
- break;
- case horizontalDefault:
- basePosition.left += targetWidth / 2;
- break;
- }
-
- switch (options.at[1]) {
- case 'bottom':
- basePosition.top += targetHeight;
- break;
- case verticalDefault:
- basePosition.top += targetHeight / 2;
- break;
- }
-
- basePosition.left += offset[0];
- basePosition.top += offset[1];
-
- return this.each(function() {
- var elem = $(this),
- elemWidth = elem.outerWidth(),
- elemHeight = elem.outerHeight(),
- position = $.extend({}, basePosition),
- over,
- myOffset,
- atOffset;
-
- switch (options.my[0]) {
- case 'right':
- position.left -= elemWidth;
- break;
- case horizontalDefault:
- position.left -= elemWidth / 2;
- break;
- }
-
- switch (options.my[1]) {
- case 'bottom':
- position.top -= elemHeight;
- break;
- case verticalDefault:
- position.top -= elemHeight / 2;
- break;
- }
-
- $.each(['left', 'top'], function(i, dir) {
- ($.ui.position[collision[i]] &&
- $.ui.position[collision[i]][dir](position, {
- targetWidth: targetWidth,
- targetHeight: targetHeight,
- elemWidth: elemWidth,
- elemHeight: elemHeight,
- offset: offset,
- my: options.my,
- at: options.at
- }));
- });
-
- (options.stackfix !== false && $.fn.stackfix && elem.stackfix());
- // the by function is passed the offset values, not the position values
- // we'll need the logic from the .offset() setter to be accessible for
- // us to calculate the position values to make the by option more useful
- ($.isFunction(options.by) ? options.by.call(this, position) : elem.offset(position));
- });
-};
-
-$.ui.position = {
- fit: {
- left: function(position, data) {
- var over = position.left + data.elemWidth - $(window).width() - $(window).scrollLeft();
- position.left = over > 0 ? position.left - over : Math.max(0, position.left);
- },
- top: function(position, data) {
- var over = position.top + data.elemHeight - $(window).height() - $(window).scrollTop();
- position.top = over > 0 ? position.top - over : Math.max(0, position.top);
- }
- },
-
- flip: {
- left: function(position, data) {
- if (data.at[0] == 'center')
- return;
- var over = position.left + data.elemWidth - $(window).width() - $(window).scrollLeft(),
- myOffset = data.my[0] == 'left' ? -data.elemWidth : data.my[0] == 'right' ? data.elemWidth : 0,
- offset = -2 * data.offset[0];
- position.left += position.left < 0 ? myOffset + data.targetWidth + offset : over > 0 ? myOffset - data.targetWidth + offset : 0;
- },
- top: function(position, data) {
- if (data.at[1] == 'center')
- return;
- var over = position.top + data.elemHeight - $(window).height() - $(window).scrollTop(),
- myOffset = data.my[1] == 'top' ? -data.elemHeight : data.my[1] == 'bottom' ? data.elemHeight : 0,
- atOffset = data.at[1] == 'top' ? data.targetHeight : -data.targetHeight,
- offset = -2 * data.offset[1];
- position.top += position.top < 0 ? myOffset + data.targetHeight + offset : over > 0 ? myOffset + atOffset + offset : 0;
- }
- }
-};
-
-
-// the following functionality is planned for jQuery 1.4
-// based on http://plugins.jquery.com/files/offset.js.txt
-$.fn.extend({
- _offset: $.fn.offset,
- offset: function(newOffset) {
- return !newOffset ? this._offset() : this.each(function() {
- var elem = $(this),
- // we need to convert static positioning to relative positioning
- isRelative = /relative|static/.test(elem.css('position')),
- hide = elem.css('display') == 'none';
-
- (isRelative && elem.css('position', 'relative'));
- (hide && elem.show());
-
- var offset = elem.offset(),
- delta = {
- left : parseInt(elem.css('left'), 10),
- top: parseInt(elem.css('top'), 10)
- };
-
- // in case of 'auto'
- delta.left = !isNaN(delta.left)
- ? delta.left
- : isRelative
- ? 0
- : this.offsetLeft;
- delta.top = !isNaN(delta.top)
- ? delta.top
- : isRelative
- ? 0
- : this.offsetTop;
-
- // allow setting only left or only top
- if (newOffset.left || newOffset.left === 0) {
- elem.css('left', newOffset.left - offset.left + delta.left);
- }
- if (newOffset.top || newOffset.top === 0) {
- elem.css('top', newOffset.top - offset.top + delta.top);
- }
-
- (hide && elem.hide());
- });
- }
-});
-
-})(jQuery);
+/*
+ * jQuery UI Position @VERSION
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Position
+ */
+(function($) {
+
+$.ui = $.ui || {};
+
+var horizontalPositions = /left|center|right/,
+ horizontalDefault = 'center',
+ verticalPositions = /top|center|bottom/,
+ verticalDefault = 'center',
+ _position = $.fn.position;
+
+$.fn.position = function(options) {
+ if (!options || !options.of) {
+ return _position.apply(this, arguments);
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend({}, options);
+
+ var target = $(options.of),
+ collision = (options.collision || 'flip').split(' '),
+ offset = options.offset ? options.offset.split(' ') : [0, 0],
+ targetWidth,
+ targetHeight,
+ basePosition;
+
+ if (options.of.nodeType === 9) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: 0, left: 0 };
+ } else if (options.of.scrollTo && options.of.document) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if (options.of.preventDefault) {
+ // force left top to allow flipping
+ options.at = 'left top';
+ targetWidth = targetHeight = 0;
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ basePosition = target.offset();
+ }
+
+ // force my and at to have valid horizontal and veritcal positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each(['my', 'at'], function() {
+ var pos = (options[this] || '').split(' ');
+ pos = pos.length == 1
+ ? horizontalPositions.test(pos[0])
+ ? pos.concat([verticalDefault])
+ : verticalPositions.test(pos[0])
+ ? [horizontalDefault].concat(pos)
+ : [horizontalDefault, verticalDefault]
+ : pos;
+ pos[0] = horizontalPositions.test(pos[0]) ? pos[0] : horizontalDefault;
+ pos[1] = verticalPositions.test(pos[1]) ? pos[1] : verticalDefault;
+ options[this] = pos;
+ });
+
+ // normalize collision option
+ if (collision.length == 1) {
+ collision[1] = collision[0];
+ }
+
+ // normalize offset option
+ offset[0] = parseInt(offset[0], 10) || 0;
+ if (offset.length == 1) {
+ offset[1] = offset[0];
+ }
+ offset[1] = parseInt(offset[1], 10) || 0;
+
+ switch (options.at[0]) {
+ case 'right':
+ basePosition.left += targetWidth;
+ break;
+ case horizontalDefault:
+ basePosition.left += targetWidth / 2;
+ break;
+ }
+
+ switch (options.at[1]) {
+ case 'bottom':
+ basePosition.top += targetHeight;
+ break;
+ case verticalDefault:
+ basePosition.top += targetHeight / 2;
+ break;
+ }
+
+ basePosition.left += offset[0];
+ basePosition.top += offset[1];
+
+ return this.each(function() {
+ var elem = $(this),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ position = $.extend({}, basePosition),
+ over,
+ myOffset,
+ atOffset;
+
+ switch (options.my[0]) {
+ case 'right':
+ position.left -= elemWidth;
+ break;
+ case horizontalDefault:
+ position.left -= elemWidth / 2;
+ break;
+ }
+
+ switch (options.my[1]) {
+ case 'bottom':
+ position.top -= elemHeight;
+ break;
+ case verticalDefault:
+ position.top -= elemHeight / 2;
+ break;
+ }
+
+ $.each(['left', 'top'], function(i, dir) {
+ ($.ui.position[collision[i]] &&
+ $.ui.position[collision[i]][dir](position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ offset: offset,
+ my: options.my,
+ at: options.at
+ }));
+ });
+
+ (options.stackfix !== false && $.fn.stackfix && elem.stackfix());
+ elem.offset($.extend(position, { using: options.using }));
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function(position, data) {
+ var over = position.left + data.elemWidth - $(window).width() - $(window).scrollLeft();
+ position.left = over > 0 ? position.left - over : Math.max(0, position.left);
+ },
+ top: function(position, data) {
+ var over = position.top + data.elemHeight - $(window).height() - $(window).scrollTop();
+ position.top = over > 0 ? position.top - over : Math.max(0, position.top);
+ }
+ },
+
+ flip: {
+ left: function(position, data) {
+ if (data.at[0] == 'center')
+ return;
+ var over = position.left + data.elemWidth - $(window).width() - $(window).scrollLeft(),
+ myOffset = data.my[0] == 'left' ? -data.elemWidth : data.my[0] == 'right' ? data.elemWidth : 0,
+ offset = -2 * data.offset[0];
+ position.left += position.left < 0 ? myOffset + data.targetWidth + offset : over > 0 ? myOffset - data.targetWidth + offset : 0;
+ },
+ top: function(position, data) {
+ if (data.at[1] == 'center')
+ return;
+ var over = position.top + data.elemHeight - $(window).height() - $(window).scrollTop(),
+ myOffset = data.my[1] == 'top' ? -data.elemHeight : data.my[1] == 'bottom' ? data.elemHeight : 0,
+ atOffset = data.at[1] == 'top' ? data.targetHeight : -data.targetHeight,
+ offset = -2 * data.offset[1];
+ position.top += position.top < 0 ? myOffset + data.targetHeight + offset : over > 0 ? myOffset + atOffset + offset : 0;
+ }
+ }
+};
+
+// offset setter from jQuery 1.4
+if (!$.offset.setOffset) {
+ $.offset.setOffset = function( elem, options ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( jQuery.curCSS( elem, 'position' ) ) ) {
+ elem.style.position = 'relative';
+ }
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( jQuery.curCSS( elem, 'top', true ), 10 ) || 0,
+ curLeft = parseInt( jQuery.curCSS( elem, 'left', true ), 10) || 0,
+ props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( 'using' in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ };
+
+ var _offset = $.fn.offset;
+ $.fn.offset = function( options ) {
+ var elem = this[0];
+ if ( !elem || !elem.ownerDocument ) { return null; }
+ if ( options ) {
+ return this.each(function() {
+ $.offset.setOffset( this, options );
+ });
+ }
+ return _offset.call(this);
+ };
+}
+
+})(jQuery);
diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js
index 866bfb172..b5898c504 100644
--- a/ui/jquery.ui.progressbar.js
+++ b/ui/jquery.ui.progressbar.js
@@ -14,7 +14,9 @@
(function($) {
$.widget("ui.progressbar", {
-
+ options: {
+ value: 0
+ },
_init: function() {
this.element
@@ -51,7 +53,7 @@ $.widget("ui.progressbar", {
this.valueDiv.remove();
- $.widget.prototype.destroy.apply(this, arguments);
+ $.Widget.prototype.destroy.apply(this, arguments);
return this;
},
@@ -61,11 +63,11 @@ $.widget("ui.progressbar", {
return this._value();
}
- this._setData('value', newValue);
+ this._setOption('value', newValue);
return this;
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
switch (key) {
case 'value':
@@ -75,7 +77,7 @@ $.widget("ui.progressbar", {
break;
}
- $.widget.prototype._setData.apply(this, arguments);
+ $.Widget.prototype._setOption.apply(this, arguments);
},
@@ -111,10 +113,7 @@ $.widget("ui.progressbar", {
});
$.extend($.ui.progressbar, {
- version: "@VERSION",
- defaults: {
- value: 0
- }
+ version: "@VERSION"
});
})(jQuery);
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index 70f92f591..d93e07948 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -14,8 +14,25 @@
*/
(function($) {
-$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
-
+$.widget("ui.resizable", $.ui.mouse, {
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ zIndex: 1000
+ },
_init: function() {
var self = this, o = this.options;
@@ -498,29 +515,11 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
};
}
-}));
+});
$.extend($.ui.resizable, {
version: "@VERSION",
- eventPrefix: "resize",
- defaults: $.extend({}, $.ui.mouse.defaults, {
- alsoResize: false,
- animate: false,
- animateDuration: "slow",
- animateEasing: "swing",
- aspectRatio: false,
- autoHide: false,
- containment: false,
- ghost: false,
- grid: false,
- handles: "e,s,se",
- helper: false,
- maxHeight: null,
- maxWidth: null,
- minHeight: 10,
- minWidth: 10,
- zIndex: 1000
- })
+ eventPrefix: "resize"
});
/*
diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js
index 153f17c7f..596ca4641 100644
--- a/ui/jquery.ui.selectable.js
+++ b/ui/jquery.ui.selectable.js
@@ -14,8 +14,14 @@
*/
(function($) {
-$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
-
+$.widget("ui.selectable", $.ui.mouse, {
+ options: {
+ appendTo: 'body',
+ autoRefresh: true,
+ distance: 0,
+ filter: '*',
+ tolerance: 'touch'
+ },
_init: function() {
var self = this;
@@ -243,17 +249,10 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
return false;
}
-}));
+});
$.extend($.ui.selectable, {
- version: "@VERSION",
- defaults: $.extend({}, $.ui.mouse.defaults, {
- appendTo: 'body',
- autoRefresh: true,
- distance: 0,
- filter: '*',
- tolerance: 'touch'
- })
+ version: "@VERSION"
});
})(jQuery);
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js
index 0e3fa0170..ffd0f8475 100644
--- a/ui/jquery.ui.slider.js
+++ b/ui/jquery.ui.slider.js
@@ -19,8 +19,18 @@
// (how many times can you page up/down to go through the whole range)
var numPages = 5;
-$.widget("ui.slider", $.extend({}, $.ui.mouse, {
-
+$.widget("ui.slider", $.ui.mouse, {
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: 'horizontal',
+ range: false,
+ step: 1,
+ value: 0,
+ values: null
+ },
_init: function() {
var self = this, o = this.options;
@@ -462,9 +472,9 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
- $.widget.prototype._setData.apply(this, arguments);
+ $.Widget.prototype._setOption.apply(this, arguments);
switch (key) {
case 'disabled':
@@ -594,22 +604,11 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
}
-}));
+});
$.extend($.ui.slider, {
version: "@VERSION",
- eventPrefix: "slide",
- defaults: $.extend({}, $.ui.mouse.defaults, {
- animate: false,
- distance: 0,
- max: 100,
- min: 0,
- orientation: 'horizontal',
- range: false,
- step: 1,
- value: 0,
- values: null
- })
+ eventPrefix: "slide"
});
})(jQuery);
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index d627bcea6..663eddd79 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -14,7 +14,31 @@
*/
(function($) {
-$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
+$.widget("ui.sortable", $.ui.mouse, {
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: 'auto',
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: '> *',
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000
+ },
_init: function() {
var o = this.options;
@@ -1000,7 +1024,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},
_trigger: function() {
- if ($.widget.prototype._trigger.apply(this, arguments) === false) {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
this.cancel();
}
},
@@ -1018,35 +1042,11 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
};
}
-}));
+});
$.extend($.ui.sortable, {
version: "@VERSION",
- eventPrefix: "sort",
- defaults: $.extend({}, $.ui.mouse.defaults, {
- appendTo: "parent",
- axis: false,
- connectWith: false,
- containment: false,
- cursor: 'auto',
- cursorAt: false,
- dropOnEmpty: true,
- forcePlaceholderSize: false,
- forceHelperSize: false,
- grid: false,
- handle: false,
- helper: "original",
- items: '> *',
- opacity: false,
- placeholder: false,
- revert: false,
- scroll: true,
- scrollSensitivity: 20,
- scrollSpeed: 20,
- scope: "default",
- tolerance: "intersect",
- zIndex: 1000
- })
+ eventPrefix: "sort"
});
})(jQuery);
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 2d6a992c0..b3c823026 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -16,12 +16,31 @@
var tabId = 0;
$.widget("ui.tabs", {
-
+ options: {
+ add: null,
+ ajaxOptions: null,
+ cache: false,
+ cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ collapsible: false,
+ disable: null,
+ disabled: [],
+ enable: null,
+ event: 'click',
+ fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
+ idPrefix: 'ui-tabs-',
+ load: null,
+ panelTemplate: '<div></div>',
+ remove: null,
+ select: null,
+ show: null,
+ spinner: '<em>Loading&#8230;</em>',
+ tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
+ },
_init: function() {
this._tabify(true);
},
- _setData: function(key, value) {
+ _setOption: function(key, value) {
if (key == 'selected') {
if (this.options.collapsible && value == this.options.selected) {
return;
@@ -625,27 +644,7 @@ $.widget("ui.tabs", {
});
$.extend($.ui.tabs, {
- version: '@VERSION',
- defaults: {
- add: null,
- ajaxOptions: null,
- cache: false,
- cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
- collapsible: false,
- disable: null,
- disabled: [],
- enable: null,
- event: 'click',
- fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
- idPrefix: 'ui-tabs-',
- load: null,
- panelTemplate: '<div></div>',
- remove: null,
- select: null,
- show: null,
- spinner: '<em>Loading&#8230;</em>',
- tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
- }
+ version: '@VERSION'
});
/*
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 9321e05db..e1dac2f66 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -20,25 +20,54 @@ $.fn.remove = function() {
return _remove.apply(this, arguments);
};
-// $.widget is a factory to create jQuery plugins
-// taking some boilerplate code out of the plugin code
-$.widget = function(name, prototype) {
+$.widget = function(name, base, prototype) {
var namespace = name.split(".")[0],
fullName;
name = name.split(".")[1];
fullName = namespace + '-' + name;
+ if (!prototype) {
+ prototype = base;
+ base = $.Widget;
+ }
+
// create selector for plugin
$.expr[':'][fullName] = function(elem) {
return !!$.data(elem, name);
};
-
- // create plugin method
+
+ $[namespace] = $[namespace] || {};
+ $[namespace][name] = function(options, element) {
+ // allow instantiation without initializing for simple inheritance
+ (arguments.length && this._widgetInit(options, element));
+ };
+
+ var basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+// $.each(basePrototype, function(key, val) {
+// if ($.isPlainObject(val)) {
+// basePrototype[key] = $.extend({}, val);
+// }
+// });
+ basePrototype.options = $.extend({}, basePrototype.options);
+ $[namespace][name].prototype = $.extend(true, basePrototype, {
+ namespace: namespace,
+ widgetName: name,
+ widgetEventPrefix: $[namespace][name].prototype.widgetEventPrefix || name,
+ widgetBaseClass: fullName
+ }, prototype);
+
+ $.widget.bridge(name, $[namespace][name]);
+};
+
+$.widget.bridge = function(name, object) {
$.fn[name] = function(options) {
var isMethodCall = (typeof options == 'string'),
args = Array.prototype.slice.call(arguments, 1),
returnValue = this;
-
+
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length
? $.extend.apply(null, [true, options].concat(args))
@@ -61,99 +90,102 @@ $.widget = function(name, prototype) {
}
})
: this.each(function() {
- ($.data(this, name) ||
- $.data(this, name, new $[namespace][name](this, options))._init());
+ ($.data(this, name) || $.data(this, name, new object(options, this)));
}));
return returnValue;
};
+};
- // create widget constructor
- $[namespace] = $[namespace] || {};
- $[namespace][name] = function(element, options) {
- var self = this;
-
- this.namespace = namespace;
- this.widgetName = name;
- this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
- this.widgetBaseClass = fullName;
+$.Widget = function(options, element) {
+ // allow instantiation without initializing for simple inheritance
+ (arguments.length && this._widgetInit(options, element));
+};
+$.Widget.prototype = {
+ widgetName: 'widget',
+ widgetEventPrefix: '',
+ options: {
+ disabled: false
+ },
+ _widgetInit: function(options, element) {
+ // $.widget.bridge stores the plugin instance, but we do it anyway
+ // so that it's stored even before the _init function runs
+ this.element = $(element).data(this.widgetName, this);
this.options = $.extend(true, {},
- $.widget.defaults,
- $[namespace][name].defaults,
- $.metadata && $.metadata.get(element)[name],
+ this.options,
+ // DEPRECATED: move defaults to prototype.options
+ $[this.namespace][this.widgetName].defaults,
+ $.metadata && $.metadata.get(element)[this.widgetName],
options);
- this.element = $(element)
- .bind('setData.' + name, function(event, key, value) {
- if (event.target == element) {
- return self._setData(key, value);
- }
- })
- .bind('getData.' + name, function(event, key) {
- if (event.target == element) {
- return self._getData(key);
- }
- })
- .bind('remove.' + name, function() {
- return self.destroy();
- });
- };
+ // TODO: use bind's scope option when moving to jQuery 1.4
+ var self = this;
+ this.element.bind('remove.' + this.widgetName, function() {
+ self.destroy();
+ });
- // add widget prototype
- $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
-};
+ (this._init && this._init(options, element));
+ },
-$.widget.prototype = {
- _init: function() {},
destroy: function() {
- this.element.removeData(this.widgetName)
- .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
- .removeAttr('aria-disabled');
+ this.element
+ .unbind('.' + this.widgetName)
+ .removeData(this.widgetName);
+ this.widget()
+ .unbind('.' + this.widgetName)
+ .removeAttr('aria-disabled')
+ .removeClass(
+ this.widgetBaseClass + '-disabled ' +
+ this.namespace + '-state-disabled');
+ },
- return this;
+ widget: function() {
+ return this.element;
},
option: function(key, value) {
var options = key,
self = this;
+ if (arguments.length === 0) {
+ // don't return a reference to the internal hash
+ return $.extend({}, self.options);
+ }
+
if (typeof key == "string") {
if (value === undefined) {
- return this._getData(key);
+ return this.options[key];
}
options = {};
options[key] = value;
}
$.each(options, function(key, value) {
- self._setData(key, value);
+ self._setOption(key, value);
});
return self;
},
- _getData: function(key) {
- return this.options[key];
- },
- _setData: function(key, value) {
+ _setOption: function(key, value) {
this.options[key] = value;
if (key == 'disabled') {
- this.element
+ this.widget()
[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled')
.attr("aria-disabled", value);
}
+
+ return this;
},
enable: function() {
- this._setData('disabled', false);
- return this;
+ return this._setOption('disabled', false);
},
disable: function() {
- this._setData('disabled', true);
- return this;
+ return this._setOption('disabled', true);
},
_trigger: function(type, event, data) {
@@ -181,9 +213,7 @@ $.widget.prototype = {
}
};
-$.widget.defaults = {
- disabled: false
-};
-
+// DEPRECATED: use the plugin's parent widget instead of $.widget
+$.widget.prototype = $.Widget.prototype;
})(jQuery);