Limit the number of citation tools to 5

Don't let too much toothpaste get out of that tube aye!?

Change-Id: I5cd92b7826d55ddde505f1bb883c6f8ed3223ec0
This commit is contained in:
Trevor Parscal 2014-04-10 11:47:34 -07:00
parent aeec009c14
commit afb182c23c

View file

@ -57,6 +57,10 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
); );
}; };
/* Inheritance */
OO.inheritClass( ve.init.mw.Target, ve.init.Target );
/* Events */ /* Events */
/** /**
@ -169,12 +173,10 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
* @event sanityCheckComplete * @event sanityCheckComplete
*/ */
/* Inheritance */
OO.inheritClass( ve.init.mw.Target, ve.init.Target );
/* Static Properties */ /* Static Properties */
ve.init.mw.Target.static.citationToolsLimit = 5;
ve.init.mw.Target.static.toolbarGroups = [ ve.init.mw.Target.static.toolbarGroups = [
// History // History
{ 'include': [ 'undo', 'redo' ] }, { 'include': [ 'undo', 'redo' ] },
@ -783,7 +785,8 @@ ve.init.mw.Target.onSerializeError = function ( jqXHR, status, error ) {
* *
*/ */
ve.init.mw.Target.prototype.generateCitationFeatures = function () { ve.init.mw.Target.prototype.generateCitationFeatures = function () {
var i, len, item, name, data, tool, tools, dialog; var i, len, item, name, data, tool, tools, dialog,
limit = this.constructor.static.citationToolsLimit;
if ( !ve.ui.MWCitationDialog ) { if ( !ve.ui.MWCitationDialog ) {
// Citation module isn't loaded, so skip this // Citation module isn't loaded, so skip this
@ -798,7 +801,7 @@ ve.init.mw.Target.prototype.generateCitationFeatures = function () {
} catch ( e ) { } } catch ( e ) { }
if ( ve.isArray( tools ) ) { if ( ve.isArray( tools ) ) {
for ( i = 0, len = tools.length; i < len; i++ ) { for ( i = 0, len = Math.min( limit, tools.length ); i < len; i++ ) {
item = tools[i]; item = tools[i];
data = { 'template': item.template }; data = { 'template': item.template };
// Generate transclusion tool // Generate transclusion tool