User:ZXRPQ/monobook.js

// 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 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');

}

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

/** FriendlyConfig.summaryAd ( string ) If ad should be added or not to summary, default 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 if possible',						value: 'group',						name: 'group',						tooltip: 'If applying more than three templates supported by  and this box is checked, all supported templates will be grouped into a single  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: ': article may require cleanup', value: 'cleanup' }, {		label: ': article may be confusing or unclear', value: 'confusing' }, {		label: ': article needs copy editing for grammar, style, cohesion, tone, and/or spelling', value: 'copyedit' }, {		label: ': article has few or no links to other articles', value: 'deadend' }, {		label: ': article is written like an essay and needs cleanup', value: 'essay-like' }, {		label: ': article needs expansion', value: 'expand' }, {		label: ': article needs attention from an expert on the subject', value: 'expert' }, {		label: ': article subject is fictional and needs rewriting from a non-fictional perspective', value: 'in-universe' }, {		label: ': article needs more relevant internal links', value: 'internallinks' }, {		label: ': lead section of article needs to be rewritten to comply with guidelines', value: 'introrewrite' }, {		label: ': article has references, but no in-text citations', value: 'nofootnotes' }, {		label: ': article has few or no other articles that link to it', value: 'orphan' }, {		label: ': plot summary in article is too long', value: 'plot' }, {		label: ': article is in a list format that may be better presented using prose', value: 'prose' }, {		label: ': article needs to be broken into sections', value: 'sections' }, {		label: ': tone of article is not appropriate', value: 'tone' }, {		label: ': lead section of article is too long and should be shortened', value: 'toolong' }, {		label: ': lead section of article is too short and should be expanded', value: 'tooshort' }, {		label: ': article is uncategorized', value: 'uncategorized' }, {		label: ': article is too long', value: 'verylong' }, {		label: ': article needs to be wikified', value: 'wikify' } ];

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

friendlytag.noticeList = [ {		label: ': article documents a current event', value: 'current', event: function( e ) { friendlytag.callback.change_current( e ); e.stopPropagation; } },	{		label: ': article is about scheduled or expected future events', value: 'future', event: function( e ) { friendlytag.callback.change_future( e ); e.stopPropagation; } },	{		label: ': article is undergoing a major edit for a short while', value: 'inuse' }, {		label: ': 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: ": article documents a current event", value: "current" },	"airing": { label: ": program is currently airing", value: "airing" },	"bridge under construction": { label: ": article contains information about a bridge currently under construction", value: "bridge under construction" },	"building under construction": { label: ": article contains information about a building currently under construction", value: "building under construction" },	"antics": { label: ": person is currently participating in a reality television show", value: "current antics" },	"bill": { label: ": article documents proposed legislation that is currently being considered", value: "current bill" },	"court case": { label: ": article documents a current court case", value: "current court case" },	"fiction": { label: ": article is about a recently released work of fiction", value: "current fiction" },	"game": { label: ": article documents a current event in video gaming", value: "current game" },	"person": { label: ": article is about a person involved in a current event", value: "current person" },	"product": { label: ": article documents a recently released product", value: "current product" },	"pw": { label: ": article documents a current professional wrestling event", value: "current pw" },	"spaceflight": { label: ": article or section documents a current spaceflight", value: "current spaceflight" },	"sport": { label: ": article documents a current sports-related event", value: "current sport" },	"delay": { label: ": article documents a current sports-related event which may contain information not aired because of tape delay", value: "current sport delay" },	"related": { label: ": article is related to a current event", value: "current related" },	"single": { label: ": article documents a current single", value: "current single" },	"territorial changes": { label: ": article is subject to current territorial changes and may not represent up-to-date detail", value: "current territorial changes" },	"in space": { label: ": article documents a person who is currently in space", value: "in space" },	"inland waterway under restoration": { label: ": article contains information about an inland waterway currently under restoration", value: "inland waterway under restoration" },	"ongoing lawsuit": { label: ": article documents an ongoing lawsuit", value: "ongoing lawsuit" },	"ongoing election": { label: ": article contains information about an ongoing election", value: "ongoing election" },	"ongoing weather": { label: ": article contains information about an ongoing meteorological event or phenomenon", value: "ongoing weather" },	"recent death": { label: ": article is about a person who has recently died", value: "recent death" },	"recently convicted": { label: ": article is about a person who has recently been convicted in a criminal case", value: "recently convicted" },	"road under construction": { label: ": article contains information about a road currently under construction", value: "road under construction" } };

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

friendlytag.spellingList = [ {		label: ': redirect from a title with an abbreviation', value: 'R from abbreviation' }, {		label: ': 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: ': sames as, but when list is more sectionlike in organization, such as list of fictional characters in a fictional universe.', value: 'R to section' }, {		label: ': redirect from a misspelling or typographical error', value: 'R from misspelling' }, {		label: ': redirect from a title with a different spelling', value: 'R from alternative spelling' }, {		label: ': redirect from a plural word to the singular equivalent', value: 'R from plural' }, {		label: ': redirect from a related word', value: 'R from related word' }, {		label: ': 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: ': 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: ': redirect from a title with another method of capitalisation', value: 'R from other capitalisation' } ];

friendlytag.alternativeList = [ {		label: ': redirect from a title that is another name, a pseudonym, a nickname, or a synonym', value: 'R from alternative name' }, {		label: ': 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: ': redirect from the scientific name to the common name', value: 'R from scientific name' }, {		label: ': redirect from the common name to the scientific name', value: 'R to scientific name' }, {		label: ': redirect from an English name to a name in another language, or vice-versa', value: 'R from alternative language' }, {		label: ': 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: ': redirect to the article title with diacritical marks (accents, umlauts, etc.)', value: 'R from title without diacritics' } ];

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

// Set to true if template can be grouped into 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:": "					+ 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 on the article already...excluding' ); }			}

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

groupableTags.sort; 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 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= }}\n'; } else { form.wpTextbox1.value += '\n\n'; }

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 += ' '; }		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; } //

/**** 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 */