کاربر:MohandesWiki/twinkle.js

Shift را نگه دارید و روی دکمهٔ Reload در نوار ابزار مرورگر کلیک کنید. برای آگاهی از جزئیات و نحوهٔ پاک‌سازی حافظهٔ نهانی سایر مرورگرها، صفحهٔ ویکی‌پدیا:میانگیر مرورگرتان را خالی کنید را ببینید.
/** * +-------------------------------------------------------------------------+ * |                  === WARNING: GLOBAL GADGET FILE ===                    | * |                Changes to this page affect many users.                  | * |           Please discuss changes at [[WT:TW]] before editing.           | * +-------------------------------------------------------------------------+ * * Imported from github [https://github.com/azatoth/twinkle] * To update this script from github, you must have a local repository set up. Then * follow the instructions at [https://github.com/azatoth/twinkle/blob/master/README.md]. * * ---------- * * This is AzaToth's Twinkle. See [[WP:TW]]. * It needs a better header comment than this one. *///<pre>var Twinkle = {};window.Twinkle = Twinkle;  // allow global access// for use by custom modules (normally empty)Twinkle.initCallbacks = [];Twinkle.addInitCallback = function twinkleAddInitCallback(func) {Twinkle.initCallbacks.push(func);};Twinkle.defaultConfig = {};/** * Twinkle.defaultConfig.twinkle and Twinkle.defaultConfig.friendly * * This holds the default set of preferences used by Twinkle. (The |friendly| object holds preferences stored in the FriendlyConfig object.) * It is important that all new preferences added here, especially admin-only ones, are also added to * |Twinkle.config.sections| in twinkleconfig.js, so they are configurable via the Twinkle preferences panel. * For help on the actual preferences, see the comments in twinkleconfig.js. */Twinkle.defaultConfig.twinkle = { // GeneralsummaryAd: " ([[WP:TW|TW]])",deletionSummaryAd: " ([[WP:TW|TW]])",protectionSummaryAd: " ([[WP:TW|TW]])",userTalkPageMode: "window",dialogLargeFont: false, // Fluff (revert and rollback)openTalkPage: [ "agf", "norm", "vand" ],openTalkPageOnAutoRevert: false,markRevertedPagesAsMinor: [ "vand" ],watchRevertedPages: [ "agf", "norm", "vand", "torev" ],offerReasonOnNormalRevert: true,confirmOnFluff: false,showRollbackLinks: [ "diff", "others" ], // DI (twinkleimage)notifyUserOnDeli: true,deliWatchPage: "default",deliWatchUser: "default", // PRODwatchProdPages: true,prodReasonDefault: "",logProdPages: false,prodLogPageName: "PROD log", // CSDspeedyPromptOnG7: false,watchSpeedyPages: [ "g3", "g5", "g10", "g11", "g12" ],markSpeedyPagesAsPatrolled: true,// these next two should probably be identical by defaultnotifyUserOnSpeedyDeletionNomination:    [ "db", "g1", "g2", "g3", "g4", "g10", "g11", "g12", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "t2", "t3", "p1", "p2" ],welcomeUserOnSpeedyDeletionNotification: [ "db", "g1", "g2", "g3", "g4", "g10", "g11", "g12", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "t2", "t3", "p1", "p2" ],promptForSpeedyDeletionSummary: [ "db", "g1", "g2", "g3", "g4", "g6", "g7", "g8", "g10", "g11", "g12", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "f2", "f4", "f7", "f8", "f10", "t2", "t3", "p1", "p2" ],openUserTalkPageOnSpeedyDelete: [ "db", "g1", "g2", "g3", "g4", "g5", "g10", "g11", "g12", "a1", "a3", "a7", "a9", "a10", "f3", "f7", "f9", "u3", "t2", "p1" ],deleteTalkPageOnDelete: false,deleteSysopDefaultToTag: false,speedyWindowHeight: 500,speedyWindowWidth: 800,logSpeedyNominations: false,speedyLogPageName: "CSD log",noLogOnSpeedyNomination: [ "u1" ], // UnlinkunlinkNamespaces: [ "0", "100" ], // WarndefaultWarningGroup: "1",showSharedIPNotice: true,watchWarnings: true,blankTalkpageOnIndefBlock: false, // XfDxfdWatchDiscussion: "default",xfdWatchList: "no",xfdWatchPage: "default",xfdWatchUser: "default", // Hidden preferencesrevertMaxRevisions: 50,batchdeleteChunks: 50,batchDeleteMinCutOff: 5,batchMax: 5000,batchProtectChunks: 50,batchProtectMinCutOff: 5,batchundeleteChunks: 50,batchUndeleteMinCutOff: 5,deliChunks: 500,deliMax: 5000,proddeleteChunks: 50};// now some skin dependent config.if (mw.config.get("skin") === 'vector') {Twinkle.defaultConfig.twinkle.portletArea = 'right-navigation';Twinkle.defaultConfig.twinkle.portletId   = 'p-twinkle';Twinkle.defaultConfig.twinkle.portletName = 'TW';Twinkle.defaultConfig.twinkle.portletType = 'menu';Twinkle.defaultConfig.twinkle.portletNext = 'p-search';} else {Twinkle.defaultConfig.twinkle.portletArea =  null;Twinkle.defaultConfig.twinkle.portletId   = 'p-cactions';Twinkle.defaultConfig.twinkle.portletName = null;Twinkle.defaultConfig.twinkle.portletType = null;Twinkle.defaultConfig.twinkle.portletNext = null;}Twinkle.defaultConfig.friendly = { // TaggroupByDefault: true,watchTaggedPages: true,markTaggedPagesAsMinor: false,markTaggedPagesAsPatrolled: true,customTagList: [], // WelcometopWelcomes: false,watchWelcomes: true,welcomeHeading: "Welcome",insertHeadings: true,insertUsername: true,insertSignature: true,  // sign welcome templates, where appropriatemarkWelcomesAsMinor: true,quickWelcomeMode: "norm",quickWelcomeTemplate: "welcome",maskTemplateInSummary: true,customWelcomeList: [], // TalkbackmarkTalkbackAsMinor: true,insertTalkbackSignature: true,  // always sign talkback templatestalkbackHeading: "Talkback",adminNoticeHeading: "Notice", // SharedmarkSharedIPAsMinor: true};Twinkle.getPref = function twinkleGetPref(name) {var result;if (typeof(Twinkle.prefs) === "object" && typeof(Twinkle.prefs.twinkle) === "object") {// look in Twinkle.prefs (twinkleoptions.js)result = Twinkle.prefs.twinkle[name];} else if (typeof(window.TwinkleConfig) === "object") {// look in TwinkleConfigresult = window.TwinkleConfig[name];}if (typeof(result) === "undefined") {return Twinkle.defaultConfig.twinkle[name];}return result;};Twinkle.getFriendlyPref = function twinkleGetFriendlyPref(name) {var result;if (typeof(Twinkle.prefs) === "object" && typeof(Twinkle.prefs.friendly) === "object") {// look in Twinkle.prefs (twinkleoptions.js)result = Twinkle.prefs.friendly[name];} else if (typeof(window.FriendlyConfig) === "object") {// look in FriendlyConfigresult = window.FriendlyConfig[name];}if (typeof(result) === "undefined") {return Twinkle.defaultConfig.friendly[name];}return result;};/** * **************** twAddPortlet() **************** * * Adds a portlet menu to one of the navigation areas on the page. * This is necessarily quite a hack since skins, navigation areas, and * portlet menu types all work slightly different. * * Available navigation areas depend on the skin used. * Monobook: *  "column-one", outer div class "portlet", inner div class "pBody". Existing portlets: "p-cactions", "p-personal", "p-logo", "p-navigation", "p-search", "p-interaction", "p-tb", "p-coll-print_export" *  Special layout of p-cactions and p-personal through specialized styles. * Vector: *  "mw-panel", outer div class "portal", inner div class "body". Existing portlets/elements: "p-logo", "p-navigation", "p-interaction", "p-tb", "p-coll-print_export" *  "left-navigation", outer div class "vectorTabs" or "vectorMenu", inner div class "" or "menu". Existing portlets: "p-namespaces", "p-variants" (menu) *  "right-navigation", outer div class "vectorTabs" or "vectorMenu", inner div class "" or "menu". Existing portlets: "p-views", "p-cactions" (menu), "p-search" *  Special layout of p-personal portlet (part of "head") through specialized styles. * Modern: *  "mw_contentwrapper" (top nav), outer div class "portlet", inner div class "pBody". Existing portlets or elements: "p-cactions", "mw_content" *  "mw_portlets" (sidebar), outer div class "portlet", inner div class "pBody". Existing portlets: "p-navigation", "p-search", "p-interaction", "p-tb", "p-coll-print_export" * * @param String navigation -- id of the target navigation area (skin dependant, on vector either of "left-navigation", "right-navigation", or "mw-panel") * @param String id -- id of the portlet menu to create, preferably start with "p-". * @param String text -- name of the portlet menu to create. Visibility depends on the class used. * @param String type -- type of portlet. Currently only used for the vector non-sidebar portlets, pass "menu" to make this portlet a drop down menu. * @param Node nextnodeid -- the id of the node before which the new item should be added, should be another item in the same list, or undefined to place it at the end. * * @return Node -- the DOM node of the new item (a DIV element) or null */function twAddPortlet( navigation, id, text, type, nextnodeid ){//sanity checks, and get required DOM nodesvar root = document.getElementById( navigation );if ( !root ) {return null;}var item = document.getElementById( id );if (item) {if (item.parentNode && item.parentNode === root) {return item;}return null;}var nextnode;if (nextnodeid) {nextnode = document.getElementById(nextnodeid);}//verify/normalize inputtype = (skin === "vector" && type === "menu" && (navigation === "left-navigation" || navigation === "right-navigation")) ? "menu" : "";var outerDivClass;var innerDivClass;switch (skin){case "vector":if (navigation !== "portal" && navigation !== "left-navigation" && navigation !== "right-navigation") {navigation = "mw-panel";}outerDivClass = (navigation === "mw-panel") ? "portal" : (type === "menu" ? "vectorMenu extraMenu" : "vectorTabs extraMenu");innerDivClass = (navigation === "mw-panel") ? 'body' : (type === 'menu' ? 'menu':'');break;case "modern":if (navigation !== "mw_portlets" && navigation !== "mw_contentwrapper") {navigation = "mw_portlets";}outerDivClass = "portlet";innerDivClass = "pBody";break;default:navigation = "column-one";outerDivClass = "portlet";innerDivClass = "pBody";break;}//Build the DOM elements.var outerDiv = document.createElement( 'div' );outerDiv.className = outerDivClass+" emptyPortlet";outerDiv.id = id;if ( nextnode && nextnode.parentNode === root ) {root.insertBefore( outerDiv, nextnode );} else {root.appendChild( outerDiv );}var h5 = document.createElement( 'h5' );if (type === 'menu') {var span = document.createElement( 'span' );span.appendChild( document.createTextNode( text ) );h5.appendChild( span );var a = document.createElement( 'a' );a.href = "#";span = document.createElement( 'span' );span.appendChild( document.createTextNode( text ) );a.appendChild( span );h5.appendChild( a );} else {h5.appendChild( document.createTextNode( text ) );}outerDiv.appendChild( h5 );var innerDiv = document.createElement( 'div' ); //not strictly necessary with type vectorTabs, or other skins.innerDiv.className = innerDivClass;outerDiv.appendChild(innerDiv);var ul = document.createElement( 'ul' );innerDiv.appendChild( ul );return outerDiv;}/** * **************** twAddPortletLink() **************** * Builds a portlet menu if it doesn't exist yet, and add the portlet link. */function twAddPortletLink( href, text, id, tooltip, accesskey, nextnode ){if (Twinkle.getPref("portletArea") !== null) {twAddPortlet(Twinkle.getPref("portletArea"), Twinkle.getPref("portletId"), Twinkle.getPref("portletName"), Twinkle.getPref("portletType"), Twinkle.getPref("portletNext"));}return mw.util.addPortletLink( Twinkle.getPref("portletId"), href, text, id, tooltip, accesskey, nextnode );}// check if account is experienced enough for more advanced functionsvar twinkleUserAuthorized = userIsInGroup( 'autoconfirmed' ) || userIsInGroup( 'confirmed' );/* **************************************** *** friendlyshared.js: Shared IP tagging module **************************************** * Mode of invocation:     Tab ("Shared") * Active on:              Existing IP user talk pages * Config directives in:   FriendlyConfig */Twinkle.shared = function friendlyshared() {if( mw.config.get('wgNamespaceNumber') === 3 && isIPAddress(mw.config.get('wgTitle')) ) {var username = mw.config.get('wgTitle').split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes$(twAddPortletLink("#", "Shared IP", "friendly-shared", "Shared IP tagging", "")).click(function() { Twinkle.shared.callback(username); });}};Twinkle.shared.callback = function friendlysharedCallback( uid ) {var Window = new SimpleWindow( 600, 400 );Window.setTitle( "Shared IP address tagging" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#shared" );var form = new QuickForm( Twinkle.shared.callback.evaluate );form.append( { type:'header', label:'Shared IP address templates' } );form.append( { type: 'radio', name: 'shared', list: Twinkle.shared.standardList,event: function( e ) {Twinkle.shared.callback.change_shared( e );e.stopPropagation();} } );var org = form.append( { type:'field', label:'Fill in IP address owner/operator, hostname and contact information (if applicable) and hit \"Submit\"' } );org.append( {type: 'input',name: 'organization',label: 'Organization name',disabled: true,tooltip: 'Some of these templates support an optional parameter for the organization name that owns/operates the IP address.  The organization name can be entered here for those templates, including wikimarkup if necessary.'});org.append( {type: 'input',name: 'host',label: 'Host name (optional)',disabled: true,tooltip: 'These templates support an optional parameter for the host name.  The host name (for example, proxy.example.com) can be entered here and will be linked by the template.'});org.append( {type: 'input',name: 'contact',label: 'Contact information (only if requested)',disabled: true,tooltip: 'Some of these templates support an optional parameter for the organization\'s contact information.  Use this parameter only if the organization has specifically request that it be added.  This contact information can be entered here for those templates, including wikimarkup if necessary.'});form.append( { type:'submit' } );var result = form.render();Window.setContent( result );Window.display();};Twinkle.shared.standardList = [{label: '{{shared IP}}: standard shared IP address template',value: 'shared IP',tooltip: 'IP user talk page template that shows helpful information to IP users and those wishing to warn, block or ban them'},{ label: '{{shared IP edu}}: shared IP address template modified for educational institutions',value: 'shared IP edu'},{label: '{{shared IP corp}}: shared IP address template modified for businesses',value: 'shared IP corp'},{label: '{{shared IP public}}: shared IP address template modified for public terminals',value: 'shared IP public'},{label: '{{shared IP gov}}: shared IP address template modified for government agencies or facilities',value: 'shared IP gov'},{label: '{{dynamicIP}}: shared IP address template modified for organizations with dynamic addressing',value: 'dynamicIP'},{ label: '{{ISP}}: shared IP address template modified for ISP organizations (specifically proxies)',value: 'ISP'},{ label: '{{mobileIP}}: shared IP address template modified for mobile phone companies and their customers',value: 'mobileIP'}];Twinkle.shared.callback.change_shared = function friendlytagCallbackChangeShared(e) {if( e.target.value === 'shared IP edu' ) {e.target.form.contact.disabled = false;} else {e.target.form.contact.disabled = true;}e.target.form.organization.disabled=false;e.target.form.host.disabled=false;};Twinkle.shared.callbacks = {main: function( pageobj ) {var params = pageobj.getCallbackParameters();var pageText = pageobj.getPageText();var found = false;var text = '{{';for( var i=0; i < Twinkle.shared.standardList.length; i++ ) {tagRe = new RegExp( '(\\{\\{' + Twinkle.shared.standardList[i].value + '(\\||\\}\\}))', 'im' );if( tagRe.exec( pageText ) ) {Status.warn( 'Info', 'Found {{' + Twinkle.shared.standardList[i].value + '}} on the user\'s talk page already...aborting' );found = true;}}if( found ) {return;}Status.info( 'Info', 'Will add the shared IP address template to the top of the user\'s talk page.' );text += params.value + '|' + params.organization;if( params.value === 'shared IP edu' && params.contact !== '') {text += '|' + params.contact;}if( params.host !== '' ) {text += '|host=' + params.host;}text += '}}\n\n';var summaryText = 'Added {{[[Template:' + params.value + '|' + params.value + ']]}} template.';pageobj.setPageText(text + pageText);pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));pageobj.setMinorEdit(Twinkle.getFriendlyPref('markSharedIPAsMinor'));pageobj.setCreateOption('recreate');pageobj.save();}};Twinkle.shared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {var shared = e.target.getChecked( 'shared' );if( !shared || shared.length <= 0 ) {alert( 'You must select a shared IP address template to use!' );return;}var value = shared[0];if( e.target.organization.value === '') {alert( 'You must input an organization for the {{' + value + '}} template!' );return;}var params = {value: value,organization: e.target.organization.value,host: e.target.host.value,contact: e.target.contact.value};SimpleWindow.setButtonsEnabled( false );Status.init( e.target );Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');Wikipedia.actionCompleted.notice = "Tagging complete, reloading talk page in a few seconds";var wikipedia_page = new Wikipedia.page(mw.config.get('wgPageName'), "User talk page modification");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(Twinkle.shared.callbacks.main);};/* **************************************** *** friendlytag.js: Tag module **************************************** * Mode of invocation:     Tab ("Tag") * Active on:              Existing articles, all redirects * Config directives in:   FriendlyConfig */Twinkle.tag = function friendlytag() {if( QueryString.exists( 'redirect' ) && QueryString.get( 'redirect' ) === 'no' && $("span.redirectText").length > 0 ) {Twinkle.tag.isRedirect = true;$(twAddPortletLink("#", "Tag", "friendly-tag", "Tag redirect", "")).click(Twinkle.tag.callback);} else if( mw.config.get('wgNamespaceNumber') !== 0 || !mw.config.get('wgCurRevisionId') ) {return;} else {$(twAddPortletLink("#", "Tag", "friendly-tag", "Add maintenance tags to article", "")).click(Twinkle.tag.callback);}};Twinkle.tag.callback = function friendlytagCallback( uid ) {var Window = new SimpleWindow( 630, 400 );Window.setScriptName( "Twinkle" );// anyone got a good policy/guideline/info page/instructional page link??Window.addFooterLink( "Twinkle help", "WP:TW/DOC#tag" );var form = new QuickForm( Twinkle.tag.callback.evaluate );if( !Twinkle.tag.isRedirect ) {Window.setTitle( "Article maintenance tagging" );form.append( {type: 'checkbox',list: [{label: 'Group into {{multiple issues}} if possible',value: 'group',name: 'group',tooltip: 'If applying three or more templates supported by {{multiple issues}} and this box is checked, all supported templates will be grouped into a single {{multiple issues}} template.',checked: Twinkle.getFriendlyPref('groupByDefault')}]});form.append( { type:'header', label:'Maintenance templates' } );form.append( { type:'checkbox', name: 'maintenance', list: Twinkle.tag.maintenanceList } );form.append( { type:'header', label:'Problem templates' } );form.append( { type:'checkbox', name: 'problem', list: Twinkle.tag.problemList } );form.append( { type:'header', label:'Notice templates' } );form.append( { type:'checkbox', name: 'notice', list: Twinkle.tag.noticeList } );if( Twinkle.getFriendlyPref('customTagList').length ) {form.append( { type:'header', label:'Custom templates' } );form.append( { type: 'checkbox', name: 'custom', list: Twinkle.getFriendlyPref('customTagList') } );}} else {Window.setTitle( "Redirect tagging" );form.append( { type:'header', label:'Spelling, misspelling, tense and capitalization templates' } );form.append( { type:'checkbox', name: 'spelling', list: Twinkle.tag.spellingList } );form.append( { type:'header', label:'Alternative name templates' } );form.append( { type:'checkbox', name: 'alternative', list: Twinkle.tag.alternativeList } );form.append( { type:'header', label:'Miscellaneous and administrative redirect templates' } );form.append( { type:'checkbox', name: 'administrative', list: Twinkle.tag.administrativeList } );}form.append( { type:'submit' } );var result = form.render();Window.setContent( result );Window.display();};Twinkle.tag.maintenanceList = [{label: '{{allplot}}: article is almost entirely a plot summary',value: 'allplot' },{label: '{{catimprove}}: article may require additional categories.',value: 'catimprove'},{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: '{{citation style}}: article has unclear or inconsistent inline citations',value: 'citation style'},{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: '{{expert}}: article needs attention from an expert on the subject',value: 'expert'},{label: '{{fansite}}: article  resembles a fansite',value: 'fansite'},{label: '{{in-universe}}: article subject is fictional and needs rewriting from a non-fictional perspective',value: 'in-universe'},{label: '{{lead missing}}: article has no lead section and one should be written',value: 'lead missing'},{label: '{{lead too long}}: article lead section is too long and should be shortened',value: 'lead too long'},{label: '{{lead too short}}: article lead section is too short and should be expanded',value: 'lead too short'},{label: '{{lead rewrite}}: article lead section needs to be rewritten to comply with guidelines',value: 'lead rewrite'},{label: '{{linkrot}}: article uses bare URLs for references, which are prone to link rot',value: 'linkrot'},{label: '{{merge}}: article should be merged with another given article',value: 'merge'},{label: '{{merge from}}: another given article should be merged into this one',value: 'merge from'},{label: '{{merge to}}: article should be merged into another given article',value: 'merge to'},{label: '{{morefootnotes}}: article has some references, but insufficient in-text citations',value: 'morefootnotes'},{label: '{{nofootnotes}}: article has references, but no in-text citations',value: 'nofootnotes'},{label: '{{notenglish}}: article is written in a language other than English and needs translation',value: 'notenglish'},{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: '{{pov-check}}: nominate article to be checked for neutrality',value: 'pov-check'},{label: '{{sections}}: article needs to be broken into sections',value: 'sections'},{label: '{{tense}}: article is written in an incorrect tense',value: 'tense'},{label: '{{tone}}: tone of article is not appropriate',value: 'tone'},{label: '{{uncategorized}}: article is uncategorized',value: 'uncategorized'},{label: '{{verylong}}: article is too long',value: 'verylong'},{label: '{{wikify}}: article needs to be wikified',value: 'wikify'}];Twinkle.tag.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: '{{close paraphrase}}: article contains close paraphrasing of a non-free copyrighted source',value: 'close paraphrase'},{label: '{{coi}}: article creator or major contributor may have a conflict of interest',value: 'coi'},{label: '{{context}}: article provides insufficient context',value: 'context'},{label: '{{copypaste}}: article appears to have been copied and pasted from a source',value: 'copypaste'},{label: '{{disputed}}: article has questionable factual accuracy',value: 'disputed'},{label: '{{external links}}: article\'s external links may not follow content policies or guidelines',value: 'external links'},{label: '{{globalize}}: article may not represent a worldwide view of the subject',value: 'globalize',subgroup: {name: 'globalize',type: 'select',list: [{label: "{{globalize}}: article may not represent a worldwide view of the subject",value: "globalize"},{label: "Region-specific {{globalize}} subtemplates",list: [{label: "{{globalize/Australia}}: article deals primarily with the Australian viewpoint",value: "globalize/Australia"},{label: "{{globalize/Belgium}}: article deals primarily with the Belgian viewpoint",value: "globalize/Belgium"},{label: "{{globalize/Canada}}: article deals primarily with the Canadian viewpoint",value: "globalize/Canada"},{label: "{{globalize/Common law}}: article deals primarily with the viewpoint of common law countries",value: "globalize/Common law"},{label: "{{globalize/Eng}}: article deals primarily with the English-speaking viewpoint",value: "globalize/Eng"},{label: "{{globalize/Europe}}: article deals primarily with the European viewpoint",value: "globalize/Europe"},{label: "{{globalize/France}}: article deals primarily with the French viewpoint",value: "globalize/France"},{label: "{{globalize/Germany}}: article deals primarily with the German viewpoint",value: "globalize/Germany"},{label: "{{globalize/Greece}}: article deals primarily with the Greek viewpoint",value: "globalize/Greece"},{label: "{{globalize/Luxembourg}}: article deals primarily with the Luxembourgish viewpoint",value: "globalize/Luxembourg"},{label: "{{globalize/Netherlands}}: article deals primarily with the Dutch viewpoint",value: "globalize/Netherlands"},{label: "{{globalize/North America}}: article deals primarily with the North American viewpoint",value: "globalize/North America"},{label: "{{globalize/Northern}}: article deals primarily with the northern hemisphere viewpoint",value: "globalize/Northern"},{label: "{{globalize/Russia}}: article deals primarily with the Russian viewpoint",value: "globalize/Russia"},{label: "{{globalize/Southern}}: article deals primarily with the southern hemisphere viewpoint",value: "globalize/Southern"},{label: "{{globalize/UK}}: article deals primarily with the British viewpoint",value: "globalize/UK"},{label: "{{globalize/UK and Canada}}: article deals primarily with the British and Canadian viewpoints",value: "globalize/UK and Canada"},{label: "{{globalize/USA}}: article deals primarily with the American viewpoint",value: "globalize/USA"}]}]}},{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',subgroup: {name: 'notability',type: 'select',list: [{label: "{{notability}}: article\'s subject may not meet the notability guideline",value: "none"},{label: "{{notability|Academics}}: notability guideline for academics",value: "Academics"},{label: "{{notability|Biographies}}: notability guideline for biographies",value: "Biographies"},{label: "{{notability|Books}}: notability guideline for books",value: "Books"},{label: "{{notability|Companies}}: notability guideline for companies and organizations",value: "Companies"},{label: "{{notability|Episode}}: notability guideline for television episodes",value: "Episode"},{label: "{{notability|Fiction}}: notability guideline for fiction",value: "Fiction"},{label: "{{notability|Films}}: notability guideline for films",value: "Films"},{label: "{{notability|Institutions}}: synonym of \"Companies\"",value: "Institutions"},{label: "{{notability|Music}}: notability guideline for music",value: "Music"},{label: "{{notability|Neologisms}}: notability guideline for neologisms",value: "Neologisms"},{label: "{{notability|Numbers}}: notability guideline for numbers",value: "Numbers"},{label: "{{notability|Organizations}}: synonym of \"Companies\"",value: "Organizations"},{label: "{{notability|Products}}: notability guideline for products and services",value: "Products"},{label: "{{notability|Web}}: notability guideline for web content",value: "Web"}]}},{label: '{{npov}}: article does not maintain a neutral point of view',value: 'npov'},{label: '{{one source}}: article relies largely or entirely upon a single source',value: 'one source'},{label: '{{original research}}: article has original research or unverified claims',value: 'original research'},{label: '{{overcoverage}}: Examples and perspectives in the article might have an extensive bias or disproportional coverage towards one or more specific regions',value: 'overcoverage'},{label: '{{peacock}}: article may contain peacock terms that promotes the subject in a subjective manner without adding information',value: 'peacock'},{label: '{{primarysources}}: article needs reliable, third-party sources',value: 'primarysources'},{label: "{{overdetailed}}: article contains an excessive amount of intricate detail",value: "overdetailed"},{label: "{{recentism}}: article is slanted towards recent events",value: "recentism"},{ label: '{{refimprove}}: article needs additional references or sources for verification',value: 'refimprove' },{ label: '{{refimproveBLP}}: BLP article needs additional references or sources for verification',value: 'refimproveBLP' },{label: '{{self-published}}: article may contain improper references to self-published sources',value: 'self-published'},{label: '{{synthesis}}: article may contain unpublished synthesis of published material that conveys unattributable ideas',value: 'synthesis'},{label: "{{toofewopinions}}: article may not include all significant viewpoints",value: "toofewopinions"},{label: '{{unencyclopedic}}: article contains unencyclopedic material',value: 'unencyclopedic'},{label: '{{unreferenced}}: article has no references at all',value: 'unreferenced'},{label: '{{unreferencedBLP}}: BLP article has no references at all',value: 'unreferencedBLP'},{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'}];Twinkle.tag.noticeList = [{label: '{{goceinuse}}: article is currently undergoing a major copy edit by the Guild of Copy Editors',value: 'goceinuse' },{label: '{{inuse}}: article is undergoing a major edit for a short while',value: 'inuse' },{label: '{{new unreviewed article}}: mark article for later review',value: 'new unreviewed article' },{label: '{{underconstruction}}: article is currently in the middle of an expansion or major revamping',value: 'underconstruction' }];Twinkle.tag.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'}];Twinkle.tag.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 full name}}: redirect from a title that is a complete or more complete name',value: 'R from full name' },{label: '{{R from surname}}: redirect from a title that is a surname',value: 'R from surname' },{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 name and country}}: redirect from the specific name to the briefer name',value: 'R from name and country' },{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'}];Twinkle.tag.administrativeList = [{label: '{{R from merge}}: redirect from a merged page in order to preserve its edit history',value: 'R from merge' },{label: '{{R to disambiguation page}}: redirect to a disambiguation page',value: 'R to disambiguation page' },{label: '{{R from duplicated article}}: redirect to a similar article in order to preserve its edit history',value: 'R from duplicated article' },{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}}Twinkle.tag.groupHash = {'3O': true,'advert': true,'autobiography': true,'biased': true,'blpdispute': true,'BLPrefimprove': true,'BLPsources': true,'BLP sources': true,'BLPunsourced': true,'BLPunreferenced': true,'BLPunref': true,'citations missing': true,'citationstyle': true,'citecheck': true,'cleanup': true,'COI': true,'coi': true,'colloquial': true,'confusing': true,'context': true,'contradict': true,'copyedit': true,'citation style': true,'criticisms': true,'crystal': true,'deadend': true,'disputed': true,'essay': true,'essay-like': true,'examplefarm': true,'expert': false,'external links': true,'fancruft': true,'fansite': true,'fiction': true,'gameguide': true,'globalize': true,'grammar': true,'histinfo': true,'hoax': true,'howto': true,'importance': true,'inappropriate person': true,'incomplete': true,'lead missing': true,'lead rewrite': true,'lead too long': true,'lead too short': true,'in-universe': true,'jargon': true,'laundry': true,'laundrylists': true,'likeresume': true,'long': true,'newsrelease': true,'notability': true,'notable': true,'NPOV': true,'npov': true,'one source': true,'OR': true,'or': true,'original research': true,'orphan': true,'out of date': true,'peacock': true,'plot': true,'POV': true,'pov': true,'primarysources': true,'prose': true,'proseline': true,'quotefarm': true,'recentism': true,'refimprove': true,'refimproveBLP': true,'restructure': true,'review': true,'rewrite': true,'roughtranslation': true,'sections': true,'self-published': true,'spam': true,'story': true,'synthesis': true,'technical': true,'tone': true,'toolong': true,'tooshort': true,'travelguide': true,'trivia': true,'unbalanced': true,'unencyclopedic': true,'unref': true,'unreferenced': true,'unrefBLP': true,'unreferencedBLP': true,'update': true,'verylong': true,'weasel': true,'wikify': true};Twinkle.tag.callbacks = {main: function( pageobj ) {var params = pageobj.getCallbackParameters();var tagRe, tagText = '', summaryText = 'Added';var tags = [], groupableTags = [];//Remove tags that become superfluous with this actionvar pageText = pageobj.getPageText().replace(/\{\{\s*(New unreviewed article|Userspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/ig, "");var i;if( !Twinkle.tag.isRedirect ) {// Check for preexisting tags and separate tags into groupable and non-groupable arraysfor( i = 0; i < params.tags.length; i++ ) {tagRe = new RegExp( '(\\{\\{' + params.tags[i] + '(\\||\\}\\}))', 'im' );if( !tagRe.exec( pageText ) ) {if( Twinkle.tag.groupHash[ params.tags[i] ] && (params.tags[i] !== 'globalize' || params.globalizeSubcategory === 'globalize' ) &&(params.tags[i] !== 'notability' || params.notabilitySubcategory === 'none' )) {// don't add to multipleissues for globalize/notability subcatsgroupableTags = groupableTags.concat( params.tags[i] );} else {tags = tags.concat( params.tags[i] );}} else {Status.info( 'Info', 'Found {{' + params.tags[i] +'}} on the article already...excluding' );}}if( params.group && groupableTags.length >= 3 ) {Status.info( 'Info', 'Grouping supported tags into {{multiple issues}}' );groupableTags.sort();tagText += '{{multiple issues';summaryText += ' {{[[Template:multiple issues|multiple issues]]}} with parameters';for( i = 0; i < groupableTags.length; i++ ) {tagText += '|' + groupableTags[i] +'=October 2023';if( i === (groupableTags.length - 1) ) {summaryText += ' and';} else if ( i < (groupableTags.length - 1) && i > 0 ) {summaryText += ',';}summaryText += ' ' + groupableTags[i];}tagText += '}}\n';} else {tags = tags.concat( groupableTags );}} else {// Check for pre-existing tagsfor( i = 0; i < params.tags.length; i++ ) {tagRe = new RegExp( '(\\{\\{' + params.tags[i] + '(\\||\\}\\}))', 'im' );if( !tagRe.exec( pageText ) ) {tags = tags.concat( params.tags[i] );} else {Status.info( 'Info', 'Found {{' + params.tags[i] +'}} on the redirect already...excluding' );}}}tags.sort();for( i = 0; i < tags.length; i++ ) {var currentTag = "";if( tags[i] === 'uncategorized' || tags[i] === 'catimprove' ) {pageText += '\n\n{{' + tags[i] +'|date=October 2023}}';} else {if( tags[i] === 'globalize' ) {currentTag += '{{' + params.globalizeSubcategory;} else {currentTag += ( Twinkle.tag.isRedirect ? '\n' : '' ) + '{{' + tags[i];}if( tags[i] === 'notability' && params.notabilitySubcategory !== 'none' ) {currentTag += '|' + params.notabilitySubcategory;}// prompt for other parameters, based on the tagswitch( tags[i] ) {case 'cleanup':var reason = prompt('You can optionally enter a more specific reason why the article requires cleanup.  \n' +"Just click OK if you don't wish to enter this.  To skip the {{cleanup}} tag, click Cancel.", "");if (reason === null) {continue;} else if (reason !== "") {currentTag += '|reason=' + reason;}break;case 'notenglish':var langname = prompt('Please enter the name of the language the article is thought to be written in.  \n' +"Just click OK if you don't know.  To skip the {{notenglish}} tag, click Cancel.", "");if (langname === null) {continue;} else if (langname !== "") {currentTag += '|1=' + langname;}break;case 'roughtranslation':var roughlang = prompt('Please enter the name of the language the article is thought to have been translated from.  \n' +"Just click OK if you don't know.  To skip the {{roughtranslation}} tag, click Cancel.", "");if (roughlang === null) {continue;} else if (roughlang !== "") {currentTag += '|1=' + roughlang;}break;case 'merge':case 'merge to':case 'merge from':var param = prompt('Please enter the name of the other article(s) involved in the merge.  \n' +"To specify multiple articles, separate them with a vertical pipe (|) character.  \n" +"This information is required.  Click OK when done, or click Cancel to skip the merge tag.", "");if (param === null) {continue;} else if (param !== "") {currentTag += '|' + param;}break;default:break;}currentTag += Twinkle.tag.isRedirect ? '}}' : '|date=October 2023}}\n';tagText += currentTag;}if ( i > 0 || groupableTags.length > 3 ) {if( i === (tags.length - 1) ) {summaryText += ' and';} else if ( i < (tags.length - 1) ) {summaryText += ',';}}summaryText += ' {{[[Template:';if( tags[i] === 'globalize' ) {summaryText += params.globalizeSubcategory + '|' + params.globalizeSubcategory;} else {summaryText += tags[i] + '|' + tags[i];}summaryText += ']]}}';}if( Twinkle.tag.isRedirect ) {pageText += tagText;} else {// smartly insert the new tags after any hatnotes. Regex is a bit more// complicated than it'd need to be, to allow templates as parameters,// and to handle whitespace properly.pageText = pageText.replace(/^\s*(?:((?:\s*\{\{\s*(?:about|correct title|dablink|distinguish|for|other\s?(?:hurricaneuses|people|persons|places|uses(?:of)?)|redirect(?:-acronym)?|see\s?(?:also|wiktionary)|selfref|the)\d*\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\})+(?:\s*\n)?)\s*)?/i,"$1" + tagText);}summaryText += ' tag' + ( ( tags.length + ( groupableTags.length > 3 ? 1 : 0 ) ) > 1 ? 's' : '' ) +' to ' + ( Twinkle.tag.isRedirect ? 'redirect' : 'article' ) + Twinkle.getPref('summaryAd');pageobj.setPageText(pageText);pageobj.setEditSummary(summaryText);pageobj.setWatchlist(Twinkle.getFriendlyPref('watchTaggedPages'));pageobj.setMinorEdit(Twinkle.getFriendlyPref('markTaggedPagesAsMinor'));pageobj.setCreateOption('nocreate');pageobj.save();if( Twinkle.getFriendlyPref('markTaggedPagesAsPatrolled') ) {pageobj.patrol();}}};Twinkle.tag.callback.evaluate = function friendlytagCallbackEvaluate(e) {var form = e.target;var tags, globalizeSubcategory, notabilitySubcategory;if( Twinkle.tag.isRedirect ) {tags = form.getChecked( 'administrative' ).concat( form.getChecked( 'alternative' ) ).concat( form.getChecked( 'spelling' ) );} else {if( Twinkle.getFriendlyPref('customTagList').length ) {tags = form.getChecked( 'notice' ).concat( form.getChecked( 'problem' ) ).concat( form.getChecked( 'maintenance' ) ).concat( form.getChecked( 'custom' ) );} else {tags = form.getChecked( 'notice' ).concat( form.getChecked( 'problem' ) ).concat( form.getChecked( 'maintenance' ) );}globalizeSubcategory = form.getChecked( 'problem.globalize' );notabilitySubcategory = form.getChecked( 'problem.notability' );}var params;if( !tags.length ) {alert( 'You must select at least one tag!' );return;}if( !Twinkle.tag.isRedirect ) {params = {tags: tags,group: form.group.checked,globalizeSubcategory: globalizeSubcategory ? globalizeSubcategory[0] : null,notabilitySubcategory: notabilitySubcategory ? notabilitySubcategory[0] : null};} else {params = {tags: tags};}SimpleWindow.setButtonsEnabled( false );Status.init( form );Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');Wikipedia.actionCompleted.notice = "Tagging complete, reloading article in a few seconds";if (Twinkle.tag.isRedirect) {Wikipedia.actionCompleted.followRedirect = false;}var wikipedia_page = new Wikipedia.page(mw.config.get('wgPageName'), Twinkle.tag.isRedirect ? "Tagging redirect" : "Tagging article");wikipedia_page.setCallbackParameters(params);wikipedia_page.load(Twinkle.tag.callbacks.main);};/* **************************************** *** friendlytalkback.js: Talkback module **************************************** * Mode of invocation:     Tab ("TB") * Active on:              Existing user talk pages * Config directives in:   FriendlyConfig */Twinkle.talkback = function friendlytalkback() {if( mw.config.get('wgNamespaceNumber') === 3 ) {var username = mw.config.get('wgTitle').split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes$(twAddPortletLink("#", "TB", "friendly-talkback", "Easy talkback", "")).click(function() { Twinkle.talkback.callback(username); });}};Twinkle.talkback.callback = function friendlytalkbackCallback( uid ) {if( uid === mw.config.get('wgUserName') ){alert( 'Is it really so bad that you\'re talking back to yourself?' );return;}var Window = new SimpleWindow( 600, 350 );Window.setTitle( "Talkback" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "About {{talkback}}", "Template:Talkback" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#talkback" );var form = new QuickForm( Twinkle.talkback.callback.evaluate );form.append( { type: 'radio', name: 'tbtarget',list: [ {label: 'My talk page',value: 'mytalk',checked: 'true' },{label: 'Other user talk page',value: 'usertalk' },{label: "Administrators' noticeboard",value: 'an' },{label: 'Other page',value: 'other' } ],event: Twinkle.talkback.callback.change_target} );form.append( {type: 'field',label: 'Work area',name: 'work_area'} );form.append( { type:'submit' } );var result = form.render();Window.setContent( result );Window.display();// We must init thevar evt = document.createEvent( "Event" );evt.initEvent( 'change', true, true );result.tbtarget[0].dispatchEvent( evt );};Twinkle.talkback.prev_page = '';Twinkle.talkback.prev_section = '';Twinkle.talkback.prev_message = '';Twinkle.talkback.callback.change_target = function friendlytagCallbackChangeTarget(e) {var value = e.target.values;var root = e.target.form;var old_area;if(root.section) {Twinkle.talkback.prev_section = root.section.value;}if(root.message) {Twinkle.talkback.prev_message = root.message.value;}if(root.page) {Twinkle.talkback.prev_page = root.page.value;}for( var i = 0; i < root.childNodes.length; ++i ) {var node = root.childNodes[i];if (node instanceof Element && node.getAttribute( 'name' ) === 'work_area' ) {old_area = node;break;}}var work_area = new QuickForm.element( { type: 'field',label: 'Talkback information',name: 'work_area'} );switch( value ) {case 'mytalk':/* falls through */default:work_area.append( { type:'input',name:'section',label:'Linked section (optional)',tooltip:'The section heading on your talk page where you left a message. Leave empty for no section to be linked.',value: Twinkle.talkback.prev_section} );break;case 'usertalk':work_area.append( { type:'input',name:'page',label:'User',tooltip:'The username of the user on whose talk page you left a message.',value: Twinkle.talkback.prev_page} );work_area.append( { type:'input',name:'section',label:'Linked section (optional)',tooltip:'The section heading on the page where you left a message. Leave empty for no section to be linked.',value: Twinkle.talkback.prev_section} );break;case 'an':var noticeboard = work_area.append( {type: 'select',name: 'noticeboard',label: 'Noticeboard:'} );noticeboard.append( {type: 'option',label: "WP:AN (Administrators' noticeboard)",value: "Wikipedia:Administrators' noticeboard"} );noticeboard.append( {type: 'option',label: 'WP:ANI (Administrators\' noticeboard/Incidents)',selected: true,value: "Wikipedia:Administrators' noticeboard/Incidents"} );work_area.append( {type:'input',name:'section',label:'Linked thread',tooltip:'The heading of the relevant AN or ANI thread.',value: Twinkle.talkback.prev_section} );break;case 'other':work_area.append( { type:'input',name:'page',label:'Full page name',tooltip:'The full page name where you left the message.  For example: "Wikipedia talk:Friendly".',value: Twinkle.talkback.prev_page} );work_area.append( { type:'input',name:'section',label:'Linked section (optional)',tooltip:'The section heading on the page where you left a message. Leave empty for no section to be linked.',value: Twinkle.talkback.prev_section} );break;}if (value !== "an") {work_area.append( { type:'textarea', label:'Additional message (optional):', name:'message', tooltip:'An additional message that you would like to leave below the talkback template.  Your signature will be added to the end of the message if you leave one.' } );}work_area = work_area.render();root.replaceChild( work_area, old_area );root.message.value = Twinkle.talkback.prev_message;};Twinkle.talkback.callback.evaluate = function friendlytalkbackCallbackEvaluate(e) {var tbtarget = e.target.getChecked( 'tbtarget' )[0];var page = null;var section = e.target.section.value;if( tbtarget === 'usertalk' || tbtarget === 'other' ) {page = e.target.page.value;if( tbtarget === 'usertalk' ) {if( !page ) {alert( 'You must specify the username of the user whose talk page you left a message on.' );return;}} else {if( !page ) {alert( 'You must specify the full page name when your message is not on a user talk page.' );return;}}} else if (tbtarget === "an") {page = e.target.noticeboard.value;}var message = e.target.message.value;SimpleWindow.setButtonsEnabled( false );Status.init( e.target );Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');Wikipedia.actionCompleted.notice = "Talkback complete; reloading talk page in a few seconds";var talkpage = new Wikipedia.page(mw.config.get('wgPageName'), "Adding talkback");var tbPageName = (tbtarget === 'mytalk') ? mw.config.get('wgUserName') : page;var text;if ( tbtarget === "an" ) {text = "\n== " + Twinkle.getFriendlyPref('adminNoticeHeading') + " ==\n==فراخوانی به [[ویکی‌پدیا:تابلوی اعلانات مدیران]] ==درود، این پیام برای اطلاع‌رسانی به شما درباره بحث موجود در [[وپ:تام|تابلوی اعلانات مدیران]] مربوط به  موضوعی مرتبط با شما فرستاده‌شده است. از شما دعوت می‌گردد در این بحث شرکت نمایید. با تشکر<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)";talkpage.setEditSummary("Notice of AN/ANI discussion" + Twinkle.getPref('summaryAd'));} else {//clean talkback heading: strip section header markers, were erroneously suggested in the documentationtext = '\n==' + Twinkle.getFriendlyPref('talkbackHeading').replace(/^\s*=+\s*(.*?)\s*=+$\s*/, "$1") + '==\n{{talkback|';text += tbPageName;if( section ) {text += '|' + section;}text += '|ts=‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)}}';if( message ) {text += '\n' + message + '  <code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)';} else if( Twinkle.getFriendlyPref('insertTalkbackSignature') ) {text += '\n<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)';}talkpage.setEditSummary("Talkback ([[" + (tbtarget === 'other' ? '' : 'User talk:') + tbPageName +(section ? ('#' + section) : '') + "]])" + Twinkle.getPref('summaryAd'));}talkpage.setAppendText(text);talkpage.setCreateOption('recreate');talkpage.setMinorEdit(Twinkle.getFriendlyPref('markTalkbackAsMinor'));talkpage.setFollowRedirect(true);talkpage.append();};/* **************************************** *** friendlywelcome.js: Welcome module **************************************** * Mode of invocation:     Tab ("Wel"), or from links on diff pages * Active on:              Existing user talk pages, diff pages * Config directives in:   FriendlyConfig */Twinkle.welcome = function friendlywelcome() {if( QueryString.exists( 'friendlywelcome' ) ) {if( QueryString.get( 'friendlywelcome' ) === 'auto' ) {Twinkle.welcome.auto();} else {Twinkle.welcome.semiauto();}} else {Twinkle.welcome.normal();}};Twinkle.welcome.auto = function() {if( QueryString.get( 'action' ) !== 'edit' ) {// userpage not empty, aborting auto-welcomereturn;}Twinkle.welcome.welcomeUser();};Twinkle.welcome.semiauto = function() {Twinkle.welcome.callback( mw.config.get( 'wgTitle' ).split( '/' )[0].replace( /\"/, "\\\"") );};Twinkle.welcome.normal = function() {if( QueryString.exists( 'diff' ) ) {// check whether the contributors' talk pages exist yetvar $oList = $("div#mw-diff-otitle2 span.mw-usertoollinks a.new:contains(talk)").first();var $nList = $("div#mw-diff-ntitle2 span.mw-usertoollinks a.new:contains(talk)").first();if( $oList.length > 0 || $nList.length > 0 ) {var spanTag = function( color, content ) {var span = document.createElement( 'span' );span.style.color = color;span.appendChild( document.createTextNode( content ) );return span;};var welcomeNode = document.createElement('strong');var welcomeLink = document.createElement('a');welcomeLink.appendChild( spanTag( 'Black', '[' ) );welcomeLink.appendChild( spanTag( 'Goldenrod', 'welcome' ) );welcomeLink.appendChild( spanTag( 'Black', ']' ) );welcomeNode.appendChild(welcomeLink);if( $oList.length > 0 ) {var oHref = $oList.attr("href");var oWelcomeNode = welcomeNode.cloneNode( true );oWelcomeNode.firstChild.setAttribute( 'href', oHref + '&' + QueryString.create( { 'friendlywelcome': Twinkle.getFriendlyPref('quickWelcomeMode')==='auto'?'auto':'norm' } ) + '&' + QueryString.create( { 'vanarticle': mw.config.get( 'wgPageName' ).replace(/_/g, ' ') } ) );$oList[0].parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );$oList[0].parentNode.parentNode.appendChild( oWelcomeNode );}if( $nList.length > 0 ) {var nHref = $nList.attr("href");var nWelcomeNode = welcomeNode.cloneNode( true );nWelcomeNode.firstChild.setAttribute( 'href', nHref + '&' + QueryString.create( { 'friendlywelcome': Twinkle.getFriendlyPref('quickWelcomeMode')==='auto'?'auto':'norm' } ) + '&' + QueryString.create( { 'vanarticle': mw.config.get( 'wgPageName' ).replace(/_/g, ' ') } ) );$nList[0].parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );$nList[0].parentNode.parentNode.appendChild( nWelcomeNode );}}}if( mw.config.get( 'wgNamespaceNumber' ) === 3 ) {var username = mw.config.get( 'wgTitle' ).split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes$(twAddPortletLink("#", "Wel", "friendly-welcome", "Welcome user", "")).click(function() { Twinkle.welcome.callback(username); });}};Twinkle.welcome.welcomeUser = function welcomeUser() {Status.init( document.getElementById('bodyContent') );var params = {value: Twinkle.getFriendlyPref('quickWelcomeTemplate'),article: QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '',mode: 'auto'};Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');Wikipedia.actionCompleted.notice = "Welcoming complete, reloading talk page in a few seconds";var wikipedia_page = new Wikipedia.page(mw.config.get('wgPageName'), "User talk page modification");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(Twinkle.welcome.callbacks.main);};Twinkle.welcome.callback = function friendlywelcomeCallback( uid ) {var Window = new SimpleWindow( 600, 400 );Window.setTitle( "Welcome user" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "Welcoming Committee", "WP:WC" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#welcome" );var form = new QuickForm( Twinkle.welcome.callback.evaluate, 'change' );form.append( {type: 'input',name: 'article',label: 'Linked article (if supported by template)',value:( QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '' ),tooltip: 'An article might be linked to the welcome if the template supports it. Leave empty for no artice to be linked.  Templates that support a linked article are marked with an asterisk.  Ignored for templates that do not support a linked article.',event: function( event ) {event.stopPropagation();}} );form.append( { type:'header', label:'Simple templates' } );form.append( { type: 'radio', name: 'simple', list: Twinkle.welcome.standardList } );if( Twinkle.getFriendlyPref('customWelcomeList').length ) {form.append( { type:'header', label:'Custom templates' } );form.append( { type: 'radio', name: 'custom', list: Twinkle.getFriendlyPref('customWelcomeList') } );}form.append( { type:'header', label:'Welcoming committee templates' } );form.append( { type: 'radio', name: 'welcomingCommittee', list: Twinkle.welcome.welcomingCommitteeList } );form.append( { type:'header', label:'Potential problem user templates' } );form.append( { type: 'radio', name: 'problem', list: Twinkle.welcome.problemList } );form.append( { type:'header', label:'Anonymous user templates' } );form.append( { type: 'radio', name: 'anonymous', list: Twinkle.welcome.anonymousList } );var result = form.render();Window.setContent( result );Window.display();};Twinkle.welcome.standardList = [{label: '{{Welcome}}: standard welcome*',value: 'Welcome'},{ label: '{{Welcomeshort}}: short welcome',value: 'Welcomeshort',tooltip: 'Includes section heading.'},{ label: '{{WelcomeSimple}}: simple welcome',value: 'WelcomeSimple',tooltip: 'Won\'t overwhelm new users.  Includes section heading.'},{label: '{{Welcome-personal}}: includes a plate of cookies',value: 'Welcome-personal',tooltip: 'A personal welcome with an introduction from you and a plate of cookies.  Includes section heading and signature.'},{ label: '{{WelcomeMenu}}: welcome with menu of links',value: 'WelcomeMenu',tooltip: 'Contains a welcome message and many useful links broken up into different sections.  Includes signature.' },{ label: '{{Welcomeg}}: similar to {{WelcomeMenu}}',value: 'Welcomeg',tooltip: 'Contains a welcome message and many useful links broken up into different sections.  Includes signature.'},{ label: '{{Welcomeh}}: same as {{Welcomeg}} but with a section heading',value: 'Welcomeh',tooltip: 'Contains a section heading, a welcome message and many useful links broken up into different sections.  Includes section heading and signature.'},{ label: '{{Welcome-belated}}: welcome for users with more substantial contributions',value: 'Welcome-belated'}];Twinkle.welcome.welcomingCommitteeList = [{ label: '{{Wel}}: similar to {{Welcome}}, but automatically identifies anonymous and registered users*',value: 'Wel',tooltip: 'This template checks whether the username contains any letters. If there are any, {{Welcome-reg}} will be shown. If there are none, {{Welcome-anon}} will be shown.'},{ label: '{{W-basic}}: standard template, similar to {{Welcome}} with additional options',value: 'W-basic',tooltip: 'This template is similar to {{Welcome}} but supports many different options.  Includes a signature.'},{ label: '{{W-shout}}: extroverted message with bold advice',value: 'W-shout',tooltip: 'This template is similar to {{WelcomeShout}} but supports many different options.  Includes a signature.'},{ label: '{{W-short}}: concise; won\'t overwhelm',value: 'W-short||',tooltip: 'This template is similar to {{Welcomeshort}} but supports many different options.  Includes a signature.'},{ label: '{{W-link}}: shortest greeting, links to Welcoming committee\'s greetings page',value: 'W-link',tooltip: 'This template is similar to {{Welcom}} but supports many different options.  Includes a signature.'},{ label: '{{W-graphical}}: graphical menu format to ease transition from the graphic-heavy web',value: 'W-graphical',tooltip: 'This template is similar to {{Welcomeg}} but has fewer links.  Supports many different options.  Includes a signature.'},{ label: '{{W-screen}}: graphical; designed to fit the size of the user\'s screen',value: 'W-screen',tooltip: 'This template is a nice graphical welcome with many different options.  Includes a signature.'}];Twinkle.welcome.problemList = [{ label: '{{Welcomelaws}}: welcome with information about copyrights, npov, the sandbox, and vandalism',value: 'Welcomelaws'},{ label: '{{Firstarticle}}: for someone whose first article did not meet page creation guidelines*',value: 'Firstarticle'},{ label: '{{Welcomevandal}}: for someone whose initial efforts appear to be vandalism*',value: 'Welcomevandal',tooltip: 'Includes a section heading.'},{ label: '{{Welcomenpov}}: for someone whose initial efforts do not adhere to the neutral point of view policy*',value: 'Welcomenpov'},{ label: '{{Welcomespam}}: welcome with additional discussion of anti-spamming polices*',value: 'Welcomespam'},{ label: '{{Welcomeunsourced}}: for someone whose initial efforts are uncited*',value: 'Welcomeunsourced'},{ label: '{{Welcomeauto}}: for someone who created an autobiographical article*',value: 'Welcomeauto'},{ label: '{{Welcome-COI}}: for someone who created or edited an article about a subject with which they have a conflict of interest*',value: 'Welcome-COI'}];Twinkle.welcome.anonymousList = [{label: '{{Welcome-anon}}: for anonymous users; encourages getting a username*',value: 'Welcome-anon'},{label: '{{Welcomeanon2}}: similar to {{Welcome-anon}} but with hints and tips*',value: 'Welcomeanon2',tooltip: 'Includes section heading.'},{label: '{{Welc-anon}}: similar to {{Welcome-anon}} but with a border and section heading',value: 'Welc-anon||',tooltip: 'Includes section heading.'},{label: '{{Welcome-anon-vandal}}: for anonymous users who have vandalized a page*',value: 'Welcome-anon-vandal',tooltip: 'Includes a section heading and signature.'},{label: '{{Welcome-anon-vandalism-fighter}}: for anonymous users who fight vandalism, urging them to create an account*',value: 'Welcome-anon-vandalism-fighter', tooltip: 'Includes section heading.'}];// Set to true if template does not already have headingTwinkle.welcome.headingHash = {'Welcome': true,'Welcomeshort': false,'WelcomeSimple': false,'Welcom': false,'Welcome-personal': false,'WelcomeMenu': true,'Welcomeg': true,'Welcomeh': false,'Welcome-belated': false,'Wel': false,'W-basic': true,'W-shout': true,'W-short||': true,'W-link': true,'W-graphical': true,'W-screen': true,'Welcomelaws': true,'Firstarticle': true,'Welcomevandal': false,'Welcomenpov': true,'Welcomespam': true,'Welcomeunsourced': true,'Welcomeauto': false,'Welcome-COI': true,'Welcome-anon': true,'Welcomeanon2': false,'Welc-anon||': false,'Welcome-anon-vandalism-fighter': false,'Welcome-anon-vandal': false};// Set to true if template already has signatureTwinkle.welcome.signatureHash = {'Welcome': false,'Welcomeshort': false,'WelcomeSimple': false,'Welcom': true,'Welcome-personal': false,'WelcomeMenu': true,'Welcomeg': true,'Welcomeh': true,'Welcome-belated': true,'Wel': false,'W-basic': true,'W-shout': true,'W-short||': true,'W-link': true,'W-graphical': true,'W-screen': true,'Welcomelaws': false,'Firstarticle': true,'Welcomevandal': true,'Welcomenpov': false,'Welcomespam': false,'Welcomeunsourced': false,'Welcome-COI': false,'Welcome-anon': false,'Welcomeanon2': false,'Welc-anon||': false,'Welcome-anon-vandalism-fighter': false,'Welcome-anon-vandal': true};/* Set to true if template supports article * name from art template parameter  */Twinkle.welcome.artHash = {'Welcome': true,'Welcomeshort': false,'WelcomeSimple': false,'Welcom': false,'Welcome-personal': false,'WelcomeMenu': false,'Welcomeg': false,'Welcomeh': false,'Welcome-belated': false,'Wel': true,'W-basic': false,'W-shout': false,'W-short||': false,'W-link': false,'W-graphical': false,'W-screen': false,'Welcomelaws': false,'Firstarticle': false,'Welcomevandal': false,'Welcomenpov': false,'Welcomespam': false,'Welcomeunsourced': false,'Welcomeauto': true,'Welcome-COI': false,'Welcome-anon': true,'Welcomeanon2': true,'Welc-anon||': false,'Welcome-anon-vandalism-fighter': true,'Welcome-anon-vandal': false};/* Set to true if template supports article * name from vanarticle template parameter  */Twinkle.welcome.vandalHash = {'Welcome': false,'Welcomeshort': false,'WelcomeSimple': false,'Welcom': false,'Welcome-personal': false,'WelcomeMenu': false,'Welcomeg': false,'Welcomeh': false,'Welcome-belated': false,'Wel': false,'W-basic': false,'W-shout': false,'W-short||': false,'W-link': false,'W-graphical': false,'W-screen': false,'Welcomelaws': false,'Firstarticle': true,'Welcomevandal': true,'Welcomenpov': true,'Welcomespam': true,'Welcomeunsourced': true,'Welcomeauto': false,'Welcome-COI': false,'Welcome-anon': false,'Welcomeanon2': false,'Welc-anon||': false,'Welcome-anon-vandalism-fighter': false,'Welcome-anon-vandal': true};Twinkle.welcome.callbacks = {main: function( pageobj ) {var params = pageobj.getCallbackParameters();var oldText = pageobj.getPageText();// abort if mode is auto and form is not emptyif( pageobj.exists() && params.mode === 'auto' ) {Status.info( 'Warning', 'User talk page not empty; aborting automatic welcome' );Wikipedia.actionCompleted.event();return;}var text = '';Status.info( 'Info', 'Will add the welcome template to the ' +( Twinkle.getFriendlyPref('topWelcomes') ? 'top' : 'bottom' ) +' of the user\'s talk page.' );if( !Twinkle.getFriendlyPref('topWelcomes') ) {text += oldText + '\n';}if( Twinkle.welcome.headingHash[ params.value ] && Twinkle.getFriendlyPref('insertHeadings') ) {Status.info( 'Info', 'Will create a new heading for the welcome' );// strip section header markers from pref, to preserve backwards compatibilitytext += "== " + Twinkle.getFriendlyPref('welcomeHeading').replace(/^\s*=+\s*(.*?)\s*=+$\s*/, "$1") + " ==\n";}Status.info( 'Info', 'Will substitute the {{' + params.value + '}} welcome template' );text += '{{subst:' + params.value;if( Twinkle.welcome.artHash[ params.value ] ) {if( Twinkle.getFriendlyPref('insertUsername') && params.value.substring(2,0) !== 'W-' ) {Status.info( 'Info', 'Will add your username to the template' );text += '|' + mw.config.get('wgUserName');}if( params.article ) {Status.info( 'Info', 'Will add article link to the template' );text += '|art=' + params.article;}} else if( Twinkle.welcome.vandalHash[ params.value ] ) {if( params.article ) {Status.info( 'Info', 'Will add article link to the template' );}text += '|' + params.article;if( Twinkle.getFriendlyPref('insertUsername') ) {Status.info( 'Info', 'Will add your username to the template' );text += '|' + mw.config.get('wgUserName');}} else if( Twinkle.getFriendlyPref('insertUsername') ) {Status.info( 'Info', 'Will add your username to the template' );text += '|' + mw.config.get('wgUserName');} text += '}}';if( !Twinkle.welcome.signatureHash[ params.value ] && Twinkle.getFriendlyPref('insertSignature') ) {Status.info( 'Info', 'Will add your signature after the welcome' );text += ' \n<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)';}if( Twinkle.getFriendlyPref('topWelcomes') ) {text += '\n\n' + oldText;} var summaryText = "Added " + ( Twinkle.getFriendlyPref('maskTemplateInSummary') ? 'welcome' : ( '{{[[Template:' + params.value + '|' + params.value + ']]}}' ) ) +" template to user talk page";pageobj.setPageText(text);pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));pageobj.setMinorEdit(Twinkle.getFriendlyPref('markWelcomesAsMinor'));pageobj.setWatchlist(Twinkle.getFriendlyPref('watchWelcomes'));pageobj.setCreateOption('recreate');pageobj.save();}};Twinkle.welcome.callback.evaluate = function friendlywelcomeCallbackEvaluate(e) {// Ignore if a change to the text field triggered this eventif( e.target.name === 'article' ) {return;}var params = {value: e.target.values,article: e.target.form.article.value,mode: 'manual'};SimpleWindow.setButtonsEnabled( false );Status.init( e.target.form );Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');Wikipedia.actionCompleted.notice = "Welcoming complete, reloading talk page in a few seconds";var wikipedia_page = new Wikipedia.page(mw.config.get('wgPageName'), "User talk page modification");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(Twinkle.welcome.callbacks.main);};/* **************************************** *** twinklearv.js: ARV module **************************************** * Mode of invocation:     Tab ("ARV") * Active on:              Existing and non-existing user pages, user talk pages, contributions pages * Config directives in:   TwinkleConfig */Twinkle.arv = function twinklearv() {if ( mw.config.get('wgNamespaceNumber') === 2 || mw.config.get('wgNamespaceNumber') === 3 ||     ( mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "Contributions" )) {// If we are on the contributions page, need to parse some thenvar username;if( mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "Contributions" ) {username = decodeURIComponent(/user=(.+)/.exec($('div#contentSub a[title="Special:Log"]').last().attr("href").replace(/\+/g, "%20"))[1]);} else {username = mw.config.get('wgTitle').split( '/' )[0]; // only first part before any slashes}if ( !username ) {return;}var title = isIPAddress( username ) ? 'Report IP to administrators' : 'Report user to administrators';if (twinkleUserAuthorized) {$(twAddPortletLink("#", "ARV", "tw-arv", title, "" )).click(function() { Twinkle.arv.callback(username.replace( /\"/g, "\\\"")); } );} else {$(twAddPortletLink("#", 'ARV', 'tw-arv', title, "" )).click(function() { alert("Your account is too new to use Twinkle."); } );}}};Twinkle.arv.callback = function ( uid ) {if( uid === mw.config.get('wgUserName') ){alert( 'You don\'t want to report yourself, do you?' );return;}var Window = new SimpleWindow( 600, 500 );Window.setTitle( "Advance Reporting and Vetting" ); //BackronymWindow.setScriptName( "Twinkle" );Window.addFooterLink( "Guide to AIV", "WP:GAIV" );Window.addFooterLink( "UAA instructions", "WP:UAAI" );Window.addFooterLink( "About SPI", "WP:SPI" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#arv" );var form = new QuickForm( Twinkle.arv.callback.evaluate );var categories = form.append( {type: 'select',name: 'category',label: 'Select report type: ',event: Twinkle.arv.callback.changeCategory} );categories.append( {type: 'option',label: 'Vandalism (WP:AIV)',value: 'aiv'} );categories.append( {type: 'option',label: 'Username (WP:UAA)',value: 'username'} );categories.append( {type: 'option',label: 'Sockpuppeteer (WP:SPI)',value: 'sock'} );categories.append( {type: 'option',label: 'Sockpuppet (WP:SPI)',value: 'puppet'} );form.append( {type: 'field',label:'Work area',name: 'work_area'} );form.append( { type:'submit' } );form.append( {type: 'hidden',name: 'uid',value: uid} );var result = form.render();Window.setContent( result );Window.display();// We must init thevar evt = document.createEvent( "Event" );evt.initEvent( 'change', true, true );result.category.dispatchEvent( evt );};Twinkle.arv.callback.changeCategory = function (e) {var value = e.target.value;var root = e.target.form;var old_area;for( var i = 0; i < root.childNodes.length; ++i ) {var node = root.childNodes[i];if (node instanceof Element && node.getAttribute( 'name' ) === 'work_area') {old_area = node;break;}}var work_area = null;switch( value ) {case 'aiv':/* falls through */default:work_area = new QuickForm.element( { type: 'field',label: 'Report user for vandalism',name: 'work_area'} );work_area.append( {type: 'input',name: 'page',label: 'Primary linked page: ',tooltip: 'Leave blank to not link to the page in the report',value: QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '',event: function(e) {var value = e.target.value;var root = e.target.form;if( value === '' ) {root.badid.disabled = root.goodid.disabled = true;} else {root.badid.disabled = false;root.goodid.disabled = root.badid.value === '';}}} );work_area.append( {type: 'input',name: 'badid',label: 'Revision ID for target page when vandalised: ',tooltip: 'Leave blank for no diff link',value: QueryString.exists( 'vanarticlerevid' ) ? QueryString.get( 'vanarticlerevid' ) : '',disabled: !QueryString.exists( 'vanarticle' ),event: function(e) {var value = e.target.value;var root = e.target.form;root.goodid.disabled = value === '';}} );work_area.append( {type: 'input',name: 'goodid',label: 'Last good revision ID before vandalism of target page: ',tooltip: 'Leave blank for diff link to previous revision',value: QueryString.exists( 'vanarticlegoodrevid' ) ? QueryString.get( 'vanarticlegoodrevid' ) : '',disabled: !QueryString.exists( 'vanarticle' ) || QueryString.exists( 'vanarticlerevid' )} );work_area.append( {type: 'checkbox',name: 'arvtype',list: [{ label: 'Vandalism after final (level 4 or 4im) warning given',value: 'final'},{ label: 'Vandalism after recent (within 1 day) release of block',value: 'postblock'},{ label: 'Evidently a vandalism-only account',value: 'vandalonly',disabled: isIPAddress( root.uid.value )},{ label: 'Account is evidently a spambot or a compromised account',value: 'spambot'},{ label: 'Account is a promotion-only account',value: 'promoonly'}]} );work_area.append( {type: 'textarea',name: 'reason',label: 'Comment: '} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;case 'username':work_area = new QuickForm.element( { type: 'field',label: 'Report username violation',name: 'work_area'} );work_area.append ( { type:'header', label:'Type(s) of inappropriate username',tooltip: 'Wikipedia does not allow usernames that are misleading, promotional, offensive or disruptive. Domain names and e-mail addresses are likewise prohibited. These criteria apply to both usernames and signatures. Usernames that are inappropriate in another language, or that represent an inappropriate name with misspellings and substitutions, or do so indirectly or by implication, are still considered inappropriate.'} );work_area.append( {type: 'checkbox',name: 'arvtype',list: [{label: 'Misleading username',value: 'misleading',tooltip: 'Misleading usernames imply relevant, misleading things about the contributor. For example, misleading points of fact, an impression of undue authority, or the suggestion that the account is operated by a group, project or collective rather than one individual.'},{ label: 'Promotional username',value: 'promotional',tooltip: 'Promotional usernames are advertisements for a company or group.'},{ label: 'Offensive username',value: 'offensive',tooltip: 'Offensive usernames make harmonious editing difficult or impossible.'},{ label: 'Disruptive username',value: 'disruptive',tooltip: 'Disruptive usernames include outright trolling or personal attacks, or otherwise show a clear intent to disrupt Wikipedia.'}]} );work_area.append( {type: 'textarea',name: 'reason',label: 'Comment:'} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;case 'puppet':work_area = new QuickForm.element( { type: 'field',label: 'Report suspected sockpuppet',name: 'work_area'} );work_area.append({type: 'input',name: 'sockmaster',label: 'Sockpuppeteer',tooltip: 'The username of the sockpuppeteer (sockmaster) without the User:-prefix'});work_area.append( {type: 'textarea',label: 'Evidence:',name: 'evidence',tooltip: 'Enter your evidence. It should make clear that each of these users is likely to be abusing multiple accounts. Usually this means diffs, page histories or other information that justifies why the users are a) the same and b) disruptive. This should purely be evidence and information needed to judge the matter. Avoid all other discussion that is not evidence of sockpuppetry or other multiple account abuse.'} );work_area.append( {type: 'checkbox',list: [{label: 'Request CheckUser evidence',name: 'checkuser',tooltip: 'CheckUser is a tool used to obtain technical evidence related to a sock-puppetry allegation. It will not be used without good cause, which you must clearly demonstrate. Make sure your evidence explains why CheckUser is appropriate.'},{label: 'Notify reported users',name: 'notify',tooltip: 'Notification is not mandatory. In many cases, especially of chronic sockpuppeteers, notification may be counterproductive. However, especially in less egregious cases involving users who has not been reported before, notification may make the cases fairer and also appear to be fairer in the eyes of the accused. Use your judgment.'}]} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;case 'sock':work_area = new QuickForm.element( { type: 'field',label: 'Report suspected sockpuppeteer',name: 'work_area'} );work_area.append({type: 'dyninput',name: 'sockpuppet',label: 'Sockpuppets',sublabel: 'Sock: ',tooltip: 'The username of the sockpuppet without the User:-prefix',min: 2});work_area.append( {type: 'textarea',label: 'Evidence:',name: 'evidence',tooltip: 'Enter your evidence. It should make clear that each of these users is likely to be abusing multiple accounts. Usually this means diffs, page histories or other information that justifies why the users are a) the same and b) disruptive. This should purely be evidence and information needed to judge the matter. Avoid all other discussion that is not evidence of sockpuppetry or other multiple account abuse.'} );work_area.append( {type: 'checkbox',list: [ {label: 'Request CheckUser evidence',name: 'checkuser',tooltip: 'CheckUser is a tool used to obtain technical evidence related to a sock-puppetry allegation. It will not be used without good cause, which you must clearly demonstrate. Make sure your evidence explains why CheckUser is appropriate.'}, {label: 'Notify reported users',name: 'notify',tooltip: 'Notification is not mandatory. In many cases, especially of chronic sockpuppeteers, notification may be counterproductive. However, especially in less egregious cases involving users who has not been reported before, notification may make the cases fairer and also appear to be fairer in the eyes of the accused. Use your judgment.'} ]} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;}};Twinkle.arv.callback.evaluate = function(e) {var form = e.target;var reason = "";var comment = "";if ( form.reason ) {comment = form.reason.value;}var uid = form.uid.value;var types;switch( form.category.value ) {// Report user for vandalismcase 'aiv':/* falls through */default:types = form.getChecked( 'arvtype' );if( !types.length && comment === '' ) {alert( 'You must specify some reason' );return;}types = types.map( function(v) {switch(v) {case 'final':return 'vandalism after final warning';case 'postblock':return 'vandalism after recent release of block';case 'spambot':return 'account is evidently a spambot or a compromised account';case 'vandalonly':return 'actions evidently indicate a vandalism-only account';case 'promoonly':return 'account is being used only for promotional purposes';default:return 'unknown reason';}} ).join( ', ' );if ( form.page.value !== '' ) {// add a leading : on linked page namespace to prevent transclusionreason = 'On [[' + form.page.value.replace( /^(Image|Category|File):/i, ':$1:' ) + ']]';if ( form.badid.value !== '' ) {var query = {'title': form.page.value,'diff': form.badid.value,'oldid': form.goodid.value};reason += ' ({{diff|' + form.page.value + '|' + form.badid.value + '|' + form.goodid.value + '|diff}})';}reason += ';';}if ( types ) {reason += " " + types;}if (comment !== "" ) {reason += (reason === "" ? "" : ". ") + comment + ".";}reason += "<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)";reason = reason.replace(/\r?\n/g, "\n*:");  // indent newlinesSimpleWindow.setButtonsEnabled( false );Status.init( form );Wikipedia.actionCompleted.redirect = "Wikipedia:Administrator intervention against vandalism";Wikipedia.actionCompleted.notice = "Reporting complete";var aivPage = new Wikipedia.page( 'Wikipedia:Administrator intervention against vandalism', 'Processing AIV request' );aivPage.setPageSection( 1 );aivPage.setFollowRedirect( true );aivPage.load( function() {var text = aivPage.getPageText();// check if user has already been reportedif (new RegExp( "\\{\\{\\s*(?:(?:[Ii][Pp])?[Vv]andal|[Uu]serlinks)\\s*\\|\\s*(?:1=)?\\s*" + RegExp.escape( uid, true ) + "\\s*\\}\\}" ).test(text)) {aivPage.getStatusElement().info( 'Report already present, will not add a new one' );return;}aivPage.getStatusElement().status( 'Adding new report...' );aivPage.setEditSummary( 'Reporting [[Special:Contributions/' + uid + '|' + uid + ']].' + Twinkle.getPref('summaryAd') );aivPage.setAppendText( '\n*{{' + ( isIPAddress( uid ) ? 'IPvandal' : 'vandal' ) + '|' + (/\=/.test( uid ) ? '1=' : '' ) + uid + '}} - ' + reason );aivPage.append();} );break;// Report inappropriate usernamecase 'username':types = form.getChecked( 'arvtype' );if( !types.length ) {alert( 'You must specify at least one breached violation' );return;}types = types.map( function( v ) { return v.toLowerCaseFirstChar(); } );if ( types.length <= 2 ) {types = types.join( ' and ' );} else {types = [ types.slice( 0, -1 ).join( ', ' ), types.slice( -1 ) ].join( ' and ' );}var article = 'a';if ( /[aeiouwyh]/.test( types[0] ) ) { // non 100% correct, but whatever, inlcuding 'h' for Cockneyarticle = 'an';}reason = "*{{user-uaa|1=" + uid + "}} &mdash; Violation of username policy as " + article + " " + types + " username. ";if (comment !== '' ) {reason += comment.toUpperCaseFirstChar() + ". ";}reason += "<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)";reason = reason.replace(/\r?\n/g, "\n*:");  // indent newlinesSimpleWindow.setButtonsEnabled( false );Status.init( form );Wikipedia.actionCompleted.redirect = "Wikipedia:Usernames for administrator attention";Wikipedia.actionCompleted.notice = "Reporting complete";var uaaPage = new Wikipedia.page( 'Wikipedia:Usernames for administrator attention', 'Processing UAA request' );uaaPage.setFollowRedirect( true );uaaPage.load( function() {var text = uaaPage.getPageText();// check if user has already been reportedif (new RegExp( "\\{\\{\\s*user-uaa\\s*\\|\\s*(1\\s*=\\s*)?" + RegExp.escape(uid, true) + "\\s*(\\||\\})" ).test(text)) {uaaPage.getStatusElement().error( 'User is already listed.' );return;}uaaPage.getStatusElement().status( 'Adding new report...' );uaaPage.setEditSummary( 'Reporting [[Special:Contributions/' + uid + '|' + uid + ']].'+ Twinkle.getPref('summaryAd') );uaaPage.setPageText( text.replace( /List begins below this line.\s*-->/, "List begins below this line.\n-->\n" + reason ) );  // add at topuaaPage.save();} );break;// WP:SPIcase "sock":/* falls through */case "puppet":var sockParameters = {evidence: form.evidence.value.rtrim(), checkuser: form.checkuser.checked, notify: form.notify.checked};var puppetReport = form.category.value === "puppet";if (puppetReport && !(form.sockmaster.value.trim())) {if (!confirm("You have not entered a sockmaster account for this puppet. Do you want to report this account as a sockpuppeteer instead?")) {return;}puppetReport = false;}sockParameters.uid = puppetReport ? form.sockmaster.value.rtrim() : uid;sockParameters.sockpuppets = puppetReport ? [uid] : $.map( $('input:text[@name=sockpuppet]',form), function(o){ return $(o).val(); });SimpleWindow.setButtonsEnabled( false );Status.init( form );Twinkle.arv.processSock( sockParameters );break;}};Twinkle.arv.processSock = function( params ) {Wikipedia.addCheckpoint(); // prevent notification events from causing an erronous "action completed"// notify all user accounts if requestedif (params.notify && params.sockpuppets.length>0) {var notifyEditSummary = "Notifying about suspicion of sockpuppeteering." + Twinkle.getPref('summaryAd');var notifyText = "\n\n==بررسی [[ویکی‌پدیا:حساب زاپاس|حساب زاپاس]] =={| align="right" style="background: transparent;"|| [[File:Puppeter template.svg|35px]]|}نام شما در رابطه با یک مورد [[ویکی‌پدیا:حساب زاپاس]] مطرح شده است. لطفاً برای دیدن شواهد به [[ویکی‌پدیا:درخواست بازرسی کاربر]] مراجعه کنید. لطفاً پیش از ویرایش در آن صفحه مطمئن شوید که با [[ویکی‌پدیا:حساب زاپاس|سیاست استفاده از حساب‌های جایگزین]] آشنا هستید. <code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)";// notify user's master accountvar masterTalkPage = new Wikipedia.page( 'User talk:' + params.uid, 'Notifying suspected sockpuppeteer' );masterTalkPage.setFollowRedirect( true );masterTalkPage.setEditSummary( notifyEditSummary );masterTalkPage.setAppendText( notifyText );masterTalkPage.append();var statusIndicator = new Status( 'Notifying suspected sockpuppets', '0%' );var total = params.sockpuppets.length;var current =   0;// display status of notifications as they progressvar onSuccess = function( sockTalkPage ) {var now = parseInt( 100 * ++(current)/total, 10 ) + '%';statusIndicator.update( now );sockTalkPage.getStatusElement().unlink();if ( current >= total ) {statusIndicator.info( now + ' (completed)' );}};var socks = params.sockpuppets;// notify each puppet accountfor( var i = 0; i < socks.length; ++i ) {var sockTalkPage = new Wikipedia.page( 'User talk:' + socks[i], "Notification for " +  socks[i] );sockTalkPage.setFollowRedirect( true );sockTalkPage.setEditSummary( notifyEditSummary );sockTalkPage.setAppendText( notifyText );sockTalkPage.append( onSuccess );}}// prepare the SPI reportvar text = "\n\n{{بایگانی پرونده بازرسی}}{{وضعیت پرونده بازرسی|باز}}=== 6 October 2023 ==='''شواهد زاپاس بودن''': '''شواهد نقض سیاست''': <h3>زاپاس‌های احتمالی</h3>*'''کاربر اصلی:''' {{بازرسی کاربر|twinkle.js}}'''ابزارها''': [//tools.wmflabs.org/sigma/editorinteract.py?users={{urlencode:{{#titleparts:{{SUBPAGENAME}}}}}}&startdate=&enddate=&ns=&server=fawiki تشابه‌یاب ویرایش] {{گلوله}} [//tools.wmflabs.org/interaction-timeline?wiki=fawiki&user={{urlencode:{{#titleparts:{{SUBPAGENAME}}}}}} خط زمانی بین ویرایش‌ها]باتشکر <code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)<!-- لطفاً تمام نظرات و شواهد را بالای این خط بنویسید و از پاک کردن یا دست بردن در آن خودداری کنید. -->";var reportpage = 'Wikipedia:Sockpuppet investigations/' + params.uid;Wikipedia.actionCompleted.redirect = reportpage;Wikipedia.actionCompleted.notice = "Reporting complete";var spiPage = new Wikipedia.page( reportpage, 'Retrieving discussion page' );spiPage.setFollowRedirect( true );spiPage.setEditSummary( 'Adding new report for [[Special:Contributions/' + params.uid + '|' + params.uid + ']].'+ Twinkle.getPref('summaryAd') );spiPage.setAppendText( text );spiPage.append();Wikipedia.removeCheckpoint();  // all page updates have been started};/* **************************************** *** twinklebatchdelete.js: Batch delete module (sysops only) **************************************** * Mode of invocation:     Tab ("D-batch") * Active on:              Existing and non-existing non-articles, and Special:PrefixIndex * Config directives in:   TwinkleConfig */Twinkle.batchdelete = function twinklebatchdelete() {if( userIsInGroup( 'sysop' ) && (mw.config.get( 'wgNamespaceNumber' ) > 0 || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Prefixindex') ) {$(twAddPortletLink("#", "D-batch", "tw-batch", "Delete pages found in this category/on this page", "")).click(Twinkle.batchdelete.callback);}};Twinkle.batchdelete.unlinkCache = {};Twinkle.batchdelete.callback = function twinklebatchdeleteCallback() {var Window = new SimpleWindow( 800, 400 );Window.setTitle( "Batch deletion" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#batchdelete" );var form = new QuickForm( Twinkle.batchdelete.callback.evaluate );form.append( {type: 'checkbox',list: [{ label: 'Delete pages',name: 'delete_page',value: 'delete',checked: true},{label: 'Remove backlinks to the page',name: 'unlink_page',value: 'unlink',checked: true},{label: 'Delete redirects to deleted pages',name: 'delete_redirects',value: 'delete_redirects',checked: true}]} );form.append( {type: 'textarea',name: 'reason',label: 'Reason: '} );var query;if( mw.config.get( 'wgNamespaceNumber' ) === Namespace.CATEGORY ) {query = {'action': 'query','generator': 'categorymembers','gcmtitle': mw.config.get( 'wgPageName' ),'gcmlimit' : Twinkle.getPref('batchMax'), // the max for sysops'prop': [ 'categories', 'revisions' ],'rvprop': [ 'size' ]};} else if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Prefixindex' ) {var gapnamespace, gapprefix;if(QueryString.exists( 'from' ) ){gapnamespace = QueryString.get( 'namespace' );gapprefix = QueryString.get( 'from' ).toUpperCaseFirstChar();}else{var pathSplit = location.pathname.split('/');if (pathSplit.length < 3 || pathSplit[2] !== "Special:PrefixIndex") {return;}var titleSplit = pathSplit[3].split(':');gapnamespace = Namespace[titleSplit[0].toUpperCase()];if ( titleSplit.length < 2 || typeof(gapnamespace) === 'undefined' ){gapnamespace = Namespace.MAIN;gapprefix = pathSplit.splice(3).join('/');}else{pathSplit = pathSplit.splice(4);pathSplit.splice(0,0,titleSplit.splice(1).join(':'));gapprefix = pathSplit.join('/');}}query = {'action': 'query','generator': 'allpages','gapnamespace': gapnamespace ,'gapprefix': gapprefix,'gaplimit' : Twinkle.getPref('batchMax'), // the max for sysops'prop' : ['categories', 'revisions' ],'rvprop': [ 'size' ]};} else {query = {'action': 'query','generator': 'links','titles': mw.config.get( 'wgPageName' ),'gpllimit' : Twinkle.getPref('batchMax'), // the max for sysops'prop': [ 'categories', 'revisions' ],'rvprop': [ 'size' ]};}var wikipedia_api = new Wikipedia.api( 'Grabbing pages', query, function( self ) {var xmlDoc = self.responseXML;var snapshot = xmlDoc.evaluate('//page[@ns != "' + Namespace.IMAGE + '" and not(@missing)]', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );var list = [];for ( var i = 0; i < snapshot.snapshotLength; ++i ) {var object = snapshot.snapshotItem(i);var page = xmlDoc.evaluate( '@title', object, null, XPathResult.STRING_TYPE, null ).stringValue;var size = xmlDoc.evaluate( 'revisions/rev/@size', object, null, XPathResult.NUMBER_TYPE, null ).numberValue;var disputed = xmlDoc.evaluate( 'boolean(categories/cl[@title="Category:Contested candidates for speedy deletion"])', object, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;list.push( {label:page + ' (' + size + ' bytes)' + ( disputed ? ' (DISPUTED CSD)' : '' ), value:page, checked:!disputed });}self.params.form.append( {type: 'checkbox',name: 'pages',list: list} );self.params.form.append( { type:'submit' } );var result = self.params.form.render();self.params.Window.setContent( result );} );wikipedia_api.params = { form:form, Window:Window };wikipedia_api.post();var root = document.createElement( 'div' );Status.init( root );Window.setContent( root );Window.display();};Twinkle.batchdelete.currentDeleteCounter = 0;Twinkle.batchdelete.currentUnlinkCounter = 0;Twinkle.batchdelete.currentdeletor = 0;Twinkle.batchdelete.callback.evaluate = function twinklebatchdeleteCallbackEvaluate(event) {Wikipedia.actionCompleted.notice = 'Status';Wikipedia.actionCompleted.postfix = 'batch deletion is now complete';mw.config.set('wgPageName', mw.config.get('wgPageName').replace(/_/g, ' '));  // for queen/king/whatever and country!var pages = event.target.getChecked( 'pages' );var reason = event.target.reason.value;var delete_page = event.target.delete_page.checked;var unlink_page = event.target.unlink_page.checked;var delete_redirects = event.target.delete_redirects.checked;if( ! reason ) {return;}SimpleWindow.setButtonsEnabled( false );Status.init( event.target );if( !pages ) {Status.error( 'Error', 'nothing to delete, aborting' );return;}function toCall( work ) {if( work.length === 0 &&  Twinkle.batchdelete.currentDeleteCounter <= 0 && Twinkle.batchdelete.currentUnlinkCounter <= 0 ) {window.clearInterval( Twinkle.batchdelete.currentdeletor );Wikipedia.removeCheckpoint();return;} else if( work.length !== 0 && ( Twinkle.batchdelete.currentDeleteCounter <= Twinkle.getPref('batchDeleteMinCutOff') || Twinkle.batchdelete.currentUnlinkCounter <= Twinkle.getPref('batchDeleteMinCutOff')  ) ) {Twinkle.batchdelete.unlinkCache = []; // Clear the cachevar pages = work.shift();Twinkle.batchdelete.currentDeleteCounter += pages.length;Twinkle.batchdelete.currentUnlinkCounter += pages.length;for( var i = 0; i < pages.length; ++i ) {var page = pages[i];var query = {'action': 'query','titles': page};var wikipedia_api = new Wikipedia.api( 'Checking if page ' + page + ' exists', query, Twinkle.batchdelete.callbacks.main );wikipedia_api.params = { page:page, reason:reason, unlink_page:unlink_page, delete_page:delete_page, delete_redirects:delete_redirects };wikipedia_api.post();}}}var work = pages.chunk( Twinkle.getPref('batchdeleteChunks') );Wikipedia.addCheckpoint();Twinkle.batchdelete.currentdeletor = window.setInterval( toCall, 1000, work );};Twinkle.batchdelete.callbacks = {main: function( self ) {var xmlDoc = self.responseXML;var normal = xmlDoc.evaluate( '//normalized/n/@to', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;if( normal ) {self.params.page = normal;}var exists = xmlDoc.evaluate( 'boolean(//pages/page[not(@missing)])', xmlDoc, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;if( ! exists ) {self.statelem.error( "It seems that the page doesn't exist, perhaps it has already been deleted" );return;}var query, wikipedia_api;if( self.params.unlink_page ) {query = {'action': 'query','list': 'backlinks','blfilterredir': 'nonredirects','blnamespace': [0, 100], // main space and portal space only'bltitle': self.params.page,'bllimit': userIsInGroup( 'sysop' ) ? 5000 : 500 // 500 is max for normal users, 5000 for bots and sysops};wikipedia_api = new Wikipedia.api( 'Grabbing backlinks', query, Twinkle.batchdelete.callbacks.unlinkBacklinksMain );wikipedia_api.params = self.params;wikipedia_api.post();} else {--Twinkle.batchdelete.currentUnlinkCounter;}if( self.params.delete_page ) {if (self.params.delete_redirects){query = {'action': 'query','list': 'backlinks','blfilterredir': 'redirects','bltitle': self.params.page,'bllimit': userIsInGroup( 'sysop' ) ? 5000 : 500 // 500 is max for normal users, 5000 for bots and sysops};wikipedia_api = new Wikipedia.api( 'Grabbing redirects', query, Twinkle.batchdelete.callbacks.deleteRedirectsMain );wikipedia_api.params = self.params;wikipedia_api.post();}var wikipedia_page = new Wikipedia.page( self.params.page, 'Deleting page ' + self.params.page );wikipedia_page.setEditSummary(self.params.reason + Twinkle.getPref('deletionSummaryAd'));wikipedia_page.deletePage(function( apiobj ) { --Twinkle.batchdelete.currentDeleteCounter;var link = document.createElement( 'a' );link.setAttribute( 'href', mw.util.wikiGetlink(self.params.page) );link.setAttribute( 'title', self.params.page );link.appendChild( document.createTextNode( self.params.page ) );apiobj.statelem.info( [ 'completed (' , link , ')' ] );} );} else {--Twinkle.batchdelete.currentDeleteCounter;}},deleteRedirectsMain: function( self ) {var xmlDoc = self.responseXML;var snapshot = xmlDoc.evaluate('//backlinks/bl/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );var total = snapshot.snapshotLength;if( snapshot.snapshotLength === 0 ) {return;}var statusIndicator = new Status('Deleting redirects for ' + self.params.page, '0%');var onsuccess = function( self ) {var obj = self.params.obj;var total = self.params.total;var now = parseInt( 100 * ++(self.params.current)/total, 10 ) + '%';obj.update( now );self.statelem.unlink();if( self.params.current >= total ) {obj.info( now + ' (completed)' );Wikipedia.removeCheckpoint();}};Wikipedia.addCheckpoint();if( snapshot.snapshotLength === 0 ) {statusIndicator.info( '100% (completed)' );Wikipedia.removeCheckpoint();return;}var params = clone( self.params );params.current = 0;params.total = total;params.obj = statusIndicator;for ( var i = 0; i < snapshot.snapshotLength; ++i ) {var title = snapshot.snapshotItem(i).value;var wikipedia_page = new Wikipedia.page( title, "Deleting " + title );wikipedia_page.setEditSummary('[[WP:CSD#G8|G8]]: Redirect to deleted page "' + self.params.page + '"' + Twinkle.getPref('deletionSummaryAd'));wikipedia_page.setCallbackParameters(params);wikipedia_page.deletePage(onsuccess);}},unlinkBacklinksMain: function( self ) {var xmlDoc = self.responseXML;var snapshot = xmlDoc.evaluate('//backlinks/bl/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );if( snapshot.snapshotLength === 0 ) {--Twinkle.batchdelete.currentUnlinkCounter;return;}var statusIndicator = new Status('Unlinking backlinks to ' + self.params.page, '0%');var total = snapshot.snapshotLength * 2;var onsuccess = function( self ) {var obj = self.params.obj;var total = self.params.total;var now = parseInt( 100 * ++(self.params.current)/total, 10 ) + '%';obj.update( now );self.statelem.unlink();if( self.params.current >= total ) {obj.info( now + ' (completed)' );--Twinkle.batchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint();}};Wikipedia.addCheckpoint();if( snapshot.snapshotLength === 0 ) {statusIndicator.info( '100% (completed)' );--Twinkle.batchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint();return;}self.params.total = total;self.params.obj = statusIndicator;self.params.current =   0;for ( var i = 0; i < snapshot.snapshotLength; ++i ) {var title = snapshot.snapshotItem(i).value;var wikipedia_page = new Wikipedia.page( title, "Unlinking on " + title );var params = clone( self.params );params.title = title;params.onsuccess = onsuccess;wikipedia_page.setCallbackParameters(params);wikipedia_page.load(Twinkle.batchdelete.callbacks.unlinkBacklinks);}},unlinkBacklinks: function( pageobj ) {var params = pageobj.getCallbackParameters();if( ! pageobj.exists() ) {// we probably just deleted it, as a recursive backlinkparams.onsuccess( { params: params, statelem: pageobj.getStatusElement() } );Wikipedia.actionCompleted();return;}var text;if( params.title in Twinkle.batchdelete.unlinkCache ) {text = Twinkle.batchdelete.unlinkCache[ params.title ];} else {text = pageobj.getPageText();}var old_text = text;var wikiPage = new Mediawiki.Page( text );wikiPage.removeLink( params.page );text = wikiPage.getText();Twinkle.batchdelete.unlinkCache[ params.title ] = text;if( text === old_text ) {// Nothing to do, returnparams.onsuccess( { params: params, statelem: pageobj.getStatusElement() } );Wikipedia.actionCompleted();return;}pageobj.setEditSummary('Removing link(s) to deleted page ' + self.params.page + Twinkle.getPref('deletionSummaryAd'));pageobj.setPageText(text);pageobj.setCreateOption('nocreate');pageobj.save(params.onsuccess);}};/* **************************************** *** twinklebatchprotect.js: Batch protect module (sysops only) **************************************** * Mode of invocation:     Tab ("P-batch") * Active on:              Existing and non-existing non-articles, and Special:PrefixIndex * Config directives in:   TwinkleConfig */Twinkle.batchprotect = function twinklebatchprotect() {if( userIsInGroup( 'sysop' ) && (wgNamespaceNumber > 0 || wgCanonicalSpecialPageName == 'Prefixindex') ) {$(twAddPortletLink("#", "P-batch", "tw-pbatch", "Protect pages found on this page", "")).click(Twinkle.batchprotect.callback);}};Twinkle.batchprotect.unlinkCache = {};Twinkle.batchprotect.callback = function twinklebatchprotectCallback() {var Window = new SimpleWindow( 800, 400 );Window.setTitle( "Batch protection" );var form = new QuickForm( Twinkle.batchprotect.callback.evaluate );form.append( {type: 'select',name: 'move',label: 'Move protection',list: [{ label: 'Allow all users (still autoconfirmed)',value: '',selected: true},{ label: 'Block new and unregistered users',value: 'autoconfirmed'},{label: 'Block all non-admin users',value: 'sysop'}]} );form.append( {type: 'select',name: 'edit',label: 'Edit protection',list: [{ label: 'Allow all users',value: '',selected: true},{ label: 'Block new and unregistered users',value: 'autoconfirmed'},{label: 'Block all non-admin users',value: 'sysop'}]} );form.append( {type: 'select',name: 'create',label: 'Create protection',list: [{ label: 'Allow all users (still autoconfirmed)',value: '',selected: true},{ label: 'Block new and unregistered users',value: 'autoconfirmed'},{label: 'Block all non-admin users',value: 'sysop'}]} );form.append( {type: 'checkbox',list: [{name: 'cascade',label: 'Cascade protection'}]} );form.append( {type: 'select',name: 'expiry',label: 'Expiration: ',list: [{ label: '15 minutes', value: '15 minutes' },{ label: '30 minutes', value: '30 minutes' },{ label: '45 minutes', value: '45 minutes' },{ label: '1 hour', value: '1 hour' },{ label: '2 hours', value: '2 hours' },{ label: '3 hours', value: '3 hours' },{ label: '6 hours', value: '6 hours' },{ label: '12 hours', value: '12 hours' },{ label: '1 day', value: '1 day' },{ label: '2 days', value: '2 days' },{ label: '3 days', value: '3 days' },{ label: '4 days', value: '4 days' },{ label: '5 days', value: '5 days' },{ label: '6 days', value: '6 days' },{ label: '1 week', value: '1 week' },{ label: '2 weeks', value: '2 weeks' },{ label: '1 month', value: '1 month' },{ label: '2 months', value: '2 months' },{ label: '3 months', value: '3 months' },{ label: '6 months', value: '6 months' },{ label: '1 year', value: '1 year' },{ label: '2 years', value: '2 years' },{ label: '3 years', value: '3 years' },{ label: '6 years', value: '6 years' },{ label: 'indefinite', selected: true, value:'indefinite' }]} );form.append( {type: 'textarea',name: 'reason',label: 'Reason: '} );var query;if( wgNamespaceNumber == Namespace.CATEGORY ) {query = {'action': 'query','generator': 'categorymembers','gcmtitle': wgPageName,'gcmlimit' : Twinkle.getPref('batchMax'), // the max for sysops'prop': [ 'revisions' ],'rvprop': [ 'size' ]};} else if( wgCanonicalSpecialPageName == 'Prefixindex' ) {query = {'action': 'query','generator': 'allpages','gapnamespace': QueryString.exists('namespace') ? QueryString.get( 'namespace' ): document.getElementById('namespace').value,'gapprefix': QueryString.exists('from') ? QueryString.get( 'from' ).replace('+', ' ').toUpperCaseFirstChar() : document.getElementById('nsfrom').value.toUpperCaseFirstChar(),'gaplimit' : Twinkle.getPref('batchMax'), // the max for sysops'prop' : [ 'revisions' ],'rvprop': [ 'size' ]};} else {query = {'action': 'query','gpllimit' : Twinkle.getPref('batchMax'), // the max for sysops'generator': 'links','titles': wgPageName,'prop': [ 'revisions' ],'rvprop': [ 'size' ]};}var wikipedia_api = new Wikipedia.api( 'Grabbing pages', query, function( self ) {var xmlDoc = self.responseXML;var snapshot = xmlDoc.evaluate('//page', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );var list = [];for ( var i = 0; i < snapshot.snapshotLength; ++i ) {var object = snapshot.snapshotItem(i);var page = xmlDoc.evaluate( '@title', object, null, XPathResult.STRING_TYPE, null ).stringValue;var size = xmlDoc.evaluate( 'revisions/rev/@size', object, null, XPathResult.NUMBER_TYPE, null ).numberValue;list.push( {label:page + (size ? ' (' + size + ')' : '' ), value:page, checked: true });}self.params.form.append( {type: 'checkbox',name: 'pages',list: list});self.params.form.append( { type:'submit' } );var result = self.params.form.render();self.params.Window.setContent( result );}  );wikipedia_api.params = { form:form, Window:Window };wikipedia_api.post();var root = document.createElement( 'div' );Status.init( root );Window.setContent( root );Window.display();};Twinkle.batchprotect.currentProtectCounter = 0;Twinkle.batchprotect.currentprotector = 0;Twinkle.batchprotect.callback.evaluate = function twinklebatchprotectCallbackEvaluate(event) {wgPageName = wgPageName.replace( /_/g, ' ' ); // for queen/king/whatever and country!var pages = event.target.getChecked( 'pages' );var reason = event.target.reason.value;var create = event.target.create.value;var edit = event.target.edit.value;var cascade = event.target.cascade.checked;var expiry = event.target.expiry.value;var move = event.target.move.value;if( ! reason ) {return;}Status.init( event.target );if( !pages ) {Status.error( 'Error', 'nothing to delete, aborting' );return;}function toCall( work ) {if( work.length === 0 && Twinkle.batchprotect.currentProtectCounter <= 0 ) {Status.info( 'work done' );window.clearInterval( Twinkle.batchprotect.currentprotector );Wikipedia.removeCheckpoint();return;} else if( work.length !== 0 && Twinkle.batchprotect.currentProtectCounter <= Twinkle.getPref('batchProtectMinCutOff') ) {var pages = work.shift();Twinkle.batchprotect.currentProtectCounter += pages.length;for( var i = 0; i < pages.length; ++i ) {var page = pages[i];var query = {'action': 'query','titles': page};var wikipedia_api = new Wikipedia.api( 'Checking if page ' + page + ' exists', query, Twinkle.batchprotect.callbacks.main );wikipedia_api.params = { page:page, reason:reason, move: move, edit: edit, create: create, expiry: expiry, cascade: cascade };wikipedia_api.post();}}}var work = pages.chunk( Twinkle.getPref('batchProtectChunks') );Wikipedia.addCheckpoint();Twinkle.batchprotect.currentprotector = window.setInterval( toCall, 1000, work );};Twinkle.batchprotect.callbacks = {main: function( self ) {var xmlDoc = self.responseXML;var normal = xmlDoc.evaluate( '//normalized/n/@to', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;if( normal ) {self.params.page = normal;}var query = { 'title': self.params.page, 'action': 'protect'};var wikipedia_wiki = new Wikipedia.wiki( 'Protecting page ' + self.params.page, query, Twinkle.batchprotect.callbacks.protectPage, function( self ) { --Twinkle.batchprotect.currentProtectCounter;var link = document.createElement( 'a' );link.setAttribute( 'href', wgArticlePath.replace( '$1', self.query.title ) );link.setAttribute( 'title', self.query.title );link.appendChild( document.createTextNode( self.query.title ) );self.statelem.info( [ 'completed (' , link , ')' ] );} );wikipedia_wiki.params = self.params;wikipedia_wiki.followRedirect = false;wikipedia_wiki.get();},protectPage: function( self ) {var form  = self.responseXML.getElementById( 'mw-Protect-Form' );var postData = {'wpEditToken': form.wpEditToken.value,'mwProtect-level-edit': self.params.edit,'wpProtectExpirySelection-edit': self.params.expiry != 'indefinite' ? 'othertime' : 'indefinite','mwProtect-expiry-edit': self.params.expiry != 'indefinite' ? self.params.expiry : undefined,'mwProtect-level-move': self.params.move,'wpProtectExpirySelection-move': self.params.expiry != 'indefinite' ? 'othertime' : 'indefinite','mwProtect-expiry-move': self.params.expiry != 'indefinite' ? self.params.expiry : undefined,'mwProtect-cascade': self.params.cascade ? '' : undefined,'mwProtectWatch': form.mwProtectWatch.checked ? '' : undefined,'wpProtectReasonSelection': 'other','mwProtect-reason': self.params.reason + Twinkle.getPref('protectionSummaryAd')};self.post( postData );}};/* **************************************** *** twinklebatchundelete.js: Batch undelete module **************************************** * Mode of invocation:     Tab ("Und-batch") * Active on:              Existing and non-existing user pages (??? why?) * Config directives in:   TwinkleConfig */Twinkle.batchundelete = function twinklebatchundelete() {if( wgNamespaceNumber != Namespace.USER ) {return;}if( userIsInGroup( 'sysop' ) ) {$(twAddPortletLink("#", "Und-batch", "tw-batch-undel", "Undelete 'em all", "")).click(Twinkle.batchundelete.callback);}};Twinkle.batchundelete.callback = function twinklebatchundeleteCallback() {var Window = new SimpleWindow( 800, 400 );var form = new QuickForm( Twinkle.batchundelete.callback.evaluate );form.append( {type: 'textarea',name: 'reason',label: 'Reason: '} );var query = {'action': 'query','generator': 'links','titles': wgPageName,'gpllimit' : Twinkle.getPref('batchMax') // the max for sysops};var wikipedia_api = new Wikipedia.api( 'Grabbing pages', query, function( self ) {var xmlDoc = self.responseXML;var snapshot = xmlDoc.evaluate('//page[@missing]', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );var list = [];for ( var i = 0; i < snapshot.snapshotLength; ++i ) {var object = snapshot.snapshotItem(i);var page = xmlDoc.evaluate( '@title', object, null, XPathResult.STRING_TYPE, null ).stringValue;list.push( {label:page, value:page, checked: true });}self.params.form.append( {type: 'checkbox',name: 'pages',list: list});self.params.form.append( { type:'submit' } );var result = self.params.form.render();self.params.Window.setContent( result );}  );wikipedia_api.params = { form:form, Window:Window };wikipedia_api.post();var root = document.createElement( 'div' );Status.init( root );Window.setContent( root );Window.display();};Twinkle.batchundelete.currentUndeleteCounter = 0;Twinkle.batchundelete.currentundeletor = 0;Twinkle.batchundelete.callback.evaluate = function( event ) {Wikipedia.actionCompleted.notice = 'Status';Wikipedia.actionCompleted.postfix = 'batch undeletion is now completed';var pages = event.target.getChecked( 'pages' );var reason = event.target.reason.value;if( ! reason ) {return;}Status.init( event.target );if( !pages ) {Status.error( 'Error', 'nothing to undelete, aborting' );return;}var work = pages.chunk( Twinkle.getPref('batchUndeleteChunks') );Wikipedia.addCheckpoint();Twinkle.batchundelete.currentundeletor = window.setInterval( Twinkle.batchundelete.callbacks.main, 1000, work, reason );};Twinkle.batchundelete.callbacks = {main: function( work, reason ) {if( work.length === 0 && Twinkle.batchundelete.currentUndeleteCounter <= 0 ) {Status.info( 'work done' );window.clearInterval( Twinkle.batchundelete.currentundeletor );Wikipedia.removeCheckpoint();return;} else if( work.length !== 0 && Twinkle.batchundelete.currentUndeleteCounter <= Twinkle.getPref('batchUndeleteMinCutOff') ) {var pages = work.shift();Twinkle.batchundelete.currentUndeleteCounter += pages.length;for( var i = 0; i < pages.length; ++i ) {var title = pages[i];var query = { 'title': 'Special:Undelete','target': title,'action': 'submit'};var wikipedia_wiki = new Wikipedia.wiki( "Undeleting " + title, query, Twinkle.batchundelete.callbacks.undeletePage, function( self ) { --Twinkle.batchundelete.currentUndeleteCounter;var link = document.createElement( 'a' );link.setAttribute( 'href', mw.util.wikiGetlink(self.params.title) );link.setAttribute( 'title', self.params.title );link.appendChild( document.createTextNode(self.params.title) );self.statelem.info( ['completed (',link,')'] );});wikipedia_wiki.params = { title:title, reason: reason };wikipedia_wiki.get();}}},undeletePage: function( self ) {var form = self.responseXML.getElementById('undelete');var postData = {'wpComment': self.params.reason + '.' +  Twinkle.getPref('deletionSummaryAd'),'target': self.params.image,'wpEditToken': form.wpEditToken.value,'restore': 1};self.post( postData );}};/******************************************** twinklecloser.js: AFD/AFC closer module***************************************** Mode of invocation:     Link on AFD subpages (including daily log pages) and AFC daily log pages* Active on:              The aforementioned pages* Config directives in:   TwinkleConfig*/Twinkle.closer = function twinklecloser() {var closeable = false;var type;if( /Wikipedia:Articles_for_creation\/\d{4}-\d{2}-\d{2}/.test(mw.config.get('wgPageName')) ) {closeable = true;type = 'afc';} else if(  /Wikipedia:Articles_for_deletion\//.test(mw.config.get('wgPageName')) ) {closeable = true;type = 'afd';}if( closeable ) {Twinkle.closer.mark( type );}};Twinkle.closer.mark = function twinklecloserMark( type ) {var sections;switch( type ) {case 'afc':sections = $('h2:has(span.editsection)');sections.each(function(index, section) {var query = new QueryString($(this).find('span.editsection a').attr('href').split( '?', 2 )[1]);var section_number = query.get('section');var closelink = $('<a/>', {'text': '[close]','click': function(){Twinkle.closer.actions.afc(section_number);},'class': 'twinkle-closer-link twinkle-closer-link-afc','css': { 'color': '#449922'}}).prependTo(this);});break;case 'afd':sections = $('h3:has(span.editsection)');sections.each(function(index, section) {var $a = $(this).find('span.editsection a');var page =$a.attr('title');var query = new QueryString($a.attr('href').split( '?', 2 )[1]);var section_number = query.get('section');var closelink = $('<a/>', {'text': '[close]','click': function(){Twinkle.closer.actions.afd(section_number, page);},'class': 'twinkle-closer-link twinkle-closer-link-afd','css': { 'color': '#449922'}}).prependTo(this);});break;default:alert("Twinkle.closer.mark: unknown closure type " + type);break;}};Twinkle.closer.actions = {afc: function twinklecloserActionsAfc( section ) {var Window = new SimpleWindow( 800, 400 );Window.setTitle( "Close AFC" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "AFC reviewing instructions", "WP:AFCR" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#closer-afc" );var form = new QuickForm( Twinkle.closer.callbacks.afc.evaluate );form.append ( {label: 'Action: ',type: 'select',name: 'type',event: Twinkle.closer.callbacks.afc.submenu,list: [{label: 'Approved',value: 'approved'},{label: 'Denied',value: 'denied'},{label: 'Archive',value: 'archive'}]});form.append( {type: 'div',id: 'work_area'} );form.append( {type: 'hidden',name: 'section',value: section} );form.append( {type: 'hidden',name: 'page',value: page} );form.append( { type:'submit' } );var result = form.render();Window.setContent( result );Window.display();// We must init thevar evt = document.createEvent( "Event" );evt.initEvent( 'change', true, true );result.type.dispatchEvent( evt );},afd: function twinklecloserActionsAfd( section, page ) {var Window = new SimpleWindow( 800, 400 );Window.setTitle( "Close AFD" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "AFD closing instructions", "Wikipedia:Articles for deletion/Administrator instructions" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#closer-afd" );var form = new QuickForm( Twinkle.closer.callbacks.afd.evaluate );form.append ( {label: 'Action: ',type: 'radio',name: 'type',list: [{label: 'Keep',value: 'keep'},{label: 'No consensus',value: 'no consensus'},{label: 'Merge',value: 'merge'},{label: 'Redirect',value: 'redirect',subgroup: {type: 'input',name: 'target',label: 'Target: ',tooltip: 'the name of the page to redirect to'}},{label: 'Delete',value: 'delete',subgroup: {type: 'checkbox',list: [{label: 'Delete? ',value: 'delete',name: 'del',tooltop: 'if we should delete the page on the fly',checked: true}]}}]});form.append( {type: 'textarea',name: 'reason',label: 'Reason:'} );form.append( {type: 'input',name: 'affected_page',label: 'Affected page: ',value: page.replace( /.*\/(.*?)(\s\(.*?\))?/, "$1" )} );form.append( {type: 'div',id: 'work_area'} );form.append( {type: 'hidden',name: 'section',value: section} );form.append( {type: 'hidden',name: 'page',value: page} );form.append( { type:'submit' } );var result = form.render();Window.setContent( result );Window.display();}};Twinkle.closer.callbacks = {afc: {submenu: function(e) {var value = e.target.value;var root = e.target.form;var old_area = document.getElementById( 'work_area' );var work_area = null;switch( value ) {case 'archive':work_area = new QuickForm.element( {type: 'div',id: 'work_area'} );work_area.append( {type: 'checkbox',name: 'approved',list: [{label: 'Approved ',value: 'approved'}]} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;case 'approved':work_area = new QuickForm.element( {type: 'div',id: 'work_area'} );work_area.append( {type: 'input',name: 'article',label: 'Article ',tooltop: 'Leave empty if article was created as specified'} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;case 'denied':work_area = new QuickForm.element( {type: 'div',id: 'work_area'} );work_area.append( {type: 'select',name: 'reason',label: 'Reason ',list: [{label:'v',value:'v'},{label:'bio',value:'bio'},{label:'nn',value:'nn'},{label:'web',value:'web'},{label:'corp',value:'corp'},{label:'music',value:'music'},{label:'dict',value:'dict'},{label:'context',value:'context'},{label:'blank',value:'blank'},{label:'neo',value:'neo'},{label:'joke',value:'joke'},{label:'lang',value:'lang'},{label:'blp',value:'blp'},{label:'npov',value:'npov'},{label:'not',value:'not'}]} );work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );break;default:alert("Twinkle.closer.callbacks.afc.submenu: unknown outcome " + value);break;}},evaluate: function(e) {var form = e.target;var type = form.type.value;var section = form.section.value;var params = { type: type };switch( type ) {case 'approved':var article = form.article.value;params.tag = '{{subst:afc accept' + ( article ? '|' + article : '' ) + '}}';break;case 'denied':var reason = form.reason.value;params.tag = '{{subst:afc ' + reason + '}}';break;case 'archive':var approved = form.approved.checked;params.top = '{{subst:afc top' + ( approved ? '|approved' : '' ) + '}}';params.bottom = '{{subst:afc b}}';break;default:alert("Twinkle.closer.callbacks.afc.evaluate: unknown outcome " + type);break;}SimpleWindow.setButtonsEnabled( false );Status.init( form );var page = Wikipedia.page(mw.config.get('wgPageName'), "Processing");page.setPageSection(section);page.setCallbackParameters(params);page.load(Twinkle.closer.callbacks.afc.edit);},edit: function( pageobj ) {var text = pageobj.getPageText();var params = pageobj.getCallbackParameters();var statelem = pageobj.getStatusElement();var summary;switch( params.type ) {case 'approved':text += params.tag + '<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)';summary = 'Approving article.';break;case 'denied':text += params.tag + '<code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)';summary = 'Denying article.';break;case 'archive':text = text.replace( /^(==.*?==)\n/, "$1\n" + params.top  );text += params.bottom;summary = 'Archiving.';break;default:alert("Twinkle.closer.callbacks.afc.edit: unknown outcome " + params.type);break;}pageobj.setPageText(text);pageobj.setEditSummary(summary + Twinkle.getPref('summaryAd'));pageobj.setCreateOption('nocreate');pageobj.save();}},afd: {submenu: function(e) {var value = e.target.value;var root = e.target.form;var old_area = document.getElementById( 'work_area' );varwork_area = new QuickForm.element( {type: 'div',id: 'work_area'} );switch( value ) {case 'keep':case 'no consensus':// nothingbreak;case 'redirect':work_area.append( {type: 'input',name: 'target',label: 'Target: ',tooltip: 'the name of the page to redirect to'} );break;case 'merge':// merge must be done manuallybreak;case 'delete':work_area.append( {type: 'checkbox',list: [{label: 'Delete? ',value: 'delete',name: 'del',tooltop: 'if we should delete the page on the fly',checked: true}]} );break;default:alert("Twinkle.closer.callbacks.afd.submenu: unknown outcome " + value);break;}work_area = work_area.render();old_area.parentNode.replaceChild( work_area, old_area );},evaluate: function(e) {var form = e.target;var reason = form.reason.value;var type = form.type.value;var section = form.section.value;var page = form.page.value;var affected_page = form.affected_page.value;var params = { type: type, page: page, reason: reason, affected_page: affected_page };var label, wp_page;switch( type ) {case 'keep':label = "Keep";break;case 'no consensus':label = "No consensus";break;case 'redirect':label = "Redirect";var target = form.target.value;break;case 'merge':label = "Merge";break;case 'delete':label = "Delete";var del = form.del.checked;break;default:alert("Twinkle.closer.callbacks.afd.evaluate: unknown outcome " + type);break;}params.label = label;SimpleWindow.setButtonsEnabled( false );Status.init( form );if( type === 'delete' ) {if( del ) {// Start by purging redirectvar query = {'action': 'query','list': 'backlinks','blfilterredir': 'redirects','bltitle': affected_page,'bllimit': 5000};var wikipedia_api = new Wikipedia.api( 'Grabbing redirects', query, Twinkle.closer.callbacks.afd.deleteRedirectsMain );wikipedia_api.params = params;wikipedia_api.post();// and now, delete!wp_page = Wikipedia.page(affected_page, 'Deleting page');wp_page.setEditSummary("Deleted per outcome of [[WP:AFD]] discussion (see [[" + params.page + "]])." + Twinkle.getPref('deletionSummaryAd'));wp_page.deletePage();}}wp_page = Wikipedia.page(page, "Updating process page");wp_page.setPageSection(section);wp_page.setCallbackParameters(params);wp_page.load(Twinkle.closer.callbacks.afd.edit);},deleteRedirectsMain: function( self ) {var $doc = $(self.responseXML);$doc.find("backlinks bl").each(function(){var title = $(this).attr('title');var page = new Wikipedia.page(title, "Deleting redirecting page " + title);page.setEditSummary("Speedy deleted per ([[WP:CSD#R1|CSD R1]]), Redirect to deleted page \"" + self.params.affected_page + "\"." + Twinkle.getPref('deletionSummaryAd'));page.deletePage();});},edit: function( pageobj ) {var text = pageobj.getText();var params = pageobj.getCallbackParameters();pageobj.setEditSummary( "Closing discussion, result was \"" + params.label + "\"" +  Twinkle.getPref('summaryAd') );pageobj.setPageText("{{subst:Afd top}}'''" + params.label + "''' " + params.reason + ". <code style="background:yellow">:)</code>[[کاربر:Ladsgroup|امیر]]<sup>[[بحث کاربر:Ladsgroup|Συζήτηση]] </sup> ‏۶ اکتبر ۲۰۲۳، ساعت ۰۳:۰۲ (UTC)n" + text + "\n{{subst:Afd bottom}}");pageobj.save();}}};/* **************************************** *** twinkleconfig.js: Preferences module **************************************** * Mode of invocation:     Adds configuration form to Wikipedia:Twinkle/Preferences and user                            subpages named "/Twinkle preferences", and adds ad box to the top of user                            subpages belonging to the currently logged-in user which end in '.js' * Active on:              What I just said.  Yeah. * Config directives in:   TwinkleConfig I, [[User:This, that and the other]], originally wrote this.  If the code is misbehaving, or you have any questions, don't hesitate to ask me.  (This doesn't at all imply [[WP:OWN]]ership - it's just meant to point you in the right direction.)  -- TTO */Twinkle.config = {};Twinkle.config.commonEnums = {watchlist: { yes: "Add to watchlist", no: "Don't add to watchlist", "default": "Follow your site preferences" },talkPageMode: { window: "In a window, replacing other user talks", tab: "In a new tab", blank: "In a totally new window" }};Twinkle.config.commonSets = {csdCriteria: {db: "Custom rationale ({{db}})",g1: "G1", g2: "G2", g3: "G3", g4: "G4", g5: "G5", g6: "G6", g7: "G7", g8: "G8", g10: "G10", g11: "G11", g12: "G12",a1: "A1", a2: "A2", a3: "A3", a5: "A5", a7: "A7", a9: "A9", a10: "A10",u1: "U1", u2: "U2", u3: "U3",f1: "F1", f2: "F2", f3: "F3", f7: "F7", f8: "F8", f9: "F9", f10: "F10",c1: "C1",t2: "T2", t3: "T3",r2: "R2", r3: "R3",p1: "P1", p2: "P2"  // db-multiple is not listed here because it is treated differently within twinklespeedy},csdCriteriaDisplayOrder: ["db","g1", "g2", "g3", "g4", "g5", "g6", "g7", "g8", "g10", "g11", "g12","a1", "a2", "a3", "a5", "a7", "a9", "a10","u1", "u2", "u3","f1", "f2", "f3", "f7", "f8", "f9", "f10","c1","t2", "t3","r2", "r3","p1", "p2"],csdAndDICriteria: {db: "Custom rationale ({{db}})",g1: "G1", g2: "G2", g3: "G3", g4: "G4", g5: "G5", g6: "G6", g7: "G7", g8: "G8", g10: "G10", g11: "G11", g12: "G12",a1: "A1", a2: "A2", a3: "A3", a5: "A5", a7: "A7", a9: "A9", a10: "A10",u1: "U1", u2: "U2", u3: "U3",f1: "F1", f2: "F2", f3: "F3", f4: "F4", f5: "F5", f6: "F6", f7: "F7", f8: "F8", f9: "F9", f10: "F10", f11: "F11",c1: "C1",t2: "T2", t3: "T3",r2: "R2", r3: "R3",p1: "P1", p2: "P2"},csdAndDICriteriaDisplayOrder: ["db","g1", "g2", "g3", "g4", "g5", "g6", "g7", "g8", "g10", "g11", "g12","a1", "a2", "a3", "a5", "a7", "a9", "a10","u1", "u2", "u3","f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11","c1","t2", "t3","r2", "r3","p1", "p2"],namespacesNoSpecial: {"0": "Article","1": "Talk (article)","2": "User","3": "User talk","4": "Wikipedia","5": "Wikipedia talk","6": "File","7": "File talk","8": "MediaWiki","9": "MediaWiki talk","10": "Template","11": "Template talk","12": "Help","13": "Help talk","14": "Category","15": "Category talk","100": "Portal","101": "Portal talk","108": "Book","109": "Book talk"}};/** * Section entry format: * * { *   title: <human-readable section title>, *   adminOnly: <true for admin-only sections>, *   hidden: <true for advanced preferences that rarely need to be changed - they can still be modified by manually editing twinkleoptions.js>, *   inFriendlyConfig: <true for preferences located under FriendlyConfig rather than TwinkleConfig>, *   preferences: [ *     { *       name: <TwinkleConfig property name>, *       label: <human-readable short description - used as a form label>, *       helptip: <(optional) human-readable text (using valid HTML) that complements the description, like limits, warnings, etc.> *       adminOnly: <true for admin-only preferences>, *       type: <string|boolean|integer|enum|set|customList> (customList stores an array of JSON objects { value, label }), *       enumValues: <for type = "enum": a JSON object where the keys are the internal names and the values are human-readable strings>, *       setValues: <for type = "set": a JSON object where the keys are the internal names and the values are human-readable strings>, *       setDisplayOrder: <(optional) for type = "set": an array containing the keys of setValues (as strings) in the order that they are displayed>, *       customListValueTitle: <for type = "customList": the heading for the left "value" column in the custom list editor>, *       customListLabelTitle: <for type = "customList": the heading for the right "label" column in the custom list editor> *     }, *     . . . *   ] * }, * . . . * */Twinkle.config.sections = [{title: "General",preferences: [// TwinkleConfig.summaryAd (string)// Text to be appended to the edit summary of edits made using Twinkle{name: "summaryAd",label: "\"Ad\" to be appended to Twinkle's edit summaries",helptip: "The summary ad should start with a space, and be kept short.",type: "string"},// TwinkleConfig.deletionSummaryAd (string)// Text to be appended to the edit summary of deletions made using Twinkle{name: "deletionSummaryAd",label: "Summary ad to use for deletion summaries",helptip: "Normally the same as the edit summary ad above.",adminOnly: true,type: "string"},// TwinkleConfig.protectionSummaryAd (string)// Text to be appended to the edit summary of page protections made using Twinkle{name: "protectionSummaryAd",label: "Summary ad to use for page protections",helptip: "Normally the same as the edit summary ad above.",adminOnly: true,type: "string"},// TwinkleConfig.userTalkPageMode may take arguments:// 'window': open a new window, remember the opened window// 'tab': opens in a new tab, if possible.// 'blank': force open in a new window, even if such a window exists{name: "userTalkPageMode",label: "When opening a user talk page, open it",type: "enum",enumValues: Twinkle.config.commonEnums.talkPageMode},// TwinkleConfig.dialogLargeFont (boolean){name: "dialogLargeFont",label: "Use larger text in Twinkle dialogs",type: "boolean"}]},{title: "Image deletion (DI)",preferences: [// TwinkleConfig.notifyUserOnDeli (boolean)// If the user should be notified after placing a file deletion tag{name: "notifyUserOnDeli",label: "Check the \"notify initial uploader\" box by default",type: "boolean"},// TwinkleConfig.deliWatchPage (string)// The watchlist setting of the page tagged for deletion. Either "yes", "no", or "default". Default is "default" (Duh).{name: "deliWatchPage",label: "Add image page to watchlist when tagging",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist},// TwinkleConfig.deliWatchUser (string)// The watchlist setting of the user talk page if a notification is placed. Either "yes", "no", or "default". Default is "default" (Duh).{name: "deliWatchUser",label: "Add user talk page of initial uploader to watchlist when notifying",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist}]},{title: "Proposed deletion (PROD)",preferences: [// TwinkleConfig.watchProdPages (boolean)// If, when applying prod template to page, to watch the page{name: "watchProdPages",label: "Add article to watchlist when tagging",type: "boolean"},// TwinkleConfig.prodReasonDefault (string)// The prefilled PROD reason.{name: "prodReasonDefault",label: "Prefilled PROD reason",type: "string"},{name: "logProdPages",label: "Keep a log in userspace of all pages you tag for PROD",helptip: "Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you tag for PROD using Twinkle.",type: "boolean"},{name: "prodLogPageName",label: "Keep the PROD userspace log at this user subpage",helptip: "i.e. User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the PROD userspace log.",type: "string"}]},{title: "Revert and rollback",  // twinklefluff modulepreferences: [// TwinkleConfig.openTalkPage (array)// What types of actions that should result in opening of talk page{name: "openTalkPage",label: "Open user talk page after these types of reversions",type: "set",setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }},// TwinkleConfig.openTalkPageOnAutoRevert (bool)// Defines if talk page should be opened when calling revert from contrib page, because from there, actions may be multiple, and opening talk page not suitable. If set to true, openTalkPage defines then if talk page will be opened.{name: "openTalkPageOnAutoRevert",label: "Open user talk page when invoking rollback from user contributions",helptip: "Often, you may be rolling back many pages at a time from a vandal's contributions page, so it would be unsuitable to open the user talk page. Hence, this option is off by default. When this is on, the desired options must be enabled in the previous setting for this to work.",type: "boolean"},// TwinkleConfig.markRevertedPagesAsMinor (array)// What types of actions that should result in marking edit as minor{name: "markRevertedPagesAsMinor",label: "Mark as minor edit for these types of reversions",type: "set",setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }},// TwinkleConfig.watchRevertedPages (array)// What types of actions that should result in forced addition to watchlist{name: "watchRevertedPages",label: "Add pages to watchlist for these types of reversions",type: "set",setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }},// TwinkleConfig.offerReasonOnNormalRevert (boolean)// If to offer a prompt for extra summary reason for normal reverts, default to true{name: "offerReasonOnNormalRevert",label: "Prompt for reason for normal rollbacks",helptip: "\"Normal\" rollbacks are the ones that are invoked from the middle [rollback] link.",type: "boolean"},{name: "confirmOnFluff",label: "Provide a confirmation message before reverting",helptip: "For users of pen or touch devices, and chronically indecisive people.",type: "boolean"},// TwinkleConfig.showRollbackLinks (array)// Where Twinkle should show rollback links (diff, others, mine, contribs)// Note from TTO: |contribs| seems to be equal to |others| + |mine|, i.e. redundant, so I left it out heres{name: "showRollbackLinks",label: "Show rollback links on these pages",type: "set",setValues: { diff: "Diff pages", others: "Contributions pages of other users", mine: "My contributions page" }}]},{title: "Shared IP tagging",inFriendlyConfig: true,preferences: [{name: "markSharedIPAsMinor",label: "Mark shared IP tagging as a minor edit",type: "boolean"}]},{title: "Speedy deletion (CSD)",preferences: [// TwinkleConfig.speedyPromptOnG7 (boolean){name: "speedyPromptOnG7",label: "Prompt for rationale when tagging with G7 (author request)",type: "boolean"},// TwinkleConfig.watchSpeedyPages (array)// Whether to add speedy tagged pages to watchlist{name: "watchSpeedyPages",label: "Add page to watchlist when tagging with these criteria",type: "set",setValues: Twinkle.config.commonSets.csdCriteria,setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder},// TwinkleConfig.markSpeedyPagesAsPatrolled (boolean)// If, when applying speedy template to page, to mark the page as patrolled (if the page was reached from NewPages){name: "markSpeedyPagesAsPatrolled",label: "Mark page as patrolled when tagging (if possible)",helptip: "Due to technical limitations, pages are only marked as patrolled when they are reached via Special:NewPages.",type: "boolean"},// TwinkleConfig.notifyUserOnSpeedyDeletionNomination (array)// What types of actions should result that the author of the page being notified of nomination{name: "notifyUserOnSpeedyDeletionNomination",label: "Notify page creator only when tagging with these criteria",helptip: "Even if you choose to notify from the CSD screen, the notification will only take place for those criteria selected here.",type: "set",setValues: Twinkle.config.commonSets.csdCriteria,setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder},// TwinkleConfig.welcomeUserOnSpeedyDeletionNotification (array of strings)// On what types of speedy deletion notifications shall the user be welcomed// with a "firstarticle" notice if his talk page has not yet been created.{name: "welcomeUserOnSpeedyDeletionNotification",label: "Welcome page creator alongside notification when tagging with these criteria",helptip: "The welcome is issued only if the user is notified about the deletion, and only if their talk page does not already exist. The template used is {{<a href=\"" + mw.util.wikiGetlink("Template:Firstarticle") + "\">firstarticle</a>}}.",type: "set",setValues: Twinkle.config.commonSets.csdCriteria,setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder},// TwinkleConfig.promptForSpeedyDeletionSummary (array of strings){name: "promptForSpeedyDeletionSummary",label: "Allow editing of deletion summary when deleting under these criteria",adminOnly: true,type: "set",setValues: Twinkle.config.commonSets.csdAndDICriteria,setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder},// TwinkleConfig.openUserTalkPageOnSpeedyDelete (array of strings)// What types of actions that should result user talk page to be opened when speedily deleting (admin only){name: "openUserTalkPageOnSpeedyDelete",label: "Open user talk page when deleting under these criteria",adminOnly: true,type: "set",setValues: Twinkle.config.commonSets.csdAndDICriteria,setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder},// TwinkleConfig.deleteTalkPageOnDelete (boolean)// If talk page if exists should also be deleted (CSD G8) when spedying a page (admin only){name: "deleteTalkPageOnDelete",label: "Check the \"also delete talk page\" box by default",adminOnly: true,type: "boolean"},// TwinkleConfig.deleteSysopDefaultToTag (boolean)// Make the CSD screen default to "tag" instead of "delete" (admin only){name: "deleteSysopDefaultToTag",label: "Default to speedy tagging instead of outright deletion",adminOnly: true,type: "boolean"},// TwinkleConfig.speedyWindowWidth (integer)// Defines the width of the Twinkle SD window in pixels{name: "speedyWindowWidth",label: "Width of speedy deletion window (pixels)",type: "integer"},// TwinkleConfig.speedyWindowWidth (integer)// Defines the width of the Twinkle SD window in pixels{name: "speedyWindowHeight",label: "Height of speedy deletion window (pixels)",helptip: "If you have a big monitor, you might like to increase this.",type: "integer"},{name: "logSpeedyNominations",label: "Keep a log in userspace of all CSD nominations",helptip: "Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you nominate for CSD using Twinkle. Files tagged using DI are also added to this log.",type: "boolean"},{name: "speedyLogPageName",label: "Keep the CSD userspace log at this user subpage",helptip: "i.e. User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the CSD userspace log.",type: "string"},{name: "noLogOnSpeedyNomination",label: "Do not create a userspace log entry when tagging with these criteria",type: "set",setValues: Twinkle.config.commonSets.csdAndDICriteria,setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder}]},{title: "Tag",inFriendlyConfig: true,preferences: [{name: "groupByDefault",label: "Check the \"group into {{multiple issues}}\" box by default",type: "boolean"},{name: "watchTaggedPages",label: "Add page to watchlist when tagging",type: "boolean"},{name: "markTaggedPagesAsMinor",label: "Mark addition of tags as a minor edit",type: "boolean"},{name: "markTaggedPagesAsPatrolled",label: "Mark pages as patrolled when tagging (if possible)",helptip: "Due to technical limitations, pages are only marked as patrolled when they are reached via Special:NewPages.",type: "boolean"},{name: "customTagList",label: "Custom article maintenance tags to display",helptip: "These appear as additional options at the bottom of the list of tags. For example, you could add new maintenance tags which have not yet been added to Twinkle's defaults.",type: "customList",customListValueTitle: "Template name (no curly brackets)",customListLabelTitle: "Text to show in Welcome dialog"}]},{title: "Talkback",inFriendlyConfig: true,preferences: [{name: "markTalkbackAsMinor",label: "Mark talkbacks as minor edits",type: "boolean"},{name: "insertTalkbackSignature",label: "Insert signature within talkbacks",type: "boolean"},{name: "talkbackHeading",label: "Section heading to use for talkbacks",type: "string"},{name: "adminNoticeHeading",label: "Section heading to use for administrators' noticeboard notices",type: "string"}]},{title: "Unlink",preferences: [// TwinkleConfig.unlinkNamespaces (array)// In what namespaces unlink should happen, default in 0 (article) and 100 (portal){name: "unlinkNamespaces",label: "Remove links from pages in these namespaces",helptip: "Avoid selecting any talk namespaces, as Twinkle might end up unlinking on talk archives (a big no-no).",type: "set",setValues: Twinkle.config.commonSets.namespacesNoSpecial}]},{title: "Warn user",preferences: [// TwinkleConfig.defaultWarningGroup (int)// if true, watch the page which has been dispatched an warning or notice, if false, default applies{name: "defaultWarningGroup",label: "Default warning level",type: "enum",enumValues: { "1": "Level 1", "2": "Level 2", "3": "Level 3", "4": "Level 4", "5": "Level 4im", "6": "Single-issue notices", "7": "Single-issue warnings", "8": "Block (admin only)" }},// TwinkleConfig.showSharedIPNotice may take arguments:// true: to show shared ip notice if an IP address// false: to not print the notice{name: "showSharedIPNotice",label: "Add extra notice on shared IP talk pages",helptip: "The notice used for this is not a template - it is hard-coded in Twinkle at the moment.",type: "boolean"},// TwinkleConfig.watchWarnings (boolean)// if true, watch the page which has been dispatched an warning or notice, if false, default applies{name: "watchWarnings",label: "Add user talk page to watchlist when notifying",type: "boolean"},// TwinkleConfig.blankTalkpageOnIndefBlock (boolean)// if true, blank the talk page when issuing an indef block notice (per [[WP:UW#Indefinitely blocked users]]){name: "blankTalkpageOnIndefBlock",label: "Blank the talk page when indefinitely blocking users",helptip: "See <a href=\"" + mw.util.wikiGetlink("WP:UW#Indefinitely blocked users") + "\">WP:UW</a> for more information.",adminOnly: true,type: "boolean"}]},{title: "Welcome user",inFriendlyConfig: true,preferences: [{name: "topWelcomes",label: "Place welcomes above existing content on user talk pages",type: "boolean"},{name: "watchWelcomes",label: "Add user talk pages to watchlist when welcoming",helptip: "Doing so adds to the personal element of welcoming a user - you will be able to see how they are coping as a newbie, and possibly help them.",type: "boolean"},{name: "insertHeadings",label: "Insert a section heading before welcomes",type: "boolean"},{name: "welcomeHeading",label: "Section heading to use for welcomes",helptip: "Only has an effect if headings are enabled, and the heading is not part of the template.",type: "string"},{name: "insertUsername",label: "Add your username to the template (where applicable)",helptip: "Some welcome templates have an opening sentence like \"Hi, I'm &lt;username&gt;. Welcome\" etc. If you turn off this option, these templates will not display your username in that way.",type: "boolean"},{name: "insertSignature",label: "Add your signature after the welcome",helptip: "Strongly recommended.",type: "boolean"},{name: "markWelcomesAsMinor",label: "Mark welcomes as minor edits",type: "boolean"},{name: "maskTemplateInSummary",label: "Omit the name of the welcome template in the edit summary",helptip: "The names of some of the templates (e.g. \"welcome-anon-vandal\") may be viewed by the user as attacks, so it is better to leave them out of the edit summary",type: "boolean"},{name: "quickWelcomeMode",label: "Clicking the \"welcome\" link on a diff page will",helptip: "If you choose to welcome automatically, the template you specify below will be used.",type: "enum",enumValues: { auto: "welcome automatically", norm: "prompt you to select a template" }},{name: "quickWelcomeTemplate",label: "Template to use when welcoming automatically",helptip: "Enter the name of a welcome template, without the curly brackets. A link to the given article will be added.",type: "string"},{name: "customWelcomeList",label: "Custom welcome templates to display",helptip: "You can add other welcome templates, or user subpages that are welcome templates (prefixed with \"User:\"). Don't forget that these templates are substituted onto user talk pages.",type: "customList",customListValueTitle: "Template name (no curly brackets)",customListLabelTitle: "Text to show in Welcome dialog"}]},{title: "XFD (deletion discussions)",preferences: [// TwinkleConfig.xfdWatchPage (string)// The watchlist setting of the page being nominated for XfD. Either "yes" (add to watchlist), "no" (don't// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).{name: "xfdWatchPage",label: "Add the nominated page to watchlist",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist},// TwinkleConfig.xfdWatchDiscussion (string)// The watchlist setting of the newly created XfD page (for those processes that create discussion pages for each nomination),// or the list page for the other processes.// Either "yes" (add to watchlist), "no" (don't add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).{name: "xfdWatchDiscussion",label: "Add the deletion discussion page to watchlist",helptip: "This refers to the discussion subpage (for AfD and MfD) or the daily log page (for TfD, CfD, RfD and FfD)",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist},// TwinkleConfig.xfdWatchList (string)// The watchlist setting of the XfD list page, *if* the discussion is on a separate page. Either "yes" (add to watchlist), "no" (don't// add to watchlist), or "default" (use setting from preferences). Default is "no" (Hehe. Seriously though, who wants to watch it?// Sorry in advance for any false positives.).{name: "xfdWatchList",label: "Add the daily log/list page to the watchlist (where applicable)",helptip: "This only applies for AfD and MfD, where the discussions are transcluded onto a daily log page (for AfD) or the main MfD page (for MfD).",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist},// TwinkleConfig.xfdWatchUser (string)// The watchlist setting of the user if he receives a notification. Either "yes" (add to watchlist), "no" (don't// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).{name: "xfdWatchUser",label: "Add the user talk page to watchlist (when notifying)",type: "enum",enumValues: Twinkle.config.commonEnums.watchlist}]},{title: "Hidden",hidden: true,preferences: [// twinkle.header.js: portlet setup{name: "portletArea",type: "string"},{name: "portletId",type: "string"},{name: "portletName",type: "string"},{name: "portletType",type: "string"},{name: "portletNext",type: "string"},// twinklefluff.js: defines how many revision to query maximum, maximum possible is 50, default is 50{name: "revertMaxRevisions",type: "integer"},// twinklebatchdelete.js: How many pages should be processed at a time{name: "batchdeleteChunks",type: "integer"},// twinklebatchdelete.js: How many pages left in the process of being completed should allow a new batch to be initialized{name: "batchDeleteMinCutOff",type: "integer"},// twinklebatchdelete.js: How many pages should be processed maximum{name: "batchMax",type: "integer"},// twinklebatchprotect.js: How many pages should be processed at a time{name: "batchProtectChunks",type: "integer"},// twinklebatchprotect.js: How many pages left in the process of being completed should allow a new batch to be initialized{name: "batchProtectMinCutOff",type: "integer"},// twinklebatchundelete.js: How many pages should be processed at a time{name: "batchundeleteChunks",type: "integer"},// twinklebatchundelete.js: How many pages left in the process of being completed should allow a new batch to be initialized{name: "batchUndeleteMinCutOff",type: "integer"},// twinkledelimages.js: How many files should be processed at a time{name: "deliChunks",type: "integer"},// twinkledelimages.js: How many files should be processed maximum{name: "deliMax",type: "integer"},// twinkledeprod.js: How many pages should be processed at a time{name: "proddeleteChunks",type: "integer"}]}]; // end of Twinkle.config.sections//{//name: "",//label: "",//type: ""//},Twinkle.config.init = function twinkleconfigInit() {if ((mw.config.get("wgPageName") === "Wikipedia:Twinkle/Preferences" ||    (mw.config.get("wgNamespaceNumber") === 2 && mw.config.get("wgTitle").lastIndexOf("/Twinkle preferences") === (mw.config.get("wgTitle").length - 20))) &&    mw.config.get("wgAction") === "view") {// create the config page at Wikipedia:Twinkle/Preferences, and at user subpages (for testing purposes)if (!document.getElementById("twinkle-config")) {return;  // maybe the page is misconfigured, or something - but any attempt to modify it will be pointless}// set style (the url() CSS function doesn't seem to work from wikicode - ?!)document.getElementById("twinkle-config-titlebar").style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB%2FqqA%2BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEhQTFRFr73ZobTPusjdsMHZp7nVwtDhzNbnwM3fu8jdq7vUt8nbxtDkw9DhpbfSvMrfssPZqLvVztbno7bRrr7W1d%2Fs1N7qydXk0NjpkW7Q%2BgAAADVJREFUeNoMwgESQCAAAMGLkEIi%2FP%2BnbnbpdB59app5Vdg0sXAoMZCpGoFbK6ciuy6FX4ABAEyoAef0BXOXAAAAAElFTkSuQmCC)";var contentdiv = document.getElementById("twinkle-config-content");contentdiv.textContent = "";  // clear children// let user know about possible conflict with monobook.js/vector.js file// (settings in that file will still work, but they will be overwritten by twinkleoptions.js settings)var contentnotice = document.createElement("p");// I hate innerHTML, but this is one thing it *is* good for...contentnotice.innerHTML = "<b>Before modifying your preferences here,</b> make sure you have removed any old <code>TwinkleConfig</code> and <code>FriendlyConfig</code> settings from your <a href=\"" + mw.util.wikiGetlink("Special:MyPage/skin.js") + "\" title=\"Special:MyPage/skin.js\">user JavaScript file</a>.";contentdiv.appendChild(contentnotice);// look and see if the user does in fact have any old settings in their skin JS filevar skinjs = new Wikipedia.page("User:" + mw.config.get("wgUserName") + "/" + mw.config.get("skin") + ".js");skinjs.setCallbackParameters(contentnotice);skinjs.load(Twinkle.config.legacyPrefsNotice);// start a table of contentsvar toctable = document.createElement("table");toctable.className = "toc";toctable.style.marginLeft = "0.4em";var toctr = document.createElement("tr");var toctd = document.createElement("td");// create TOC titlevar toctitle = document.createElement("div");toctitle.id = "toctitle";var toch2 = document.createElement("h2");toch2.textContent = "Contents ";toctitle.appendChild(toch2);// add TOC show/hide linkvar toctoggle = document.createElement("span");toctoggle.className = "toctoggle";toctoggle.appendChild(document.createTextNode("["));var toctogglelink = document.createElement("a");toctogglelink.className = "internal";toctogglelink.setAttribute("href", "#tw-tocshowhide");toctogglelink.textContent = "hide";toctoggle.appendChild(toctogglelink);toctoggle.appendChild(document.createTextNode("]"));toctitle.appendChild(toctoggle);toctd.appendChild(toctitle);// create item container: this is what we add stuff tovar tocul = document.createElement("ul");toctogglelink.addEventListener("click", function twinkleconfigTocToggle() {var $tocul = $(tocul);$tocul.toggle();if ($tocul.find(":visible").length) {toctogglelink.textContent = "hide";} else {toctogglelink.textContent = "show";}}, false);toctd.appendChild(tocul);toctr.appendChild(toctd);toctable.appendChild(toctr);contentdiv.appendChild(toctable);var tocnumber = 1;var contentform = document.createElement("form");contentform.setAttribute("action", "javascript:void(0)");  // was #tw-save - changed to void(0) to work around Chrome issuecontentform.addEventListener("submit", Twinkle.config.save, true);contentdiv.appendChild(contentform);var container = document.createElement("table");container.style.width = "100%";contentform.appendChild(container);$(Twinkle.config.sections).each(function(sectionkey, section) {if (section.hidden || (section.adminOnly && !userIsInGroup("sysop"))) {return true;  // i.e. "continue" in this context}var configgetter;  // retrieve the live config valuesif (section.inFriendlyConfig) {configgetter = Twinkle.getFriendlyPref;} else {configgetter = Twinkle.getPref;}// add to TOCvar tocli = document.createElement("li");tocli.className = "toclevel-1";var toca = document.createElement("a");toca.setAttribute("href", "#twinkle-config-section-" + tocnumber.toString());toca.appendChild(document.createTextNode(section.title));tocli.appendChild(toca);tocul.appendChild(tocli);var row = document.createElement("tr");var cell = document.createElement("td");cell.setAttribute("colspan", "3");var heading = document.createElement("h4");heading.style.borderBottom = "1px solid gray";heading.style.marginTop = "0.2em";heading.id = "twinkle-config-section-" + (tocnumber++).toString();heading.appendChild(document.createTextNode(section.title));cell.appendChild(heading);row.appendChild(cell);container.appendChild(row);var rowcount = 1;  // for row banding// add each of the preferences to the form$(section.preferences).each(function(prefkey, pref) {if (pref.adminOnly && !userIsInGroup("sysop")) {return true;  // i.e. "continue" in this context}row = document.createElement("tr");row.style.marginBottom = "0.2em";// create odd row bandingif (rowcount++ % 2 === 0) {row.style.backgroundColor = "rgba(128, 128, 128, 0.1)";}cell = document.createElement("td");var label, input;switch (pref.type) {case "boolean":  // create a checkboxcell.setAttribute("colspan", "2");label = document.createElement("label");input = document.createElement("input");input.setAttribute("type", "checkbox");input.setAttribute("id", pref.name);input.setAttribute("name", pref.name);if (configgetter(pref.name) === true) {input.setAttribute("checked", "checked");}label.appendChild(input);label.appendChild(document.createTextNode(" " + pref.label));cell.appendChild(label);break;case "string":  // create an input boxcase "integer":// add label to first columncell.style.textAlign = "right";cell.style.paddingRight = "0.5em";label = document.createElement("label");label.setAttribute("for", pref.name);label.appendChild(document.createTextNode(pref.label + ":"));cell.appendChild(label);row.appendChild(cell);// add input box to second columncell = document.createElement("td");cell.style.paddingRight = "1em";input = document.createElement("input");input.setAttribute("type", "text");input.setAttribute("id", pref.name);input.setAttribute("name", pref.name);if (pref.type === "integer") {input.setAttribute("size", 6);input.setAttribute("type", "number");input.setAttribute("step", "1");  // integers only}if (configgetter(pref.name)) {input.setAttribute("value", configgetter(pref.name));}cell.appendChild(input);break;case "enum":  // create a combo box// add label to first column// note: duplicates the code above, under string/integercell.style.textAlign = "right";cell.style.paddingRight = "0.5em";label = document.createElement("label");label.setAttribute("for", pref.name);label.appendChild(document.createTextNode(pref.label + ":"));cell.appendChild(label);row.appendChild(cell);// add input box to second columncell = document.createElement("td");cell.style.paddingRight = "1em";input = document.createElement("select");input.setAttribute("id", pref.name);input.setAttribute("name", pref.name);$.each(pref.enumValues, function(enumvalue, enumdisplay) {var option = document.createElement("option");option.setAttribute("value", enumvalue);if (configgetter(pref.name) == enumvalue) {option.setAttribute("selected", "selected");}option.appendChild(document.createTextNode(enumdisplay));input.appendChild(option);});cell.appendChild(input);break;case "set":  // create a set of check boxes// add label first of allcell.setAttribute("colspan", "2");label = document.createElement("label");  // not really necessary to use a label element here, but we do it for consistency of stylinglabel.appendChild(document.createTextNode(pref.label + ":"));cell.appendChild(label);var checkdiv = document.createElement("div");checkdiv.style.paddingLeft = "1em";var worker = function(itemkey, itemvalue) {var checklabel = document.createElement("label");checklabel.style.marginRight = "0.7em";checklabel.style.display = "inline-block";var check = document.createElement("input");check.setAttribute("type", "checkbox");check.setAttribute("id", pref.name + "_" + itemkey);check.setAttribute("name", pref.name + "_" + itemkey);if (configgetter(pref.name) && configgetter(pref.name).indexOf(itemkey) !== -1) {check.setAttribute("checked", "checked");}// cater for legacy integer array values for unlinkNamespaces (this can be removed a few years down the track...)if (pref.name === "unlinkNamespaces") {if (configgetter(pref.name) && configgetter(pref.name).indexOf(parseInt(itemkey, 10)) !== -1) {check.setAttribute("checked", "checked");}}checklabel.appendChild(check);checklabel.appendChild(document.createTextNode(itemvalue));checkdiv.appendChild(checklabel);};if (pref.setDisplayOrder) {// add check boxes according to the given display order$.each(pref.setDisplayOrder, function(itemkey, item) {worker(item, pref.setValues[item]);});} else {// add check boxes according to the order it gets fed to us (probably strict alphabetical)$.each(pref.setValues, worker);}cell.appendChild(checkdiv);break;case "customList":// add label to first columncell.style.textAlign = "right";cell.style.paddingRight = "0.5em";label = document.createElement("label");label.setAttribute("for", pref.name);label.appendChild(document.createTextNode(pref.label + ":"));cell.appendChild(label);row.appendChild(cell);// add button to second columncell = document.createElement("td");cell.style.paddingRight = "1em";var button = document.createElement("button");button.setAttribute("id", pref.name);button.setAttribute("name", pref.name);button.setAttribute("type", "button");button.addEventListener("click", Twinkle.config.listDialog.display, false);// use jQuery data on the button to store the current config value$(button).data({value: configgetter(pref.name),pref: pref,inFriendlyConfig: section.inFriendlyConfig});button.appendChild(document.createTextNode("Edit items"));cell.appendChild(button);break;default:alert("twinkleconfig: unknown data type for preference " + pref.name);break;}row.appendChild(cell);// add help tipcell = document.createElement("td");cell.style.fontSize = "90%";cell.style.color = "gray";if (pref.helptip) {cell.innerHTML = pref.helptip;}// add reset link (custom lists don't need this, as their config value isn't displayed on the form)if (pref.type !== "customList") {var resetlink = document.createElement("a");resetlink.setAttribute("href", "#tw-reset");resetlink.setAttribute("id", "twinkle-config-reset-" + pref.name);resetlink.addEventListener("click", Twinkle.config.resetPrefLink, false);if (resetlink.style.styleFloat) {  // IE (inc. IE9)resetlink.style.styleFloat = "right";} else {  // standardsresetlink.style.cssFloat = "right";}resetlink.style.margin = "0 0.6em";resetlink.appendChild(document.createTextNode("Reset"));cell.appendChild(resetlink);}row.appendChild(cell);container.appendChild(row);return true;});return true;});var footerbox = document.createElement("div");footerbox.setAttribute("id", "twinkle-config-buttonpane");footerbox.style.backgroundColor = "#BCCADF";footerbox.style.padding = "0.5em";var button = document.createElement("button");button.setAttribute("id", "twinkle-config-submit");button.setAttribute("type", "submit");button.appendChild(document.createTextNode("Save changes"));footerbox.appendChild(button);var footerspan = document.createElement("span");footerspan.className = "plainlinks";footerspan.style.marginLeft = "2.4em";footerspan.style.fontSize = "90%";var footera = document.createElement("a");footera.setAttribute("href", "#tw-reset-all");footera.setAttribute("id", "twinkle-config-resetall");footera.addEventListener("click", Twinkle.config.resetAllPrefs, false);footera.appendChild(document.createTextNode("Restore defaults"));footerspan.appendChild(footera);footerbox.appendChild(footerspan);contentform.appendChild(footerbox);// since all the section headers exist now, we can try going to the requested anchorif (location.hash) {location.hash = location.hash;}} else if (mw.config.get("wgNamespaceNumber") === 2) {var box = document.createElement("div");box.setAttribute("id", "twinkle-config-headerbox");box.style.border = "1px #f60 solid";box.style.background = "#fed";box.style.padding = "0.6em";box.style.margin = "0.5em auto";box.style.textAlign = "center";var link;if (mw.config.get("wgTitle") === mw.config.get("wgUserName") + "/twinkleoptions.js") {// place "why not try the preference panel" noticebox.style.fontWeight = "bold";box.style.width = "80%";box.style.borderWidth = "2px";if (mw.config.get("wgArticleId") > 0) {  // page existsbox.appendChild(document.createTextNode("This page contains your Twinkle preferences. You can change them using the "));} else {  // page does not existbox.appendChild(document.createTextNode("You can customize Twinkle to suit your preferences by using the "));}link = document.createElement("a");link.setAttribute("href", mw.util.wikiGetlink("Wikipedia:Twinkle/Preferences") );link.appendChild(document.createTextNode("Twinkle preferences panel"));box.appendChild(link);box.appendChild(document.createTextNode(", or by editing this page."));$(box).insertAfter($("#contentSub"));} else if (mw.config.get("wgTitle").indexOf(mw.config.get("wgUserName")) === 0 && mw.config.get("wgTitle").lastIndexOf(".js") == mw.config.get("wgTitle").length - 3) {// place "Looking for Twinkle options?" noticebox.style.width = "60%";box.appendChild(document.createTextNode("If you want to set Twinkle preferences, you can use the "));link = document.createElement("a");link.setAttribute("href", mw.util.wikiGetlink("Wikipedia:Twinkle/Preferences") );link.appendChild(document.createTextNode("Twinkle preferences panel"));box.appendChild(link);box.appendChild(document.createTextNode("."));$(box).insertAfter($("#contentSub"));}}};// Wikipedia.page callback from init codeTwinkle.config.legacyPrefsNotice = function twinkleconfigLegacyPrefsNotice(pageobj) {var text = pageobj.getPageText();var contentnotice = pageobj.getCallbackParameters();if (text.indexOf("TwinkleConfig") !== -1 || text.indexOf("FriendlyConfig") !== -1) {contentnotice.innerHTML = '<table class="plainlinks ombox ombox-content"><tr><td class="mbox-image">' +'<img alt="" src="http://upload.wikimedia.org/wikipedia/en/3/38/Imbox_content.png" /></td>' +'<td class="mbox-text"><p><big><b>Before modifying your settings here,</b> you must remove your old Twinkle and Friendly settings from your personal skin JavaScript.</big></p>' +'<p>To do this, you can <a href="' + mw.config.get("wgScript") + '?title=User:' + encodeURIComponent(mw.config.get("wgUserName")) + '/' + mw.config.get("skin") + '.js&action=edit" target="_tab"><b>edit your personal JavaScript</b></a>, removing all lines of code that refer to <code>TwinkleConfig</code> and <code>FriendlyConfig</code>.</p>' +'</td></tr></table>';} else {$(contentnotice).remove();}};// custom list-related stuffTwinkle.config.listDialog = {};Twinkle.config.listDialog.addRow = function twinkleconfigListDialogAddRow(dlgtable, value, label) {var contenttr = document.createElement("tr");// "remove" buttonvar contenttd = document.createElement("td");var removeButton = document.createElement("button");removeButton.setAttribute("type", "button");removeButton.addEventListener("click", function() { $(contenttr).remove(); }, false);removeButton.textContent = "Remove";contenttd.appendChild(removeButton);contenttr.appendChild(contenttd);// value input boxcontenttd = document.createElement("td");var input = document.createElement("input");input.setAttribute("type", "text");input.className = "twinkle-config-customlist-value";input.style.width = "97%";if (value) {input.setAttribute("value", value);}contenttd.appendChild(input);contenttr.appendChild(contenttd);// label input boxcontenttd = document.createElement("td");input = document.createElement("input");input.setAttribute("type", "text");input.className = "twinkle-config-customlist-label";input.style.width = "98%";if (label) {input.setAttribute("value", label);}contenttd.appendChild(input);contenttr.appendChild(contenttd);dlgtable.appendChild(contenttr);};Twinkle.config.listDialog.display = function twinkleconfigListDialogDisplay(e) {var $prefbutton = $(e.target);var curvalue = $prefbutton.data("value");var curpref = $prefbutton.data("pref");var dialog = new SimpleWindow(720, 400);dialog.setTitle(curpref.label);dialog.setScriptName("Twinkle preferences");var dialogcontent = document.createElement("div");var dlgtable = document.createElement("table");dlgtable.className = "wikitable";dlgtable.style.margin = "1.4em 1em";dlgtable.style.width = "auto";var dlgtbody = document.createElement("tbody");// header rowvar dlgtr = document.createElement("tr");// top-left cellvar dlgth = document.createElement("th");dlgth.style.width = "5%";dlgtr.appendChild(dlgth);// value column headerdlgth = document.createElement("th");dlgth.style.width = "35%";dlgth.textContent = (curpref.customListValueTitle ? curpref.customListValueTitle : "Value");dlgtr.appendChild(dlgth);// label column headerdlgth = document.createElement("th");dlgth.style.width = "60%";dlgth.textContent = (curpref.customListLabelTitle ? curpref.customListLabelTitle : "Label");dlgtr.appendChild(dlgth);dlgtbody.appendChild(dlgtr);// content rowsvar gotRow = false;$.each(curvalue, function(k, v) {gotRow = true;Twinkle.config.listDialog.addRow(dlgtbody, v.value, v.label);});// if there are no values present, add a blank row to start the user offif (!gotRow) {Twinkle.config.listDialog.addRow(dlgtbody);}// final "add" buttonvar dlgtfoot = document.createElement("tfoot");dlgtr = document.createElement("tr");var dlgtd = document.createElement("td");dlgtd.setAttribute("colspan", "3");var addButton = document.createElement("button");addButton.style.minWidth = "8em";addButton.setAttribute("type", "button");addButton.addEventListener("click", function(e) {Twinkle.config.listDialog.addRow(dlgtbody);}, false);addButton.textContent = "Add";dlgtd.appendChild(addButton);dlgtr.appendChild(dlgtd);dlgtfoot.appendChild(dlgtr);dlgtable.appendChild(dlgtbody);dlgtable.appendChild(dlgtfoot);dialogcontent.appendChild(dlgtable);// buttonpane buttons: [Save changes] [Reset] [Cancel]var button = document.createElement("button");button.setAttribute("type", "submit");  // so SimpleWindow puts the button in the button panebutton.addEventListener("click", function(e) {Twinkle.config.listDialog.save($prefbutton, dlgtbody);dialog.close();}, false);button.textContent = "Save changes";dialogcontent.appendChild(button);button = document.createElement("button");button.setAttribute("type", "submit");  // so SimpleWindow puts the button in the button panebutton.addEventListener("click", function(e) {Twinkle.config.listDialog.reset($prefbutton, dlgtbody);}, false);button.textContent = "Reset";dialogcontent.appendChild(button);button = document.createElement("button");button.setAttribute("type", "submit");  // so SimpleWindow puts the button in the button panebutton.addEventListener("click", function(e) {dialog.close();  // the event parameter on this function seems to be broken}, false);button.textContent = "Cancel";dialogcontent.appendChild(button);dialog.setContent(dialogcontent);dialog.display();};// Resets the data value, re-populates based on the new (default) value, then saves the// old data value again (less surprising behaviour)Twinkle.config.listDialog.reset = function twinkleconfigListDialogReset(button, tbody) {// reset value on buttonvar $button = $(button);var curpref = $button.data("pref");var oldvalue = $button.data("value");Twinkle.config.resetPref(curpref, $button.data("inFriendlyConfig"));// reset formvar $tbody = $(tbody);$tbody.find("tr").slice(1).remove();  // all rows except the first (header) row// add the new valuesvar curvalue = $button.data("value");$.each(curvalue, function(k, v) {Twinkle.config.listDialog.addRow(tbody, v.value, v.label);});// save the old value$button.data("value", oldvalue);};Twinkle.config.listDialog.save = function twinkleconfigListDialogSave(button, tbody) {var result = [];var current = {};$(tbody).find('input[type="text"]').each(function(inputkey, input) {if ($(input).hasClass("twinkle-config-customlist-value")) {current = { value: input.value };} else {current.label = input.value;// exclude totally empty rowsif (current.value || current.label) {result.push(current);}}});$(button).data("value", result);};// reset/restore defaultsTwinkle.config.resetPrefLink = function twinkleconfigResetPrefLink(e) {var wantedpref = e.target.id.substring(21); // "twinkle-config-reset-" prefix is stripped// search tactics$(Twinkle.config.sections).each(function(sectionkey, section) {if (section.hidden || (section.adminOnly && !userIsInGroup("sysop"))) {return true;  // continue: skip impossibilities}var foundit = false;$(section.preferences).each(function(prefkey, pref) {if (pref.name !== wantedpref) {return true;  // continue}Twinkle.config.resetPref(pref, section.inFriendlyConfig);foundit = true;return false;  // break});if (foundit) {return false;  // break}});return false;  // stop link from scrolling page};Twinkle.config.resetPref = function twinkleconfigResetPref(pref, inFriendlyConfig) {switch (pref.type) {case "boolean":document.getElementById(pref.name).checked = (inFriendlyConfig ?Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]);break;case "string":case "integer":case "enum":document.getElementById(pref.name).value = (inFriendlyConfig ?Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]);break;case "set":$.each(pref.setValues, function(itemkey, itemvalue) {if (document.getElementById(pref.name + "_" + itemkey)) {document.getElementById(pref.name + "_" + itemkey).checked = ((inFriendlyConfig ?Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]).indexOf(itemkey) !== -1);}});break;case "customList":$(document.getElementById(pref.name)).data("value", (inFriendlyConfig ?Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]));break;default:alert("twinkleconfig: unknown data type for preference " + pref.name);break;}};Twinkle.config.resetAllPrefs = function twinkleconfigResetAllPrefs() {// no confirmation message - the user can just refresh/close the page to abort$(Twinkle.config.sections).each(function(sectionkey, section) {if (section.hidden || (section.adminOnly && !userIsInGroup("sysop"))) {return true;  // continue: skip impossibilities}$(section.preferences).each(function(prefkey, pref) {if (!pref.adminOnly || userIsInGroup("sysop")) {Twinkle.config.resetPref(pref, section.inFriendlyConfig);}});return true;});return false;  // stop link from scrolling page};Twinkle.config.save = function twinkleconfigSave(e) {Status.init( document.getElementById("twinkle-config-content") );Wikipedia.actionCompleted.notice = "Save";var userjs = "User:" + mw.config.get("wgUserName") + "/twinkleoptions.js";var wikipedia_page = new Wikipedia.page(userjs, "Saving preferences to " + userjs);wikipedia_page.setCallbackParameters(e.target);wikipedia_page.load(Twinkle.config.writePrefs);return false;};// The JSON stringify method in the following code was excerpted from// http://www.JSON.org/json2.js// version of 2011-02-23// Douglas Crockford, the code's author, has released it into the Public Domain.// See http://www.JSON.org/js.htmlvar JSON;if (!JSON) {JSON = {};}(function() {var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent = '  ',  // hardcoded indentmeta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' };function quote(string) {escapable.lastIndex = 0;return escapable.test(string) ? '"' + string.replace(escapable, function (a) {var c = meta[a];return typeof c === 'string' ? c :'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);}) + '"' : '"' + string + '"';}function str(key, holder) {var i, k, v, length, mind = gap, partial, value = holder[key];if (value && typeof value === 'object' && typeof value.toJSON === 'function') {value = value.toJSON(key);}switch (typeof value) {case 'string':return quote(value);case 'number':return isFinite(value) ? String(value) : 'null';case 'boolean':case 'null':return String(value);case 'object':if (!value) {return 'null';}gap += indent;partial = [];if (Object.prototype.toString.apply(value) === '[object Array]') {length = value.length;for (i = 0; i < length; i += 1) {partial[i] = str(i, value) || 'null';}v = partial.length === 0 ? '[]' : gap ?'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :'[' + partial.join(',') + ']';gap = mind;return v;}for (k in value) {if (Object.prototype.hasOwnProperty.call(value, k)) {v = str(k, value);if (v) {partial.push(quote(k) + (gap ? ': ' : ':') + v);}}}v = partial.length === 0 ? '{}' : gap ?'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :'{' + partial.join(',') + '}';gap = mind;return v;default:throw new Error( "JSON.stringify: unknown data type" );}}if (typeof JSON.stringify !== 'function') {JSON.stringify = function (value, ignoredParam1, ignoredParam2) {ignoredParam1 = ignoredParam2;  // boredomgap = '';return str('', {'': value});};}}());Twinkle.config.writePrefs = function twinkleconfigWritePrefs(pageobj) {var form = pageobj.getCallbackParameters();var statelem = pageobj.getStatusElement();// this is the object which gets serialized into JSONvar newConfig = {twinkle: {},friendly: {}};// keeping track of all preferences that we encounter// any others that are set in the user's current config are kept// this way, preferences that this script doesn't know about are not lost// (it does mean obsolete prefs will never go away, but... ah well...)var foundTwinklePrefs = [], foundFriendlyPrefs = [];// a comparison function is needed later on// it is just enough for our purposes (i.e. comparing strings, numbers, booleans,// arrays of strings, and arrays of { value, label })// and it is not very robust: e.g. compare([2], ["2"]) === true, and// compare({}, {}) === false, but it's good enough for our purposes herevar compare = function(a, b) {if (Object.prototype.toString.apply(a) === "[object Array]") {if (a.length !== b.length) {return false;}var asort = a.sort(), bsort = b.sort();for (var i = 0; asort[i]; i++) {// comparison of the two properties of custom listsif ((typeof asort[i] === "object") && (asort[i].label !== bsort[i].label ||asort[i].value !== bsort[i].value)) {return false;} else if (asort[i].toString() !== bsort[i].toString()) { return false;}}return true;} else {return a === b;}};$(Twinkle.config.sections).each(function(sectionkey, section) {if (section.adminOnly && !userIsInGroup("sysop")) {return;  // i.e. "continue" in this context}// reach each of the preferences from the form$(section.preferences).each(function(prefkey, pref) {var userValue;  // = undefined// only read form values for those prefs that have themif (!section.hidden && (!pref.adminOnly || userIsInGroup("sysop"))) {switch (pref.type) {case "boolean":  // read from the checkboxuserValue = form[pref.name].checked;break;case "string":  // read from the input box or combo boxcase "enum":userValue = form[pref.name].value;break;case "integer":  // read from the input boxuserValue = parseInt(form[pref.name].value, 10);if (isNaN(userValue)) {Status.warn("Saving", "The value you specified for " + pref.name + " (" + pref.value + ") was invalid.  The save will continue, but the invalid data value will be skipped.");userValue = null;}break;case "set":  // read from the set of check boxesuserValue = [];if (pref.setDisplayOrder) {// read only those keys specified in the display order$.each(pref.setDisplayOrder, function(itemkey, item) {if (form[pref.name + "_" + item].checked) {userValue.push(item);}});} else {// read all the keys in the list of values$.each(pref.setValues, function(itemkey, itemvalue) {if (form[pref.name + "_" + itemkey].checked) {userValue.push(itemkey);}});}break;case "customList":  // read from the jQuery data stored on the button objectuserValue = $(form[pref.name]).data("value");break;default:alert("twinkleconfig: unknown data type for preference " + pref.name);break;}}// only save those preferences that are *different* from the defaultif (section.inFriendlyConfig) {if (typeof userValue !== "undefined" && !compare(userValue, Twinkle.defaultConfig.friendly[pref.name])) {newConfig.friendly[pref.name] = userValue;}foundFriendlyPrefs.push(pref.name);} else {if (typeof userValue !== "undefined" && !compare(userValue, Twinkle.defaultConfig.twinkle[pref.name])) {newConfig.twinkle[pref.name] = userValue;}foundTwinklePrefs.push(pref.name);}});});if (Twinkle.prefs) {$.each(Twinkle.prefs.twinkle, function(tkey, tvalue) {if (foundTwinklePrefs.indexOf(tkey) === -1) {newConfig.twinkle[tkey] = tvalue;}});$.each(Twinkle.prefs.friendly, function(fkey, fvalue) {if (foundFriendlyPrefs.indexOf(fkey) === -1) {newConfig.friendly[fkey] = fvalue;}});}var text ="// twinkleoptions.js: personal Twinkle preferences file\n" +"//\n" +"// NOTE: The easiest way to change your Twinkle preferences is by using the\n" +"// Twinkle preferences panel, at [[" + mw.config.get("wgPageName") + "]].\n" +"//\n" +"// This file is AUTOMATICALLY GENERATED.  Any changes you make (aside from\n" +"// changing the configuration parameters in a valid-JavaScript way) will be\n" +"// overwritten the next time you click \"save\" in the Twinkle preferences\n" +"// panel.  If modifying this file, make sure to use correct JavaScript.\n" +"\n" +"window.Twinkle.prefs = ";text += JSON.stringify(newConfig, null, 2);text +=";\n" +"\n" +"// End of twinkleoptions.js\n";pageobj.setPageText(text);pageobj.setEditSummary("Saving Twinkle preferences: automatic edit from [[" + mw.config.get("wgPageName") + "]] ([[WP:TW|TW]])");pageobj.setCreateOption("recreate");pageobj.save(Twinkle.config.saveSuccess);};Twinkle.config.saveSuccess = function twinkleconfigSaveSuccess(pageobj) {pageobj.getStatusElement().info("successful");var noticebox = document.createElement("div");noticebox.className = "successbox";noticebox.style.fontSize = "100%";noticebox.style.marginTop = "2em";noticebox.innerHTML = "<p><b>Your Twinkle preferences have been saved.</b></p><p>To see the changes, you will need to <a href=\"" + mw.util.wikiGetlink("WP:BYPASS") + "\" title=\"WP:BYPASS\"><b>bypass your browser cache</b></a>.</p>";Status.root.appendChild(noticebox);var noticeclear = document.createElement("br");noticeclear.style.clear = "both";Status.root.appendChild(noticeclear);};/******************************************** twinkledelimages.js: Batch deletion of images (sysops only)***************************************** Mode of invocation:     Tab ("Deli-batch")* Active on:              Existing non-special pages* Config directives in:   TwinkleConfig*/Twinkle.delimages = function twinkledeli() {if( mw.config.get( 'wgNamespaceNumber' ) < 0 || !mw.config.get( 'wgCurRevisionId' ) ) {return;}if( userIsInGroup( 'sysop' ) ) {$(twAddPortletLink("#", "Deli-batch", "tw-deli", "Delete files found on page", "")).click(Twinkle.delimages.callback);}};Twinkle.delimages.unlinkCache = {};Twinkle.delimages.callback = function twinkledeliCallback() {var Window = new SimpleWindow( 800, 400 );Window.setTitle( "Batch file deletion" );Window.setScriptName( "Twinkle" );Window.addFooterLink( "Twinkle help", "WP:TW/DOC#delimages" );var form = new QuickForm( Twinkle.delimages.callback.evaluate );form.append( {type: 'checkbox',list: [{label: 'Delete files',name: 'delete_image',value: 'delete',checked: true},{label: 'Unlink uses of this file',name: 'unlink_image',value: 'unlink',checked: true}]} );form.append( {type: 'textarea',name: 'reason',label: 'Reason: '} );var query;if( mw.config.get( 'wgNamespaceNumber' ) === Namespace.CATEGORY ) {query = {'action': 'query','generator': 'categorymembers','gcmtitle': mw.config.get( 'wgPageName' ),'gcmnamespace': Namespace.IMAGE,'gcmlimit' : Twinkle.getPref('deliMax'), 'prop': [ 'imageinfo', 'categories', 'revisions' ],'grvlimit': 1,'grvprop': [ 'user' ]};} else {query = {'action': 'query','generator': 'images','titles': mw.config.get( 'wgPageName' ),'prop': [ 'imageinfo', 'categories', 'revisions' ],'gimlimit': 'max'};}var wikipedia_api = new Wikipedia.api( 'Grabbing files', query, function( self ) {var xmlDoc = self.responseXML;var images = $(xmlDoc).find('page[imagerepository="local"]');var list = [];$.each(images, function() {var $self = $(this);var image = $self.attr('title');var user = $self.find('imageinfo ii').attr('user');var last_edit = $self.find('revisions rev').attr('user');var disputed = $self.find('categories cl[title="Category:Contested candidates for speedy deletion"]').size() > 0;list.push( {'label': image + ' - author: ' + user + ', last edit from: ' + last_edit + ( disputed ? ' DISPUTED' : '' ),'value': image,'checked': !disputed});});self.params.form.append( {type: 'checkbox',name: 'images',list: list});self.params.form.append( { type:'submit' } );var result = self.params.form.render();self.params.Window.setContent( result );}  );wikipedia_api.params = { form:form, Window:Window };wikipedia_api.post();var root = document.createElement( 'div' );Status.init( root );Window.setContent( root );Window.display();};Twinkle.delimages.currentDeleteCounter = 0;Twinkle.delimages.currentUnlinkCounter = 0;Twinkle.delimages.currentdeletor = 0;Twinkle.delimages.callback.evaluate = function twinkledeliCallbackEvaluate(event) {mw.config.set('wgPageName', mw.config.get('wgPageName').replace(/_/g, ' '));  // for queen/king/whatever and country!var images = event.target.getChecked( 'images' );var reason = event.target.reason.value;var delete_image = event.target.delete_image.checked;var unlink_image = event.target.unlink_image.checked;if( ! reason ) {return;}SimpleWindow.setButtonsEnabled( false );Status.init( event.target );function toCall( work ) {if( work.length === 0 && Twinkle.delimages.currentDeleteCounter <= 0 && Twinkle.delimages.currentUnlinkCounter <= 0 ) {window.clearInterval( Twinkle.delimages.currentdeletor );Wikipedia.removeCheckpoint();return;} else if( work.length !== 0 && Twinkle.delimages.currentDeleteCounter <= Twinkle.getPref('batchDeleteMinCutOff') && Twinkle.delimages.currentUnlinkCounter <= Twinkle.getPref('batchDeleteMinCutOff') ) {Twinkle.delimages.unlinkCache = []; // Clear the cachevar images = work.shift();Twinkle.delimages.currentDeleteCounter = images.length;Twinkle.delimages.currentUnlinkCounter = images.length;var i;for( i = 0; i < images.length; ++i ) {var image = images[i];var query = {'action': 'query','titles': image};var wikipedia_api = new Wikipedia.api( 'Checking if file ' + image + ' exists', query, Twinkle.delimages.callbacks.main );wikipedia_api.params = { image:image, reason:reason, unlink_image:unlink_image, delete_image:delete_image };wikipedia_api.post();}}}var work = images.chunk( Twinkle.getPref('deliChunks') );Wikipedia.addCheckpoint();Twinkle.delimages.currentdeletor = window.setInterval( toCall, 1000, work );};Twinkle.delimages.callbacks = {main: function( self ) {var xmlDoc = self.responseXML;var $data = $(xmlDoc);var normal = $data