User:Tinucherian/assessorrevised.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Tinucherian/assessorrevised. |
importScript('User:AzaToth/morebits.js');
//See [[User:Drilnoth/assessortags.js/doc]] for details.
//Greatly based off of [[User:Ioeth/friendlytag.js]].
// <nowiki>
// If assessortagsConfig aint exist.
if( typeof( assessortagsConfig ) == 'undefined' ) {
assessortagsConfig = {};
}
/**
assessortagsConfig.summaryAd ( string )
If ad should be added or not to summary, default " using [[User:Drilnoth/assessortags.js/doc|AssessorTags]]"
*/
if( typeof( assessortagsConfig.summaryAd ) == 'undefined' ) {
assessortagsConfig.summaryAd = " using [[User:Drilnoth/assessortags.js/doc|AssessorTags]]";
}
/**
assessortagsConfig.groupByDefault ( boolean )
*/
if( typeof( assessortagsConfig.groupByDefault ) == 'undefined' ) {
assessortagsConfig.groupByDefault = true;
}
/**
assessortagsConfig.groupingBanner ( choice between WikiProjectBanners and WikiProjectBannerShell )
*/
if( typeof( assessortagsConfig.groupingBanner ) == 'undefined' ) {
assessortagsConfig.groupingBanner = "WikiProjectBannerShell";
}
/**
assessortagsConfig.markTaggedPagesAsMinor ( boolean )
*/
if( typeof( assessortagsConfig.markTaggedPagesAsMinor ) == 'undefined' ) {
assessortagsConfig.markTaggedPagesAsMinor = true;
}
function assessortags() {
if( wgNamespaceNumber == 1 || wgNamespaceNumber == 5 || wgNamespaceNumber == 7 || wgNamespaceNumber == 11 || wgNamespaceNumber == 13 ||wgNamespaceNumber == 15 || wgNamespaceNumber == 101 )
mw.util.addPortletLink( 'p-cactions', "javascript:assessortags.callback()", "wikiprojects", "ca-wikiprojecttags", "Add WikiProject banners", "");
}
$(assessortags);
assessortags.callback = function assessortagsCallback() {
var Window = new SimpleWindow( 400, 500 );
var form = new QuickForm( assessortags.callback.evaluate );
{
Window.setTitle( "WikiProject tagging" );
form.append( {
type: 'checkbox',
list: [
{
label: 'Group into {{' + assessortagsConfig.groupingBanner + '}}',
value: 'group',
name: 'group',
tooltip: 'If adding two or more banners and this box is checked, all newly added banners will be grouped into a single {{' + assessortagsConfig.groupingBanner + '}} template.',
checked: assessortagsConfig.groupByDefault
}
]
}
);
form.append( { type:'submit' } );
if( typeof( assessortagsConfig.customBannerList ) == 'object' ) {
form.append( { type:'header', label:'Custom' } );
form.append( { type: 'checkbox', name: 'custom', list: assessortagsConfig.customBannerList } );
form.append( { type:'submit' } );
}
form.append( { type:'header', label:'WikiProject banners (topical)' } );
form.append( { type:'checkbox', name: 'main', list: assessortags.mainList } );
form.append( { type:'header', label:'WikiProject banners (other)' } );
form.append( { type:'checkbox', name: 'second', list: assessortags.secondList } );
}
form.append( { type:'submit' } );
var result = form.render();
Window.setContent( result );
Window.display();
}
assessortags.mainList = [
{
label: 'Albums',
value: 'Album',
subgroup: {
name: 'album',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
}
]
}
},
{
label: 'Biography',
value: 'WPBiography',
subgroup: {
name: 'biography',
type: 'checkbox',
list: [
{
label: "Actors and Filmmakers WikiProject",
value: "|filmbio-work-group=yes"
},
{
label: "Arts and Entertainment work group",
value: "|a&e-work-group=yes"
},
{
label: "British Royalty WikiProject",
value: "|british-royalty=yes"
},
{
label: "Military work group",
value: "|military-work-group=yes"
},
{
label: "Musicians WikiProject",
value: "|musician-work-group=yes"
},
{
label: "Peerage and Baronetage WikiProject",
value: "|peerage-work-group=yes"
},
{
label: "Politics and Government work group",
value: "|politician-work-group=yes"
},
{
label: "Royalty WikiProject",
value: "|royalty-work-group=yes"
},
{
label: "Science and Academia work group",
value: "|s&a-work-group=yes"
},
{
label: "Sports and Games work group",
value: "|sports-work-group=yes"
},
{
label: "Living: Yes",
value: "|living=yes",
tooltip: 'Check box if person is alive, otherwise check box below.'
},
{
label: "Living: No",
value: "|living=no",
tooltip: 'Check box if person is no longer alive, otherwise check box above.'
},
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
},
{
label: "Needs persondata",
value: "|needs-persondata=yes"
},
{
label: "Needs an image",
value: "|needs-photo=yes"
},
{
label: "Active politician",
value: "|activepol=yes"
}
]
}
},
{
label: 'Books',
value: 'WPBooks',
subgroup: {
name: 'books',
type: 'checkbox',
list: [
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
},
{
label: "Needs an image",
value: "|needs-infobox-cover=yes"
}
]
}
},
{
label: 'Computing',
value: 'WikiProject Computing',
subgroup: {
name: 'computing',
type: 'checkbox',
list: [
{
label: "Amiga WikiProject",
value: "|amiga=yes"
},
{
label: "Computer and Information Security task force",
value: "|security=yes"
},
{
label: "Computer Hardware task force",
value: "|hardware=yes"
},
{
label: "Computer Networking WikiProject",
value: "|network=yes"
},
{
label: "Early Computers task force",
value: "|early-comp=yes"
},
{
label: "Malware WikiProject",
value: "|malware=yes"
},
{
label: "Websites WikiProject",
value: "|websites=yes"
},
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
},
{
label: "Needs an image",
value: "|image-needed=yes"
}
]
}
},
{
label: 'Dungeons & Dragons',
value: 'D&D',
subgroup: {
name: 'dungeonsanddragons',
type: 'checkbox',
list: [
{
label: "Dragonlance task force",
value: "|Dragonlance=yes"
},
{
label: "Forgotten Realms task force",
value: "|Realms=yes"
},
{
label: "Greyhawk task force",
value: "|Greyhawk=yes"
},
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs general cleanup",
value: "|cleanup=yes"
},
{
label: "Needs rewrite to be out-of-universe",
value: "|fiction=yes"
},
{
label: "Good target for articles to be merged to",
value: "|merge=yes"
}
]
}
},
{
label: 'Films',
value: 'Film',
subgroup: {
name: 'films',
type: 'checkbox',
list: [
{
label: "American Cinema task force",
value: "|American-task-force=yes"
},
{
label: "Argentine Cinema task force",
value: "|Argentine-task-force=yes"
},
{
label: "Australian Cinema task force",
value: "|Australian-task-force=yes"
},
{
label: "Film Awards task force",
value: "|Awards-task-force=yes"
},
{
label: "Baltic Cinema task force",
value: "|Baltic-task-force=yes"
},
{
label: "British Cinema task force",
value: "|British-task-force=yes"
},
{
label: "Canadian Cinema task force",
value: "|Canadian-task-force=yes"
},
{
label: "Chinese Cinema task force",
value: "|Chinese-task-force=yes"
},
{
label: "Film Festivals task force",
value: "|Festival-task-force=yes"
},
{
label: "Filmmaking task force",
value: "|Filmmaking-task-force=yes"
},
{
label: "French Cinema task force",
value: "|French-task-force=yes"
},
{
label: "German Cinema task force",
value: "|German-task-force=yes"
},
{
label: "Indian Cinema task force",
value: "|Indian-task-force=yes"
},
{
label: "Italian Cinema task force",
value: "|Italian-task-force=yes"
},
{
label: "Japanese Cinema task force",
value: "|Japanese-task-force=yes"
},
{
label: "Korean Cinema task force",
value: "|Korean-task-force=yes"
},
{
label: "New Zealand Cinema task force",
value: "|NZ-task-force=yes"
},
{
label: "Nordic Cinema task force",
value: "|Nordic-task-force=yes"
},
{
label: "Persian Cinema task force",
value: "|Persian-task-force=yes"
},
{
label: "Southeast Asian Cinema task force",
value: "|Southeast-task-force=yes"
},
{
label: "Soviet and Post-Soviet Cinema task force",
value: "|Soviet-task-force=yes"
},
{
label: "Spanish Cinema task force",
value: "|Spanish-task-force=yes"
},
{
label: "War Films task force",
value: "|War-task-force=yes"
},
{
label: "Needs a plot summary",
value: "|needs-plot=yes"
},
{
label: "Needs more information about cast",
value: "|needs-cast=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
},
{
label: "Needs an image",
value: "|needs-image=yes"
}
]
}
},
{
label: 'LGBT Studies',
value: 'LGBTProject'
},
{
label: 'Military History',
value: 'WPMILHIST',
subgroup: {
name: 'milhist',
type: 'checkbox',
list: [
{
label: "No applicable task force",
value: "|no-task-force=yes"
},
{
label: "African Military History task force",
value: "|African=yes"
},
{
label: "American Civil War task force",
value: "|ACW=yes"
},
{
label: "American Revolutionary War task force",
value: "|ARW=yes"
},
{
label: "Australian Military History task force",
value: "|Australian=yes"
},
{
label: "Aviation, Military task force",
value: "|Aviation=yes"
},
{
label: "Balkan Military History task force",
value: "|Balkan=yes"
},
{
label: "Baltic Military History task force",
value: "|Baltic=yes"
},
{
label: "Biography task force",
value: "|Biography=yes"
},
{
label: "British Military History task force",
value: "|British=yes"
},
{
label: "Canadian Military History task force",
value: "|Canadian=yes"
},
{
label: "Chinese Military History task force",
value: "|Chinese=yes"
},
{
label: "Classical Warfare task force",
value: "|Classical=yes"
},
{
label: "Crusades task force",
value: "|Crusades=yes"
},
{
label: "Dutch Military History task force",
value: "|Dutch=yes"
},
{
label: "Early Modern Warfare task force",
value: "|Early-Modern=yes"
},
{
label: "Films, War task force",
value: "|Films=yes"
},
{
label: "French Military History task force",
value: "|French=yes"
},
{
label: "Fortifications task force",
value: "|Fortifications=yes"
},
{
label: "German Military History task force",
value: "|German=yes"
},
{
label: "Historiography, Military task force",
value: "|Historiography=yes"
},
{
label: "Indian Military History task force",
value: "|Indian=yes"
},
{
label: "Intelligence task force",
value: "|Intel=yes"
},
{
label: "Italian Military History task force",
value: "|Italian=yes"
},
{
label: "Japanese Military History task force",
value: "|Japanese=yes"
},
{
label: "Korean Military History task force",
value: "|Korean=yes"
},
{
label: "Land Vehicles, Military task force",
value: "|Land-vehicles=yes"
},
{
label: "Lebanese Military History task force",
value: "|Lebanese=yes"
},
{
label: "Maritime Warfare task force",
value: "|Maritime=yes"
},
{
label: "Medieval Warfare task force",
value: "|Medieval=yes"
},
{
label: "Memorials and Cemeteries, Military task force",
value: "|Memorials=yes"
},
{
label: "Middle Eastern Military History task force",
value: "|Middle-Eastern=yes"
},
{
label: "Muslim Military History, Early task force",
value: "|Muslim=yes"
},
{
label: "Napoleonic Era task force",
value: "|Napoleonic=yes"
},
{
label: "National Militaries task force",
value: "|National=yes"
},
{
label: "New Zealand Military History task force",
value: "|New-Zealand=yes"
},
{
label: "Nordic Military History task force",
value: "|Nordic=yes"
},
{
label: "Ottoman Military History task force",
value: "|Ottoman=yes"
},
{
label: "Polish Military History task force",
value: "|Polish=yes"
},
{
label: "Romanian Military History task force",
value: "|Romanian=yes"
},
{
label: "Russian Military History task force",
value: "|Russian=yes"
},
{
label: "Science, Military task force",
value: "|Science=yes"
},
{
label: "South American Military History task force",
value: "|South-American=yes"
},
{
label: "Southeast Asian Military History task force",
value: "|Southeast-Asian=yes"
},
{
label: "Spanish Military History task force",
value: "|Spanish=yes"
},
{
label: "Taiwanese Military History task force",
value: "|Taiwanese=yes"
},
{
label: "Technology and Engineering, Military task force",
value: "|Technology=yes"
},
{
label: "United States Military History task force",
value: "|US=yes"
},
{
label: "Weaponry task force",
value: "|Weaponry=yes"
},
{
label: "World War I task force",
value: "|WWI=yes"
},
{
label: "World War II task force",
value: "|WWII=yes"
}
]
}
},
{
label: 'Mississippi',
value: 'WikiProject Mississippi',
subgroup: {
name: 'mississippi',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs reassessment",
value: "|reassess=yes"
},
{
label: "Candidate for merging",
value: "|merge=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
}
]
}
},
{
label: 'Russia',
value: 'WikiProject Russia',
subgroup: {
name: 'russia',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
}
]
}
},
{
label: 'Simpsons, The',
value: 'WikiProject The Simpsons'
},
{
label: 'Songs',
value: 'Songs',
subgroup: {
name: 'songs',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
}
]
}
},
{
label: 'Soviet Union',
value: 'WikiProject Soviet Union',
subgroup: {
name: 'soviet',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
},
{
label: "Needs an infobox",
value: "|needs-infobox=yes"
}
]
}
},
{
label: 'Vital Articles',
value: 'Vital',
tooltip: 'Articles must be listed at [[WP:VA/E]] to be added to this project.',
subgroup: {
name: 'vital',
type: 'checkbox',
list: [
{
label: "Needs immediate attention",
value: "|attention=yes"
}
]
}
}
];
assessortags.secondList = [
{
label: 'Disambiguation',
value: 'DisambigProject'
}
];
assessortags.callbacks = {
main: function( self ) {
var form = self.responseXML.getElementById( 'editform' );
var tagRe, text = '', summaryText = ''; //Is the summaryText still needed?
var tags = new Array(), groupableTags = new Array(); //Is the groupableTags really still needed? Removing it fowls stuff up, but it seems like it should be removable
// Check for preexisting tags
Status.info( 'Info', 'Looking for banners already on page' );
for( var i = 0; i < self.params.tags.length; i++ ) {
var txt = form.wpTextbox1.value;
txt = txt.value.replace(new RegExp('\\{\\{' + self.params.tags[i] + '(\\||\\}\\})', 'gim'), '\\{\\{' + self.params.tags[i] + '$1' + 'BLAH');
}
if( self.params.group && tags.length >= 2 ) {
Status.info( 'Info', 'Adding banners to top of page' );
Status.info( 'Info', 'Grouping banners into \{\{' + assessortagsConfig.groupingBanner + '\}\}' );
groupableTags.sort();
text += '\{\{' + assessortagsConfig.groupingBanner + '|1=' + '\n';
for( var i = 0; i < tags.length; i++ ) {
text += '\{\{' + tags[i];
if( tags[i] == 'D&D' ) {
text += self.params.dungeonsanddragonsSubcategory.join("");
} else if( tags[i] == 'WPBiography' ) {
text += self.params.biographySubcategory.join("");
} else if( tags[i] == 'Film' ) {
text += self.params.filmsSubcategory.join("");
} else if( tags[i] == 'WikiProject Computing' ) {
text += self.params.computingSubcategory.join("");
} else if( tags[i] == 'WPBooks' ) {
text += self.params.booksSubcategory.join("");
} else if( tags[i] == 'Vital' ) {
text += self.params.vitalSubcategory.join("");
} else if( tags[i] == 'WPMILHIST' ) {
text += self.params.milhistSubcategory.join("");
} else if( tags[i] == 'WikiProject Mississippi' ) {
text += self.params.mississippiSubcategory.join("");
} else if( tags[i] == 'WikiProject Russia' ) {
text += self.params.russiaSubcategory.join("");
} else if( tags[i] == 'WikiProject Soviet Union' ) {
text += self.params.sovietSubcategory.join("");
} else if( tags[i] == 'Album' ) {
text += self.params.albumSubcategory.join("");
} else if( tags[i] == 'Songs' ) {
text += self.params.songsSubcategory.join("");
}
text += '\}\}\n';
}
text += '\}\}\n';
} else {
tags = tags.concat( groupableTags );
}
if( self.params.group && tags.length < 2 ) {
Status.info( 'Info', 'Adding banners to top of page' );
tags.sort();
for( var i = 0; i < tags.length; i++ ) {
text += '\{\{' + tags[i];
if( tags[i] == 'D&D' ) {
text += self.params.dungeonsanddragonsSubcategory.join("");
} else if( tags[i] == 'WPBiography' ) {
text += self.params.biographySubcategory.join("");
} else if( tags[i] == 'Film' ) {
text += self.params.filmsSubcategory.join("");
} else if( tags[i] == 'WikiProject Computing' ) {
text += self.params.computingSubcategory.join("");
} else if( tags[i] == 'WPBooks' ) {
text += self.params.booksSubcategory.join("");
} else if( tags[i] == 'Vital' ) {
text += self.params.vitalSubcategory.join("");
} else if( tags[i] == 'WPMILHIST' ) {
text += self.params.milhistSubcategory.join("");
} else if( tags[i] == 'WikiProject Mississippi' ) {
text += self.params.mississippiSubcategory.join("");
} else if( tags[i] == 'WikiProject Russia' ) {
text += self.params.russiaSubcategory.join("");
} else if( tags[i] == 'WikiProject Soviet Union' ) {
text += self.params.sovietSubcategory.join("");
} else if( tags[i] == 'Album' ) {
text += self.params.albumSubcategory.join("");
} else if( tags[i] == 'Songs' ) {
text += self.params.songsSubcategory.join("");
}
text += '\}\}\n';
}
}
text += form.wpTextbox1.value;
summaryText += 'Added WikiProject banners to page' + assessortagsConfig.summaryAd;
var postData = {
'wpMinoredit': assessortagsConfig.markTaggedPagesAsMinor ? 1 : undefined,
'wpStarttime': form.wpStarttime.value,
'wpEdittime': form.wpEdittime.value,
'wpAutoSummary': form.wpAutoSummary.value,
'wpEditToken': form.wpEditToken.value,
'wpSummary': summaryText,
'wpTextbox1': text
};
self.post( postData );
}
}
assessortags.callback.evaluate = function assessortagsCallbackEvaluate(e) {
var form = e.target;
{if( typeof( assessortagsConfig.customBannerList ) == 'object' ) {
var tags = form.getChecked( 'main' ).concat( form.getChecked( 'second' ) ).concat( form.getChecked( 'custom' ) );
} else {
var tags = form.getChecked( 'main' ).concat( form.getChecked( 'second' ) );
}
var albumSubcategory = form.getChecked( 'main.album' );
var biographySubcategory = form.getChecked( 'main.biography' );
var booksSubcategory = form.getChecked( 'main.books' );
var computingSubcategory = form.getChecked( 'main.computing' );
var dungeonsanddragonsSubcategory = form.getChecked( 'main.dungeonsanddragons' );
var filmsSubcategory = form.getChecked( 'main.films' );
var milhistSubcategory = form.getChecked( 'main.milhist' );
var mississippiSubcategory = form.getChecked( 'main.mississippi' );
var russiaSubcategory = form.getChecked( 'main.russia' );
var songsSubcategory = form.getChecked( 'main.songs' );
var sovietSubcategory = form.getChecked( 'main.soviet' );
var vitalSubcategory = form.getChecked( 'main.vital' );
}
var params;
if( tags.length == 0 ) {
alert( 'Please select at least one banner.' );
return;
}
params = {
tags: tags,
group: form.group.checked,
albumSubcategory: albumSubcategory ? albumSubcategory : null,
biographySubcategory: biographySubcategory ? biographySubcategory : null,
booksSubcategory: booksSubcategory ? booksSubcategory : null,
computingSubcategory: computingSubcategory ? computingSubcategory : null,
dungeonsanddragonsSubcategory: dungeonsanddragonsSubcategory ? dungeonsanddragonsSubcategory : null,
filmsSubcategory: filmsSubcategory ? filmsSubcategory : null,
milhistSubcategory: milhistSubcategory ? milhistSubcategory : null,
mississippiSubcategory: mississippiSubcategory ? mississippiSubcategory : null,
russiaSubcategory: russiaSubcategory ? russiaSubcategory : null,
songsSubcategory: songsSubcategory ? songsSubcategory : null,
sovietSubcategory: sovietSubcategory ? sovietSubcategory : null,
vitalSubcategory: vitalSubcategory ? vitalSubcategory : null,
rcid: QueryString.exists( 'rcid' ) ? QueryString.get( 'rcid' ) : ''
}
Status.init( form );
var query = {
'title': wgPageName,
'action': 'submit'
};
Wikipedia.actionCompleted.redirect = wgPageName;
Wikipedia.actionCompleted.notice = "Tagging complete, reloading article";
var wikipedia_wiki = new Wikipedia.wiki( 'Article modification', query, assessortags.callbacks.main );
wikipedia_wiki.params = params;
wikipedia_wiki.get();
}
// </nowiki>