From b78033ffec8e1c953f790fae9ce54056fc23dea2 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Mon, 21 Apr 2014 12:42:09 -0700 Subject: [PATCH] Update OOjs UI to v0.1.0-pre (d4baf57069) New changes: 351db20 Localisation updates from https://translatewiki.net. 1a21253 Set up jsduck d492a0f Revert "Add aggregate method" Change-Id: Ida003c21a1f748f78ac0b36511d86e9dd3f8da58 --- resources/lib/oojs-ui/i18n/diq.json | 2 +- resources/lib/oojs-ui/i18n/he.json | 2 +- resources/lib/oojs-ui/oojs-ui.js | 73 +++++---------------------- resources/lib/oojs-ui/oojs-ui.svg.css | 4 +- 4 files changed, 16 insertions(+), 65 deletions(-) diff --git a/resources/lib/oojs-ui/i18n/diq.json b/resources/lib/oojs-ui/i18n/diq.json index 105d806a98..09415fd2b0 100644 --- a/resources/lib/oojs-ui/i18n/diq.json +++ b/resources/lib/oojs-ui/i18n/diq.json @@ -12,6 +12,6 @@ "ooui-dialog-action-close": "Racnê", "ooui-outline-control-move-down": "Bendi bere cêr", "ooui-outline-control-move-up": "Bendi bere cor", - "ooui-outline-control-remove": "Obji hewad", + "ooui-outline-control-remove": "Obcey wedare", "ooui-toolbar-more": "Zewbi" } diff --git a/resources/lib/oojs-ui/i18n/he.json b/resources/lib/oojs-ui/i18n/he.json index cd8c9f2836..403b200716 100644 --- a/resources/lib/oojs-ui/i18n/he.json +++ b/resources/lib/oojs-ui/i18n/he.json @@ -18,6 +18,6 @@ "ooui-dialog-action-close": "סגירה", "ooui-outline-control-move-down": "להזיז את הפריט מטה", "ooui-outline-control-move-up": "להזיז את הפריט מעלה", - "ooui-outline-control-remove": "הסרת פריט", + "ooui-outline-control-remove": "להסיר את הפריט", "ooui-toolbar-more": "עוד" } diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index 32576042bd..47a9a936c3 100644 --- a/resources/lib/oojs-ui/oojs-ui.js +++ b/resources/lib/oojs-ui/oojs-ui.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (989950a4db) + * OOjs UI v0.1.0-pre (d4baf57069) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: Fri Apr 18 2014 13:02:46 GMT-0700 (PDT) + * Date: Mon Apr 21 2014 12:42:04 GMT-0700 (PDT) */ ( function ( OO ) { @@ -556,8 +556,6 @@ OO.ui.Element.prototype.getElementWindow = function () { /** * Get closest scrollable container. - * - * @see #static-method-getClosestScrollableContainer */ OO.ui.Element.prototype.getClosestScrollableElementContainer = function () { return OO.ui.Element.getClosestScrollableContainer( this.$element[0] ); @@ -586,7 +584,6 @@ OO.ui.Element.prototype.setElementGroup = function ( group ) { /** * Scroll element into view. * - * @see #static-method-scrollIntoView * @param {Object} [config={}] */ OO.ui.Element.prototype.scrollElementIntoView = function ( config ) { @@ -595,7 +592,7 @@ OO.ui.Element.prototype.scrollElementIntoView = function ( config ) { /** * Bind a handler for an event on this.$element - * @see #static-method-onDOMEvent + * * @param {string} event * @param {Function} callback */ @@ -605,7 +602,7 @@ OO.ui.Element.prototype.onDOMEvent = function ( event, callback ) { /** * Unbind a handler bound with #offDOMEvent - * @see #static-method-offDOMEvent + * * @param {string} event * @param {Function} callback */ @@ -2192,6 +2189,7 @@ OO.ui.FlaggableElement.prototype.setFlags = function ( flags ) { * @constructor * @param {jQuery} $group Container node, assigned to #$group * @param {Object} [config] Configuration options + * @cfg {Object.} [aggregations] Events to aggregate, keyed by item event name */ OO.ui.GroupElement = function OoUiGroupElement( $group, config ) { // Configuration @@ -2201,7 +2199,8 @@ OO.ui.GroupElement = function OoUiGroupElement( $group, config ) { this.$group = $group; this.items = []; this.$items = this.$( [] ); - this.aggregateItemEvents = {}; + this.aggregate = !$.isEmptyObject( config.aggregations ); + this.aggregations = config.aggregations || {}; }; /* Methods */ @@ -2215,54 +2214,6 @@ OO.ui.GroupElement.prototype.getItems = function () { return this.items.slice( 0 ); }; -/** - * Add an aggregate item event. - * - * Aggregated events are listened to on each item and then emitted by the group under a new name, - * and with an additional leading parameter containing the item that emitted the original event. - * Other arguments that were emitted from the original event are passed through. - * - * @param {Object.} events Aggregate events emitted by group, keyed by item - * event, use null value to remove aggregation - * @throws {Error} If aggregation already exists - */ -OO.ui.GroupElement.prototype.aggregate = function ( events ) { - var i, len, item, add, remove, itemEvent, groupEvent; - - for ( itemEvent in events ) { - groupEvent = events[itemEvent]; - - // Remove existing aggregated event - if ( itemEvent in this.aggregateItemEvents ) { - // Don't allow duplicate aggregations - if ( groupEvent ) { - throw new Error( 'Duplicate item event aggregation for ' + itemEvent ); - } - // Remove event aggregation from existing items - remove = {}; - remove[itemEvent] = this.aggregateItemEvents[itemEvent]; - for ( i = 0, len = this.items.length; i < len; i++ ) { - this.items[i].disconnect( this, remove ); - } - // Prevent future items from aggregating event - delete this.aggregateItemEvents[itemEvent]; - } - - // Add new aggregate event - if ( groupEvent ) { - // Make future items aggregate event - this.aggregateItemEvents[itemEvent] = groupEvent; - // Add event aggregation to existing items - for ( i = 0, len = this.items.length; i < len; i++ ) { - item = this.items[i]; - add = {}; - add[itemEvent] = [ 'emit', groupEvent, item ]; - item.connect( this, add ); - } - } - } -}; - /** * Add items. * @@ -2287,10 +2238,10 @@ OO.ui.GroupElement.prototype.addItems = function ( items, index ) { } } // Add the item - if ( !$.isEmptyObject( this.aggregateItemEvents ) ) { + if ( this.aggregate ) { events = {}; - for ( event in this.aggregateItemEvents ) { - events[event] = [ 'emit', this.aggregateItemEvents[event], item ]; + for ( event in this.aggregations ) { + events[event] = [ 'emit', this.aggregations[event], item ]; } item.connect( this, events ); } @@ -2330,7 +2281,7 @@ OO.ui.GroupElement.prototype.removeItems = function ( items ) { item = items[i]; index = $.inArray( item, this.items ); if ( index !== -1 ) { - if ( !$.isEmptyObject( this.aggregateItemEvents ) ) { + if ( this.aggregate ) { item.disconnect( this ); } item.setElementGroup( null ); @@ -2356,7 +2307,7 @@ OO.ui.GroupElement.prototype.clearItems = function () { // Remove all items for ( i = 0, len = this.items.length; i < len; i++ ) { item = this.items[i]; - if ( !$.isEmptyObject( this.aggregateItemEvents ) ) { + if ( this.aggregate ) { item.disconnect( this ); } item.setElementGroup( null ); diff --git a/resources/lib/oojs-ui/oojs-ui.svg.css b/resources/lib/oojs-ui/oojs-ui.svg.css index a79c4a1cf3..ed564bea40 100644 --- a/resources/lib/oojs-ui/oojs-ui.svg.css +++ b/resources/lib/oojs-ui/oojs-ui.svg.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (989950a4db) + * OOjs UI v0.1.0-pre (d4baf57069) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: Fri Apr 18 2014 13:02:46 GMT-0700 (PDT) + * Date: Mon Apr 21 2014 12:42:04 GMT-0700 (PDT) */ /* Textures */ -- 2.20.1