Avoid duplicate entries for WikiProjects
This commit is contained in:
parent
37c04681a9
commit
cfccff6ee4
@ -1057,6 +1057,19 @@
|
||||
return v;
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all occurences of a value from an array
|
||||
* @param {array} array
|
||||
* @param {mixed} value
|
||||
*/
|
||||
removeFromArray: function ( array, value ) {
|
||||
var index = $.inArray( value, array );
|
||||
while ( index !== -1 ) {
|
||||
array.splice( index, 1 );
|
||||
index = $.inArray( value, array );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an <a> element that links to a given page
|
||||
* @param {string} pagename
|
||||
|
@ -1781,13 +1781,18 @@
|
||||
|
||||
// Add biography banner if specified
|
||||
if ( data.isBiography ) {
|
||||
// Ensure we don't have duplicate biography tags
|
||||
AFCH.removeFromArray( data.newWikiProjects, 'WikiProject Biography' );
|
||||
|
||||
talkText += ( '\n{{WikiProject Biography|living=' +
|
||||
( data.lifeStatus !== 'unknown' ? ( data.lifeStatus === 'living' ? 'yes' : 'no' ) : '' ) +
|
||||
'|class=' + data.newAssessment + '|listas=' + data.subjectName + '}}' );
|
||||
}
|
||||
|
||||
if ( data.newAssessment === 'disambig' ) {
|
||||
talkText += '\n{{WikiProject Disambiguation}}';
|
||||
if ( data.newAssessment === 'disambig' &&
|
||||
$.inArray( 'WikiProject Disambiguation', data.newWikiProjects ) === -1 )
|
||||
{
|
||||
data.newWikiProjects.push( 'WikiProject Disambiguation' );
|
||||
}
|
||||
|
||||
// Add WikiProjects
|
||||
|
Loading…
x
Reference in New Issue
Block a user