X-Git-Url: https://git.heureux-cyclage.org/index.php?a=blobdiff_plain;f=resources%2Flib%2Foojs-ui%2Foojs-ui-core.js;h=cd1a3de0a75b932d50992b64cebe81766d18a5f0;hb=d7e368ac0e171410922ceb0c7121a2450a793429;hp=2a1427b33ff08c5749b204bdb1f7ebf3a91659a4;hpb=566c04a549562cdf0c4c58e6544e40127df12b80;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/lib/oojs-ui/oojs-ui-core.js b/resources/lib/oojs-ui/oojs-ui-core.js index 2a1427b33f..cd1a3de0a7 100644 --- a/resources/lib/oojs-ui/oojs-ui-core.js +++ b/resources/lib/oojs-ui/oojs-ui-core.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.17.6 + * OOjs UI v0.17.8 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2016-07-12T20:26:03Z + * Date: 2016-08-16T21:13:48Z */ ( function ( OO ) { @@ -2026,6 +2026,7 @@ OO.ui.mixin.ButtonElement.prototype.toggleFramed = function ( framed ) { OO.ui.mixin.ButtonElement.prototype.setActive = function ( value ) { this.active = !!value; this.$element.toggleClass( 'oo-ui-buttonElement-active', this.active ); + this.updateThemeClasses(); return this; }; @@ -6994,7 +6995,7 @@ OO.ui.CheckboxMultiselectWidget.prototype.getRelativeFocusableItem = function ( * @param {jQuery.Event} e */ OO.ui.CheckboxMultiselectWidget.prototype.onClick = function ( e ) { - var $options, checked, + var $options, lastClickedIndex, nowClickedIndex, i, direction, wasSelected, items, $lastClicked = this.$lastClicked, $nowClicked = $( e.target ).closest( '.oo-ui-checkboxMultioptionWidget' ) .not( '.oo-ui-widget-disabled' ); @@ -7002,19 +7003,32 @@ OO.ui.CheckboxMultiselectWidget.prototype.onClick = function ( e ) { // Allow selecting multiple options at once by Shift-clicking them if ( $lastClicked && $nowClicked.length && e.shiftKey ) { $options = this.$group.find( '.oo-ui-checkboxMultioptionWidget' ); - checked = $nowClicked.find( 'input' ).prop( 'checked' ); - - $options - .slice( - Math.min( $options.index( $lastClicked ), $options.index( $nowClicked ) ), - Math.max( $options.index( $lastClicked ), $options.index( $nowClicked ) ) + 1 - ) - .find( 'input' ) - .filter( function () { - return !this.disabled; - } ) - .prop( 'checked', checked ) - .trigger( 'change' ); + lastClickedIndex = $options.index( $lastClicked ); + nowClickedIndex = $options.index( $nowClicked ); + // If it's the same item, either the user is being silly, or it's a fake event generated by the + // browser. In either case we don't need custom handling. + if ( nowClickedIndex !== lastClickedIndex ) { + items = this.items; + wasSelected = items[ nowClickedIndex ].isSelected(); + direction = nowClickedIndex > lastClickedIndex ? 1 : -1; + + // This depends on the DOM order of the items and the order of the .items array being the same. + for ( i = lastClickedIndex; i !== nowClickedIndex; i += direction ) { + if ( !items[ i ].isDisabled() ) { + items[ i ].setSelected( !wasSelected ); + } + } + // For the now-clicked element, use immediate timeout to allow the browser to do its own + // handling first, then set our value. The order in which events happen is different for + // clicks on the and on the