diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/.jshintrc | 12 | ||||
-rw-r--r-- | ui/i18n/jquery.ui.datepicker-sr-SR.js | 2 | ||||
-rw-r--r-- | ui/i18n/jquery.ui.datepicker-sr.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 31 | ||||
-rw-r--r-- | ui/jquery.ui.core.js | 9 | ||||
-rw-r--r-- | ui/jquery.ui.datepicker.js | 42 | ||||
-rw-r--r-- | ui/jquery.ui.draggable.js | 101 |
7 files changed, 105 insertions, 94 deletions
diff --git a/ui/.jshintrc b/ui/.jshintrc index 578ee94a1..a5d36e1d3 100644 --- a/ui/.jshintrc +++ b/ui/.jshintrc @@ -1,17 +1,21 @@ { - "browser": true, + "boss": true, "curly": true, - "eqnull": true, "eqeqeq": true, + "eqnull": true, "expr": true, - "jquery": true, - "latedef": true, + "immed": true, "noarg": true, "onevar": true, "quotmark": "double", + "smarttabs": true, "trailing": true, "undef": true, "unused": true, + + "browser": true, + "jquery": true, + "globals": { "Globalize": false } diff --git a/ui/i18n/jquery.ui.datepicker-sr-SR.js b/ui/i18n/jquery.ui.datepicker-sr-SR.js index 6d5d04211..810d21daa 100644 --- a/ui/i18n/jquery.ui.datepicker-sr-SR.js +++ b/ui/i18n/jquery.ui.datepicker-sr-SR.js @@ -14,7 +14,7 @@ jQuery(function($){ dayNamesShort: ['Ned','Pon','Uto','Sre','Čet','Pet','Sub'], dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], weekHeader: 'Sed', - dateFormat: 'dd/mm/yy', + dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, diff --git a/ui/i18n/jquery.ui.datepicker-sr.js b/ui/i18n/jquery.ui.datepicker-sr.js index d4e1d9af0..1349a26cf 100644 --- a/ui/i18n/jquery.ui.datepicker-sr.js +++ b/ui/i18n/jquery.ui.datepicker-sr.js @@ -14,7 +14,7 @@ jQuery(function($){ dayNamesShort: ['Нед','Пон','Уто','Сре','Чет','Пет','Суб'], dayNamesMin: ['Не','По','Ут','Ср','Че','Пе','Су'], weekHeader: 'Сед', - dateFormat: 'dd/mm/yy', + dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 5e64f5164..ae3b86ae9 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -16,12 +16,11 @@ var lastActive, startXPos, startYPos, clickDragged, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - stateClasses = "ui-state-hover ui-state-active ", typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", formResetHandler = function() { - var buttons = $( this ).find( ":ui-button" ); + var form = $( this ); setTimeout(function() { - buttons.button( "refresh" ); + form.find( ":ui-button" ).button( "refresh" ); }, 1 ); }, radioGroup = function( radio ) { @@ -71,8 +70,7 @@ $.widget( "ui.button", { var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", - activeClass = !toggleButton ? "ui-state-active" : "", - focusClass = "ui-state-focus"; + activeClass = !toggleButton ? "ui-state-active" : ""; if ( options.label === null ) { options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); @@ -104,14 +102,16 @@ $.widget( "ui.button", { } }); - this.element - .bind( "focus" + this.eventNamespace, function() { - // no need to check disabled, focus won't be triggered anyway - that.buttonElement.addClass( focusClass ); - }) - .bind( "blur" + this.eventNamespace, function() { - that.buttonElement.removeClass( focusClass ); - }); + // Can't use _focusable() because the element that receives focus + // and the element that gets the ui-state-focus class are different + this._on({ + focus: function() { + this.buttonElement.addClass( "ui-state-focus" ); + }, + blur: function() { + this.buttonElement.removeClass( "ui-state-focus" ); + } + }); if ( toggleButton ) { this.element.bind( "change" + this.eventNamespace, function() { @@ -257,7 +257,7 @@ $.widget( "ui.button", { this.element .removeClass( "ui-helper-hidden-accessible" ); this.buttonElement - .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) + .removeClass( baseClasses + " ui-state-active " + typeClasses ) .removeAttr( "role" ) .removeAttr( "aria-pressed" ) .html( this.buttonElement.find(".ui-button-text").html() ); @@ -272,6 +272,9 @@ $.widget( "ui.button", { if ( key === "disabled" ) { this.widget().toggleClass( "ui-state-disabled", !!value ); this.element.prop( "disabled", !!value ); + if ( value ) { + this.buttonElement.removeClass( "ui-state-focus" ); + } return; } this._resetButton(); diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index bbe5da333..f0d9e42ec 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -276,10 +276,15 @@ $.ui.plugin = { proto.plugins[ i ].push( [ option, set[ i ] ] ); } }, - call: function( instance, name, args ) { + call: function( instance, name, args, allowDisconnected ) { var i, set = instance.plugins[ name ]; - if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { + + if ( !set ) { + return; + } + + if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { return; } diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 5892e2ddc..b433cb79b 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -16,7 +16,6 @@ $.extend($.ui, { datepicker: { version: "@VERSION" } }); var PROP_NAME = "datepicker", - dpuuid = new Date().getTime(), instActive; function getZindex( elem ) { @@ -775,9 +774,10 @@ $.extend(Datepicker.prototype, { inst.dpDiv[showAnim || "show"](showAnim ? duration : null); } - if (inst.input.is(":visible") && !inst.input.is(":disabled")) { + if ( $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); } + $.datepicker._curInst = inst; } }, @@ -804,10 +804,7 @@ $.extend(Datepicker.prototype, { inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl"); - // #6694 - don't focus the input if it's already focused - // this breaks the change event in IE - if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && - inst.input.is(":visible") && !inst.input.is(":disabled") && inst.input[0] !== document.activeElement) { + if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); } @@ -824,16 +821,11 @@ $.extend(Datepicker.prototype, { } }, - /* Retrieve the size of left and top borders for an element. - * @param elem (jQuery object) the element of interest - * @return (number[2]) the left and top borders - */ - _getBorders: function(elem) { - var convert = function(value) { - return {thin: 1, medium: 2, thick: 3}[value] || value; - }; - return [parseFloat(convert(elem.css("border-left-width"))), - parseFloat(convert(elem.css("border-top-width")))]; + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + // Support: IE and jQuery <1.9 + _shouldFocusInput: function( inst ) { + return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); }, /* Check positioning to remain on screen. */ @@ -1580,27 +1572,27 @@ $.extend(Datepicker.prototype, { inst.dpDiv.find("[data-handler]").map(function () { var handler = { prev: function () { - window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, -stepMonths, "M"); + $.datepicker._adjustDate(id, -stepMonths, "M"); }, next: function () { - window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, +stepMonths, "M"); + $.datepicker._adjustDate(id, +stepMonths, "M"); }, hide: function () { - window["DP_jQuery_" + dpuuid].datepicker._hideDatepicker(); + $.datepicker._hideDatepicker(); }, today: function () { - window["DP_jQuery_" + dpuuid].datepicker._gotoToday(id); + $.datepicker._gotoToday(id); }, selectDay: function () { - window["DP_jQuery_" + dpuuid].datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); + $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); return false; }, selectMonth: function () { - window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "M"); + $.datepicker._selectMonthYear(id, this, "M"); return false; }, selectYear: function () { - window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "Y"); + $.datepicker._selectMonthYear(id, this, "Y"); return false; } }; @@ -2065,8 +2057,4 @@ $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); $.datepicker.version = "@VERSION"; -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window["DP_jQuery_" + dpuuid] = $; - })(jQuery); diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 0c58aa4b8..45b724fde 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -66,6 +66,10 @@ $.widget("ui.draggable", $.ui.mouse, { }, _destroy: function() { + if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { + this.destroyOnClear = true; + return; + } this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); this._mouseDestroy(); }, @@ -125,8 +129,10 @@ $.widget("ui.draggable", $.ui.mouse, { this._cacheMargins(); //Store the helper's css position - this.cssPosition = this.helper.css("position"); + this.cssPosition = this.helper.css( "position" ); this.scrollParent = this.helper.scrollParent(); + this.offsetParent = this.helper.offsetParent(); + this.offsetParentCssPosition = this.offsetParent.css( "position" ); //The element's absolute position on the page minus margins this.offset = this.positionAbs = this.element.offset(); @@ -184,6 +190,10 @@ $.widget("ui.draggable", $.ui.mouse, { }, _mouseDrag: function(event, noPropagation) { + // reset any necessary cached properties (see #5009) + if ( this.offsetParentCssPosition === "fixed" ) { + this.offset.parent = this._getParentOffset(); + } //Compute the helpers position this.position = this._generatePosition(event); @@ -227,11 +237,6 @@ $.widget("ui.draggable", $.ui.mouse, { this.dropped = false; } - //if the original element is no longer in the DOM don't bother to continue (see #8269) - if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) { - return false; - } - if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { if(that._trigger("stop", event) !== false) { @@ -320,7 +325,6 @@ $.widget("ui.draggable", $.ui.mouse, { _getParentOffset: function() { //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: @@ -440,7 +444,7 @@ $.widget("ui.draggable", $.ui.mouse, { } var mod = d === "absolute" ? 1 : -1, - scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent; //Cache the scroll if (!this.offset.scroll) { @@ -452,13 +456,13 @@ $.widget("ui.draggable", $.ui.mouse, { pos.top + // The absolute mouse position this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod ) ), left: ( pos.left + // The absolute mouse position this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : this.offset.scroll.left ) * mod) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod ) ) }; @@ -468,8 +472,7 @@ $.widget("ui.draggable", $.ui.mouse, { var containment, co, top, left, o = this.options, - scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, - scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName), + scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent, pageX = event.pageX, pageY = event.pageY; @@ -530,14 +533,14 @@ $.widget("ui.draggable", $.ui.mouse, { this.offset.click.top - // Click offset (relative to the element) this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top + // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) ), left: ( pageX - // The absolute mouse position this.offset.click.left - // Click offset (relative to the element) this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left + // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : this.offset.scroll.left )) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) ) }; @@ -550,13 +553,16 @@ $.widget("ui.draggable", $.ui.mouse, { } this.helper = null; this.cancelHelperRemoval = false; + if ( this.destroyOnClear ) { + this.destroy(); + } }, // From now on bulk stuff - mainly helpers _trigger: function(type, event, ui) { ui = ui || this._uiHash(); - $.ui.plugin.call(this, type, [event, ui]); + $.ui.plugin.call( this, type, [ event, ui, this ], true ); //The absolute position has to be recalculated after plugins if(type === "drag") { this.positionAbs = this._convertPositionTo("absolute"); @@ -578,9 +584,9 @@ $.widget("ui.draggable", $.ui.mouse, { }); $.ui.plugin.add("draggable", "connectToSortable", { - start: function(event, ui) { + start: function( event, ui, inst ) { - var inst = $(this).draggable( "instance" ), o = inst.options, + var o = inst.options, uiSortable = $.extend({}, ui, { item: inst.element }); inst.sortables = []; $(o.connectToSortable).each(function() { @@ -596,11 +602,12 @@ $.ui.plugin.add("draggable", "connectToSortable", { }); }, - stop: function(event, ui) { + stop: function( event, ui, inst ) { //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper - var inst = $(this).draggable( "instance" ), - uiSortable = $.extend({}, ui, { item: inst.element }); + var uiSortable = $.extend( {}, ui, { + item: inst.element + }); $.each(inst.sortables, function() { if(this.instance.isOver) { @@ -633,9 +640,9 @@ $.ui.plugin.add("draggable", "connectToSortable", { }); }, - drag: function(event, ui) { + drag: function( event, ui, inst ) { - var inst = $(this).draggable( "instance" ), that = this; + var that = this; $.each(inst.sortables, function() { @@ -735,15 +742,17 @@ $.ui.plugin.add("draggable", "connectToSortable", { }); $.ui.plugin.add("draggable", "cursor", { - start: function() { - var t = $("body"), o = $(this).draggable( "instance" ).options; + start: function( event, ui, instance ) { + var t = $( "body" ), + o = instance.options; + if (t.css("cursor")) { o._cursor = t.css("cursor"); } t.css("cursor", o.cursor); }, - stop: function() { - var o = $(this).draggable( "instance" ).options; + stop: function( event, ui, instance ) { + var o = instance.options; if (o._cursor) { $("body").css("cursor", o._cursor); } @@ -751,15 +760,16 @@ $.ui.plugin.add("draggable", "cursor", { }); $.ui.plugin.add("draggable", "opacity", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).draggable( "instance" ).options; + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; if(t.css("opacity")) { o._opacity = t.css("opacity"); } t.css("opacity", o.opacity); }, - stop: function(event, ui) { - var o = $(this).draggable( "instance" ).options; + stop: function( event, ui, instance ) { + var o = instance.options; if(o._opacity) { $(ui.helper).css("opacity", o._opacity); } @@ -767,15 +777,15 @@ $.ui.plugin.add("draggable", "opacity", { }); $.ui.plugin.add("draggable", "scroll", { - start: function() { - var i = $(this).draggable( "instance" ); + start: function( event, ui, i ) { if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { i.overflowOffset = i.scrollParent.offset(); } }, - drag: function( event ) { + drag: function( event, ui, i ) { - var i = $(this).draggable( "instance" ), o = i.options, scrolled = false; + var o = i.options, + scrolled = false; if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { @@ -823,10 +833,9 @@ $.ui.plugin.add("draggable", "scroll", { }); $.ui.plugin.add("draggable", "snap", { - start: function() { + start: function( event, ui, i ) { - var i = $(this).draggable( "instance" ), - o = i.options; + var o = i.options; i.snapElements = []; @@ -843,10 +852,9 @@ $.ui.plugin.add("draggable", "snap", { }); }, - drag: function(event, ui) { + drag: function( event, ui, inst ) { var ts, bs, ls, rs, l, r, t, b, i, first, - inst = $(this).draggable( "instance" ), o = inst.options, d = o.snapTolerance, x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, @@ -918,9 +926,9 @@ $.ui.plugin.add("draggable", "snap", { }); $.ui.plugin.add("draggable", "stack", { - start: function() { + start: function( event, ui, instance ) { var min, - o = $(this).draggable( "instance" ).options, + o = instance.options, group = $.makeArray($(o.stack)).sort(function(a,b) { return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); }); @@ -936,15 +944,18 @@ $.ui.plugin.add("draggable", "stack", { }); $.ui.plugin.add("draggable", "zIndex", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).draggable( "instance" ).options; + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; + if(t.css("zIndex")) { o._zIndex = t.css("zIndex"); } t.css("zIndex", o.zIndex); }, - stop: function(event, ui) { - var o = $(this).draggable( "instance" ).options; + stop: function( event, ui, instance ) { + var o = instance.options; + if(o._zIndex) { $(ui.helper).css("zIndex", o._zIndex); } |