User:ZXRPQ/monobook.js

Source: Wikipedia, the free encyclopedia.
<
User:ZXRPQ
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[User:Pyrospirit/scriptpackage.js]]

/*

This is a collection of JavaScript assembled by [[User:Pyrospirit]]. I haven't written 
any of this myself, but I use all of it and find it very useful.

These scripts are designed for use in Firefox and will all work in Firefox. Most of the 
scripts won't work in Internet Explorer, and I have no idea what will happen with other 
browsers. Solution: get Firefox.

I'm somewhat of a newbie with JavaScript, so please report any problems with these 
scripts to whomever wrote the script or ask at [[Wikipedia:Village pump (technical)]].

To decrease loading time, I've set many scripts only to run on certain types of pages. 
So, if a script isn't showing up, it might be because you'd almost never use it on the 
page you're on anyway.

*/

/*
== Scripts in this area are enabled in all browsers ==
*/

// [[User:Lupin/popups.js]] - navigation popups
if(wgAction!='edit' && wgAction!='submit')
importScript('User:Lupin/popups.js');

// [[User:Jsimlo/shortcuts.js]] - customized sidebar links
importScript('User:Jsimlo/shortcuts.js');

function shortcutsInit ()
{

  shortcutsAddLink ( 'Monobook.js', 'Special:Mypage/monobook.js' );
  shortcutsAddLink ( 'New pages', 'Special:Newpages' );
  shortcutsAddLink ( 'AIV', 'Wikipedia:Administrator intervention against vandalism' );
  shortcutsAddLink ( 'Orphans', 'Category:Orphaned articles from July 2006' );
  shortcutsAddLink ( 'Cleanup', 'Category:Cleanup from July 2006' );
  shortcutsAddLink ( 'AIV', 'Wikipedia:Administrator intervention against vandalism' );
  shortcutsAddLink ( 'Help desk', 'Wikipedia:Help desk' );
  shortcutsAddLink ( 'RD:COMP', 'Wikipedia:Reference desk/Computing' );
  shortcutsAddLink ( 'RD:ENT', 'Wikipedia:Reference desk/Entertainment' );
  shortcutsAddLink ( 'RD:HUM', 'Wikipedia:Reference desk/Humanities' );
  shortcutsAddLink ( 'RD:LANG', 'Wikipedia:Reference desk/Language' );
  shortcutsAddLink ( 'RD:MATH', 'Wikipedia:Reference desk/Mathematics' );
  shortcutsAddLink ( 'RD:SCI', 'Wikipedia:Reference desk/Science' );
  shortcutsAddLink ( 'RD:MISC', 'Wikipedia:Reference desk/Miscellaneous' );

}

// User watchlist from [[User:Tra/userwatchlist.js]]
importScript('User:Tra/userwatchlist.js');

// Logs link in toolbox
if (wgCanonicalNamespace!='User' && wgCanonicalNamespace!='User talk')
importScript('Wikipedia:WikiProject User scripts/Scripts/Logs link');

// Reformats compare button in history as a link
if (wgAction=='history')
importScript('MediaWiki:WikiProject User scripts/Scripts/Compare link.js');

// Performs basic formatting changes from a tab while editing
importScript('Wikipedia:WikiProject User scripts/Scripts/Formatter');

// Quick previewing button in editing toolbar
if (wgAction=='edit' || wgAction=='submit')
importScript('User:Alex Smotrov/qpreview.js');

// Gives assessment data for an article
if (wgCanonicalNamespace=='')
importScript('User:Outriggr/metadata.js');

// Adds extra edit/hist tabs for both discussion page and article page
importScript('Wikipedia:WikiProject User scripts/Scripts/Six tabs');

// Improves formatting of history pages
if (wgAction=='history')
importScript('User:Alex_Smotrov/histcomb.js');

// Edit top link by [[User:Alex Smotrov]]
importScript('User:Alex_Smotrov/edittop.js');
if (wgAction=='edit' && document.URL.indexOf('&section=0') != -1)
addOnloadHook(function(){
document.getElementById('wpSummary').value = "/* Intro */ ";
})

// Unwatch links next to page names in watchlist from [[User:Alex Smotrov/wlunwatch.js]]
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') 
addOnloadHook(function () {
var frm = document.getElementsByTagName('form')[0];
frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
var lnk = document.createElement('a');
lnk.appendChild(document.createTextNode('Unwatch…'));
lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
frm.parentNode.insertBefore(lnk, frm);
})

importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');
autosubmit=false;
minoredit=true;
show_cwli=true;

// Box with newest pages in sidebar
importScript('User:TheJosh/Scripts/NewPagePatrol.js');
npp_enabled = false;
npp_num_pages = 10;
npp_refresh = 5;

// Box with recent changes in sidebar
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
rcp_enabled = false;
rcp_num_pages = 10;
rcp_refresh = 5;

/*

== Scripts in this area are disabled in Internet Explorer due to compatibility issues ==
*/
var detect = navigator.userAgent.toLowerCase();
var IE;
var place = detect.indexOf('msie') + 1;
if (place) IE=true;
if (!IE) {

// Twinkle script (reverting, warning, reporting, csd, xfd, prod, rpp)
importScript('User:AzaToth/twinkle.js');

TwinkleConfig = {

revertMaxRevisions              :       50,
userTalkPageMode                :       'tab',
showSharedIPNotice              :       true,
openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert        :       true,
openAOLAnonTalkPage             :       false,
summaryAd                       :       " ~",
deletionSummaryAd               :       " ~",
protectionSummaryAd             :       " ~",
watchSpeedyPages                :       [ ],
watchProdPages                  :       true,
openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages              :       [ ],
markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete          :       false,
watchWarnings                   :       false,
markAIVReportAsMinor            :       false,
markSpeedyPagesAsMinor          :       false,
offerReasonOnNormalRevert       :       true
};

// [[WP:FRIENDLY]] script similar to Twinkle (tagging, welcoming)
importScript('User:Ioeth/friendly.js');

FriendlyConfig = {
  summaryAd               :  " ~",
  watchWelcomes           :  false,
  markWelcomesAsMinor     :  false,
  watchTaggedPages        :  false,
  markTaggedPagesAsMinor  :  true,
  insertHeadings          :  true,
  welcomeHeading          :  "== Welcome ==",
  insertUsername          :  true,
  insertSignature         :  true
};

// [[User:Voice of All]]'s helper JavaScript
importScript('User:Voice of All/Addtabs/monobook.js');

// UTC time clock with double-click purge function
importScript('User:Voice of All/UTCclock.js');

// Some history-related script from VoA
importScript('User:Voice of All/History/monobook.js');

// [[User:Lupin/recent2.js]] anti-vandalism script
importScript('User:Lupin/recent2.js');

}

// <nowiki>
// If FriendlyConfig aint exist.
if( typeof( FriendlyConfig ) == 'undefined' ) {
	FriendlyConfig = {};
}

/**
 FriendlyConfig.summaryAd ( string )
 If ad should be added or not to summary, default [[WP:FRIENDLY|Friendly]]
 */
if( typeof( FriendlyConfig.summaryAd ) == 'undefined' ) {
	FriendlyConfig.summaryAd = " ~";
}

/**
 FriendlyConfig.groupByDefault ( boolean )
 */
if( typeof( FriendlyConfig.groupByDefault ) == 'undefined' ) {
	FriendlyConfig.groupByDefault = true;
}

/**
 FriendlyConfig.watchTaggedPages ( boolean )
 */
if( typeof( FriendlyConfig.watchTaggedPages ) == 'undefined' ) {
	FriendlyConfig.watchTaggedPages = true;
}

/**
 FriendlyConfig.markTaggedPagesAsMinor ( boolean )
 */
if( typeof( FriendlyConfig.markTaggedPagesAsMinor ) == 'undefined' ) {
	FriendlyConfig.markTaggedPagesAsMinor = true;
}

function friendlytag() {
	if( QueryString.exists( 'redirect' ) && QueryString.get( 'redirect' ) == 'no' ) {
		isRedirect = true;
		mw.util.addPortletLink( 'p-cactions', "javascript:friendlytag.callback()", "tag", "friendly-tag", "Tag redirect", "");
	} else if( wgNamespaceNumber != 0 || wgCurRevisionId == false ) {
		return;
	} else {
		mw.util.addPortletLink( 'p-cactions', "javascript:friendlytag.callback()", "tag", "friendly-tag", "Tag article", "");
	}
}

addOnloadHook(friendlytag);

friendlytag.callback = function friendlytagCallback( uid ) {
	var Window = new SimpleWindow( 600, 400 );
	if( !isRedirect ) {
		Window.setTitle( "Article maintenance tagging" );
	} else {
		Window.setTitle( "Redirect tagging" );
	}
	var form = new QuickForm( friendlytag.callback.evaluate );
	
	if( !isRedirect ) {
		form.append( {
				type: 'checkbox',
				list: [
					{
						label: 'Group into {{articleissues}} if possible',
						value: 'group',
						name: 'group',
						tooltip: 'If applying more than three templates supported by {{articleissues}} and this box is checked, all supported templates will be grouped into a single {{articleissues}} template.',
						checked: FriendlyConfig.groupByDefault
					}
				]
			}
		);

		form.append( { type:'submit' } );

		form.append( { type:'header', label:'Maintenance templates' } );
		form.append( { type:'checkbox', name: 'maintenance', list: friendlytag.maintenanceList } );

		form.append( { type:'header', label:'Problem templates' } );
		form.append( { type:'checkbox', name: 'problem', list: friendlytag.problemList } );

		form.append( { type:'header', label:'Notice templates' } );
		form.append( { type:'checkbox', name: 'notice', list: friendlytag.noticeList } );
	} else {
		form.append( { type:'submit' } );
		
		form.append( { type:'header', label:'Spelling, misspelling, tense and capitalization templates' } );
		form.append( { type:'checkbox', name: 'spelling', list: friendlytag.spellingList } );
		
		form.append( { type:'header', label:'Alternative name templates' } );
		form.append( { type:'checkbox', name: 'alternative', list: friendlytag.alternativeList } );
		
		form.append( { type:'header', label:'Miscellaneous and administrative redirect templates' } );
		form.append( { type:'checkbox', name: 'administrative', list: friendlytag.administrativeList } );
	}
	
	form.append( { type:'submit' } );

	var result = form.render();
	Window.setContent( result );
	Window.display();
}

isRedirect = false;

friendlytag.maintenanceList = [
	{
		label: '{{cleanup}}: article may require cleanup',
		value: 'cleanup' },
	{
		label: '{{confusing}}: article may be confusing or unclear',
		value: 'confusing' },
	{
		label: '{{copyedit}}: article needs copy editing for grammar, style, cohesion, tone, and/or spelling',
		value: 'copyedit' },
	{
		label: '{{deadend}}: article has few or no links to other articles',
		value: 'deadend' },
	{
		label: '{{essay-like}}: article is written like an essay and needs cleanup',
		value: 'essay-like' },
	{
		label: '{{expand}}: article needs expansion',
		value: 'expand' },
	{
		label: '{{expert}}: article needs attention from an expert on the subject',
		value: 'expert' },
	{
		label: '{{in-universe}}: article subject is fictional and needs rewriting from a non-fictional perspective',
		value: 'in-universe' },
	{
		label: '{{internallinks}}: article needs more relevant internal links',
		value: 'internallinks' },
	{
		label: '{{introrewrite}}: lead section of article needs to be rewritten to comply with guidelines',
		value: 'introrewrite' },
	{
		label: '{{nofootnotes}}: article has references, but no in-text citations',
		value: 'nofootnotes' },
	{
		label: '{{orphan}}: article has few or no other articles that link to it',
		value: 'orphan' },
	{
		label: '{{plot}}: plot summary in article is too long',
		value: 'plot' },
	{
		label: '{{prose}}: article is in a list format that may be better presented using prose',
		value: 'prose' },
	{
		label: '{{sections}}: article needs to be broken into sections',
		value: 'sections' },
	{
		label: '{{tone}}: tone of article is not appropriate',
		value: 'tone' },
	{
		label: '{{toolong}}: lead section of article is too long and should be shortened',
		value: 'toolong' },
	{
		label: '{{tooshort}}: lead section of article is too short and should be expanded',
		value: 'tooshort' },
	{
		label: '{{uncategorized}}: article is uncategorized',
		value: 'uncategorized' },
	{
		label: '{{verylong}}: article is too long',
		value: 'verylong' },
	{
		label: '{{wikify}}: article needs to be wikified',
		value: 'wikify' }
];

friendlytag.problemList = [
	{
		label: '{{advert}}: article is written like an advertisement',
		value: 'advert' },
	{
		label: '{{autobiography}}: article is an autobiography and may not be of NPOV',
		value: 'autobiography' },
	{
		label: '{{coi}}: article creator or major contributor may have a conflict of interest',
		value: 'coi' },
	{
		label: '{{context}}: article provides insufficient context',
		value: 'context' },
	{
		label: '{{disputed}}: article has questionable factual accuracy',
		value: 'disputed' },
	{
		label: '{{hoax}}: article may be a complete hoax',
		value: 'hoax' },
	{
		label: '{{non-free}}: article may contain excessive or improper use of copyrighted materials',
		value: 'non-free' },
	{
		label: '{{notability}}: article\'s subject may not meet the notability guideline',
		value: 'notability',
		event: function( e ) {
			friendlytag.callback.change_notability( e );
			e.stopPropagation();
		} },
	{
		label: '{{npov}}: article does not maintain a neutral point of view',
		value: 'npov' },
	{
		label: '{{original research}}: article has original research or unverified claims',
		value: 'original research' },
	{
		label: '{{primarysources}}: article needs reliable, third-party sources',
		value: 'primarysources' },
	{ 
		label: '{{refimprove}}: article needs additional references or sources for verification',
		value: 'refimprove' },
	{
		label: '{{self-published}}: article may contain improper references to self-published sources',
		value: 'self-published' },
	{
		label: '{{totally-disputed}}: article is not neutral and has questionable factual accuracy',
		value: 'totally-disputed' },
	{
		label: '{{unencyclopedic}}: article is unencyclopedic and should be deleted',
		value: 'unencyclopedic' },
	{
		label: '{{unreferenced}}: article has no references at all',
		value: 'unreferenced' },
	{
		label: '{{update}}: article information is out of date',
		value: 'update' },
	{
		label: '{{weasel}}: article quality may be compromised by the use of weasel words',
		value: 'weasel' }
];

friendlytag.noticeList = [
	{
		label: '{{current}}: article documents a current event',
		value: 'current',
		event: function( e ) {
			friendlytag.callback.change_current( e );
			e.stopPropagation();
		} },
	{
		label: '{{future}}: article is about scheduled or expected future events',
		value: 'future',
		event: function( e ) {
			friendlytag.callback.change_future( e );
			e.stopPropagation();
		} },
	{
		label: '{{inuse}}: article is undergoing a major edit for a short while',
		value: 'inuse' },
	{
		label: '{{underconstruction}}: article is currently in the middle of an expansion or major revamping',
		value: 'underconstruction' }
];

friendlytag.notabilityList = {
	"Academics": {
		label: "notability guideline for academics",
		value: "Academics"
	},
	"Biographies": {
		label: "notability guideline for biographies",
		value: "Biographies"
	},
	"Books": {
		label: "notability guideline for books",
		value: "Books"
	},
	"Companies": {
		label: "notability guideline for companies and organizations",
		value: "Companies"
	},
	"Episode": {
		label: "notability guideline for television episodes",
		value: "Episode"
	},
	"Fiction": {
		label: "notability guideline for fiction",
		value: "Fiction"
	},
	"Institutions": {
		label: "synonym of \"Companies\"",
		value: "Institutions"
	},
	"Music": {
		label: "notability guideline for music",
		value: "Music"
	},
	"Neologisms": {
		label: "notability guideline for neologisms",
		value: "Neologisms"
	},
	"Numbers": {
		label: "notability guideline for numbers",
		value: "Numbers"
	},
	"Organizations": {
		label: "synonym of \"Companies\"",
		value: "Organizations"
	},
	"Products": {
		label: "notability guideline for products and services",
		value: "Products"
	},
	"Web": {
		label: "notability guideline for web content",
		value: "Web"
	}
};

friendlytag.currentList = {
	"current": {
		label: "{{current}}: article documents a current event",
		value: "current"
	},
	"airing": {
		label: "{{airng}}: program is currently airing",
		value: "airing"
	},
	"bridge under construction": {
		label: "{{bridge under construction}}: article contains information about a bridge currently under construction",
		value: "bridge under construction"
	},
	"building under construction": {
		label: "{{bridge under construction}}: article contains information about a building currently under construction",
		value: "building under construction"
	},
	"antics": {
		label: "{{current antics}}: person is currently participating in a reality television show",
		value: "current antics"
	},
	"bill": {
		label: "{{current bill}}: article documents proposed legislation that is currently being considered",
		value: "current bill"
	},
	"court case": {
		label: "{{current court case}}: article documents a current court case",
		value: "current court case"
	},
	"fiction": {
		label: "{{current fiction}}: article is about a recently released work of fiction",
		value: "current fiction"
	},
	"game": {
		label: "{{current game}}: article documents a current event in video gaming",
		value: "current game"
	},
	"person": {
		label: "{{current person}}: article is about a person involved in a current event",
		value: "current person"
	},
	"product": {
		label: "{{current product}}: article documents a recently released product",
		value: "current product"
	},
	"pw": {
		label: "{{current pw}}: article documents a current professional wrestling event",
		value: "current pw"
	},
	"spaceflight": {
		label: "{{current spaceflight}}: article or section documents a current spaceflight",
		value: "current spaceflight"
	},
	"sport": {
		label: "{{current sport}}: article documents a current sports-related event",
		value: "current sport"
	},
	"delay": {
		label: "{{current sport delay}}: article documents a current sports-related event which may contain information not aired because of tape delay",
		value: "current sport delay"
	},
	"related": {
		label: "{{current related}}: article is related to a current event",
		value: "current related"
	},
	"single": {
		label: "{{current single}}: article documents a current single",
		value: "current single"
	},
	"territorial changes": {
		label: "{{current territorial changes}}: article is subject to current territorial changes and may not represent up-to-date detail",
		value: "current territorial changes"
	},
	"in space": {
		label: "{{in space}}: article documents a person who is currently in space",
		value: "in space"
	},
	"inland waterway under restoration": {
		label: "{{inland waterway under restoration}}: article contains information about an inland waterway currently under restoration",
		value: "inland waterway under restoration"
	},
	"ongoing lawsuit": {
		label: "{{ongoing lawsuit}}: article documents an ongoing lawsuit",
		value: "ongoing lawsuit"
	},
	"ongoing election": {
		label: "{{ongoing election}}: article contains information about an ongoing election",
		value: "ongoing election"
	},
	"ongoing weather": {
		label: "{{ongoing weather}}: article contains information about an ongoing meteorological event or phenomenon",
		value: "ongoing weather"
	},
	"recent death": {
		label: "{{recent death}}: article is about a person who has recently died",
		value: "recent death"
	},
	"recently convicted": {
		label: "{{recently convicted}}: article is about a person who has recently been convicted in a criminal case",
		value: "recently convicted"
	},
	"road under construction": {
		label: "{{road under construction}}: article contains information about a road currently under construction",
		value: "road under construction"
	}
};

friendlytag.futureList = {
	"future0": {
		label: "{{future}}: article is about scheduled or expected future events",
		value: "future"
	},
	"future1": {
		label: "== Education ==",
		value: "future"
	},
	"article": {
		label: "{{future article}}: expected future articles",
		value: "future article"
	},
	"book": {
		label: "{{future book}}: scheduled, forthcoming or expected future book(s)",
		value: "future book"
	},
	"museum": {
		label: "{{future museum}}: planned museum",
		value: "future museum"
	},
	"zoo exhibit": {
		label: "{{future zoo exhibit}}: planned or expected new zoo exhibit",
		value: "future zoo exhibit"
	},
	"future2": {
		label: "== Engineering ==",
		value: "future"
	},
	"building": {
		label: "{{future building}}: expected future buildings or structures",
		value: "future building"
	},
	"chip": {
		label: "{{future chip}}: scheduled or expected future computer chips",
		value: "future chip"
	},
	"dam": {
		label: "{{future dam}}: planned or expected dam",
		value: "future dam"
	},
	"energy infrastructure": {
		label: "{{future energy infrastructure}}: planned or expected future energy production, transmission, distribution or other energy related infrastructure",
		value: "future energy infrastructure"
	},
	"infrastructure": {
		label: "{{future infrastructure}}: planned or expected future infrastructure",
		value: "future infrastructure"
	},
	"mine": {
		label: "{{future mine}}: planned or proposed future mine",
		value: "future mine"
	},
	"pipeline": {
		label: "{{future pipeline}}: planned or expected pipeline",
		value: "future pipeline"
	},
	"power plant": {
		label: "{{future power plant}}: planned or expected power plant",
		value: "future power plant"
	},
	"scientific facility": {
		label: "{{future scientific facility}}: expected future scientific facility",
		value: "future scientific facility"
	},
	"software": {
		label: "{{future software}}: scheduled or expected future software",
		value: "future software"
	},
	"spaceflight": {
		label: "{{future spaceflight}}: scheduled or expected spaceflight",
		value: "future spaceflight"
	},
	"launching": {
		label: "{{launching}}: rocket or spacecraft which is either currently in the process of launching, or is scheduled to launch within the next few days",
		value: "launching"
	},
	"web service": {
		label: "{{future web service}}: scheduled or expected Web service",
		value: "future web service"
	},
	"future3": {
		label: "== Entertainment ==",
		value: "future"
	},
	"album": {
		label: "{{future album}}: scheduled or expected album",
		value: "future album"
	},
	"amusement ride": {
		label: "{{future amusement ride}}: planned or expected future amusement ride",
		value: "future amusement ride"
	},
	"awards show": {
		label: "{{future awards show}}: upcoming awards show",
		value: "future awards show"
	},
	"channel": {
		label: "{{future channel}}: future television station, channel or network",
		value: "future channel"
	},
	"comic": {
		label: "{{future comic}}: scheduled or expected comic book release, or a series already in progress",
		value: "future comic"
	},
	"film": {
		label: "{{future film}}: one or more scheduled or expected films",
		value: "future film"
	},
	"game": {
		label: "{{future game}}: unreleased video game",
		value: "future game"
	},
	"music festival": {
		label: "{{future music festival}}: upcoming music/arts festival",
		value: "future music festival"
	},
	"play article": {
		label: "{{future play article}}: upcoming play or musical",
		value: "future play article"
	},
	"radio": {
		label: "{{future radio}}: future radio station, radio network or radio show",
		value: "future radio"
	},
	"UK radio station": {
		label: "{{future UK radio station}}: future radio station in the United Kingdom",
		value: "future UK radio station"
	},
	"single": {
		label: "{{future single}}: scheduled or expected future single",
		value: "future single"
	},
	"television episode": {
		label: "{{future television episode}}: scheduled upcoming television episode of an already-running TV series",
		value: "future television episode"
	},
	"television series": {
		label: "{{future television series}}: scheduled upcoming television series",
		value: "future television series"
	},
	"webcomic": {
		label: "{{future webcomic}}: scheduled or expected webcomic update/premiere, or a series already in progress",
		value: "future webcomic"
	},
	"future4": {
		label: "== Miscellaneous ==",
		value: "future"
	},
	"concept product": {
		label: "{{concept product}}: contains information about conceptual products",
		value: "concept product"
	},
	"election": {
		label: "{{future election}}: forthcoming or ongoing election",
		value: "future election"
	},
	"election in the United States": {
		label: "{{future election in the United States}}: upcoming or ongoing election in the United States",
		value: "future election in the United States"
	},
	"product": {
		label: "{{future product}}: scheduled or expected future product",
		value: "future product"
	},
	"product small": {
		label: "{{future product small}}: (small) future product, and may contain unverified, unreliable, or incorrect information",
		value: "future product small"
	},
	"future5": {
		label: "== Transportation ==",
		value: "future"
	},
	"aircraft": {
		label: "{{future aircraft}}: scheduled or anticipated future aircraft",
		value: "future aircraft"
	},
	"airline": {
		label: "{{future airline}}: planned or expected new airline",
		value: "future airline"
	},
	"airport": {
		label: "{{future airport}}: planned or expected new airport",
		value: "future airport"
	},
	"airport authority": {
		label: "{{future airport authority}}: planned or expected new airport authority",
		value: "future airport authority"
	},
	"airport expansion": {
		label: "{{future airport expansion}}: planned or expected expansion of an existing airport",
		value: "future airport expansion"
	},
	"Australian public transportation": {
		label: "{{future Australian public transportation}}: planned or expected public transportation infrastructure in Australia",
		value: "future Australian public transportation"
	},
	"automobile": {
		label: "{{future automobile}}: scheduled or anticipated future automobile",
		value: "future automobile"
	},
	"bridge": {
		label: "{{future bridge}}: planned or proposed future bridge",
		value: "future bridge"
	},
	"Canadian public transportation": {
		label: "{{future Canadian public transportation}}: planned or expected public transportation infrastructure in Canada",
		value: "future Canadian public transportation"
	},
	"Chinese public transportation": {
		label: "{{future Chinese public transportation}}: planned or expected public transportation infrastructure in China",
		value: "future Chinese public transportation"
	},
	"concept automobile": {
		label: "{{concept automobile}}: concept automobile",
		value: "concept automobile"
	},
	"French public transportation": {
		label: "{{future French public transportation}}: planned or expected public transportation infrastructure in France",
		value: "future French public transportation"
	},
	"London transport infrastructure": {
		label: "{{future London transport infrastructure}}: planned or expected London Transport infrastructure",
		value: "future London transport infrastructure"
	},
	"motorcycle": {
		label: "{{future motorcycle}}: scheduled or anticipated future motorcycle",
		value: "future motorcycle"
	},
	"public transportation": {
		label: "{{future public transportation}}: planned or expected public transportation infrastructure",
		value: "future public transportation"
	},
	"railway station": {
		label: "{{future railway station}}: planned or expected future railway station",
		value: "future railway station"
	},
	"road": {
		label: "{{future road}}: planned or expected future road",
		value: "future road"
	},
	"tunnel": {
		label: "{{future tunnel}}: planned or expected future tunnel",
		value: "future tunnel"
	},
	"UK public transportation": {
		label: "{{future UK public transportation}}: planned or expected public transportation in the United Kingdom",
		value: "future UK public transportation"
	},
	"USA public transportation": {
		label: "{{future USA public transportation}}: proposed, planned, or expected public transportation infrastructure in the United States",
		value: "future USA public transportation"
	},
	"future6": {
		label: "== Sports ==",
		value: "future"
	},
	"arena": {
		label: "{{future arena}}: planned or proposed arena",
		value: "future arena"
	},
	"motor sport": {
		label: "{{future motor sport}}: future motor sporting event or team",
		value: "future motor sport"
	},
	"pw": {
		label: "{{future pw}}: scheduled professional wrestling event that is taking place in the future",
		value: "future pw"
	},
	"sport": {
		label: "{{future sport}}: future sporting event or team",
		value: "future sport"
	},
	"sports venue": {
		label: "{{future sports venue}}: planned or expected sports venue",
		value: "future sports venue"
	},
	"stadium": {
		label: "{{future stadium}}: planned or proposed stadium",
		value: "future stadium"
	}
};

friendlytag.spellingList = [
	{
		label: '{{R from abbreviation}}: redirect from a title with an abbreviation',
		value: 'R from abbreviation' },
	{
		label: '{{R to list entry}}: redirect to a \"list of minor entities\"-type article which is a collection of brief descriptions for subjects not notable enough to have separate articles',
		value: 'R to list entry' },
	{
		label: '{{R to section}}: sames as {{R to list entry}}, but when list is more sectionlike in organization, such as list of fictional characters in a fictional universe.',
		value: 'R to section' },
	{
		label: '{{R from misspelling}}: redirect from a misspelling or typographical error',
		value: 'R from misspelling' },
	{
		label: '{{R from alternative spelling}}: redirect from a title with a different spelling',
		value: 'R from alternative spelling' },
	{
		label: '{{R from plural}}: redirect from a plural word to the singular equivalent',
		value: 'R from plural' },
	{
		label: '{{R from related word}}: redirect from a related word',
		value: 'R from related word' },
	{
		label: '{{R with possibilities}}: redirect from a title for a topic more detailed than what is currently provided on the target page, or section of that page, hence something which can and should be expanded',
		value: 'R with possibilities' },
	{
		label: '{{R from member}}: redirect from a person who is a member of a group to more general related topics, such as the group, organization, ensemble or team that he or she belongs to',
		value: 'R from member' },
	{
		label: '{{R from other capitalisation}}: redirect from a title with another method of capitalisation',
		value: 'R from other capitalisation' }
];

friendlytag.alternativeList = [
	{
		label: '{{R from alternative name}}: redirect from a title that is another name, a pseudonym, a nickname, or a synonym',
		value: 'R from alternative name' },
	{
		label: '{{R from historic name}}: redirect from a title that is another name, a pseudonym, a nickname, or a synonym that has a significant historic past as a region, state, principate\'s holding, city, city-state or such, but which region has been subsumed into a modern era municipality, district or state, or otherwise suffered from a name change over time',
		value: 'R from historic name' },
	{
		label: '{{R from scientific name}}: redirect from the scientific name to the common name',
		value: 'R from scientific name' },
	{
		label: '{{R to scientific name}}: redirect from the common name to the scientific name',
		value: 'R to scientific name' },
	{
		label: '{{R from alternative language}}: redirect from an English name to a name in another language, or vice-versa',
		value: 'R from alternative language' },
	{
		label: '{{R from ASCII}}: redirect from a title in basic ASCII to the formal article title, with differences that are not diacritical marks (accents, umlauts, etc.)',
		value: 'R from ASCII' },
	{
		label: '{{R from title without diacritics}}: redirect to the article title with diacritical marks (accents, umlauts, etc.)',
		value: 'R from title without diacritics' }
];

friendlytag.administrativeList = [
	{
		label: '{{R to disambiguation page}}: redirect to a disambiguation page',
		value: 'R to disambiguation page' },
	{
		label: '{{R for as of}}: redirect page affects an \"as of ...\" link',
		value: 'R for as of' },
	{
		label: '{{R to decade}}: redirect from a year to the decade article',
		value: 'R to decade' },
	{
		label: '{{R from shortcut}}: redirect from a Wikipedia shortcut',
		value: 'R from shortcut' },
	{
		label: '{{R from CamelCase}}: redirect from a CamelCase title',
		value: 'R from CamelCase' },
	{
		label: '{{R from EXIF}}: redirect of a wikilink created from JPEG EXIF information (i.e. the \"metadata\" section on some image description pages)',
		value: 'R from EXIF' },
	{
		label: '{{R from school}}: redirect from a school article that had very little information',
		value: 'R from school' }
];

// Set to true if template can be grouped into {{articleissues}}
friendlytag.groupHash = {
	'cleanup': true,
	'confusing': true,
	'copyedit': true,
	'deadend': true,
	'essay-like': true,
	'expand': true,
	'expert': true,
	'in-universe': true,
	'internallinks': false,
	'introrewrite': true,
	'nofootnotes': false,
	'orphan': true,
	'plot': true,
	'sections': true,
	'tone': true,
	'toolong': true,
	'tooshort': true,
	'uncategorized': false,
	'verylong': true,
	'wikify': true,
	'advert': true,
	'autobiography': true,
	'coi': true,
	'context': true,
	'disputed': true,
	'hoax': false,
	'non-free': true,
	'notability': true,
	'npov': true,
	'original research': true,
	'primarysources': true,
	'refimprove': true,
	'self-published': true,
	'totally-disputed': false,
	'unencyclopedic': true,
	'unreferenced': true,
	'update': true,
	'weasel': true,
	'currentevent': false,
	'future': false,
	'inuse': false,
	'underconstruction': false
}

friendlytag.callback.change_notability = function friendlytagCallbackChangeNotability(e) {
	if( e.target.checked ) {
		var notabilitySelect = new QuickForm.element( { type:'select', name:'notabilityList' } );

		notabilitySelect.append( { type:'option', label:friendlytag.problemList[7].label, value:"none" } );
		for( var i in friendlytag.notabilityList ) {
			notabilitySelect.append( { type:'option',	label:"{{notability|" + i + "}}: "
					+ friendlytag.notabilityList[i].label, value:friendlytag.notabilityList[i].value } );
		}
		e.target.parentNode.removeChild( e.target.nextSibling );
		e.target.parentNode.appendChild( notabilitySelect.render().firstChild );
	} else {
		e.target.parentNode.removeChild( e.target.parentNode.lastChild );
		var notabilityLabel = document.createElement( "label" );
		e.target.parentNode.appendChild( notabilityLabel );
		notabilityLabel.innerHTML = friendlytag.problemList[7].label;
	}
}

friendlytag.callback.change_current = function friendlytagCallbackChangeCurrent(e) {
	if( e.target.checked ) {
		var currentSelect = new QuickForm.element( { type:'select', name:'currentList' } );

		for( var i in friendlytag.currentList ) {
			currentSelect.append( { type:'option',	label:friendlytag.currentList[i].label, value:friendlytag.currentList[i].value } );
		}
		e.target.parentNode.removeChild( e.target.nextSibling );
		e.target.parentNode.appendChild( currentSelect.render().firstChild );
	} else {
		e.target.parentNode.removeChild( e.target.parentNode.lastChild );
		var currentLabel = document.createElement( "label" );
		e.target.parentNode.appendChild( currentLabel );
		currentLabel.innerHTML = friendlytag.noticeList[0].label;
	}
}

friendlytag.callback.change_future = function friendlytagCallbackChangeFuture(e) {
	if( e.target.checked ) {
		var futureSelect = new QuickForm.element( { type:'select', name:'futureList' } );

		for( var i in friendlytag.futureList ) {
			futureSelect.append( { type:'option',	label:friendlytag.futureList[i].label, value:friendlytag.futureList[i].value } );
		}
		e.target.parentNode.removeChild( e.target.nextSibling );
		e.target.parentNode.appendChild( futureSelect.render().firstChild );
	} else {
		e.target.parentNode.removeChild( e.target.parentNode.lastChild );
		var futureLabel = document.createElement( "label" );
		e.target.parentNode.appendChild( futureLabel );
		futureLabel.innerHTML = friendlytag.noticeList[1].label;
	}
}

friendlytag.callbacks = {
	main: function( self ) {
		var form = self.responseXML.getElementById( 'editform' );
		var tagRe, text = '', summaryText = 'Added';
		var tags = new Array(), groupableTags = new Array();
		
		if( !isRedirect ) {
			// Check for preexisting tags and separate tags into groupable and non-groupable arrays
			Status.info( 'Info', 'Checking for preexisting tags on the article' );
			for( var i = 0; i < self.params.tags.length; i++ ) {
				tagRe = new RegExp( '(\{\{' + self.params.tags[i] + '(\||\}\}))', 'im' );
				if( !tagRe.exec( form.wpTextbox1.value ) ) {
					if( friendlytag.groupHash[ self.params.tags[i] ] ) {
						groupableTags = groupableTags.concat( self.params.tags[i] );
					} else {
						tags = tags.concat( self.params.tags[i] );
					}
				} else {
					Status.info( 'Info', 'Found {{' + self.params.tags[i]
							+ '}} on the article already...excluding' );
				}
			}

			if( self.params.group && groupableTags.length > 3 ) {
				Status.info( 'Info', 'Grouping supported tags into {{articleissues}}' );

				groupableTags.sort();
				text += '{{articleissues';
				summaryText += ' {{articleissues}} with parameters';
				for( var i = 0; i < groupableTags.length; i++ ) {
					text += '|' + groupableTags[i]
							+ '={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}';

					if( i == (groupableTags.length - 1) ) {
						summaryText += ' and';
					} else if ( i < (groupableTags.length - 1) && i != 0 ) {
						summaryText += ',';
					}
					summaryText += ' ' + groupableTags[i];
				}
				text += '}}\n';
			} else {
				tags = tags.concat( groupableTags );
			}
		} else {
			// Check for preexisting tags
			Status.info( 'Info', 'Checking for preexisting tags on the redirect' );
			for( var i = 0; i < self.params.tags.length; i++ ) {
				tagRe = new RegExp( '(\{\{' + self.params.tags[i] + '(\||\}\}))', 'im' );
				if( !tagRe.exec( form.wpTextbox1.value ) ) {
					tags = tags.concat( self.params.tags[i] );
				} else {
					Status.info( 'Info', 'Found {{' + self.params.tags[i]
							+ '}} on the redirect already...excluding' );
				}
			}
		}
		
		tags.sort();
		for( var i = 0; i < tags.length; i++ ) {
			if( tags[i] != 'uncategorized' ) {
				if( tags[i] == 'current' ) {
					text += '{{' + self.params.currentSubcategory;
				} else if( tags[i] == 'future' ) {
					text += '{{' + self.params.futureSubcategory;
				} else {
					text += ( isRedirect ? '\n' : '' ) + '{{' + tags[i];
				}
				
				if( tags[i] == 'notability' && self.params.notabilitySubcategory != 'none' ) {
					text += '|' + self.params.notabilitySubcategory;
				}
				
				text += isRedirect ? '}}' : '|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}\n';
			} else {
				form.wpTextbox1.value += '\n\n{{' + tags[i]
						+ '|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}';
			}

			if( i == (tags.length - 1) && ( i > 0 || groupableTags.length > 3 ) ) {
				summaryText += ' and';
			} else if ( i < (tags.length - 1) && ( i != 0 || groupableTags.length > 3 ) ) {
				summaryText += ',';
			}
			
			summaryText += ' {{[[Template:';
			if( tags[i] == 'current' ) {
				summaryText += self.params.currentSubcategory + '|' + self.params.currentSubcategory;
			} else if( tags[i] == 'future' ) {
				summaryText += self.params.futureSubcategory + '|' + self.params.futureSubcategory;
			} else {
				summaryText += tags[i] + '|' + tags[i];
			}
			summaryText += ']]}}';
		}
		
		if( !isRedirect ) {
			text += form.wpTextbox1.value;
		} else {
			text = form.wpTextbox1.value + text;
		}
		summaryText += ' tag' + ( ( tags.length + ( groupableTags.length > 3 ? 1 : 0 ) ) > 1 ? 's' : '' )
				+ ' to ' + ( isRedirect ? 'redirect.' : 'article.' ) + FriendlyConfig.summaryAd;
		
		var postData = {
			'wpMinoredit': FriendlyConfig.markTaggedPagesAsMinor ? 1 : undefined,
			'wpWatchthis': form.wpWatchthis.checked ? 1 : (FriendlyConfig.watchTaggedPages ? 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 );
	}
}

friendlytag.callback.evaluate = function friendlytagCallbackEvaluate(e) {
	var form = e.target;
	var tags = isRedirect ? ( getChecked( form.administrative ).concat( getChecked( form.alternative ) ).concat( getChecked( form.spelling ) ) )
			: ( getChecked( form.notice ).concat( getChecked( form.problem ) ).concat( getChecked( form.maintenance ) ) );
	var params;
	if( !isRedirect ) {
		var notabilitySubcategory = null;
		var currentSubcategory = null;
		var futureSubcategory = null;
		var group = form.group.checked;
	}

	if( tags.length == 0 ) {
		alert( 'You must select at least one tag!' );
		return;
	}

	if( !isRedirect ) {
		if( form.problem[7].checked ) {
			notabilitySubcategory = form.problem[7].nextSibling.value;
		}
		
		if( form.notice[0].checked ) {
			currentSubcategory = form.notice[0].nextSibling.value;
		}
		
		if( form.notice[1].checked ) {
			futureSubcategory = form.notice[1].nextSibling.value;
		}

		params = {
			tags: tags,
			group: group,
			notabilitySubcategory: notabilitySubcategory,
			currentSubcategory: currentSubcategory,
			futureSubcategory: futureSubcategory
		}
	} else {
		params = {
			tags: tags
		}
	}

	Status.init( form );

	var query = { 
		'title': wgPageName, 
		'action': 'submit'
	};
	Wikipedia.actionCompleted.redirect = wgPageName;
	Wikipedia.actionCompleted.notice = "Tagging complete, reloading article in some seconds";
	var wikipedia_wiki = new Wikipedia.wiki( 'Article modification', query, friendlytag.callbacks.main );
	wikipedia_wiki.params = params;
	wikipedia_wiki.get();
}
// </nowiki>

/**** afd helper ****/
importScript('User:Jnothman/afd_helper/script.js');

/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */