diff options
author | rvelices <rv-github@modusoptimus.com> | 2012-10-12 20:32:30 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2012-10-12 20:32:30 +0000 |
commit | 97294dac5ac27b43cb6a116d2852578376efa58d (patch) | |
tree | a983e1fd5930a65d2c750278c84f768b59cc70c5 /themes/default/js/ui/jquery.ui.button.js | |
parent | 267c548896d1e16ace40b6c1cb4df5913ac0bfa4 (diff) |
feature 2771: upgrade jquery from 1.7.2 to 1.8.2 and jquery.ui from 1.8.16 to 1.9.0
Attention plugins: jquery ui effect script ids change when using combine_script because file names changed ...
git-svn-id: http://piwigo.org/svn/trunk@18630 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/default/js/ui/jquery.ui.button.js')
-rw-r--r-- | themes/default/js/ui/jquery.ui.button.js | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/themes/default/js/ui/jquery.ui.button.js b/themes/default/js/ui/jquery.ui.button.js index b82f42e5f..50b5b4268 100644 --- a/themes/default/js/ui/jquery.ui.button.js +++ b/themes/default/js/ui/jquery.ui.button.js @@ -1,11 +1,12 @@ -/* - * jQuery UI Button 1.8.16 +/*! + * jQuery UI Button 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Button + * http://api.jqueryui.com/button/ * * Depends: * jquery.ui.core.js @@ -41,6 +42,8 @@ var lastActive, startXPos, startYPos, clickDragged, }; $.widget( "ui.button", { + version: "1.9.0", + defaultElement: "<button>", options: { disabled: null, text: true, @@ -52,34 +55,32 @@ $.widget( "ui.button", { }, _create: function() { this.element.closest( "form" ) - .unbind( "reset.button" ) - .bind( "reset.button", formResetHandler ); + .unbind( "reset" + this.eventNamespace ) + .bind( "reset" + this.eventNamespace, formResetHandler ); if ( typeof this.options.disabled !== "boolean" ) { - this.options.disabled = this.element.propAttr( "disabled" ); + this.options.disabled = !!this.element.prop( "disabled" ); + } else { + this.element.prop( "disabled", this.options.disabled ); } this._determineButtonType(); this.hasTitle = !!this.buttonElement.attr( "title" ); - var self = this, + var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), focusClass = "ui-state-focus"; if ( options.label === null ) { - options.label = this.buttonElement.html(); - } - - if ( this.element.is( ":disabled" ) ) { - options.disabled = true; + options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); } this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) - .bind( "mouseenter.button", function() { + .bind( "mouseenter" + this.eventNamespace, function() { if ( options.disabled ) { return; } @@ -88,13 +89,13 @@ $.widget( "ui.button", { $( this ).addClass( "ui-state-active" ); } }) - .bind( "mouseleave.button", function() { + .bind( "mouseleave" + this.eventNamespace, function() { if ( options.disabled ) { return; } $( this ).removeClass( hoverClass ); }) - .bind( "click.button", function( event ) { + .bind( "click" + this.eventNamespace, function( event ) { if ( options.disabled ) { event.preventDefault(); event.stopImmediatePropagation(); @@ -102,26 +103,26 @@ $.widget( "ui.button", { }); this.element - .bind( "focus.button", function() { + .bind( "focus" + this.eventNamespace, function() { // no need to check disabled, focus won't be triggered anyway - self.buttonElement.addClass( focusClass ); + that.buttonElement.addClass( focusClass ); }) - .bind( "blur.button", function() { - self.buttonElement.removeClass( focusClass ); + .bind( "blur" + this.eventNamespace, function() { + that.buttonElement.removeClass( focusClass ); }); if ( toggleButton ) { - this.element.bind( "change.button", function() { + this.element.bind( "change" + this.eventNamespace, function() { if ( clickDragged ) { return; } - self.refresh(); + that.refresh(); }); // if mouse moves between mousedown and mouseup (drag) set clickDragged flag // prevents issue where button state changes but checkbox/radio checked state // does not in Firefox (see ticket #6970) this.buttonElement - .bind( "mousedown.button", function( event ) { + .bind( "mousedown" + this.eventNamespace, function( event ) { if ( options.disabled ) { return; } @@ -129,7 +130,7 @@ $.widget( "ui.button", { startXPos = event.pageX; startYPos = event.pageY; }) - .bind( "mouseup.button", function( event ) { + .bind( "mouseup" + this.eventNamespace, function( event ) { if ( options.disabled ) { return; } @@ -140,22 +141,22 @@ $.widget( "ui.button", { } if ( this.type === "checkbox" ) { - this.buttonElement.bind( "click.button", function() { + this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled || clickDragged ) { return false; } $( this ).toggleClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", self.element[0].checked ); + that.buttonElement.attr( "aria-pressed", that.element[0].checked ); }); } else if ( this.type === "radio" ) { - this.buttonElement.bind( "click.button", function() { + this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled || clickDragged ) { return false; } $( this ).addClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", "true" ); + that.buttonElement.attr( "aria-pressed", "true" ); - var radio = self.element[ 0 ]; + var radio = that.element[ 0 ]; radioGroup( radio ) .not( radio ) .map(function() { @@ -166,31 +167,31 @@ $.widget( "ui.button", { }); } else { this.buttonElement - .bind( "mousedown.button", function() { + .bind( "mousedown" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).addClass( "ui-state-active" ); lastActive = this; - $( document ).one( "mouseup", function() { + that.document.one( "mouseup", function() { lastActive = null; }); }) - .bind( "mouseup.button", function() { + .bind( "mouseup" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).removeClass( "ui-state-active" ); }) - .bind( "keydown.button", function(event) { + .bind( "keydown" + this.eventNamespace, function(event) { if ( options.disabled ) { return false; } - if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { + if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) { $( this ).addClass( "ui-state-active" ); } }) - .bind( "keyup.button", function() { + .bind( "keyup" + this.eventNamespace, function() { $( this ).removeClass( "ui-state-active" ); }); @@ -212,10 +213,11 @@ $.widget( "ui.button", { }, _determineButtonType: function() { + var ancestor, labelSelector, checked; - if ( this.element.is(":checkbox") ) { + if ( this.element.is("[type=checkbox]") ) { this.type = "checkbox"; - } else if ( this.element.is(":radio") ) { + } else if ( this.element.is("[type=radio]") ) { this.type = "radio"; } else if ( this.element.is("input") ) { this.type = "input"; @@ -226,8 +228,8 @@ $.widget( "ui.button", { if ( this.type === "checkbox" || this.type === "radio" ) { // we don't search against the document in case the element // is disconnected from the DOM - var ancestor = this.element.parents().filter(":last"), - labelSelector = "label[for='" + this.element.attr("id") + "']"; + ancestor = this.element.parents().last(); + labelSelector = "label[for='" + this.element.attr("id") + "']"; this.buttonElement = ancestor.find( labelSelector ); if ( !this.buttonElement.length ) { ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); @@ -238,11 +240,11 @@ $.widget( "ui.button", { } this.element.addClass( "ui-helper-hidden-accessible" ); - var checked = this.element.is( ":checked" ); + checked = this.element.is( ":checked" ); if ( checked ) { this.buttonElement.addClass( "ui-state-active" ); } - this.buttonElement.attr( "aria-pressed", checked ); + this.buttonElement.prop( "aria-pressed", checked ); } else { this.buttonElement = this.element; } @@ -252,7 +254,7 @@ $.widget( "ui.button", { return this.buttonElement; }, - destroy: function() { + _destroy: function() { this.element .removeClass( "ui-helper-hidden-accessible" ); this.buttonElement @@ -264,17 +266,15 @@ $.widget( "ui.button", { if ( !this.hasTitle ) { this.buttonElement.removeAttr( "title" ); } - - $.Widget.prototype.destroy.call( this ); }, _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); + this._super( key, value ); if ( key === "disabled" ) { if ( value ) { - this.element.propAttr( "disabled", true ); + this.element.prop( "disabled", true ); } else { - this.element.propAttr( "disabled", false ); + this.element.prop( "disabled", false ); } return; } @@ -319,14 +319,14 @@ $.widget( "ui.button", { return; } var buttonElement = this.buttonElement.removeClass( typeClasses ), - buttonText = $( "<span></span>" ) + buttonText = $( "<span></span>", this.document[0] ) .addClass( "ui-button-text" ) .html( this.options.label ) .appendTo( buttonElement.empty() ) .text(), icons = this.options.icons, multipleIcons = icons.primary && icons.secondary, - buttonClasses = []; + buttonClasses = []; if ( icons.primary || icons.secondary ) { if ( this.options.text ) { @@ -345,7 +345,7 @@ $.widget( "ui.button", { buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); if ( !this.hasTitle ) { - buttonElement.attr( "title", buttonText ); + buttonElement.attr( "title", $.trim( buttonText ) ); } } } else { @@ -356,14 +356,15 @@ $.widget( "ui.button", { }); $.widget( "ui.buttonset", { + version: "1.9.0", options: { - items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" + items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)" }, _create: function() { this.element.addClass( "ui-buttonset" ); }, - + _init: function() { this.refresh(); }, @@ -373,12 +374,12 @@ $.widget( "ui.buttonset", { this.buttons.button( "option", key, value ); } - $.Widget.prototype._setOption.apply( this, arguments ); + this._super( key, value ); }, - + refresh: function() { - var ltr = this.element.css( "direction" ) === "ltr"; - + var rtl = this.element.css( "direction" ) === "rtl"; + this.buttons = this.element.find( this.options.items ) .filter( ":ui-button" ) .button( "refresh" ) @@ -391,15 +392,15 @@ $.widget( "ui.buttonset", { }) .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) .filter( ":first" ) - .addClass( ltr ? "ui-corner-left" : "ui-corner-right" ) + .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) .end() .filter( ":last" ) - .addClass( ltr ? "ui-corner-right" : "ui-corner-left" ) + .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) .end() .end(); }, - destroy: function() { + _destroy: function() { this.element.removeClass( "ui-buttonset" ); this.buttons .map(function() { @@ -408,8 +409,6 @@ $.widget( "ui.buttonset", { .removeClass( "ui-corner-left ui-corner-right" ) .end() .button( "destroy" ); - - $.Widget.prototype.destroy.call( this ); } }); |