MediaWiki:Gadget-PaStec.js

Aujourd'hui, MediaWiki:Gadget-PaStec.js est un sujet qui est sur toutes les lèvres, que ce soit en raison de son importance dans la société actuelle, de sa pertinence historique ou de son impact sur la vie quotidienne des gens. Depuis longtemps, MediaWiki:Gadget-PaStec.js fait l'objet d'études, de débats et d'intérêt, et son influence peut être perçue dans différents aspects de la vie quotidienne. Dans cet article, nous explorerons en profondeur l'importance de MediaWiki:Gadget-PaStec.js, en analysant ses implications dans différents contextes et son rôle dans la société contemporaine. De plus, nous approfondirons son histoire, son évolution dans le temps et sa pertinence aujourd'hui, dans le but d'offrir une vision complète et détaillée de ce sujet vaste et diversifié.
/*

 #Author Argos42 (base), Orlodrim, Dr Brains, Automatik and Gratus
 Some code from LiveRC was used in this version
 Rewrite by Dr Brains

 Installation :  Préférences > Gadgets > PaStec
 Documentation : Projet:Scripts et gadgets/Notices/PaStec (https://fr.wikipedia.orghttps://wikifreehand.com/fr/Projet:Scripts_et_gadgets/Notices/PaStec)

{{Catégorisation JS|PaStec}}

La ligne suivante garantit que cette page apparaît dans la liste des inclusions du Modèle:Annonces PaStec :
{{Annonces PaStec}}
En réalité, le modèle est utilisé en interne, par substitution.

== Activation ==

<syntaxhighlight lang="javascript"> */

window.PaStec_DebugMode = false;

window.PaStec_Enabled = {
    "PaSDelete"      : true,
    "PaSSI"          : true,
    "PaSUnwikify"    : true,
    "PaSKeep"        : true,
    "PaSMerge"       : true,
    "PaSMove"        : true,
    "PaSRedirect"    : true,
    "PaSInit"        : true,
    "PaSWarnUser"    : true,
    "PaSWarnProject" : true,
    "PaSMessage"     : true,
    "AskSILink"      : true,
    "LeftPanelLinks" : true
};

/* </syntaxhighlight>

== Paramètres personnalisables ==

=== Couleur des boutons ===

<syntaxhighlight lang="javascript"> */

window.PaStec_ButtonColors = {
    PaSDelete       : "#FF8080",
    PaSUnwikify     : "#FF8080",
    PaSKeep         : "#90FF80",
    PaSMerge        : "#BE66CC",
    PaSMove         : "#D3D3D3",
    PaSRedirect     : "#DDFFDD",
    PaSSI           : "#FF8080",
    PaSInit         : "DarkOrange",
    PaSWarnUser     : "orange",
    PaSWarnProject  : "orange",
    PaSMessage      : "yellow"
};

/* </syntaxhighlight>

=== Options pour SI ===

<syntaxhighlight lang="javascript"> */

window.PaStec_SIoptions = {
    "G1"  : "Page manifestement aberrante",
    "G2"  : "«\xA0Bac à sable\xA0»",
    "G3"  : "Vandalisme ou canular manifeste",
    "G4"  : "Recréation d'une page supprimée à la suite d'un débat d'admissibilité",
    "G5"  : "Page créée par un contributeur banni ou bloqué",
    "G6"  : "Suppression technique",
    "G7"  : "Suppression à la demande de l'auteur",
    "G8"  : "Page liée à une page inexistante ou supprimée",
    "G10" : "Page dont le seul but est de diffamer, menacer, intimider ou harceler leur sujet, ou une quelconque autre entité",
    "G11" : "Publicité ou promotion manifeste",
    "G12" : "Violation manifeste des droits d'auteur",
    "A1"  : "Article sans sujet clair",
    "A2"  : "Article en langue étrangère",
    "A3"  : "Article sans contenu",
    "A5"  : "Article transféré à un autre wiki",
    "A10" : "Article récemment créé qui doublonne un article existant",
    "A11" : "Article ne répondant pas aux critères d'admissibilité",
    "A12" : "Travail inédit manifeste",
    "C1"  : "Catégorie vide depuis au moins quatre jours",
    "C2"  : "Renommage ou fusion (catégorie)",
    "U1"  : "Demande de l'utilisateur (PU)",
    "U2"  : "Utilisateur inexistant",
    "P2"  : "Portail quasi-vide"
};

/* </syntaxhighlight>

=== Pages de discussion projet spéciales ===

<syntaxhighlight lang="javascript"> */

window.PaStec_ProjectSpecialTalkPage = ;

/* </syntaxhighlight>

=== Textes ===

<syntaxhighlight lang="javascript"> */

window.PaStec_Texts = {

  // Divers / Non classés
    ScriptName       : "PaStec",
    commentTag       : "]\xA0: ",
    DocURL           : "//fr.wikipedia.orghttps://wikifreehand.com/fr/Projet:Scripts_et_gadgets/Notices/PaStec",
    DocText          : "documentation",
    Flow			 : "IMPORTANT\xA0: Cette fonction est désormais compatible avec les pages de discussion Flow. Le script ne pouvant plus détecter si les messages sont déposés, merci de vérifier votre historique de contributions.",


  // Erreurs
    PaSDisabled      : "Fonction désactivée pour maintenance",
    ReplaceFailed    : "Échec du remplacement dans $1",
    URLFailed        : "Échec pour URL $1",
    APIFailed        : "Erreur API\xA0: $1",
    ErrorConflict    : "La page a été modifiée depuis son chargement. La dernière édition a été faite par $user avec le commentaire «\xA0$comment\xA0». Voulez-vous vraiment effectuer la clôture\xA0?",
    SIPaSErrorExists : "Erreur\xA0: la page existe.",


  // Menu PaS

    PaSLegend             : "<big>Formulaire de <b>$1</b></big> <small>($2)</small> ",
    PaSLegendHide         : "masquer",
    PaSLegendShow         : "afficher",
    PaSPanelReason        : "Raison",
    RemoveItem            : "Supprimer cet élément",
    AddItem               : "Ajouter un élément",
    Validate              : "Valider",
    PaSAlertMissingParam  : "Certains champs doivent obligatoirement être renseignés",

    PaSWelcome            : "(hidden)",
    PaSWelcomeLegend      : "(hidden)",

    PaSDelete             : "SUPPRIMER",
    PaSDeleteLegend       : "Clôturer le débat d'admissibilité en suppression",
    PaSDeleteReasonDef    : "{{HC}}",
    PaSPanelAskSI         : "Effectuer une requête de Suppression Immédiate",
    PaSPanelDelete        : "Supprimer la page, la page de discussion associée et les éventuelles redirections",

    PaSSI                 : "SI",
    PaSSILegend           : "Clôturer le débat d'admissibilité à la suite d'une SI",
    PaSDerRedir           : "Supprimer les redirections",

    PaSUnwikify           : "Déwikifier",
    PaSUnwikifyLegend     : "Supprimer les liens vers la page",
    PaSUnwikifyRunning    : "Modification de «\xA0$1\xA0»",
    PaSUnwikifySummary    : "Résumé de modification\xA0: $1",

    PaSKeep               : "CONSERVER",
    PaSKeepLegend         : "Clôturer le débat d'admissibilité en conservation",
    PASkeepReasonDef      : "Admissible",

    PaSMerge              : "FUSIONNER",
    PaSMergeLegend        : "Clôturer le débat d'admissibilité en fusion",
    PaSMergeReasonDef     : "Consensus pour une fusion",
    PaSMergeRequest       : "Faire une requête de fusion",
    PaSMergePages         : "Pages à fusionner",

    PaSMove               : "RENOMMER",
    PaSMoveLegend         : "Clôturer le débat d'admissibilité en renommage",
    PaSMoveReasonDef      : "Consensus pour un renommage",
    PaSMoveDo             : "Renommer la page",
    PaSMoveAsk            : "Demander le renommage de la page",
    PaSMoveNo             : "Ne rien faire",
    PaSMoveNewPage        : "Nouveau titre de la page",

    PaSRedirect           : "REDIRECTION",
    PaSRedirectLegend     : "Clôturer le débat d'admissibilité en redirection",
    PaSRedirectReasonDef  : "Consensus pour une redirection",
    PaSRedirectDo         : "Créer la redirection",
    PaSRedirectTitle      : "Titre de la page cible",

    PaSInit               : "Initialiser le débat",
    PaSInitLegend         : "Initialiser le débat d'admissibilité",
    PaSInitDefinition     : "Thème de la page",

    PaSWarnUser           : "Avertir utilisateurs",
    PaSWarnUserLegend     : "Avertir des utilisateurs du débat d'admissibilité",
    PaSHideBots           : "Masquer les bots",
    PaSShowBots           : "Afficher les bots",
    PaSHideIPs            : "Masquer les IP",
    PaSShowIPs            : "Afficher les IP",
    Creator               : "créateur",
    NbEdits               : "$user\xA0: $edits {{PLURAL:$edits|édition|éditions}} <small>(dernière = $last)</small>",
    PaSCheckUsersToWarn   : "Sélectionner les utilisateurs à avertir",

    PaSWarnProject         : "Avertir projets",
    PaSWarnProjectLegend   : "Avertir des projets du débat d'admissibilité",
    PaSWarnProjectProjects : "Sélectionner les projets à avertir",

    PaSMessage            : "Message",
    PaSMessageLegend      : "Envoyer un message au(x) développeur(s)",
    PaSMessageText        : "Texte du message",
    PaSMessageTarget      : "Page(s) cible(s) du message",

    PasWLH_links           : "Liens $1\xA0:",
    PasWLH_redirects       : "Redirections $1\xA0:",
    PasWLH_doubleredirects : "Doubles redirections $1\xA0:",
    PasWLH_embeddedin      : "Inclusions $1\xA0:",
    PasWLH_imageusage      : "Usages du fichier $1\xA0:",
    PasWLH_categorymembers : "Pages dans la catégorie $1\xA0:",
    PasWLH_Refresh         : "(rafraîchir)",
    PasWLH_NextPage        : "Page suivante",


  // Paramètres pour les requêtes

    // Pages
    PaSMainPageName     : "Wikipédia:Débat d'admissibilité",
    SIPageName          : "Wikipédia:Demande de suppression immédiate",
    MovePageName        : "Wikipédia:Demande de renommage",
    DoMergeMainPageName : "Wikipédia:Fusion technique",

    // Commentaires de modifications
    MovePageComment        : "$1 clôture débat d'admissibilité (retrait bandeau «\xA0Admissibilité\xA0») (])",
    MoveMainPageComment    : "",
    MergePaSComment        : "Ajout bandeau «\xA0Clôture\xA0» (]",
    DoMergeMainPageComment : "Demande de fusion → ] et ] (]",
    DoMergePage1Comment    : "Clôture en fusion avec ] — Remplacement {{Admissibilité}} par {{À fusionner}} (])",
    DoMergePagesComment    : "Fusion technique avec ] — Ajout du bandeau «\xA0À fusionner\xA0» (])",
    RedirectPageComment    : "Tranformation en redirection vers ] - Décision débat d'admissibilité (])",
    RedirectCorrComment    : "Correction double redirection vers ] - Décision débat d'admissibilité (])",
    SIPaSComment           : "Ajout bandeau «\xA0Clôture\xA0» (])",
    MessageComment         : "Message",
    KirMainComment         : "]\xA0: proposition à la suppression (])",
    KirPageComment         : "Ajout bandeau «\xA0Admissibilité\xA0» / retrait bandeau(x) ",
    WarnComment            : "L'admissibilité de l'article «\xA0]\xA0» est débattue",
    TagComment             : "$page $type (ajout bandeau «\xA0Clôture\xA0») (])",
    PASaskSIComment        : "Demande de suppression immédiate → ] (])",
    PASstoreComment        : "]\xA0: $type (archivage) (])",
    PASkeepTalkComment     : "$page conservation (ajout bandeau «\xA0Page conservée\xA0») (])",
    PASkeepPageComment     : "$page conservation (retrait bandeau «\xA0Admissibilité\xA0») (])",
    AskSImainComment       : "Demande de suppression immédiate → ]",
    AskSIpageComment       : "Suppression immédiate $reason (ajout bandeau)",
    DelRedirComment        : "Redirection cassée après suppression de sa cible (])",
    DeleteComment          : "]",
    RemoveLinkComment      : "Retrait du lien vers la page «\xA0$1\xA0» supprimée à la suite d'un débat d'admissibilité (])",
    RemoveCatComment       : "Retrait de la catégorie «\xA0$1\xA0» supprimée à la suite d'un débat d'admissibilité (])",
    RemoveFileComment      : "Retrait du fichier «\xA0$1\xA0» supprimé à la suite d'un débat d'admissibilité (])",

    // Headers
    PASkeepHeader     : "Clôture en conservation",
    DeleteHeader      : "Clôture en suppression",
    DeleteAskHeader   : "Clôture en suppression + demande de SI",
    DeleteDoHeader    : "Clôture en suppression + suppressions",
    MoveHeader        : "Clôture en renommage",
    MoveAskHeader     : "Clôture en renommage + demande de renommage(s)",
    MoveDoHeader      : "Clôture en renommage + renommage(s)",
    MergeHeader       : "Clôture en fusion",
    DoMergeHeader     : "Clôture en fusion + requête sur WP:PAF",
    RedirectHeader    : "Clôture en redirection",
    RedirectDoHeader  : "Clôture en redirection + création redirection",
    SIHeader          : "Clôture suite à SI",
    KirHeader         : "Proposition de la page à la suppression",
    WarnUserHeader    : "Avertissement contributeur",
    WarnProjectHeader : "Avertissement projet",
    MessageHeader     : "Message",
    running           : "Traitement en cours, veuillez patienter.",
    maybeerror        : "Si ce message persiste, une erreur a du survenir.",
    isProtected       : "La page «\xA0$1\xA0» est protégée, non modifiable",
    cannotUnwikify    : "Aucune modification ne peut être apportée à la page «\xA0$1\xA0»",
    UnwikifyHeader    : "Validation des modifications de la page «\xA0$1\xA0»",
    PaSdone           : "Opération terminée",

    // Modèles
    DeleteTemplate          : "{{Admissibilité}}\n",
    DeleteTemplateNI        : "<noinclude>{{Admissibilité|note=ok}}</noinclude>",
    MergeTemplate           : "{{Article fusionné|$reason. Clôture en fusion de ] et ].|2=~~~~}}",
    DoMergeMainPageTemplate : "== ] et ] ==\n\nDemande de fusion décidée lors d'un ] ]. Ceci n'est pas une demande de vote pour ou contre la fusion (la décision a déjà été prise lors du débat d'admissibilité) mais uniquement une demande pour qu'un tiers effectue la fusion. --~~~~ ",
    DoMergePagesTemplate    : "{{Fusion technique|$1|$2}}",
    MoveMainTemplate        : "{{subst:Demande de renommage| $old | $new | ] }}",
    SIPaSTemplate           : "{{Article supprimé en SI}}",
    MessageTemplate         : "== Message de ~~~ ==\n\nMessage écrit le ~~~~~<br>$1",
    WarnTemplate            : "{{subst:Avertissement débat d'admissibilité (Flow)|$page}}",
    TagTemplate             : "{{$type|$reason|2=~~~~}}",
    PASaskSITemplate        : "== {{a'|$page}} ==\n\n* '''Motif''' : Clôture en suppression du ]. Merci.\n* '''Demandée''' par ~~~~",
    PASkeepTalkTemplate     : "{{Page conservée|date={{subst:Aujourd'hui}}}}",
    KirMainTemplate         : "*{{L|$page}} ($definition)",
    AskSIpage_Template      : "{{Suppression Immédiate|$reason|utilisateur=~~~}}",
    AskSImain_Template      : "== {{a'|$page}} ==\n\n* '''Motif''' : {{Utilisateur:Gratus/PaStec/motif SI|$reason}}\n* '''Demandée''' par ~~~~",

    // Types PaS
    MovePaSType      : "Article renommé",
    RedirectPaSType  : "Article transformé en redirection",
    PASkeepPaSType   : "Article conservé",
    DeletePaSType    : "Article supprimé",

    // Types page centrale
    MoveMainType     : "renommage",
    MergeMainType    : "fusion",
    RedirectMainType : "transformation en redirection",
    SIMainType       : "suppression immédiate",
    PASkeepMainType  : "conservation",
    DeleteMainType   : "suppression",

    // Cibles
    SIPaSTarget    : "=== Discussions ===",
    MergePaSTarget : "=== Discussions ===",
    TagTarget      : "=== Discussions ===",
    KirMainTarget  : "{{En-tête section Débat d'admissibilité|$day|$month|$year}}",

    // Archivage PaS
    PASstoreRegExp   : "(.*$escpage$(.*))\n((.*)((\n.*?)*)Requ.tes trait.es}}(.*\n))",
    PASstoreTemplate : "$3$1 : $type  ~~~~\n",


  // Liens dans le menu de gauche
    PaStodo1Title : "Débats d'admissibilité à traiter",
    PaStodo1Text  : "Débats d'admissibilité 7\xA0jours",
    PaStodo2Title : "Débats d'admissibilité à traiter après prolongation",
    PaStodo2Text  : "Débats d'admissibilité 14\xA0jours",
    InitPaSTitle  : "Initialiser un débat d'admissibilité",
    InitPaSText   : "Initialiser débat d'admissibilité",
    InitPaSURL    : "$1/Admissibilité&action=edit&editintro=Modèle:Admissibilité/initialise/intro&preload=Modèle:Initialiser_Débat_d'admissibilité",


   // Demande de SI
    AskSI              : "Demander SI",
    AskSIConfirm       : "Souhaitez-vous vraiment demander la suppression immédiate\xA0?\n* page = $1\n* motif = $2",
    AskSICheckContribs : "Vérifiez vos contributions pour voir si le script a fonctionné correctement.",


  // Edit tests
    EditTest_redirect : "La page suivante est une redirection\xA0: $1",
    EditTest_nobot    : "La page suivante n'accepte pas les modifications effectuées par les robots\xA0: $1",
    EditTest_nopastec : "La page suivante n'accepte pas les modifications effectuées par PaStec\xA0: $1"
};
/* </syntaxhighlight>

=== Autres ===

<syntaxhighlight lang="javascript"> */

// RegExp modèle {{Admissibilité}} et alias à supprimer en cas de conservation de la page

window.PaStec_DeleteTemplatePattern = "\{\{ *(dmissibilit(e|é)|u(p|pp)ression| supprimer|n àS|roposé à la suppression)*\}\}";
// attention à l'ordre dans cette regex, il faut chercher en premier le cas avec avec les "noinclude"
window.PaStec_RemoveDeleteTemplateRegExp = new RegExp("<noinclude>\s*" + PaStec_DeleteTemplatePattern + "\s*<\/noinclude>\n?" + "|" + PaStec_DeleteTemplatePattern + "\n?");
window.PaStec_ReplaceDeleteTemplateRegExp = new RegExp(PaStec_DeleteTemplatePattern);


// RegExp modèle {{Admissibilité à vérifier}} et équivalents à supprimer lors d'une proposition de suppression

window.PaStec_AdmitTemplatePattern = "\{\{ *(dmissibilit(e|é) à vérifier|érifiabilité|otoriété)*\}\}";
// même remarque que plus haut, concernant l'ordre dans la regex
window.PaStec_RemoveAdmitTemplateRegExp = new RegExp("<noinclude>\s*" + PaStec_AdmitTemplatePattern + "\s*<\/noinclude>\n?" + "|" + PaStec_AdmitTemplatePattern + "\n?");
window.PaStec_ReplaceAdmitTemplateRegExp = new RegExp(PaStec_AdmitTemplatePattern);


// RegExp des catégories de bots

window.PaStec_BotCatRegExp = /Catégorie:Wikipédia:Bot/g;


// Test d'édition

window.PaStec_EditTests = [
    {regexp: /^\s*#REDIRECT/i, message: window.PaStec_Texts.EditTest_redirect},
    {regexp: /\{\{ *nobots *\}\}/i, message: window.PaStec_Texts.EditTest_nobot},
    {regexp: /\{\{ *bots *\| *deny *= *(*, *)?PStec */i, message: window.PaStec_Texts.EditTest_nopastec}
];


// Groupes nécessaires par droit

window.PaStec_NeededGroup = {
    "applychangetags" : ,
    "apihighlimit"    : ,
    "move"            : ,
    "delete"          : 
};


// Balisage

window.PaStec_tagName = (mw.config.get('wgWikiID') === "frwiki" ? "PaStec" : "");


// Pdd des développeurs

window.PaStec_DevTalkPages = [
    "Discussion Projet:Scripts et gadgets/Notices/PaStec",
    "Utilisateur:Gratus/PaStec/Message"
];


// Espaces de noms par défaut pour les requêtes de pages liées

window.PaStec_WLH_BLDefaultNamespaces = ;

window.PaStec_WLH_EIDefaultNamespaces = false;

window.PaStec_WLH_IUDefaultNamespaces = false;


// Autres options

window.PaStec_AutoHideMenu = false;

window.PaStec_InputSize = 40;

window.PaStec_Suggestions_suggestsize = 5;

window.PaStec_Suggestions_requestlimit = 15;

window.PaStec_CaseSensitive = false;

window.Pastec_seil = 3 ;

/* </syntaxhighlight>

== Styles CSS ==

<syntaxhighlight lang=javascript> */

mw.loader.addStyleTag(""
    + "#AskSISpan { float: right;margin-top: 0.2em; } "
    + "#PaStec_PanelButtons { text-align:center;margin:0; } "
    + ".PaStec_TabButtons { margin:0;margin-bottom:0.5em; } "
    + ".PaStec_PanelButton, .PaStec_ActionButton { margin:1px;margin-right:5px;padding:1px 5px;border-radius:5px; } "
    + ".PaStec_ActionButtonValidate { margin-right:10px;font-weight:bold; } "
    + "#PaStec_PaSWelcomeInput { display:none; } "
    + "#PaStec_PaSWelcomeButtons { display:none; } "
    + "#PaStec_PaSWelcomeFieldset .PaStec_PanelContent { background: url('//upload.wikimedia.org/wikipedia/commons/e/ea/PaStec_logo_%282023%29.svg') center center / 600px no-repeat scroll #EEEEEE;margin-top:1.3em;margin-bottom:1.3em; } "
    + "#PaStec_PaSWelcomeFieldset legend { display:none; } "
    + "#PaStec_PaSWelcomeFieldset { padding-top:1em;margin-top:1.2em; } "
    + ".PaStec_Fieldset { text-align:left;margin-top:0; } "
    + ".PaStec_PanelContent { border:1px solid #2F6FAB;background:#EEEEEE;padding:1em;height:300px;overflow-y:auto; } "
    + ".PaStec_PanelControl { text-align:center; } "
    + ".PaStec_ResizeAnchor { min-height:20px;font-weight:bold;text-align:center;padding:2px;cursor:n-resize;border:1px solid #2F6FAB;background:#CCCCCC; } "
    + ".MouseMoveFunctionRunning * { -webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor:n-resize; } "
    + ".showmenu { display:none; } "
    + ".hidemenu { display:inline; } "
    + ".MenuHidden .showmenu { display:inline; } "
    + ".MenuHidden .hidemenu, .MenuHidden div { display:none; } "
    + "#PaStec_PaSMessageInput { margin-left:1em; } "
    + "#PaStec_PaSInitInput    { margin-right:1em; } "
    + ".PaStec_Fieldset form { border:1px solid #DDDDDD;padding:2px;margin:2px; } "
    + ".PaStec_Fieldset form:hover { border:1px solid #CCCCCC;background-color:#DDDDDD; } "
    + ".PaStec_Fieldset form.mandatory { border:1px solid IndianRed;background-color:LightSalmon; } "
    + ".PaStec_Fieldset form.mandatory:hover { border:1px solid FireBrick;background-color:DarkSalmon; } "
    + ".PaStec_Fieldset ul, .PaStec_Fieldset ol { list-style-type:none;margin:0; } "
    + ".PaStec_Fieldset li { margin-right:1em; } "
    + "#UserListOL, #ProjectListOL { margin-left:2.5em;column-count:3; } "
    + "#UserListOL li, #ProjectListOL li { display:block !important; } "
    + ".PaStec_WhatlinkshereList li { display:inline !important;white-space:nowrap; } "
//    + ".aa-bloc-tete { display:none; } "
    + "#hideipbutton { display:inline !important; } "
    + "#showipbutton { display:none !important; } "
    + ".iphidden #hideipbutton { display:none !important; } "
    + ".iphidden #showipbutton { display:inline !important; } "
    + ".iphidden #UserListOL li.ip { display:none !important; } "
    + "#hidebotbutton { display:inline !important; } "
    + "#showbotbutton { display:none !important; } "
    + ".bothidden #hidebotbutton { display:none !important; } "
    + ".bothidden #showbotbutton { display:inline !important; } "
    + ".bothidden #UserListOL li.bot { display:none !important; } "
    + ".PaStec_WhatlinkshereList a.modified { text-decoration:underline;text-decoration-color:DarkGreen; } "
    + ".PaStec_WhatlinkshereList a.unmodified { text-decoration:underline;text-decoration-color:Orange;text-decoration-style:wavy; } "
    + ".PaStec_WhatlinkshereList a.cannotmodify { text-decoration:underline;text-decoration-color:red;text-decoration-style:wavy; } "
    + ".PaStec_WhatlinkshereList #currentdiff_PaSUnwikify { color:black !important;text-decoration:underline;font-weight:bold; } "
    + "#PaStec_PaSUnwikifyFieldset .PaStec_Whatlinkshere_redirects { display:none; } "
    + ".PaStec_EmptyDiffPreview { display:none; } "
    + ".PaStec_DiffPreview #editform { display:none; } "
    + ".PaStec_DiffPreview { background-color:#FFFFFF;font-size:90%;border:1px solid #DDDDDD;padding:2px;padding-bottom:10px;margin:2px; } "
    + ".PaStec_DiffPreview h2 { text-align:center;padding-top: 0.25em;margin-bottom:0; } "
    + ".PaStec_DiffPreview .summarydiv { text-align:center;border-bottom:1px solid #AAA;margin-top:0;padding:0.15em;font-weight:bold; } "
    + ".PaStec_DiffPreview .summaryspan { font-family: monospace,monospace;font-weight:normal !important; } "
    + ".PaStec_DiffPreview table.diff { border:none;border-spacing:0px;margin:0;width:100%;table-layout:fixed; } "
    + ".PaStec_DiffPreview table.diff td { padding:0.1em 0.5em; } "
    + ".PaStec_DiffPreview table.diff td.diff-marker { padding:0.25em; } "
    + ".PaStec_DiffPreview table.diff col.diff-marker { width:2%; } "
    + ".PaStec_DiffPreview table.diff col.diff-content { width:48%; } "
    + ".PaStec_DiffPreview table.diff td div { word-wrap:break-word; } "
    + ".PaStec_DiffPreview td.diff-otitle, .PaStec_DiffPreview td.diff-ntitle { text-align:center; } "
    + ".PaStec_DiffPreview td.diff-lineno { font-weight:bold; } "
    + ".PaStec_DiffPreview td.diff-marker { text-align:right;font-weight:bold;font-size:1.25em;line-height:1.2; } "
    + ".PaStec_DiffPreview td.diff-addedline, .PaStec_DiffPreview td.diff-deletedline, .PaStec_DiffPreview td.diff-context { font-size:88%;line-height:1.2;vertical-align:top;white-space:-moz-pre-wrap;white-space:pre-wrap;border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em; } "
    + ".PaStec_DiffPreview td.diff-addedline { border-color:#a3d3ff; } "
    + ".PaStec_DiffPreview td.diff-deletedline { border-color:#ffe49c; } "
    + ".PaStec_DiffPreview td.diff-context { background:#f9f9f9;border-color:#e6e6e6;color:#333333; } "
    + ".PaStec_DiffPreview .diffchange { font-weight:bold;text-decoration:none; } "
    + ".PaStec_DiffPreview td.diff-addedline .diffchange, .PaStec_DiffPreview td.diff-deletedline .diffchange { border-radius:0.33em;padding:0.1em; } "
    + ".PaStec_DiffPreview td.diff-addedline .diffchange { background:#d8ecff; } "
    + ".PaStec_DiffPreview td.diff-deletedline .diffchange { background:#feeec8; } "
);

/* </syntaxhighlight>

== Chargement et appel des personnalisations ==

<syntaxhighlight lang=javascript> */

window.PaStec_CustomDone = false;

window.PaStec_getCustomParams = function(){
    if(PaStec_CustomDone) return;
    PaStec_CustomDone = true;
    if(typeof(PaStec_LangCustom) === "function") try{ PaStec_LangCustom(); }catch(e){ }
    if(typeof(PaStec_SiteCustom) === "function") try{ PaStec_SiteCustom(); }catch(e){ }
    if(typeof(PaStec_UserCustom) === "function") try{ PaStec_UserCustom(); }catch(e){ }
};


window.PaStec_Load = function(func){
    if(typeof(func) === "function"){
        mw.loader.using(, function(){  $( function(){
            PaStec_getCustomParams();
            func();
        });});
    }
};

/* </syntaxhighlight>

== Fonctions utilitaires ==

=== Ajax ===

<syntaxhighlight lang=javascript> */

window.PaStec_ajax = {
    http: function(bundle) {
        // mandatory: bundle.url
        // optional:  bundle.async
        // optional:  bundle.method
        // optional:  bundle.headers
        // optional:  bundle.data
        // optional:  bundle.onSuccess (xmlhttprequest, bundle)
        // optional:  bundle.onFailure (xmlhttprequest, bundle)
        // optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure
        // optional:  bundle.retry //Argos42
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {
                PaStec_ajax.httpComplete(xmlhttp,bundle);
            }
        };
        xmlhttp.open(bundle.method ? bundle.method : "GET",bundle.url,bundle.async === false ? false : true);
        if (bundle.headers) {
            for (var field in bundle.headers) {
                try {
                    xmlhttp.setRequestHeader(field,bundle.headers);
                } catch(err) { }
            }
        }
        xmlhttp.send(bundle.data ? bundle.data : null);
        return xmlhttp;
    },
    httpComplete: function(xmlhttp, bundle) {
        if (xmlhttp.status == 200 || xmlhttp.status == 302) {
            if (bundle.onSuccess) bundle.onSuccess(xmlhttp, bundle);
        } else if (bundle.onFailure) {
            if (bundle.retry) { // je sais jamais comment marche JS
                bundle.retry--;
                PaStec_ajax.http(bundle);
                document.title = "§"+document.title;
            } else {
                bundle.onFailure(xmlhttp, bundle);
            }
        } else {
            // A activer en debug mode ?
            //  alert(xmlhttp.status+xmlhttp.responseText);
        }
    }
};

/* </syntaxhighlight>

=== Edition PDD (flow) ===
<syntaxhighlight lang=javascript> */

window.PaStec_editPdd = function(titre,page) {
    PaStec_actionsLeft++;
    new mw.Api().get({
        action : 'query',
        format : 'json',
        titles : titre,
        prop   : 'revisions',
        rvprop : 'content'
    }).then(function(data) {
        for(var pageid in data.query.pages) break;
        var contenu = data.query.pages.revisions;
        for (var i = 0; i < PaStec_EditTests.length; i++) {
            if (PaStec_EditTests.regexp.test(contenu)) {
                PaStec_actionsLeft--;
                alert(PaStec_EditTests.message.replace(/\$1/g, titre));
                return;
            }
        }
        PaStec_editPdd2(titre,page);
    });
};

window.PaStec_editPdd2 = function(titre,page) {
mw.loader.using( , function () {
    var title = new mw.Title( titre );
    var posterPromise = mw.messagePoster.factory.create( title );
   // DEBUG -- console.log('titre:',titre,'title:',title,'posterPromise:',posterPromise);
    posterPromise.done( function ( poster ) {
        var subject = PaStec_Texts.WarnComment.split("$page").join(page);
        var body = PaStec_Texts.WarnTemplate.split("$page").join(page);

        // pour ne pas avoir d'espace insécable "en dur" dans le wikitexte
        // (WarnComment était auparavant pour le résumé de modif, maintenant il sert aussi pour le titre de section)
        subject = subject.replace(/\xA0/g, ' ');

        var options = {};
        var Tag = PaStec_gettag();
        if (Tag) {
            options.tags = Tag;
        }

        poster.post( subject, body, options );
    } );
} );
};
/*</syntaxhighlight> 
=== Edition d'une page (1) ===

<syntaxhighlight lang=javascript> */

window.PaStec_editPage = function(page, pattern, replace, comment, canCreatePage) {
    PaStec_actionsLeft++;
    new mw.Api().get({
        action : 'query',
        format : 'json',
        titles : page,
        prop   : 'revisions',
        rvprop : 'content'
    }).then(function(data) {
        for(var pageid in data.query.pages) break;
        var contenu = data.query.pages.revisions;
        for (var i = 0; i < PaStec_EditTests.length; i++) {
            if (PaStec_EditTests.regexp.test(contenu)) {
                PaStec_actionsLeft--;
                alert(PaStec_EditTests.message.replace(/\$1/g, page));
                return;
            }
        }
        PaStec_editPageWithoutTests(page, pattern, replace, comment, canCreatePage);
    });
};

/* </syntaxhighlight>

=== Edition d'une page (2) ===

<syntaxhighlight lang=javascript> */

window.PaStec_editPageWithoutTests = function(page, pattern, replace, comment, canCreatePage) {
    PaStec_actionsLeft++;
    var request = mw.util.wikiScript('api')
        + '?format=xml'
        + '&action=query'
        + '&prop=revisions'
        + '&meta=tokens&type=csrf&curtimestamp=true'
        + '&rvprop=timestamp|content'
        + '&titles=' + encodeURIComponent(page);
    PaStec_ajax.http({
        retry:3,
        url: request,
        onSuccess: PaStec_doEditpage,
        onFailure: PaStec_failureAlert,
        page : page,
        comment: comment,
        pattern: pattern,
        replace: replace,
        canCreatePage: canCreatePage
    });
};

window.PaStec_doEditpage = function(xmlreq, data) {
    //data.page     //page to edit
    //data.comment  //modification comment
    //data.pattern  //search pattern
    //   for pattern
    //      "*" replaces the page content with data.replace
    //      "<" adds data.replace to the beginning of the page
    //      ">" adds data.replace to the end of the page
    //data.replace  //replacing string
    try {
        var apiNode = xmlreq.responseXML.getElementsByTagName('api');
        var page = xmlreq.responseXML.getElementsByTagName('page');
        var token = xmlreq.responseXML.getElementsByTagName('tokens').getAttribute('csrftoken');
        var lrev = page.getElementsByTagName('rev');
        var oldtext = "", basetimestamp = "";
        if (lrev.length > 0) {
            oldtext = lrev.textContent;
            basetimestamp = '&basetimestamp=' + encodeURIComponent(lrev.getAttribute('timestamp'));
        }
        var newtext;
        if (data.pattern == "*")       newtext = data.replace;
        else if (data.pattern == ">")  newtext = oldtext + data.replace;
        else if (data.pattern == "<")  newtext = data.replace + oldtext;
        else {
            newtext = oldtext.replace(data.pattern, data.replace);
            if (oldtext == newtext) {
                alert(PaStec_Texts.ReplaceFailed.split("$1").join(data.page));
                return; //replace failed
            }
        }

        // Clean up leftover trailing newlines on various cases:
        // - Remove top template that was the only one
        // - Add message on new page
        newtext = newtext.replace(/^\n+/, '');

        var Tag = PaStec_gettag();
        var requestEditData = ''
            + 'title=' + encodeURIComponent(data.page)
            + '&text=' + encodeURIComponent(newtext)
            + '&token=' + encodeURIComponent(token)
            + '&summary=' + encodeURIComponent( (Tag ? '' : PaStec_Texts.commentTag) + data.comment)
            + '&starttimestamp=' + encodeURIComponent(apiNode.getAttribute('curtimestamp'))
            + '&watchlist=nochange' + basetimestamp;
        if(Tag) requestEditData += "&tags="+encodeURIComponent(Tag);
        var headers = ;
        headers = 'application/x-www-form-urlencoded';
        PaStec_ajax.http({
            retry:3,
            url: mw.util.wikiScript('api') + '?format=xml&action=edit' + (data.canCreatePage ? '' : '&nocreate=1'),
            method: "POST",
            headers: headers,
            data: requestEditData,
            onFailure: PaStec_failureAlert,
            onSuccess:PaStec_confirmExecuted
        });
    } catch(error) {
        alert(error+" : "+data.page );
    }
};

/* </syntaxhighlight>

=== Renommage d'une page  ===

<syntaxhighlight lang=javascript> */

window.PaStec_movePage = function(title, newtitle, reason) {
    PaStec_actionsLeft++;
    var request = mw.util.wikiScript('api')
        + '?format=xml'
        + '&action=query'
        + '&meta=tokens&type=csrf';
    PaStec_ajax.http({
        retry     : 3,
        url       : request,
        onSuccess : PaStec_movePageStep2,
        onFailure : PaStec_failureAlert,
        title     : title,
        reason    : reason,
        newtitle  : newtitle
    });
};

window.PaStec_movePageStep2 = function(xmlreq, data) {
    var token = xmlreq.responseXML.getElementsByTagName('tokens').getAttribute('csrftoken');
    var request = mw.util.wikiScript('api') + '?format=xml&action=move';
    var Tag = false; // PaStec_gettag();  // FIXME : add a tag on a logevent action (T97720)
    var requestData = ''
        + 'from=' + encodeURIComponent(data.title)
        + '&to=' + encodeURIComponent(data.newtitle)
        + '&reason=' + encodeURIComponent(data.reason)
        + '&movetalk=1'
        + '&watchlist=nochange'
        + '&token=' + encodeURIComponent(token);
    if(Tag) requestData += "&tags="+encodeURIComponent(Tag);
    var headers = ;
    headers = 'application/x-www-form-urlencoded';
    PaStec_ajax.http({
        retry     : 3,
        url       : request,
        onSuccess : PaStec_confirmExecuted,
        onFailure : PaStec_failureAlert,
        method    : "POST",
        headers   : headers,
        data      : requestData
    });
};

/* </syntaxhighlight>

=== Suppression d'une page  ===

<syntaxhighlight lang=javascript> */

window.PaStec_deletePage = function(title, reason) {
    PaStec_actionsLeft++;
    var request = mw.util.wikiScript('api')
        + '?format=xml'
        + '&action=query'
        + '&meta=tokens&type=csrf';
    PaStec_ajax.http({
        retry     : 3,
        url       : request,
        onSuccess : PaStec_deletePageStep2,
        onFailure : PaStec_failureAlert,
        title     : title,
        reason    : reason
    });
};

window.PaStec_deletePageStep2 = function(xmlreq, data) {
    var token = xmlreq.responseXML.getElementsByTagName('tokens').getAttribute('csrftoken');
    var request = mw.util.wikiScript('api') + '?format=xml&action=delete';
    var Tag = false; // PaStec_gettag();  // FIXME : add a tag on a logevent action (T97720)
    var requestData = ''
        +  'title=' + encodeURIComponent(data.title)
        + '&token=' + encodeURIComponent(token)
        + '&reason=' + encodeURIComponent(data.reason)
        + '&watchlist=nochange';
    if(Tag) requestData += "&tags="+encodeURIComponent(Tag);
    var headers = ;
    headers = 'application/x-www-form-urlencoded';
    PaStec_ajax.http({
        retry     : 3,
        url       : request,
        onSuccess : PaStec_confirmExecuted,
        onFailure : PaStec_failureAlert,
        method    : "POST",
        headers   : headers,
        data      : requestData
    });
};

/* </syntaxhighlight>

=== Divers ===

<syntaxhighlight lang=javascript> */

window.PaStec_gettag = function(){
    if(!PaStec_tagName || !PaStec_UserCanDo("applychangetags")) return false;
    if(PaStec_UserCanDo("applychangetags")) return PaStec_tagName;
    return false;
};

window.PaStec_UserCanDo = function(action){
    var Groups = PaStec_NeededGroup;
    var UserGroups = mw.config.get('wgUserGroups');
    for(var a=0,l=Groups.length;a<l;a++){
        if(UserGroups.indexOf(Groups) !== -1) return true;
    }
    return false;
};

window.PaStec_failureAlert = function(xmlreq, data) {
    alert(window.PaStec_Texts.URLFailed.split("$1").join(data.page));
};

window.PaStec_confirmExecuted = function(xmlreq, data) {
    //check that the API did not returned errors :
    var error = xmlreq.responseXML.getElementsByTagName('error');
    if( error ){
        if( data.retry ){
            data.retry--;
            PaStec_ajax.http(data);
            document.title = "§"+document.title;
        } else {
            alert(PaStec_Texts.APIFailed.split("$1").join(error.getAttribute('info')));
        }
    } else if (!--PaStec_actionsLeft) {
        var type = PaStec_RunningRequests;
        PaStec_fillControl(type, PaStec_Texts.PaSdone);
        document.title = document.title.replace(/^*/g, "");
    } else {
        document.title = "*" + document.title;
    }
};

// escape regexp :
window.PaStec_RegEscape = function(text) {
    return text.replace(/{}()*+?.,\\^$|#\s]/g, "\\$&");
};

window.PaStec_Plural = function(Text){
    var PluralRegExp = new RegExp("\\{\\{PLURAL+\\}\\}", "ig");
    var Matches = Text.match(PluralRegExp);
    if(Matches!=null){
        for(var b=0,m=Matches.length;b<m;b++){
            var Match = Matches;
            var Params = Match.split('}}').join('').split('|');
            var thisnumber = parseInt(Params.replace(//g, ""));
            var Result = "";
            if(thisnumber > 1){
                Result = Params;
            }else{
                Result = Params;
            }
            if(!Result) Result = "";
            Text = Text.replace(Match, Result);
        }
    }
    return Text;
};

String.prototype.PaStec_ucFirst = function () {
    return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
};

String.prototype.PaStec_lcFirst = function () {
    return this.substr(0,1).toLowerCase() + this.substr(1,this.length);
};

//Fonctions de manipulation de pages

window.PaStec_getPageName = function(){
    var nsnb = mw.config.get('wgNamespaceNumber');
    return ((nsnb-1)===0 ? "" : mw.config.get( 'wgFormattedNamespaces' ) + ":" ) + mw.config.get( 'wgTitle' ).replace(/\/Admissibilité$/, "");
};

window.PaStec_getDiscussionPageName = function(){
    return mw.config.get( 'wgPageName' ).replace(/\/Admissibilité$/, "");
};

window.PaStec_UserIsIP = function(user) {
    var regexpIP4 = /^\d{1,3}\.\d{1,3}.\d{1,3}.\d{1,3}$/;
    var regexpIP6 = /\w{1,4}\:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}/;
    if (regexpIP4.exec(user))      return "V4";
    else if (regexpIP6.exec(user)) return "V6";
    else return false;
};

window.PaStec_createUserLink = function(user) {
    var prefix = mw.config.get( 'wgFormattedNamespaces' ) + ":";
    if (PaStec_UserIsIP(user)) prefix = "Special:Contributions/";
    return PaStec_createLink({page:(prefix+user), text:user});
};

window.PaStec_getProjectTalkPage = function(project) {
    if (typeof(PaStec_TalkPagesMap) !== 'undefined') {
        return PaStec_TalkPagesMap;
    } else {
        return mw.config.get('wgFormattedNamespaces') + ':' + project;
    }
};

window.PaStec_createProjectLink = function(project){
    var target = PaStec_getProjectTalkPage(project);
    return target !== '' ? PaStec_createLink({page: target, text: project}) : false;
};

window.PaStec_getNamespaceInfoFromPage = function(Page, ToReturn){
    if(!ToReturn || !Page) ToReturn = false;
    var NamespaceNumber = 0;
    var NamespaceName = "";
    var PageName = Page;
    var Found = false;
    for(var NS in mw.config.get('wgFormattedNamespaces')){
        if(Found) continue;
        var ThisNamespaceName = mw.config.get( 'wgFormattedNamespaces' );
        if(ThisNamespaceName==="") continue;
        var NamespaceNameRegExp = new RegExp("^("+ThisNamespaceName.PaStec_ucFirst()+"|"+ThisNamespaceName.PaStec_lcFirst()+"):", "ig");
        var Matches = Page.match(NamespaceNameRegExp);
        if(Matches!=null && Matches.length == 1){
            NamespaceNumber = parseInt(NS);
            NamespaceName = ThisNamespaceName;
            PageName = Page.replace(NamespaceNameRegExp, "");
            Found = true;
            continue;
        }
    }
    if(ToReturn==="NamespaceName") return NamespaceName;
    if(ToReturn==="PageName") return PageName;
    return NamespaceNumber;
};

window.PaStec_createLink = function(Args){
     var Path = mw.config.get('wgServer') + ( Args.more ? mw.config.get('wgScript') + "?title=$1" : mw.config.get('wgArticlePath'));
     var Link = '<a '
              + (typeof(Args.classes)=="object" && Args.classes.length > 0 ? 'class="'+Args.classes.join(" ")+'" ' : '')
              + (typeof(Args.target) != "undefined" ? 'target="'+Args.target+'" ' : ( Args.url && Args.url.indexOf("javascript:") === 0 ? '' : 'target="_blank" '))
              + 'href="'+ (typeof(Args.url) != "undefined" ? Args.url : Path.split('$1').join(encodeURIComponent(Args.page)) + (Args.more ? Args.more : '')) + '" '
              + 'title="'+(Args.title ? Args.title : (Args.page ? Args.page : "") )+'"'
              + '>'+(Args.text ? Args.text : Args.page )+'</a>';
     return Link;
};

window.PaStec_getDateFromTimestamp = function(ts){
    ts = ts.split("T");
    ts = ts.split("-");
    return (ts + "/" + ts + "/" + ts);
};

/* </syntaxhighlight>

== Lien pour les non-sysop pour demander une SI ==

<syntaxhighlight lang=javascript> */

window.PaStec_AskSILink = function(){
    if (mw.config.get('wgNamespaceNumber') >= 0) {
        if(!PaStec_UserCanDo("delete") || PaStec_DebugMode){
            if(!PaStec_Enabled.AskSILink && !PaStec_DebugMode) return;
            mw.util.addPortletLink('p-cactions', 'javascript:void(PaStec_AskForSI())', PaStec_Texts.AskSI, 'ca-pastec-si');
        }
    }
};
PaStec_Load(PaStec_AskSILink);

window.PaStec_AskForSI = function(){
    var OldSpan = document.getElementById("AskSISpan");
    if(OldSpan){
        OldSpan.parentNode.removeChild(OldSpan);
        return;
    }
    var H = document.getElementById('firstHeading');
    if(!H) H = document.getElementsByTagName('h1');
    if(!H) return;
    var Span = document.createElement('span');
    Span.id = "AskSISpan";
    var select = document.createElement('select');
    select.name = "cars";
    select.onchange = function(){ PaStec_deletepageAction(this.value); return false; };
    for(var optionname in PaStec_SIoptions){
        var optiontext = optionname + " - " + PaStec_SIoptions;
        var option = document.createElement('option');
        option.value = optionname;
        option.innerHTML = optiontext;
        select.appendChild(option);
    }
    Span.appendChild(select);
    H.appendChild(Span);
};

window.PaStec_deletepageAction = function(motif) {
    var page = mw.config.get('wgPageName');
    if(!confirm(PaStec_Texts.AskSIConfirm.split("$1").join(page).split("$2").join(motif))){
        return;
    }
    PaStec_editPage(
        page,
        "<",
        PaStec_Texts.AskSIpage_Template.split("$reason").join(motif).split("$page").join(page)+"\n",
        PaStec_Texts.AskSIpageComment.split("$reason").join(motif).split("$page").join(page)
    );
    PaStec_editPage(
        PaStec_Texts.SIPageName,
        ">",
        "\n\n" + PaStec_Texts.AskSImain_Template.split("$reason").join(motif).split("$page").join(page),
        PaStec_Texts.AskSImainComment.split("$reason").join(motif).split("$page").join(page)
    );
    alert (PaStec_Texts.AskSICheckContribs);
};

/* </syntaxhighlight>

== Liens pour consulter les PaS ou initier la PaS de la page courante ==

<syntaxhighlight lang=javascript> */

window.PaStec_getPastDate = function(days){
    var months = ;
    var minus = days * 24 * 60 * 60 * 1000;
    var Now = (new Date()).getTime();
    var PastDate = new Date(Now-minus);
    var text = "#"+PastDate.getDate()+"_"+ months;
    return text;
};

window.PaStec_LeftPanelLinks = function() {
    var a = document.getElementById("p-navigation");
    if(a){
        var b = a.getElementsByTagName("ul");
        if(b.length > 0){
            if(!PaStec_Enabled.LeftPanelLinks && !PaStec_DebugMode) return;
            var initURL = PaStec_Texts.InitPaSURL;
            var Title = mw.config.get( 'wgTitle' ).replace(/\/Admissibilité$/, "");
            var NSnumber = mw.config.get( 'wgNamespaceNumber');
            if(NSnumber % 2 == 0) NSnumber = (NSnumber+1);
            initURL = initURL.split("$1").join(encodeURIComponent(mw.config.get('wgFormattedNamespaces')+":"+Title));
            b.innerHTML = b.innerHTML
            + '<li class="mw-list-item"><span id="n-pas7" title="'+PaStec_Texts.PaStodo1Title+'">'
            + '<a href="//fr.wikipedia.orghttps://wikifreehand.com/fr/'+encodeURIComponent(PaStec_Texts.PaSMainPageName)+PaStec_getPastDate(8)+'">'+PaStec_Texts.PaStodo1Text+'</a>'
            + '</span></li>'
            + '<li class="mw-list-item"><span id="n-pas14" title="'+PaStec_Texts.PaStodo2Title+'">'
            + '<a href="//fr.wikipedia.orghttps://wikifreehand.com/fr/'+encodeURIComponent(PaStec_Texts.PaSMainPageName)+PaStec_getPastDate(15)+'">'+PaStec_Texts.PaStodo2Text+'</a>'
            + '</span></li>';
            if (mw.config.get('wgNamespaceNumber') >= 0) {
                b.innerHTML = b.innerHTML
                + '<li class="mw-list-item"><span id="n-pasi" title="'+PaStec_Texts.InitPaSTitle+'">'
                + '<a href="//fr.wikipedia.org/w/index.php?title='+initURL+'">'+PaStec_Texts.InitPaSText+'</a>'
                + '</span></li>';
            }
        }
    }
};

PaStec_Load(PaStec_LeftPanelLinks);

/* </syntaxhighlight>

== Menu de la sous-page <code>/Admissibilité</code> ==

=== Fonctions annexes ===

==== Création d'un nouvel onglet ====

<syntaxhighlight lang=javascript> */

window.PaStec_CreateNewMenuPanel = function(type, mainbutton){
    var MainFieldSet = document.getElementById("PaStec_MainContainer");
    var Buttons = document.getElementById("PaStec_PanelButtons");
    if(!MainFieldSet || !Buttons) return false;
    var button = PaStec_CreateInput("PaStec_"+type+"Input", PaStec_Texts, "button", false, false, PaStec_ToggleMenuPanel);
    button.id = "PaStec_"+type+"Input";
    button.className = "PaStec_PanelButton";
    button.style.background = PaStec_ButtonColors;
    if(mainbutton){
        button.style.fontWeight = "bold";
        button.style.textDecoration = "underline";
    }
    Buttons.appendChild(button);
    var fieldset = document.createElement('fieldset');
    fieldset.id = "PaStec_"+type+"Fieldset";
    fieldset.className = "PaStec_Fieldset";
    var legend = document.createElement('legend');
    legend.innerHTML = PaStec_Texts;
    fieldset.appendChild(legend);
    var PanelControl = document.createElement('div');
    PanelControl.className = "PaStec_PanelControl";
    PanelControl.id = "PaStec_Panel"+type+"Control";
    fieldset.appendChild(PanelControl);
    var ButtonsP = document.createElement('p');
    ButtonsP.id = "PaStec_"+type+"Buttons";
    ButtonsP.className = "PaStec_TabButtons";
    var OKbutton = PaStec_CreateInput("PaStec_"+type+"Action", PaStec_Texts.Validate, "button", false, false, function(){ PaStec_ValidateMenuPanel(type); });
    OKbutton.className = "PaStec_ActionButton PaStec_ActionButtonValidate";
    OKbutton.style.background = PaStec_ButtonColors;
    ButtonsP.appendChild(OKbutton);
    fieldset.appendChild(ButtonsP);
    var PanelContent = document.createElement('div');
    PanelContent.className = "PaStec_PanelContent";
    fieldset.appendChild(PanelContent);
    MainFieldSet.appendChild(fieldset);
    return PanelContent;
};

/* </syntaxhighlight>

==== Sélection d'un onglet ====

<syntaxhighlight lang=javascript> */

window.PaStec_ToggleMenuPanel = function(Input){
    var Id = "";
    if(Input) Id = Input.id.split("Input").join("Fieldset");
    var Onglets = document.getElementById("PaStec_PanelButtons").getElementsByTagName("input");
    var Fieldsets = document.getElementById("PaStec_MainContainer").getElementsByClassName("PaStec_Fieldset");
    for(var a=0,l=Fieldsets.length;a<l;a++){
        if(!Onglets) continue;
        if(Id){
            Onglets.style.border = ((Id == Fieldsets.id)? "2px solid black" : "2px solid Gainsboro");
            Fieldsets.style.display = ((Id == Fieldsets.id)? "" : "none");
        }else{
            Onglets.style.border = ((a==0)? "2px solid black" : "2px solid Gainsboro");
            Fieldsets.style.display = ((a==0)? "" : "none");
        }
    }
};

/* </syntaxhighlight>

==== Gestion de la hauteur des onglets ====

<syntaxhighlight lang=javascript> */

window.PaStec_SetMenuPanelHeightsTimeout = false;

window.PaStec_SetMenuPanelHeights = function(){
    var MainFieldSet = document.getElementById("PaStec_MainContainer");
    if(!MainFieldSet) return;
    var HeightFound = false;
    var FieldSets = MainFieldSet.getElementsByTagName('fieldset');
    for(var b=0,m=FieldSets.length;b<m;b++){
        if(FieldSets.style.display == "none") continue;
        var MenuPart = FieldSets.getElementsByClassName('PaStec_PanelContent');
        if(!MenuPart) continue;
        var StyleHeight = MenuPart.style.height;
        if(StyleHeight) HeightFound = StyleHeight;
    }
    if(HeightFound){
        var MenuParts = MainFieldSet.getElementsByClassName('PaStec_PanelContent');
        for(var a=0,l=MenuParts.length;a<l;a++) MenuParts.style.height = HeightFound;
    }
    if(PaStec_SetMenuPanelHeightsTimeout) clearTimeout(PaStec_SetMenuPanelHeightsTimeout);
    PaStec_SetMenuPanelHeightsTimeout = setTimeout("PaStec_SetMenuPanelHeights()", 500);
};

/* </syntaxhighlight>

==== Redimensionnement du menu ====

<syntaxhighlight lang=javascript> */

window.PaStec_GetMousePosition = function(event){
     return { "X": parseInt(event.clientX), "Y": parseInt(event.clientY) };
};

window.PaStec_GetScreenHeight = function(){
     return window.innerHeight;
};

window.PaStec_SetVerticalResizeZone = function(anchorNode, ToResizeNodes, containerNode, invert){
     if((!anchorNode)||(!ToResizeNodes)) return;
     invert = (invert===true ? -1 : 1);
     anchorNode.onmousedown = function(event){
          if(!event) { event = window.event; }
          var positionSouris_Y = (PaStec_GetMousePosition(event) * invert);
          var MaxHeight = PaStec_GetScreenHeight();
          for(var a=0;a<ToResizeNodes.length;a++){
               ToResizeNodes.initialHeight = parseInt( (MaxHeight-positionSouris_Y) - ToResizeNodes.offsetHeight );
          }
          document.body.classList.add("MouseMoveFunctionRunning");
          document.body.onmousemove=function(event) {
               if(!event) { event = window.event; }
               var positionSouris_Y = (PaStec_GetMousePosition(event) * invert);
               var MaxHeight = PaStec_GetScreenHeight();
               var HeightLimit = false;
               for(var a=0;a<ToResizeNodes.length;a++){
                    var NewHeight = parseInt((MaxHeight-positionSouris_Y) - ToResizeNodes.initialHeight);
                    if(NewHeight>MaxHeight) HeightLimit = true;
               }
               if(HeightLimit) return;
               for(var a=0;a<ToResizeNodes.length;a++){
                    var Element = ToResizeNodes;
                    if(!Element) continue;
                    var NewHeight = parseInt((MaxHeight-positionSouris_Y) - Element.initialHeight);
                    NewHeight = (NewHeight>0 ? NewHeight : 1);
                    if(Element.tagName && (Element.tagName.toLowerCase()=="iframe" || Element.tagName.toLowerCase()=="img")){
                         Element.height = NewHeight;
                    }else{
                         Element.style.height = NewHeight + 'px';
                    }
               }
          };
          document.body.onmouseup = function(event) {
               document.body.onmousemove = null;
               document.body.onmouseup = null;
               document.body.classList.remove("MouseMoveFunctionRunning");
          };
     };
     anchorNode.style.display = "";
};
/* </syntaxhighlight>

==== Affichage/Masquage du menu ====

<syntaxhighlight lang=javascript> */

window.PaStec_ShowHideMenu = function(show){
    var Menu = document.getElementById("PaStec_MainFieldset");
    if(!Menu) return;
    if(show){
        Menu.classList.remove("MenuHidden");
    }else{
        Menu.classList.add("MenuHidden");
    }
};

/* </syntaxhighlight>

==== Récupération de la liste des auteurs ====

<syntaxhighlight lang=javascript> */

window.PaStec_Authors = {};
window.PaStec_Creator = null;

window.PaStec_getArticleAuthors = function(rvcontinue, callback) {
    if (!rvcontinue) rvcontinue = "";
    var page = PaStec_getPageName();
    var APIlimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var request = mw.util.wikiScript('api') + '?format=xml&action=query'
        + '&prop=revisions&rvprop=user|timestamp'
        + '&rvlimit=' + APIlimit
        + rvcontinue
        + '&titles=' + encodeURIComponent(page)
        + '&continue=';
    PaStec_ajax.http({retry:3,url: request, onSuccess:PaStec_getArticleAuthorsRunning, CallBack:callback, onFailure: PaStec_failureAlert});
};

window.PaStec_getArticleAuthorsRunning = function(Req, data) {
    var ObjectXML = Req.responseXML;
    var Revs = ObjectXML.getElementsByTagName("rev");
    var user;
    for (var a=0, l=Revs.length; a<l; a++) {
        var rev = Revs;
        user = rev.getAttribute("user");
        if (!user) continue; // nom d'utilisateur masqué
        else PaStec_Creator = user;
        if(typeof PaStec_Authors === "undefined"){
            PaStec_Authors = {};
            PaStec_Authors.last = PaStec_getDateFromTimestamp(rev.getAttribute("timestamp"));
            PaStec_Authors.editcount =  1;
            if(user.match(/bot$/i) !== null ) PaStec_Authors.maybebot = true; // Assuming it is a bot (old bots may have lost their status)
        }else{
            PaStec_Authors.editcount = PaStec_Authors.editcount + 1;
        }
        if(PaStec_UserIsIP(user)) PaStec_Authors.ip = true;
    }
    var QueryContinue = ObjectXML.getElementsByTagName("continue");
    if(QueryContinue) {
        var rvcontinue = "&rvcontinue=" + encodeURIComponent( QueryContinue.getAttribute("rvcontinue") );
        PaStec_getArticleAuthors(rvcontinue, data.CallBack);
    } else {
        var authorlist = ;
        for(var user in PaStec_Authors){
            if(PaStec_Authors.ip !== true) authorlist.push(user);
        }
        PaStec_getArticleBotAuthors(authorlist, data.CallBack);
    }
};

window.PaStec_getArticleBotAuthors = function(authorlist, callback){
    if(authorlist.length === 0){
        authorlist = ;
        for(var user in PaStec_Authors){
            if(PaStec_Authors.ip !== true && PaStec_Authors.bot !== true) authorlist.push(user);
        }
        return PaStec_getArticleMaybeBotAuthors(authorlist, callback);
    }
    var APIlimit = ( PaStec_UserCanDo("apihighlimit") ? 500 : 50);
    var newauthorlist = ;
    var thisauthorlist = ;
    for(var a=0,l=authorlist.length;a<l;a++){
        if(a>(APIlimit-1)) newauthorlist.push(authorlist);
        else thisauthorlist.push(encodeURIComponent(authorlist));
    }
    var URL = mw.util.wikiScript('api') + '?format=xml&action=query' +
             '&list=users&usprop=groups&ususers='+thisauthorlist.join("|");
    PaStec_ajax.http({retry:3,url: URL, onSuccess:PaStec_getArticleBotAuthorsRunning, CallBack:callback, furtherauthors:newauthorlist, onFailure: PaStec_failureAlert});
};

window.PaStec_getArticleBotAuthorsRunning = function(Req, data){
    var ObjectXML = Req.responseXML;
    var Users = ObjectXML.getElementsByTagName("user");
    for(var a=0,l=Users.length;a<l;a++){
        var username = Users.getAttribute("name");
        var groups = Users.getElementsByTagName('g');
        for(var g=0,glen=groups.length;g<glen;g++){
            if(groups.firstChild.nodeValue == "bot") PaStec_Authors.bot = true;
        }
    }
    PaStec_getArticleBotAuthors(data.furtherauthors, data.CallBack);
};

window.PaStec_getArticleMaybeBotAuthors_Remaining = 0;

window.PaStec_getArticleMaybeBotAuthors = function(authorlist, callback){
    if(authorlist.length === 0) return callback();
    PaStec_getArticleMaybeBotAuthors_Remaining = authorlist.length;
    var APIlimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    for(var a=0,l=authorlist.length;a<l;a++){
        var user = authorlist;
        var request = mw.util.wikiScript('api') + '?format=xml&action=query'
        + '&prop=categories'
        + '&cllimit=' + APIlimit
        + '&titles=' + mw.config.get('wgFormattedNamespaces')+":"+encodeURIComponent(user)
        + '&continue=';
        PaStec_ajax.http({retry:3,url: request, onSuccess:PaStec_getArticleMaybeBotAuthorsRunning, CallBack:callback, user:user, onFailure: PaStec_failureAlert});
    }
};

window.PaStec_getArticleMaybeBotAuthorsRunning = function(Req, data){
    var ObjectXML = Req.responseXML;
    var Cats = ObjectXML.getElementsByTagName("cl");
    for(var a=0,l=Cats.length;a<l;a++){
        var title = Cats.getAttribute("title");
        if(title.match(PaStec_BotCatRegExp) !== null) PaStec_Authors.bot = true;
    }
    PaStec_getArticleMaybeBotAuthors_Remaining--;
    if(PaStec_getArticleMaybeBotAuthors_Remaining === 0) data.CallBack();
};

window.PaStec_getAuthorType = function(user){
    var types = ;
    if(PaStec_Authors.bot === true) types.push('<small>(bot)</small>');
    if(PaStec_Authors.maybebot === true && PaStec_Authors.bot !== true) types.push('<small>(bot?)</small>');
    if(PaStec_Authors.ip === true) types.push('<small>(IP)</small>');
    if(user === PaStec_Creator) types.push('<small style="color:red;"><b>($creator)</b></small>');
    if(types.length >0) return " "+types.join(" ");
    return "";
};

/* </syntaxhighlight>

==== Récupération de la liste des projets ====

<syntaxhighlight lang=javascript> */

window.PaStec_Projects = ;
window.PaStec_TalkPagesMap = {};

// Remplit PaStec_TalkPagesMap avec la page de discussion associée à chaque élément de projects.
// Ne recalcule pas les valeurs précédemment obtenues.
window.PaStec_populateTalkPagesMap = function(projects, callback) {
    var textToParse = '';
    for (var i = 0; i < projects.length; i++) {
        var project = projects;
        if (typeof(PaStec_TalkPagesMap) !== 'undefined') continue;
        textToParse += project + '|{{subst:Annonces PaStec|' + project + '}}\n';
    }
    if (textToParse === '') {
        callback();
        return;
    }
    var api = new mw.Api();
    api.get({'action': 'parse', 'contentmodel': 'wikitext', 'text': textToParse, 'prop': 'text',
              'onlypst': '1'}).done(function(parseResult) {
        var parseResultLines = parseResult.split('\n');
        for (var i = 0; i < parseResultLines.length; i++) {
            var fields = parseResultLines.split('|');
            if (fields.length >= 2 && !//.test(fields)) {
                PaStec_TalkPagesMap] = fields;
            }
        }
        callback();
    });
};

window.PaStec_getArticleProjects = function(tlcontinue, callback) {
    if (!tlcontinue) tlcontinue = "";
    var page = PaStec_getPageName();
    var APIlimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var request = mw.util.wikiScript('api') + '?format=xml&action=query'
        + '&prop=templates&tlnamespace=10'
        + '&tllimit=' + APIlimit
        + '&titles=' + encodeURIComponent(page)
        + tlcontinue
        + '&continue=';
    PaStec_ajax.http({retry:3,url: request, onSuccess:PaStec_getArticleProjectsRunning, CallBack:callback, onFailure: PaStec_failureAlert});
};

window.PaStec_getArticleProjectsRunning = function(Req, data){
    var ObjectXML = Req.responseXML;
    var Templates = ObjectXML.getElementsByTagName("tl");
    for(var a=0,l=Templates.length;a<l;a++){
        var title = Templates.getAttribute("title");
        if(title.match(/Modèle:Portail /) !== null){
            title = title.replace(/Modèle:Portail /, "").PaStec_ucFirst();
            if(PaStec_Projects.indexOf(title) === -1) PaStec_Projects.push(title);
        }
    }
    var QueryContinue = ObjectXML.getElementsByTagName("continue");
    if(QueryContinue) {
        var tlcontinue = "&tlcontinue=" + encodeURIComponent( QueryContinue.getAttribute("tlcontinue") );
        PaStec_getArticleProjects(tlcontinue, data.CallBack);
    } else {
        PaStec_populateTalkPagesMap(PaStec_Projects, data.CallBack);
    }
};

/* </syntaxhighlight>

==== Récupération des pages liées et des pages de la catégorie ====

<syntaxhighlight lang=javascript> */

window.PaStec_GetWhatlinkshereRunning = 0;
window.PaStec_WhatlinkshereLists = {"links":,"redirects":,"doubleredirects":,"embeddedin":,"imageusage":,"categorymembers":};

window.PaStec_getAllNamespaces = function(){
    var NSList = ;
    for(var nsnumber in mw.config.get('wgFormattedNamespaces')){
        nsnumber = parseInt(nsnumber);
        if(nsnumber > -1) NSList.push(nsnumber);
    }
    return NSList;
};

window.PaStec_GetWhatlinkshere_Addpage = function(title, type){
    if(PaStec_WhatlinkshereLists.indexOf(title)===-1) PaStec_WhatlinkshereLists.push(title);
};

window.PaStec_ClearDiff = function(type){
    if(!type){
        $(".PaStec_DiffPreview").each(function(_, Diff){
            while(Diff.firstChild){ Diff.removeChild(Diff.firstChild); }
            if(!Diff.classList.contains("PaStec_EmptyDiffPreview")) Diff.classList.add("PaStec_EmptyDiffPreview");
        });
    }else{
        var Diff = document.getElementById("PaStec_DiffPreview_"+type);
        if(!Diff) return null;
        while(Diff.firstChild){ Diff.removeChild(Diff.firstChild); };
        if(!Diff.classList.contains("PaStec_EmptyDiffPreview")) Diff.classList.add("PaStec_EmptyDiffPreview");
        return Diff;
    }
};

window.PaStec_GetWhatlinkshere = function(Page, Continues, redirectrequest){
    if(!Continues && !redirectrequest){
        PaStec_WhatlinkshereLists = {"links":,"redirects":,"doubleredirects":,"embeddedin":,"imageusage":,"categorymembers":};
        PaStec_UpdateWhatlinkshereLists();
        $(".PaStec_DiffPreview").each(function(_, Diff){
            while(Diff.firstChild){ Diff.removeChild(Diff.firstChild); }
        });
    }
    if(!Page) Page = PaStec_getPageName();
    PaStec_GetWhatlinkshereRunning++;
    var isfile = (Page.indexOf(mw.config.get('wgFormattedNamespaces')+":") === 0);
    var iscat = (Page.indexOf(mw.config.get('wgFormattedNamespaces')+":") === 0);
    var list = ;
    if(isfile) list.push('imageusage');
    if(iscat) list.push('categorymembers');
    var Namespaces = PaStec_getAllNamespaces().join("|");
    var APILimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var queryopt = {
        action      : 'query',
        list        : list,
        bllimit     : APILimit,
        blnamespace : (Array.isArray(PaStec_WLH_BLDefaultNamespaces) ? PaStec_WLH_BLDefaultNamespaces : Namespaces),
        bltitle     : Page,
        eilimit     : APILimit,
        einamespace : (Array.isArray(PaStec_WLH_EIDefaultNamespaces) ? PaStec_WLH_EIDefaultNamespaces : Namespaces),
        eititle     : Page
    };
    if(isfile){
        queryopt.iulimit     = APILimit;
        queryopt.iunamespace = (Array.isArray(PaStec_WLH_IUDefaultNamespaces) ? PaStec_WLH_IUDefaultNamespaces : Namespaces);
        queryopt.iutitle     = Page;
    }
    if(iscat){
        queryopt.cmlimit     = APILimit;
        queryopt.cmnamespace = Namespaces;
        queryopt.cmtitle     = Page;
    }
    if(Continues && Continues.blcontinue) queryopt.blcontinue = Continues.blcontinue;
    if(Continues && Continues.eicontinue) queryopt.eicontinue = Continues.eicontinue;
    if(Continues && Continues.iucontinue) queryopt.iucontinue = Continues.iucontinue;
    if(Continues && Continues.cmcontinue) queryopt.cmcontinue = Continues.cmcontinue;
    queryopt = "";
    var api = new mw.Api();
    api.get(queryopt).then( function(data) {
        PaStec_GetWhatlinkshereRunning--;
        if(data.query.backlinks){
            var AllBL = data.query.backlinks;
            var BL = AllBL.length;
            for(var a=0,l=BL;a<l;a++){
                var thispagetitle = AllBL.title;
                var thispageredirect = (AllBL.redirect === "");
                if(thispageredirect){
                    PaStec_GetWhatlinkshere_Addpage(thispagetitle, "redirects");
                    if(redirectrequest) PaStec_GetWhatlinkshere_Addpage(thispagetitle, "doubleredirects");
                    PaStec_GetWhatlinkshere(thispagetitle, false, true);
                }else{
                    PaStec_GetWhatlinkshere_Addpage(thispagetitle, "links");
                }
            }
        }
        if(data.query.embeddedin) {
            var AllEI = data.query.embeddedin;
            var EI = AllEI.length;
            for(var a=0,l=EI;a<l;a++){
                var thispagetitle = AllEI.title;
                PaStec_GetWhatlinkshere_Addpage(thispagetitle, "embeddedin");
            }
        }
        if(data.query.imageusage) {
            var AllIU = data.query.imageusage;
            var IU = AllIU.length;
            for(var a=0,l=IU;a<l;a++){
                var thispagetitle = AllIU.title;
                PaStec_GetWhatlinkshere_Addpage(thispagetitle, "imageusage");
            }
        }
        if(data.query.categorymembers) {
            var AllCM = data.query.categorymembers;
            var CM = AllCM.length;
            for(var a=0,l=CM;a<l;a++){
                var thispagetitle = AllCM.title;
                PaStec_GetWhatlinkshere_Addpage(thispagetitle, "categorymembers");
            }
        }
        var RequeteContinue = {};
        var ContinueNode = data;
        var MustContinue = false;
        if(ContinueNode){
            if(ContinueNode.blcontinue){
                RequeteContinue.blcontinue = ContinueNode.blcontinue;
                MustContinue = true;
            }
            if(ContinueNode.eicontinue){
                RequeteContinue.eicontinue = ContinueNode.eicontinue;
                MustContinue = true;
            }
            if(ContinueNode.iucontinue){
                RequeteContinue.iucontinue = ContinueNode.iucontinue;
                MustContinue = true;
            }
            if(ContinueNode.cmcontinue){
                RequeteContinue.cmcontinue = ContinueNode.cmcontinue;
                MustContinue = true;
            }
        }
        if(MustContinue){
            PaStec_GetWhatlinkshere(Page, RequeteContinue, redirectrequest);
        }else if(PaStec_GetWhatlinkshereRunning === 0){
            PaStec_UpdateWhatlinkshereLists();
        }
    });
};

window.PaStec_CreateWhatlinkshereList = function(ListsToCreate, Container){
    for(var type in PaStec_WhatlinkshereLists){
        if(ListsToCreate.indexOf(type) === -1) continue;
        var FORM = document.createElement('form');
        FORM.className = "PaStec_Whatlinkshere_"+type;
        FORM.style.display = "none";
        var label = document.createElement('label');
        var RefreshLink = PaStec_createLink({text:PaStec_Texts.PasWLH_Refresh,url:"javascript:PaStec_GetWhatlinkshere();",target:"_self"});
        label.innerHTML = PaStec_Texts.split("$1").join("<small><sup>"+RefreshLink+"</sup></small>");
        FORM.appendChild(label);
        Container.appendChild(FORM);
    }
};

window.PaStec_UpdateWhatlinkshereLists = function(){
    PaStec_ClearDiff();
    var Whatlinkshere = PaStec_WhatlinkshereLists;
    for(var type in PaStec_WhatlinkshereLists){
        var PageList = PaStec_WhatlinkshereLists;
        var Nodes = document.getElementsByClassName("PaStec_Whatlinkshere_"+type);
        for(var a=0,l=Nodes.length;a<l;a++){
            var FORM = Nodes;
            var UL = FORM.getElementsByTagName('ul');
            if(!UL){
                UL = document.createElement('ul');
                FORM.appendChild(UL);
            }
            while(UL.firstChild){ UL.removeChild(UL.firstChild); };
            if(PageList.length === 0){
                FORM.style.display = "none";
                continue;
            }else{
                FORM.style.display = "";
                var builder = document.createDocumentFragment();
                for(var p=0,plen=PageList.length;p<plen;p++){
                    if(p>0){
                        builder.appendChild(document.createTextNode(' '));
                    }
                    var newli = document.createElement('li');
                    builder.appendChild(newli);
                    var thispage = PageList;
                    var link = document.createElement('a');
                    link.target = "_blank";
                    link.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join(thispage) + "?redirect=no";
                    if(type !== "redirects"){
                        link.onclick = function(){
                            PaStec_CheckThisPage(this);
                            return false;
                        };
                    }
                    link.title = thispage;
                    link.innerHTML = thispage;
                    newli.appendChild(link);
                    var input = document.createElement('input');
                    input.type = "hidden";
                    input.name = type;
                    input.value = thispage;
                    newli.appendChild(input);
                }
                UL.appendChild(builder);
            }
        }
    }
};

/* </syntaxhighlight>

==== Suggestions ====

<syntaxhighlight lang=javascript> */

window.PaStec_CreateAddItemLink = function(inputname){
    var Link = document.createElement('a');
    Link.innerHTML = "(+)";
    Link.title = PaStec_Texts.AddItem;
    Link.href = "javascript:;";
    Link.onclick = function(){
        var parent = this.parentNode;
        if(!parent) return false;
        var NewLi = document.createElement('li');
        var Input = PaStec_CreateInput(inputname, "", "text", false, false, false, PaStec_getSuggestions);
        NewLi.appendChild(Input);
        NewLi.appendChild(document.createTextNode(" "));
        NewLi.appendChild(PaStec_CreateRemoveParentLink());
        parent.parentNode.insertBefore(NewLi, parent);
        Input.focus();
        return false;
    };
    return Link;
};

window.PaStec_Suggestions_Zindex = 5000;
window.PaStec_Suggestions_currentID = 0;

window.PaStec_Suggestions_requestrunning = {};

window.PaStec_getSuggestionID = function(el){
    var id = el.id;
    if(!id) return false;
    return parseInt(id.replace(//g, ""));
};
window.PaStec_getSuggestions = function(input){
    var ID = PaStec_getSuggestionID(input);
    if(!ID){
        ID = PaStec_Suggestions_currentID++;
        input.id = "SuggestInput_"+ID;
        var select = document.createElement('select');
        select.id = "SuggestSelect_"+ID;
        select.style.display = "none";
        select.style.position = "relative" ;
        select.style.width = input.offsetWidth + "px" ;
        select.style.top = parseInt(input.offsetHeight) + "px";
        select.style.marginBottom = "0px" ;
        select.style.marginLeft = "-" + input.offsetWidth + "px" ;
        select.onkeyup = PaStec_KeypressedOnSuggestionList;
        input.parentNode.insertBefore(select, input.nextSibling);
    }
    if(PaStec_Suggestions_requestrunning === true) return;
    PaStec_Suggestions_requestrunning = true;
    var type = input.name;
    if(type === "pages" || type === "target" || type === "newtitle") PaStec_getPageSuggestions(ID);
    if(type === "user") PaStec_getUserSuggestions(ID);
    if(type === "project") PaStec_getProjectSuggestions(ID);
};

window.PaStec_showSuggestions = function(titles, Index){
    PaStec_Suggestions_requestrunning = false;
    var Text = document.getElementById("SuggestInput_"+Index);
    var List = document.getElementById("SuggestSelect_"+Index);
    if(!Text || !List) return;
    if(titles.length === 0){
        List.style.display = "none";
        return ;
    }
    if(titles === PaStec_formatTextValue(Text.value)){
        List.style.display = "none";
        return ;
    }
    List.style.display = "inline";
    var TailleListe = PaStec_Suggestions_suggestsize;
    if(titles.length < TailleListe) TailleListe = titles.length;
    var listh = TailleListe * 20 ;
    List.style.height = listh + "px" ;
    List.size = TailleListe;
    while(List.firstChild) List.removeChild(List.firstChild);
    for(var i = 0,l=titles.length;i<l;i++){
        var opt = document.createElement("option");
        opt.appendChild(document.createTextNode(titles)) ;
        opt.onclick = function(){
            PaStec_SuggestionReplace(PaStec_getSuggestionID(this.parentNode));
        };
        opt.value = titles;
        List.appendChild(opt) ;
    }
    List.style.marginBottom = "-" + (listh + parseInt(Text.offsetHeight)) + "px" ;
    List.style.zIndex = PaStec_Suggestions_Zindex++;
    var NewValue = PaStec_formatTextValue(Text.value);
    if(titles.indexOf(NewValue) !== 0) PaStec_getSuggestions(Text);
};

window.PaStec_KeypressedOnSuggestionList = function(e){
    if (!e) var e = window.event;
    if (e.keyCode != 13) return;
    PaStec_SuggestionReplace(PaStec_getSuggestionID(this));
};

window.PaStec_SuggestionReplace = function(Index){
    var Text = document.getElementById("SuggestInput_"+Index);
    var List = document.getElementById("SuggestSelect_"+Index);
    if(!Text || !List) return;
    var TextValue = Text.value;
    var Options = List.getElementsByTagName('option');
    for(var a=0;a<Options.length;a++){
        if(Options.selected){
            var ListValue = Options.value;
            Text.value = ListValue;
            PaStec_getSuggestions(Text);
            Text.focus();
            return;
        }
    }
};

window.PaStec_formatTextValue = function(text){
    text = text.replace(/\u200E|\u200F|\u202A|\u202B|\u202C|\u202D|\u202E/g, '');
    text = text.PaStec_ucFirst();
    return text;
};

window.PaStec_getPageSuggestions = function(Index){
    var Input = document.getElementById("SuggestInput_"+Index);
    if(!Input) return;
    var text = Input.value;
    if(!text) return PaStec_showSuggestions(, Index);
    text = PaStec_formatTextValue(text);
    Input.value = text;
    var APILimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var limit = PaStec_Suggestions_requestlimit;
    if(limit > APILimit) limit = APILimit;
    var queryopt = {
        action        : 'query',
        list          : 'allpages',
        aplimit       : limit,
        apfilterredir : 'nonredirects',
        apprefix      : text,
        "continue"      : ""
    };
    var api = new mw.Api();
    api.get(queryopt).then( function(data) {
        var titles = ;
        var pages = data.query.allpages;
        if(!pages) PaStec_showSuggestions(titles, Index);
        for(var a=0,l=pages.length;a<l;a++){
            var thistitle = pages.title;
            if(titles.indexOf(thistitle) === -1) titles.push(thistitle);
        }
        PaStec_showSuggestions(titles, Index);
    });
};

window.PaStec_getUserSuggestions = function(Index){
    var Input = document.getElementById("SuggestInput_"+Index);
    if(!Input) return;
    var text = Input.value;
    if(!text) return PaStec_showSuggestions(, Index);
    text = PaStec_formatTextValue(text);
    Input.value = text;
    var APILimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var limit = PaStec_Suggestions_requestlimit;
    if(limit > APILimit) limit = APILimit;
    var queryopt = {
        action         : 'query',
        list           : 'allusers',
        aulimit        : limit,
        auexcludegroup : 'bot',
        auprefix       : text,
        "continue"       : ""
    };
    var api = new mw.Api();
    api.get(queryopt).then( function(data) {
        var titles = ;
        var users = data.query.allusers;
        if(!users) PaStec_showSuggestions(titles, Index);
        for(var a=0,l=users.length;a<l;a++){
            var thisuser = users.name;
            if(titles.indexOf(thisuser) === -1) titles.push(thisuser);
        }
        PaStec_showSuggestions(titles, Index);
    });
};

window.PaStec_getProjectSuggestions = function(Index){
    var Input = document.getElementById("SuggestInput_"+Index);
    if(!Input) return;
    var text = Input.value;
    text = PaStec_formatTextValue(text);
    if(!text) return PaStec_showSuggestions(, Index);
    Input.value = text;
    var APILimit = ( PaStec_UserCanDo("apihighlimit") ? 5000 : 500);
    var limit = (PaStec_Suggestions_requestlimit * 20);
    if(limit > APILimit) limit = APILimit;
    var queryopt = {
        action        : 'query',
        list          : 'allpages',
        aplimit       : limit,
        apfilterredir : 'nonredirects',
        apnamespace   : 103,
        apprefix      : text,
        "continue"      : ""
    };
    var api = new mw.Api();
    api.get(queryopt).then( function(data) {
        var NS = mw.config.get('wgFormattedNamespaces');
        var titles = ;
        var pages = data.query.allpages;
        if(!pages) PaStec_showSuggestions(titles, Index);
        for(var a=0,l=pages.length;a<l;a++){
            var thistitle = pages.title;
            if(thistitle.indexOf("/") !== -1) continue;
            thistitle = thistitle.split(NS+":").join("");
            if(titles.indexOf(thistitle) === -1 && titles.length < PaStec_Suggestions_requestlimit) titles.push(thistitle);
        }
        PaStec_showSuggestions(titles, Index);
    });
};

/* </syntaxhighlight>

==== Autres ====

<syntaxhighlight lang=javascript> */

window.PaStec_CreateInput = function(name, value, type, checked, disabled, onclick, onkeyup){
    var Input = document.createElement('input');
    Input.type = type;
    Input.name = name;
    Input.value = value;
    if(type === "text") Input.size = (PaStec_InputSize || 30);
    if(checked) Input.checked = "checked";
    if(disabled) Input.disabled = "disabled";
    if(onclick){
        Input.onclick = function(){ onclick(this); };
         Input.onselect = function(){ onclick(this); };
    }
    if(onkeyup){
        Input.onkeyup = function(){ onkeyup(this); };
    }
    return Input;
};

window.PaStec_CreateLabel = function(For, text){
    var Label = document.createElement('label');
    Label.setAttribute('for', For);
    Label.innerHTML = text;
    return Label;
};

window.PaStec_CreateRemoveParentLink = function(){
    var Link = document.createElement('a');
    Link.innerHTML = "(-)";
    Link.title = PaStec_Texts.RemoveItem;
    Link.href = "javascript:;";
    Link.onclick = function(){
        var parent = this.parentNode;
        if(parent) parent.parentNode.removeChild(parent);
        return false;
    };
    return Link;
};

window.PaStec_DisableForms = function(Container){
    if(!Container) Container = document.getElementById("PaStec_MainContainer");
    var Forms = Container.getElementsByTagName('form');
    for(var a=0,l=Forms.length;a<l;a++){
        Forms.onsubmit = function(){ return false; };
    }
};

/* </syntaxhighlight>

=== Création du menu ===

==== Création des onglets ====

<syntaxhighlight lang=javascript> */

window.PaStec_CreateMenuPanelFunctions = {
    "PaSWelcome" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSWelcome", true);
        if(!PanelContent) return;
    },
/* </syntaxhighlight>

===== Clôture en suppression =====

<syntaxhighlight lang=javascript> */

    "PaSDelete" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSDelete", true);
        if(!PanelContent) return;
        var ReasonForm = document.createElement('form');
        var ReasonInput = PaStec_CreateInput("reason", PaStec_Texts.PaSDeleteReasonDef, "text");
        var ReasonLabel = PaStec_CreateLabel("reason", PaStec_Texts.PaSPanelReason);
        ReasonForm.appendChild(ReasonLabel);
        ReasonForm.appendChild(document.createTextNode(" : "));
        ReasonForm.appendChild(document.createElement("br"));
        ReasonForm.appendChild(ReasonInput);
        PanelContent.appendChild(ReasonForm);
        var ActionForm = document.createElement('form');
        ActionForm.appendChild(PaStec_CreateInput("action", "AskSI", "radio", !PaStec_UserCanDo("delete") ));
        ActionForm.appendChild(document.createTextNode(" : "));
        ActionForm.appendChild(PaStec_CreateLabel("action_AskSI", PaStec_Texts.PaSPanelAskSI));
        ActionForm.style.display = "none";
        PanelContent.appendChild(ActionForm);
        if(PaStec_UserCanDo("delete")){
            ActionForm.style.display = "";
            ActionForm.appendChild(document.createElement("br"));
            ActionForm.appendChild(PaStec_CreateInput("action", "Delete", "radio", true) );
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action_Delete", PaStec_Texts.PaSPanelDelete));
            var RedirectsList = document.createElement('div');
            RedirectsList.className = "PaStec_WhatlinkshereList";
            PanelContent.appendChild(RedirectsList);
            PaStec_CreateWhatlinkshereList(, RedirectsList);
        }
    },

/* </syntaxhighlight>

===== Clôture suite à SI =====

<syntaxhighlight lang=javascript> */

    "PaSSI" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSSI", true);
        if(!PanelContent) return;
        if(PaStec_UserCanDo("delete")){
            var ActionForm = document.createElement('form');
            ActionForm.appendChild(PaStec_CreateInput("action", "DelRedir", "checkbox", true ));
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action_AskSI", PaStec_Texts.PaSDerRedir));
            PanelContent.appendChild(ActionForm);
            var RedirectsList = document.createElement('div');
            RedirectsList.className = "PaStec_WhatlinkshereList";
            PanelContent.appendChild(RedirectsList);
            PaStec_CreateWhatlinkshereList(, RedirectsList);
        }
    },

/* </syntaxhighlight>

===== Déwikification =====

<syntaxhighlight lang=javascript> */

    "PaSUnwikify" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSUnwikify");
        if(!PanelContent) return;
        var ButtonsP = document.getElementById("PaStec_PaSUnwikifyButtons");
        if(ButtonsP){
            var Nextbutton = PaStec_CreateInput("PaStec_PaSUnwikifyNextPage", PaStec_Texts.PasWLH_NextPage, "button", false, false, function(){ PaStec_CheckNextPage("PaSUnwikify"); });
            Nextbutton.className = "PaStec_ActionButton";
            ButtonsP.appendChild(Nextbutton);
        }
        var WhatlinkshereLists = document.createElement('div');
        WhatlinkshereLists.className = "PaStec_WhatlinkshereList";
        PanelContent.appendChild(WhatlinkshereLists);
        PaStec_CreateWhatlinkshereList("redirects", WhatlinkshereLists);
        if(PaStec_getPageName().indexOf(mw.config.get('wgFormattedNamespaces')+":") === 0) PaStec_CreateWhatlinkshereList("imageusage", WhatlinkshereLists);
        else if(PaStec_getPageName().indexOf(mw.config.get('wgFormattedNamespaces')+":") === 0) PaStec_CreateWhatlinkshereList("categorymembers", WhatlinkshereLists);
        else PaStec_CreateWhatlinkshereList("links", WhatlinkshereLists);
        var DiffPreview = document.createElement('div');
        DiffPreview.id = "PaStec_DiffPreview_PaSUnwikify";
        DiffPreview.className = "PaStec_DiffPreview PaStec_EmptyDiffPreview";
        PanelContent.appendChild(DiffPreview);
    },

/* </syntaxhighlight>

===== Clôture en conservation =====

<syntaxhighlight lang=javascript> */

    "PaSKeep" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSKeep", true);
        if(!PanelContent) return;
        var ReasonForm = document.createElement('form');
        var ReasonInput = PaStec_CreateInput("reason", PaStec_Texts.PASkeepReasonDef, "text");
        var ReasonLabel = PaStec_CreateLabel("reason", PaStec_Texts.PaSPanelReason);
        ReasonForm.appendChild(ReasonLabel);
        ReasonForm.appendChild(document.createTextNode(" : "));
        ReasonForm.appendChild(document.createElement("br"));
        ReasonForm.appendChild(ReasonInput);
        PanelContent.appendChild(ReasonForm);
    },

/* </syntaxhighlight>

===== Clôture en fusion =====

<syntaxhighlight lang=javascript> */

    "PaSMerge" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSMerge", true);
        if(!PanelContent) return;
        var ReasonForm = document.createElement('form');
        var ReasonInput = PaStec_CreateInput("reason", PaStec_Texts.PaSMergeReasonDef, "text");
        var ReasonLabel = PaStec_CreateLabel("reason", PaStec_Texts.PaSPanelReason);
        ReasonForm.appendChild(ReasonLabel);
        ReasonForm.appendChild(document.createTextNode(" : "));
        ReasonForm.appendChild(document.createElement("br"));
        ReasonForm.appendChild(ReasonInput);
        PanelContent.appendChild(ReasonForm);
        var OtherPagesForm = document.createElement('form');
        var OtherPagesLabel = PaStec_CreateLabel("pages", PaStec_Texts.PaSMergePages);
        var OL = document.createElement('ol');
        var Page1LI = document.createElement('li');
        Page1LI.appendChild(PaStec_CreateInput("pages", PaStec_getPageName(), "text", false, true));
        var Page2LI = document.createElement('li');
        Page2LI.appendChild(PaStec_CreateInput("pages", "", "text", false, false, false, PaStec_getSuggestions));
        OL.appendChild(Page1LI);
        OL.appendChild(Page2LI);
        var MoreLi = document.createElement('li');
        MoreLi.appendChild(PaStec_CreateAddItemLink("pages"));
        OL.appendChild(MoreLi);
        OtherPagesForm.appendChild(OtherPagesLabel);
        OtherPagesForm.appendChild(document.createTextNode(" : "));
        OtherPagesForm.appendChild(OL);
        PanelContent.appendChild(OtherPagesForm);
        var RequestForm = document.createElement('form');
        RequestForm.appendChild(PaStec_CreateInput("makerequest", "1", "checkbox", true) );
        RequestForm.appendChild(document.createTextNode(" : "));
        RequestForm.appendChild(PaStec_CreateLabel("makerequest", PaStec_Texts.PaSMergeRequest));
        PanelContent.appendChild(RequestForm);
    },

/* </syntaxhighlight>

===== Clôture en renommage =====

<syntaxhighlight lang=javascript> */

    "PaSMove" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSMove", true);
        if(!PanelContent) return;
        var ReasonForm = document.createElement('form');
        var ReasonInput = PaStec_CreateInput("reason", PaStec_Texts.PaSMoveReasonDef, "text");
        var ReasonLabel = PaStec_CreateLabel("reason", PaStec_Texts.PaSPanelReason);
        ReasonForm.appendChild(ReasonLabel);
        ReasonForm.appendChild(document.createTextNode(" : "));
        ReasonForm.appendChild(document.createElement("br"));
        ReasonForm.appendChild(ReasonInput);
        PanelContent.appendChild(ReasonForm);
        var ActionForm = document.createElement('form');
        var inputtype = (PaStec_UserCanDo("move") ? "radio" : "checkbox" );
        if(PaStec_UserCanDo("move")){
            ActionForm.appendChild(PaStec_CreateInput("action", "Move", inputtype, true) );
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action", PaStec_Texts.PaSMoveDo));
            ActionForm.appendChild(document.createElement("br"));
            ActionForm.appendChild(PaStec_CreateInput("action", "Ask", inputtype) );
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action", PaStec_Texts.PaSMoveAsk));
            ActionForm.appendChild(document.createElement("br"));
            ActionForm.appendChild(PaStec_CreateInput("action", "", inputtype) );
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action", PaStec_Texts.PaSMoveNo));
        }else{
            ActionForm.appendChild(PaStec_CreateInput("action", "Move", inputtype, true) );
            ActionForm.appendChild(document.createTextNode(" : "));
            ActionForm.appendChild(PaStec_CreateLabel("action", PaStec_Texts.PaSMoveAsk));
        }
        PanelContent.appendChild(ActionForm);
        var NewPageForm = document.createElement('form');
        var NewPageInput = PaStec_CreateInput("newtitle", "", "text", false, false, false, PaStec_getSuggestions);
        var NewPageLabel = PaStec_CreateLabel("newtitle", PaStec_Texts.PaSMoveNewPage);
        NewPageForm.appendChild(NewPageLabel);
        NewPageForm.appendChild(document.createTextNode(" : "));
        NewPageForm.appendChild(document.createElement("br"));
        NewPageForm.appendChild(NewPageInput);
        PanelContent.appendChild(NewPageForm);
        var DoubleRedirectList = document.createElement('div');
        DoubleRedirectList.className = "PaStec_WhatlinkshereList";
        PanelContent.appendChild(DoubleRedirectList);
        PaStec_CreateWhatlinkshereList(, DoubleRedirectList);
        if(!PaStec_UserCanDo("move")) DoubleRedirectList.style.display = "none";
    },

/* </syntaxhighlight>

===== Clôture en redirection =====

<syntaxhighlight lang=javascript> */

    "PaSRedirect" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSRedirect", true);
        if(!PanelContent) return;
        var ReasonForm = document.createElement('form');
        ReasonForm.appendChild(PaStec_CreateLabel("reason", PaStec_Texts.PaSPanelReason));
        ReasonForm.appendChild(document.createTextNode(" : "));
        ReasonForm.appendChild(document.createElement("br"));
        ReasonForm.appendChild(PaStec_CreateInput("reason", PaStec_Texts.PaSRedirectReasonDef, "text"));
        PanelContent.appendChild(ReasonForm);
        var RequestForm = document.createElement('form');
        RequestForm.appendChild(PaStec_CreateInput("makeredir", "1", "checkbox", true) );
        RequestForm.appendChild(document.createTextNode(" : "));
        RequestForm.appendChild(PaStec_CreateLabel("makeredir", PaStec_Texts.PaSRedirectDo));
        PanelContent.appendChild(RequestForm);
        var TargetForm = document.createElement('form');
        TargetForm.appendChild(PaStec_CreateLabel("target", PaStec_Texts.PaSRedirectTitle));
        TargetForm.appendChild(document.createTextNode(" : "));
        TargetForm.appendChild(document.createElement("br"));
        TargetForm.appendChild(PaStec_CreateInput("target", "", "text", false, false, false, PaStec_getSuggestions));
        PanelContent.appendChild(TargetForm);
        var DoubleRedirectList = document.createElement('div');
        DoubleRedirectList.className = "PaStec_WhatlinkshereList";
        PanelContent.appendChild(DoubleRedirectList);
        PaStec_CreateWhatlinkshereList(, DoubleRedirectList);
    },

/* </syntaxhighlight>

===== Initialisation PaS =====

<syntaxhighlight lang=javascript> */

    "PaSInit" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSInit");
        if(!PanelContent) return;
        var Input = document.getElementById("PaStec_PaSInitInput");
        if(Input) Input.parentNode.insertBefore(document.createElement("br"), Input);
        var DefinitionForm = document.createElement('form');
        var DefinitionInput = PaStec_CreateInput("definition", "", "text");
        var DefinitionLabel = PaStec_CreateLabel("definition", PaStec_Texts.PaSInitDefinition);
        DefinitionForm.appendChild(DefinitionLabel);
        DefinitionForm.appendChild(document.createTextNode(" : "));
        DefinitionForm.appendChild(document.createElement("br"));
        DefinitionForm.appendChild(DefinitionInput);
        PanelContent.appendChild(DefinitionForm);
    },

/* </syntaxhighlight>

===== Avertissement utilisateurs =====

<syntaxhighlight lang=javascript> */

    "PaSWarnUser" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSWarnUser");
        if(!PanelContent) return;
        var Fieldset = PanelContent.parentNode;
        Fieldset.classList.add("iphidden");
        Fieldset.classList.add("bothidden");
        PanelContent.innerHTML = '<span class="error">'+PaStec_Texts.running+'</span>';
        PaStec_getArticleAuthors("", function(){
            PanelContent.innerHTML = '';
            var UserListForm = document.createElement('form');
            PanelContent.appendChild(UserListForm);
            var UserListLabel = PaStec_CreateLabel("user", PaStec_Texts.PaSCheckUsersToWarn);
            UserListForm.appendChild(UserListLabel);
            UserListForm.appendChild(document.createTextNode(" : "));
            var UserListOL = document.createElement('ol');
            UserListOL.id = "UserListOL";
            UserListForm.appendChild(UserListOL);
            var foundip = false;
            var foundbot = false;
            for(var user in PaStec_Authors){
                var UserLi = document.createElement('li');
                var userinfos = PaStec_Authors;
                UserLi.classList.add("author");
                var isCreator = (user === PaStec_Creator || false);
                if(userinfos.ip){ UserLi.classList.add("ip"); foundip = true; }
                if(userinfos.bot){ UserLi.classList.add("bot"); foundbot = true; }
                if(isCreator) UserLi.classList.add("creator");
                var typetext = PaStec_getAuthorType(user);
                var editcount = userinfos.editcount;
                var LabelText = PaStec_Texts.NbEdits;
                LabelText = LabelText.split("$user").join(PaStec_createUserLink(user) + typetext);
                LabelText = LabelText.split("$creator").join(PaStec_Texts.Creator);
                LabelText = LabelText.split("$edits").join(editcount);
                LabelText = LabelText.split("$last").join(PaStec_Authors.last);
                LabelText = PaStec_Plural(LabelText);
                var Checked = true;
                if( (userinfos.ip || userinfos.maybebot || userinfos.editcount < Pastec_seil || userinfos.bot) && !isCreator) Checked = false;
                var Disabled = (userinfos.bot || false);
                UserLi.appendChild(PaStec_CreateInput("user", user, "checkbox", Checked, Disabled));
                UserLi.appendChild(document.createTextNode(" "));
                UserLi.appendChild(PaStec_CreateLabel("user", LabelText));
                UserListOL.appendChild(UserLi);
            }
            var MoreLi = document.createElement('li');
            MoreLi.appendChild(PaStec_CreateAddItemLink("user"));
            UserListOL.appendChild(MoreLi);
            var Target = document.getElementById("PaStec_PaSWarnUserButtons");
            if(Target && foundbot){
                var HideBotButton = PaStec_CreateInput("", PaStec_Texts.PaSHideBots, "button", false, false, function(){
                    if(!Fieldset.classList.contains("bothidden")) Fieldset.classList.add("bothidden");
                });
                HideBotButton.id = "hidebotbutton";
                HideBotButton.className = "PaStec_ActionButton";
                Target.appendChild(HideBotButton);
                var ShowBotButton = PaStec_CreateInput("", PaStec_Texts.PaSShowBots, "button", false, false, function(){
                    if(Fieldset.classList.contains("bothidden")) Fieldset.classList.remove("bothidden");
                });
                ShowBotButton.id = "showbotbutton";
                ShowBotButton.className = "PaStec_ActionButton";
                Target.appendChild(ShowBotButton);
            }
            if(Target && foundip){
                var HideIPButton = PaStec_CreateInput("", PaStec_Texts.PaSHideIPs, "button", false, false, function(){
                    if(!Fieldset.classList.contains("iphidden")) Fieldset.classList.add("iphidden");
                });
                HideIPButton.id = "hideipbutton";
                HideIPButton.className = "PaStec_ActionButton";
                Target.appendChild(HideIPButton);
                var ShowIPButton = PaStec_CreateInput("", PaStec_Texts.PaSShowIPs, "button", false, false, function(){
                    if(Fieldset.classList.contains("iphidden")) Fieldset.classList.remove("iphidden");
                });
                ShowIPButton.id = "showipbutton";
                ShowIPButton.className = "PaStec_ActionButton";
                Target.appendChild(ShowIPButton);
            }
        });
    },

/* </syntaxhighlight>

=====Avertissement projets =====

<syntaxhighlight lang=javascript> */

    "PaSWarnProject" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSWarnProject");
        if(!PanelContent) return;
        var ProjectListForm = document.createElement('form');
        PanelContent.appendChild(ProjectListForm);
        var ProjectListLabel = PaStec_CreateLabel("project", PaStec_Texts.PaSWarnProjectProjects);
        ProjectListForm.appendChild(ProjectListLabel);
        ProjectListForm.appendChild(document.createTextNode(" : "));
        var ProjectListOL = document.createElement('ol');
        ProjectListOL.id = "ProjectListOL";
        ProjectListForm.appendChild(ProjectListOL);
        ProjectListOL.innerHTML = '<li><span class="error">'+PaStec_Texts.running+'</span></li>';
        PaStec_getArticleProjects(false, function(){
            ProjectListOL.innerHTML = '';
            var Projects = PaStec_Projects;
            for(var a=0,l=Projects.length;a<l;a++){
                var Project = Projects;
                var ProjectLi = document.createElement('li');
                var ProjectLink = PaStec_createProjectLink(Project);
                ProjectLi.appendChild(PaStec_CreateInput("project", Project, "checkbox", ProjectLink !== false));
                ProjectLi.appendChild(document.createTextNode(" "));
                ProjectLi.appendChild(PaStec_CreateLabel("project", ProjectLink ? ProjectLink :
                                      '<span style="text-color:gray;"><s>' + Project + '</s> <small>(pas d\'annonce de débat d\'admissibilité)</small></span>'));
                ProjectListOL.appendChild(ProjectLi);
            }
            var MoreLi = document.createElement('li');
            MoreLi.appendChild(PaStec_CreateAddItemLink("project"));
            ProjectListOL.appendChild(MoreLi);
        });
    },

/* </syntaxhighlight>

===== Message =====

<syntaxhighlight lang=javascript> */

    "PaSMessage" : function(){
        var PanelContent = PaStec_CreateNewMenuPanel("PaSMessage");
        if(!PanelContent) return;
        var TargetForm = document.createElement('form');
        var TargetLabel = PaStec_CreateLabel("target", PaStec_Texts.PaSMessageTarget);
        TargetForm.appendChild(TargetLabel);
        TargetForm.appendChild(document.createTextNode(" : "));
        TargetForm.appendChild(document.createElement("br"));
        var TargetUL = document.createElement('ul');
        TargetForm.appendChild(TargetUL);
        for(var a=0,l=PaStec_DevTalkPages.length;a<l;a++){
            var Target = PaStec_DevTalkPages;
            var LI = document.createElement('li');
            LI.appendChild(PaStec_CreateInput("target", Target, "text", false, true));
            TargetUL.appendChild(LI);
        }
        PanelContent.appendChild(TargetForm);
        var MessageForm = document.createElement('form');
        var MessageField = document.createElement('textarea');
        MessageField.setAttribute("rows", "8");
        MessageField.name = "message";
        var MessageLabel = PaStec_CreateLabel("message", PaStec_Texts.PaSMessageText);
        MessageForm.appendChild(MessageLabel);
        MessageForm.appendChild(document.createTextNode(" : "));
        MessageForm.appendChild(MessageField);
        PanelContent.appendChild(MessageForm);
    }
};

/* </syntaxhighlight>

==== Mise en place du menu ====

<syntaxhighlight lang=javascript> */

window.PaStec_actionsLeft = 0; //compteur global

window.PaStec_CreatePaSMenu = function(){
    if((mw.config.get('wgNamespaceNumber') % 2 !== 0) && (mw.config.get('wgTitle').match(/\/Admissibilité$/) !== null) ) { //PàS
        if (!document.getElementById('talkpageheader')) {
            $('<div class="mw-talkpageheader"><div id="talkpageheader"></div></div>').prependTo('#mw-content-text');
        }
        var TalkHeader = document.getElementById('talkpageheader');
        var Fieldset = document.createElement('fieldset');
        Fieldset.id = "PaStec_MainFieldset";
        var Legend = document.createElement('legend');
        var ShowHideLinks = ""
            + PaStec_createLink({url:"javascript:PaStec_ShowHideMenu(true);", text:PaStec_Texts.PaSLegendShow,classes:})
            + PaStec_createLink({url:"javascript:PaStec_ShowHideMenu(false);",text:PaStec_Texts.PaSLegendHide,classes:});
        var docLink = PaStec_createLink({url:PaStec_Texts.DocURL,text:PaStec_Texts.DocText});
        Legend.innerHTML = PaStec_Texts.PaSLegend.split("$1").join(PaStec_Texts.ScriptName).split("$2").join(docLink).split("$3").join(ShowHideLinks);
        Fieldset.appendChild(Legend);
        var MainDiv = document.createElement('div');
        MainDiv.id = "PaStec_MainContainer";
        Fieldset.appendChild(MainDiv);
        var PanelButtonsP = document.createElement('p');
        PanelButtonsP.id = "PaStec_PanelButtons";
        MainDiv.appendChild(PanelButtonsP);
        TalkHeader.insertAdjacentElement('afterend', Fieldset);
        for(var func in PaStec_CreateMenuPanelFunctions){
            if(typeof(PaStec_CreateMenuPanelFunctions) === "function" && ( func === "PaSWelcome" || PaStec_Enabled === true || PaStec_DebugMode === true) )
                PaStec_CreateMenuPanelFunctions();
        }
        var ResizeAnchor = document.createElement('div');
        ResizeAnchor.classList.add("PaStec_ResizeAnchor");
        Fieldset.appendChild(ResizeAnchor);
        PaStec_SetVerticalResizeZone(
            ResizeAnchor,
            $(Fieldset).find(".PaStec_PanelContent").toArray(),
            MainDiv,
            true
        );
        PaStec_DisableForms();
        PaStec_ToggleMenuPanel();
        PaStec_SetMenuPanelHeightsTimeout = setTimeout("PaStec_SetMenuPanelHeights()", 500);
        PaStec_GetWhatlinkshere();
        if(PaStec_AutoHideMenu) PaStec_ShowHideMenu(false);
    }
};

PaStec_Load(PaStec_CreatePaSMenu);


/* </syntaxhighlight>

=== Validation du menu  ===

==== Vérification des paramètres ====

<syntaxhighlight lang=javascript> */

window.PaStec_ValidateNeededParams = {
    "PaSDelete" : [
        { name : "reason",      mandatory : 1 },
        { name : "action",      mandatory : 1 },
        { name : "redirects",   mandatory : 0 }
    ],
    "PaSSI" : [
        { name : "action",      mandatory : 0 },
        { name : "redirects",   mandatory : 0 }
    ],
    "PaSUnwikify" : [
        { name : "redirects",   mandatory : 0 },
        { name : "links",       mandatory : 0 },
        { name : "imageusage",  mandatory : 0 },
        { name : "categorymembers",  mandatory : 0 }
    ],
    "PaSKeep" : [
        { name : "reason",      mandatory : 1 }
    ],
    "PaSMerge" : [
        { name : "reason",      mandatory : 1 },
        { name : "pages",       mandatory : 2 },
        { name : "makerequest", mandatory : 0 }
    ],
    "PaSMove" : [
        { name : "reason",      mandatory : 1 },
        { name : "action",      mandatory : 0 },
        { name : "newtitle",    mandatory : 1, onlyif : "action" },
        { name : "redirects",   mandatory : 0 }
    ],
    "PaSRedirect" : [
        { name : "reason",      mandatory : 1 },
        { name : "makeredir",   mandatory : 0 },
        { name : "target",      mandatory : 1, onlyif : "makeredir" },
        { name : "redirects",   mandatory : 0 }
    ],
    "PaSInit" : [
        { name : "definition",  mandatory : 1 }
    ],
    "PaSWarnUser" : [
        { name : "user",        mandatory : 1 }
    ],
    "PaSWarnProject" : [
        { name : "project",     mandatory : 1 }
    ],
    "PaSMessage" : [
        { name : "target",      mandatory : 1 },
        { name : "message",     mandatory : 1 }
    ]
};

window.PaStec_GetParamsInMenuPanel = function(Form, searchedname){
    var Params = {};
    var Tags = ;
    for(var a=0,l=Tags.length;a<l;a++){
        var Elements = Form.getElementsByTagName(Tags);
        for(var b=0,m=Elements.length;b<m;b++){
            var Element = Elements;
            var ElName = Element.name;
            if(!ElName) continue;
            if(searchedname && ElName == searchedname) return Element;
            var ElValue = Element.value;
            var ElType = Element.type;
            if(Tags.toLowerCase()=='input' && (ElType == "checkbox" || ElType == "radio") && Element.checked){
                if(typeof(Params) !== "undefined"){
                    if(typeof(Params) !== "object") Params =  ];
                    Params.push(ElValue);
                }else Params = ElValue;
            }else if(Tags.toLowerCase()=='input' && (ElType == "text" || ElType == "hidden") && ElValue !== ""){
                if(typeof(Params) !== "undefined"){
                    if(typeof(Params) !== "object") Params =  ];
                    Params.push(ElValue);
                }else Params = ElValue;
            }else if(Tags.toLowerCase()!='input' && ElValue !== ""){
                if(typeof(Params) !== "undefined"){
                    if(typeof(Params) !== "object") Params =  ];
                    Params.push(ElValue);
                }else Params = ElValue;
            }
        }
    }
    if(searchedname) return null;
    return Params;
};

window.PaStec_StringEscape = function(str){
  return "'" + (""+str).replace(/\\/g, '\\\\').replace(/+n/g, '\\n').replace(/'/g, "\\'") + "'";
};

window.PaStec_ObjectToString = function(obj){
    var str = "{";
    var items = ;
    for(var itemname in obj){
        var itemvalue = obj;
        if(typeof(itemvalue) === "object") items.push(itemname+":"+PaStec_ObjectToString(itemvalue));
        else if(typeof(itemvalue) === "string") items.push(itemname+":"+PaStec_StringEscape(itemvalue));
        else items.push(itemname+":"+itemvalue);
    }
    str += items.join(",")+"}";
    return str;
};

window.PaStec_fillControl = function(type, text){
    var Control = document.getElementById("PaStec_Panel"+type+"Control");
    if(Control) Control.innerHTML = (text || "");
};

window.PaStec_ValidateDone = function(type, text){
    PaStec_fillControl(type, (text +"<br><small>"+ PaStec_Texts.running +"</small><br><small>"+ PaStec_Texts.maybeerror+"</small>"));
};

window.PaStec_GetCheckedParamsInMenuPanel = function(type){
    var Menu = document.getElementById("PaStec_"+type+"Fieldset");
    if(!Menu) return false;
    PaStec_fillControl(type, "");
    $(Menu).find('form.mandatory').removeClass("mandatory");
    var NeededParams = PaStec_ValidateNeededParams;
    var ParamsFound = PaStec_GetParamsInMenuPanel(Menu);
//    alert( type + "\n" + PaStec_ObjectToString(ParamsFound) );
    var errorsfound = false;
    var error = false;
    for(var a=0,l=NeededParams.length;a<l;a++){
        error = false;
        var mandatory = NeededParams.mandatory;
        var onlyif = NeededParams.onlyif;
        if(mandatory === 0) continue;
        if(onlyif && !ParamsFound) continue;
        var paramname = NeededParams.name;
        var paramfound = ParamsFound;
        if(!paramfound) error = true;
        if(mandatory > 1 && typeof(paramfound) === "string") error = true;
        else if(mandatory > 1 && typeof(paramfound) === "object" && paramfound.length < 2) error = true;
        else if(mandatory === 1 && typeof(paramfound) === "string" && paramfound === "") error = true;
        if(error){
            errorsfound = true;
            var thisinput = PaStec_GetParamsInMenuPanel(Menu, paramname);
            var Form = thisinput.parentNode;
            while(Form && Form.tagName && Form.tagName.toLowerCase() !== "form") Form = Form.parentNode;
            if(Form && !Form.classList.contains("mandatory")) Form.classList.add("mandatory");
        }
    }
    if(errorsfound){
        PaStec_fillControl(type, '<span class="error">' + PaStec_Texts.PaSAlertMissingParam + '</span>');
        return false;
    }
    return ParamsFound;
};

window.PaStec_RunningRequests = null;

window.PaStec_ValidateMenuPanel = function(type){
    var Params = PaStec_GetCheckedParamsInMenuPanel(type);
    if(!Params) return;
    if(!PaStec_Enabled){
        return alert( PaStec_Texts.PaSDisabled + "\n\n" + type + "\n" + PaStec_ObjectToString(Params) );
    }
    if(typeof(PaStec_ValidateFunctions) === "function"){
        PaStec_RunningRequests = type;
        PaStec_ValidateFunctions(type, Params);
    }
};

/* </syntaxhighlight>

==== Fonctions de requêtes principales  ====

<syntaxhighlight lang=javascript> */

window.PaStec_ValidateFunctions = {

/* </syntaxhighlight>

===== Clôture en suppression =====

<syntaxhighlight lang=javascript> */

    "PaSDelete" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            var page = PaStec_getPageName();
            var delpage = mw.config.get('wgPageName');
            PaStec_updatePaS(PaStec_Texts.DeletePaSType, Params.reason);
            PaStec_updatePaSMainPage(PaStec_Texts.DeleteMainType);
            if(Params.action === "Delete"){
                var reason = PaStec_Texts.DeleteComment.split("$delpage").join(delpage);
                PaStec_deletePage(page, reason);
                PaStec_deletePage(PaStec_getDiscussionPageName(), reason);
                var redirects = Params.redirects;
                if(redirects){
                    if(typeof(redirects)==="string") redirects = ;
                    for(var a=0,l=redirects.length;a<l;a++){
                        PaStec_deletePage(redirects, PaStec_Texts.DelRedirComment.split("$1").join(delpage));
                    }
                }
                PaStec_ValidateDone(PaStec_Texts.DeleteDoHeader);
            }else if(Params.action === "AskSI"){
                PaStec_editPage(
                    page,
                    PaStec_ReplaceDeleteTemplateRegExp,
                    PaStec_Texts.AskSIpage_Template.split("$reason").join("]"),
                    PaStec_Texts.AskSIpageComment.split("$reason").join("]")
                );
                PaStec_editPage(
                    PaStec_Texts.SIPageName,
                    ">",
                    "\n\n"+PaStec_Texts.PASaskSITemplate.split("$page").join(page).split("$delpage").join(delpage),
                    PaStec_Texts.PASaskSIComment.split("$page").join(page).split("$delpage").join(delpage)
                );
                PaStec_ValidateDone(PaStec_Texts.DeleteAskHeader);
            }else{
                PaStec_ValidateDone(PaStec_Texts.DeleteHeader);
            }
        });
    },

/* </syntaxhighlight>

===== Clôture suite à SI =====

<syntaxhighlight lang=javascript> */

    "PaSSI" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            var Funcs = {
                onmissing : function(){
                    PaStec_editPage(
                        mw.config.get('wgPageName'),
                        PaStec_Texts.SIPaSTarget,
                        PaStec_Texts.SIPaSTemplate+"\n\n"+PaStec_Texts.SIPaSTarget,
                        PaStec_Texts.SIPaSComment.split("$1").join(mw.config.get('wgPageName'))
                    );
                    PaStec_updatePaSMainPage(PaStec_Texts.SIMainType);
                    if(Params.action === "DelRedir" &&  Params.redirects){
                        if(typeof(redirects)==="string") redirects = ;
                        for(var a=0,l=redirects.length;a<l;a++){
                            PaStec_deletePage(redirects, PaStec_Texts.DelRedirComment.split("$1").join(mw.config.get('wgPageName')));
                        }
                    }
                    PaStec_ValidateDone(PaStec_Texts.SIHeader);
                },
                onredirect : function(){
                    alert(PaStec_Texts.SIPaSErrorExists);
                },
                onrealpage : function(){
                    alert(PaStec_Texts.SIPaSErrorExists);
                }
            };
            PaStec_doOnPageContition(PaStec_getPageName(),Funcs);
        });
    },

/* </syntaxhighlight>

===== Déwikification =====

<syntaxhighlight lang=javascript> */

    "PaSUnwikify" : function(type, Params){
        PaStec_ValidateThisDiff(type);
    },

/* </syntaxhighlight>

===== Clôture en conservation =====

<syntaxhighlight lang=javascript> */

    "PaSKeep" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            PaStec_editPage(
                PaStec_getPageName(),
                PaStec_RemoveDeleteTemplateRegExp,
                "",
                PaStec_Texts.PASkeepPageComment.split("$page").join(PaStec_getPageName()).split("$delpage").join(mw.config.get('wgPageName'))
            );
            PaStec_editPageWithoutTests(
                PaStec_getDiscussionPageName(),
                "<",
                PaStec_Texts.PASkeepTalkTemplate+"\n",
                PaStec_Texts.PASkeepTalkComment.split("$page").join(PaStec_getPageName()).split("$delpage").join(mw.config.get('wgPageName')),
                true
            );
            PaStec_updatePaS(PaStec_Texts.PASkeepPaSType, Params.reason);
            PaStec_updatePaSMainPage(PaStec_Texts.PASkeepMainType);
            PaStec_ValidateDone(PaStec_Texts.PASkeepHeader);
        });
    },

/* </syntaxhighlight>

===== Clôture en fusion =====

<syntaxhighlight lang=javascript> */

    "PaSMerge" : function(type, Params){  // 
        function ArrDeleteEl(arr, todelete){
            var newarr = ;
            for(var a=0,l=arr.length;a<l;a++){
                if(a !== todelete) newarr.push(arr);
            }
            return newarr;
        }
        PaStec_preventEditConflict(function(){
            var allpages = Params.pages;
            var lastpage = allpages;
            var firstpages = ArrDeleteEl(allpages, (allpages.length-1));
            var delpage = mw.config.get('wgPageName').replace(/_/g, " ");
            var bandeau = PaStec_Texts.MergeTemplate.split("$1").join(firstpages.join("]], [[")).split("$2").join(lastpage).split("$reason").join(Params.reason);
            PaStec_editPage(
                mw.config.get('wgPageName'),
                PaStec_Texts.MergePaSTarget,
                bandeau+"\n\n"+PaStec_Texts.MergePaSTarget,
                PaStec_Texts.MergePaSComment.split("$1").join(delpage)
            );
            PaStec_updatePaSMainPage(PaStec_Texts.MergeMainType);
            if(Params.makerequest) {
		PaStec_editPage(
                    PaStec_Texts.DoMergeMainPageName,
                    ">",
                    "\n\n"+PaStec_Texts.DoMergeMainPageTemplate.split("$1").join(firstpages.join("]], [[:")).split("$2").join(lastpage).split("$3").join(delpage),
                    PaStec_Texts.DoMergeMainPageComment.split("$1").join(firstpages.join("]], [[")).split("$2").join(lastpage).split("$3").join(delpage)
                );
                var thispage, otherpages, MergeComment;
                var MergeTemplate = PaStec_Texts.DoMergePagesTemplate.split("$1").join(firstpages.join("|")).split("$2").join(lastpage);
                for(var a=0,l=allpages.length;a<l;a++){
                    thispage = allpages;
                    otherpages = ArrDeleteEl(allpages, a);
                    if(a === 0){
                        MergeComment = PaStec_Texts.DoMergePage1Comment.split("$1").join(otherpages.join("]], [[")).split("$2").join(delpage);
		        PaStec_editPage(
                            thispage,
                            PaStec_ReplaceDeleteTemplateRegExp,
                            MergeTemplate,
                            MergeComment
                        );
                    }else{
                        MergeComment = PaStec_Texts.DoMergePagesComment.split("$1").join(otherpages.join("]], [[")).split("$2").join(delpage);
		        PaStec_editPage(
                            thispage,
                            "<",
                            MergeTemplate + "\n",
                            MergeComment
                        );
                    }
                }
                PaStec_ValidateDone(PaStec_Texts.DoMergeHeader);
            }else{
                PaStec_ValidateDone(PaStec_Texts.MergeHeader);
            }
        });
    },

/* </syntaxhighlight>

===== Clôture en renommage =====

<syntaxhighlight lang=javascript> */

    "PaSMove" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            PaStec_updatePaS(PaStec_Texts.MovePaSType, Params.reason);
            PaStec_updatePaSMainPage(PaStec_Texts.MoveMainType);
            PaStec_editPage(
                PaStec_getPageName(),
                PaStec_RemoveDeleteTemplateRegExp,
                "",
                PaStec_Texts.MovePageComment.split("$1").join(PaStec_getPageName()).split("$2").join(mw.config.get('wgPageName'))
            );
            if(Params.action === "Move"){
                PaStec_movePage(PaStec_getPageName(), Params.newtitle, Params.reason);
                var doubleredirects = Params.redirects;
                if(doubleredirects){
                    if(typeof(doubleredirects)==="string") doubleredirects = ;
                    for(var a=0,l=doubleredirects.length;a<l;a++){
                        PaStec_editPageWithoutTests(
                            doubleredirects,
                            '*',
                            '#REDIRECTION ]',
                            PaStec_Texts.RedirectCorrComment.split("$1").join(Params.newtitle).split("$2").join(mw.config.get('wgPageName'))
                        );
                    }
                }
                PaStec_ValidateDone(PaStec_Texts.MoveDoHeader);
            }else if(Params.action === "Ask"){
                PaStec_editPage(
                    PaStec_Texts.MovePageName,
                    ">",
                    "\n\n"+PaStec_Texts.MoveMainTemplate.split("$old").join(PaStec_getPageName()).split("$new").join(Params.newtitle).split("$delpage").join(mw.config.get('wgPageName')),
                    PaStec_Texts.MoveMainPageComment
                );
                PaStec_ValidateDone(PaStec_Texts.MoveAskHeader);
            }else{
                PaStec_ValidateDone(PaStec_Texts.MoveHeader);
            }
        });
    },

/* </syntaxhighlight>

===== Clôture en redirection =====

<syntaxhighlight lang=javascript> */

    "PaSRedirect" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            PaStec_updatePaS(PaStec_Texts.RedirectPaSType, Params.reason);
            PaStec_updatePaSMainPage(PaStec_Texts.RedirectMainType);
            if(Params.makeredir) {
                PaStec_editPage(
                    PaStec_getPageName(),
                    '*',
                    '#REDIRECTION ]',
                    PaStec_Texts.RedirectPageComment.split("$1").join(Params.target).split("$2").join(mw.config.get('wgPageName'))
                );

                var doubleredirects = Params.redirects;
                if(doubleredirects){
                    if(typeof(doubleredirects)==="string") doubleredirects = ;
                    for(var a=0,l=doubleredirects.length;a<l;a++){
                        PaStec_editPageWithoutTests(
                            doubleredirects,
                            '*',
                            '#REDIRECTION ]',
                            PaStec_Texts.RedirectCorrComment.split("$1").join(Params.target).split("$2").join(mw.config.get('wgPageName'))
                        );
                    }
                }
                PaStec_ValidateDone(PaStec_Texts.RedirectDoHeader);
            }else{
                PaStec_ValidateDone(PaStec_Texts.RedirectHeader);
            }
        });
    },

/* </syntaxhighlight>

===== Initialisation d'une PaS =====

<syntaxhighlight lang=javascript> */

    "PaSInit" : function(type, Params){  // 
        PaStec_preventEditConflict(function() {
            var page = PaStec_getPageName();
            var d = new Date();
            var day = d.getDate();
            var year = d.getFullYear();
            var months = ;
            var month = months;
            var target = PaStec_Texts.KirMainTarget.split("$day").join(day).split("$month").join(month).split("$year").join(year);
            PaStec_editPage(
                PaStec_Texts.PaSMainPageName,
                target,
                target+"\n"+PaStec_Texts.KirMainTemplate.split("$page").join(page).split("$definition").join(Params.definition),
                PaStec_Texts.KirMainComment.split("$page").join(page).split("$delpage").join(mw.config.get('wgPageName'))
            );

            var pagefortemplate = PaStec_getPageName();
            var template;
            if (pagefortemplate.search(/Modèle:/) != -1) {
                template = PaStec_Texts.DeleteTemplateNI;
            } else {
                template = PaStec_Texts.DeleteTemplate;
            }

            PaStec_editPageWithoutTests(
                page,
                PaStec_RemoveAdmitTemplateRegExp,
                template,
                PaStec_Texts.KirPageComment
            );
            PaStec_ValidateDone(PaStec_Texts.KirHeader);
        });
    },

/* </syntaxhighlight>

===== Avertissement utilisateur =====

<syntaxhighlight lang=javascript> */

    "PaSWarnUser" : function(type, Params){  // 
        var page = PaStec_getPageName();
        var users = Params.user;
        if(typeof(users) === "string") users = ;
        for(var a=0,l=users.length;a<l;a++){
            PaStec_editPdd(mw.config.get('wgFormattedNamespaces')+":"+users,page);
        }
        alert(PaStec_Texts.Flow);
        PaStec_ValidateDone(PaStec_Texts.WarnUserHeader);
    },

/* </syntaxhighlight>

===== Avertissement projet =====

<syntaxhighlight lang=javascript> */

    "PaSWarnProject" : function(type, Params){  // 
        if(typeof(PaStec_WarnedProjects)==="undefined") window.PaStec_WarnedProjects = {};
        var projects = Params.project;
        if(typeof(projects) === "string") projects = ;
        PaStec_populateTalkPagesMap(projects, function() {
            var page = PaStec_getPageName();
            for(var a=0,l=projects.length;a<l;a++){
                var StandardPage = PaStec_getProjectTalkPage(projects);
                if (StandardPage !== '' && !PaStec_WarnedProjects) {
                    PaStec_doOnPageContition(StandardPage, {
                        onredirect : function(redirecttarget){
                            if(!PaStec_WarnedProjects){
                                PaStec_WarnedProjects = true;
                                PaStec_ValidateFunctions(redirecttarget);
                            }
                        },
                        onrealpage : function(title){
                                PaStec_ValidateFunctions(title);
                        }
                    });
                }
            }
            PaStec_ValidateDone(PaStec_Texts.WarnProjectHeader);
        });
    },

    "PaSWarnThisProject" : function(targetpage){
        var page = PaStec_getPageName();
        var foundspecialproject = false;
        for(var sp=0,splen=PaStec_ProjectSpecialTalkPage.length;sp<splen;sp++){
            var ThisSpecialProject = PaStec_ProjectSpecialTalkPage;
            var Reg = ThisSpecialProject.regexp;
            if(targetpage.search(Reg) !== -1){
                foundspecialproject = true;
                var template = ThisSpecialProject.template;
                var projectpage = ThisSpecialProject.page;
                if(!template){
                    PaStec_editPdd(projectpage,page);
                    alert(PaStec_Texts.Flow);
                }else{
                	
                    PaStec_editPage(
                        projectpage,
                        ">",
                        "\n\n"+template.split("$page").join(page)+"\n",
                        PaStec_Texts.WarnComment.split("$page").join(page)
                    );
                }
            }
        }
        if(!foundspecialproject){
        	PaStec_editPdd(targetpage,page);
            alert(PaStec_Texts.Flow);
        }
    },

/* </syntaxhighlight>

===== Message =====

<syntaxhighlight lang=javascript> */

    "PaSMessage" : function(type, Params){  // 
        var target = Params.target;
        if(typeof(target) === "string") target = ;
        for(var a=0,l=target.length;a<l;a++){
            PaStec_editPage(
                target,
                ">",
                "\n\n"+PaStec_Texts.MessageTemplate.split("$1").join(Params.message),
                PaStec_Texts.MessageComment
            );
        }
        PaStec_ValidateDone(PaStec_Texts.MessageHeader);
    }
};

/* </syntaxhighlight>

==== Fonctions de requêtes secondaires  ====

<syntaxhighlight lang=javascript> */

function PaStec_preventEditConflict(Callback) {
    if(!mw.config.get('wgArticleId')) return Callback(); // La page de suppression n'existe pas : pas de conflit possible
    var query = {format: 'json', action: 'query', prop: 'revisions', titles: mw.config.get( 'wgPageName' ), rvprop: 'ids|user|comment'};
    $.getJSON(mw.util.wikiScript('api'), query, function(obj) {
        var last = obj.query.pages;
        var notlastmess = PaStec_Texts.ErrorConflict.split("$user").join(last.user).split("$comment").join(last.comment);
        if(last.revid == mw.config.get('wgRevisionId') || confirm(notlastmess) ){
            Callback();
        }
    });
}

function PaStec_doOnPageContition(pagename, Callbacks) {
    new mw.Api().get({action : 'query', prop : , rvprop : 'content', titles : pagename}).then(function(data) {
        var pages = data.query.pages;
        for(var id in pages){
            var thispage = pages;
            var isMissing = (thispage.missing === "");
            if(isMissing){
                if(typeof(Callbacks.onmissing)==="function") Callbacks.onmissing();
                return;
            }
            var isRedirect = (thispage.redirect === "");
            if(isRedirect){
                var Rev = thispage.revisions;
                var Text = Rev;
                if(Text){
                    var redirecttarget = Text.split("]]").split(";
                    if(typeof(Callbacks.onredirect)==="function") Callbacks.onredirect(redirecttarget);
                }
                return;
            }
            if(typeof(Callbacks.onrealpage)==="function") return Callbacks.onrealpage(pagename);
        }
    });
}

/* </syntaxhighlight>

===== Mise à jour du débat d'admissibilité =====

<syntaxhighlight lang=javascript> */

function PaStec_updatePaS(type, reason){
    var bandeau = PaStec_Texts.TagTemplate.split("$type").join(type).split("$reason").join(reason);
    PaStec_editPage(
        mw.config.get('wgPageName'),
        PaStec_Texts.TagTarget,
        bandeau+"\n\n"+PaStec_Texts.TagTarget,
        PaStec_Texts.TagComment.split("$page").join(PaStec_getPageName()).split("$type").join(type).split("$delpage").join(mw.config.get('wgPageName'))
    );
}

/* </syntaxhighlight>

===== Mise à jour de la page centrale (]) =====

<syntaxhighlight lang=javascript> */

function PaStec_updatePaSMainPage(type){
    PaStec_editPage(
        PaStec_Texts.PaSMainPageName,
        new RegExp(PaStec_Texts.PASstoreRegExp.split("$escpage$").join(PaStec_RegEscape(PaStec_getPageName()))),
        PaStec_Texts.PASstoreTemplate.split("$type").join(type),
        PaStec_Texts.PASstoreComment.split("$page").join(PaStec_getPageName()).split("$type").join(type).split("$delpage").join(mw.config.get('wgPageName'))
    );
}

/* </syntaxhighlight>

===== Fonctions pour la déwikification  =====

<syntaxhighlight lang=javascript> */

window.PaStec_CheckNextPage = function(type){
    var OldLink = document.getElementById("currentdiff_"+type);
    if(OldLink){
        var Li = OldLink.parentNode;
        var NextLi = Li.nextElementSibling;
        if(NextLi) return PaStec_CheckThisPage(NextLi.getElementsByTagName('a'));
    }
    var Fieldset = document.getElementById("PaStec_"+type+"Fieldset");
    if(!Fieldset) return;
    OldLink = document.getElementById("currentdiff_"+type);
    if(OldLink) OldLink.classList.add("modified");
    var Form = Fieldset.getElementsByClassName("PaStec_Whatlinkshere_links");
    if(!Form) Form = Fieldset.getElementsByClassName("PaStec_Whatlinkshere_imageusage");
    if(!Form) Form = Fieldset.getElementsByClassName("PaStec_Whatlinkshere_categories");
    if(!Form) return;
    var LinkLists = Form.getElementsByTagName('ul');
    for(var a=0,l=LinkLists.length;a<l;a++){
        var AllLinks = LinkLists.getElementsByTagName('a');
        for(var link=0,linklen=AllLinks.length;link<linklen;link++){
            var Link = AllLinks;
            if(!Link.classList.contains("modified") && !Link.classList.contains("cannotmodify")) return PaStec_GetThisDiff(Link, type, Link.title);
        }
    }
};

window.PaStec_CheckThisPage = function(Link){
    if(Link.classList.contains("modified")) return;
    var Page = Link.title;
    var parent = Link.parentNode;
    while(parent && parent.tagName.toLowerCase() !== "fieldset"){ parent = parent.parentNode; }
    if(!parent.id) return;
    var type = parent.id.split("PaStec_").join("").split("Fieldset").join("");
    PaStec_GetThisDiff(Link, type, Page);
};

window.PaStec_getParentForm = function(el){
    var parent = el.parentNode;
    while(parent && parent.tagName.toLowerCase() !== "form"){ parent = parent.parentNode; }
    return parent;
};

window.PaStec_getElementWithId = function(elementId, elementParentNode){
      if(!elementParentNode) elementParentNode = document.body;
      if (elementParentNode.getElementById) return elementParentNode.getElementById(elementId);
      return elementParentNode.querySelector('#' + elementId);
};

window.PaStec_CanValidate = false;

window.PaStec_GetThisDiff = function(Link, type, Page){
    var Diff = PaStec_ClearDiff(type);
    PaStec_CanValidate = false;
    if(!Diff) return;
    var OldLink = document.getElementById("currentdiff_"+type);
    if(OldLink){ OldLink.id = "";
        if(!OldLink.classList.contains("cannotmodify") && !OldLink.classList.contains("unmodified")) OldLink.classList.add("unmodified");
    }
    Link.id = "currentdiff_"+type;
    Link.focus();
    var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURIComponent(Page) + "&action=submit";
    $.ajax({ url : URL, complete : function(editReq){
        PaStec_CanValidate = false;
        var HtmlDoc = new DOMParser().parseFromString(editReq.responseText, 'text/html');
        var TextArea = PaStec_getElementWithId("wpTextbox1", HtmlDoc);
        var wpSummary = PaStec_getElementWithId("wpSummary", HtmlDoc);
        var wpSave = PaStec_getElementWithId("wpSave", HtmlDoc);
        if(!wpSave){
            Link.classList.add("cannotmodify");
            PaStec_fillControl(type, PaStec_Texts.isProtected.split("$1").join(Page));
            PaStec_CheckNextPage(type);
            return;
        }
        var OldText = TextArea.value;
        var Datas = { text : OldText, summary : "" };
        Datas = PaStec_TextUnwikify(Datas, type);
        if(Datas.text === OldText){
            Link.classList.add("cannotmodify");
            PaStec_fillControl(type, PaStec_Texts.cannotUnwikify.split("$1").join(Page));
            PaStec_CheckNextPage(type);
            return;
        }
        PaStec_fillControl(type);
        Diff.classList.remove("PaStec_EmptyDiffPreview");
        TextArea.value = Datas.text;
        wpSummary.value = Datas.summary;
        var H = document.createElement("h2");
        H.innerHTML = PaStec_Texts.PaSUnwikifyRunning.split("$1").join(Page);
        Diff.appendChild(H);
        var SummaryDiv = document.createElement('div');
        SummaryDiv.className = "summarydiv";
        SummaryDiv.innerHTML = PaStec_Texts.PaSUnwikifySummary.split("$1").join('<span class="summaryspan">'+Datas.summary+'</span>');
        Diff.appendChild(SummaryDiv);
        var DiffDiv = document.createElement('div');
        DiffDiv.innerHTML = '<span class="error">'+PaStec_Texts.running+'</span>';
        Diff.appendChild(DiffDiv);
        var Params = PaStec_GetParamsInMenuPanel(PaStec_getParentForm(TextArea));
        var ParamsInURL = ;
        for(var P in Params){
            if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
        }
        ParamsInURL = (ParamsInURL.join("&")+"&wpDiff=1");
        $.ajax({
            url      : PaStec_getParentForm(TextArea).getAttribute("action")+"&wpDiff=1",
            method   : "POST",
            headers  : {'Content-Type':'application/x-www-form-urlencoded'},
            data     : ParamsInURL,
            complete : function(diffReq){
                PaStec_ClearDiff(type);
                var HtmlDoc = new DOMParser().parseFromString(diffReq.responseText, 'text/html');
                H = document.createElement("h2");
                H.innerHTML = PaStec_Texts.PaSUnwikifyRunning.split("$1").join(Page);
                Diff.appendChild(H);
                SummaryDiv = document.createElement('div');
                SummaryDiv.className = "summarydiv";
                SummaryDiv.innerHTML = PaStec_Texts.PaSUnwikifySummary.split("$1").join('<span class="summaryspan">'+Datas.summary+'</span>');
                Diff.appendChild(SummaryDiv);
                DiffDiv = document.createElement('div');
                Diff.appendChild(DiffDiv);
                var Content = PaStec_getElementWithId("mw-content-text", HtmlDoc);
                DiffDiv.innerHTML = Content.innerHTML;
                var TitleInput = document.createElement('input')
                TitleInput.name = "wpTitle";
                TitleInput.value = Page;
                DiffDiv.appendChild(TitleInput);
                Diff.classList.remove("PaStec_EmptyDiffPreview");
                Link.blur();
                TitleInput.focus();
                TitleInput.type = "hidden";
                PaStec_CanValidate = true;
            }
        });
    }});
};

window.PaStec_ValidateThisDiff = function(type){
    var Diff = document.getElementById("PaStec_DiffPreview_"+type);
    if(!Diff) return;
    if(!PaStec_CanValidate) return PaStec_CheckNextPage(type);
    var wpSave = PaStec_getElementWithId("wpSave", Diff);
    if(!wpSave) return;
    PaStec_CanValidate = false;
    var Link = document.getElementById("currentdiff_"+type);
    if(Link){
        Link.classList.remove("cannotmodify");
        Link.classList.remove("unmodified");
        Link.classList.add("modified");
    }
    var Params = PaStec_GetParamsInMenuPanel(Diff);
    var Tag = PaStec_gettag();
    var requestEditData = ''
        + 'title=' + encodeURIComponent(Params.wpTitle)
        + '&text=' + encodeURIComponent(Params.wpTextbox1)
        + '&token=' + encodeURIComponent(Params.wpEditToken)
        + '&summary=' + encodeURIComponent( (Tag ? '' : PaStec_Texts.commentTag) + Params.wpSummary)
        + '&starttimestamp=' + encodeURIComponent(Params.wpStarttime)
        + '&basetimestamp=' + encodeURIComponent(Params.wpEdittime)
        + '&watchlist=nochange';
    if(Tag) requestEditData += "&tags="+encodeURIComponent(Tag);
    var headers = ;
    headers = 'application/x-www-form-urlencoded';
    PaStec_actionsLeft++;
    PaStec_ajax.http({
        retry:3,
        url: mw.util.wikiScript('api') + '?format=xml&action=edit',
        method: "POST",
        headers: headers,
        data: requestEditData,
        onFailure: PaStec_failureAlert,
        onSuccess:function(Req, data){
            PaStec_confirmExecuted(Req, data);
            PaStec_CheckNextPage(type);
        }
    });
    PaStec_ValidateDone(type, PaStec_Texts.UnwikifyHeader.split("$1").join(Params.wpTitle));
};

window.PaStec_TextUnwikify = function(Datas, type){
    var Params = PaStec_GetCheckedParamsInMenuPanel(type); // 
    if(!Params) return;
    var text = Datas.text;
    var summary = Datas.summary;
    var redirects = Params.redirects;
    if(!redirects) redirects = ;
    if(typeof(redirects) === "string") redirects = ;
    var thispage = PaStec_getPageName();
    redirects.push(thispage);
    var catdelete = false, filedelete = false, linkdelete = false;
    for(var a=0,l=redirects.length;a<l;a++){
        var linktocheck = redirects;
        var isFilelink = (linktocheck.indexOf(mw.config.get('wgFormattedNamespaces')) === 0);
        var isCatlink = (linktocheck.indexOf(mw.config.get('wgFormattedNamespaces')) === 0);
        if(isCatlink){ // ---------------------------------------------- Catégories
            var REGEXP = PaStec_CreateCatRegExp(linktocheck);
            var matches = text.match(REGEXP);
            if(matches !== null){
                catdelete = true;
                for(var m=0,mlen=matches.length;m<mlen;m++){
                    text = text.replace(matches, "");
                }
            }
        }else if(isFilelink){ // --------------------------------------- Images
            var FileTag = "__FILENAME__";
            var REGEXP = PaStec_CreateFileRegExp(linktocheck);
            var matches = text.match(REGEXP);
            if(matches !== null){
                for(var m=0,mlen=matches.length;m<mlen;m++){
                    text = text.replace(matches, FileTag);
                }
                // --------------------------------------------------------------------------------------- Images dans infobox ou autre modèle
                var REGEXPTemplate = new RegExp("=( )*"+FileTag+"( )**{1}", "g");
                var matchesT = text.match(REGEXPTemplate);
                if(matchesT !== null){
                    filedelete = true;
                    for(var m=0,mlen=matchesT.length;m<mlen;m++){
                        var thismatch = matchesT;
                        var Value = "="+thismatch.replace(/=*/g, "");
                        text = text.replace(thismatch, Value);
                    }
                }
                // --------------------------------------------------------------------------------------- Galeries d'images
                var REGEXPGalleryStart = new RegExp("<gallery*>", "g");
                var REGEXPGalleryEnd = new RegExp("</gallery", "g");
                var textisgallery = false;
                var parttodelete = ;
                var textsplit = text.split("\n");
                for(var a=0,l=textsplit.length;a<l;a++){
                    var thistextpart = textsplit;
                    var galstart = (thistextpart.match(REGEXPGalleryStart) !== null);
                    var galend = (thistextpart.match(REGEXPGalleryEnd) !== null);
                    var filefound = (thistextpart.indexOf(FileTag) !== -1);
                    if(galstart && galend && !filefound) continue;
                    if(filefound){
                        filedelete = true;
                        if(galstart && !galend){
                            var gallerytag = thistextpart.match(REGEXPGalleryStart);
                            textsplit = gallerytag;
                            textisgallery = true;
                            continue;
                        }
                        if(!galstart && galend){
                            textsplit = '</gallery>';
                            textisgallery = false;
                            continue;
                        }
                        if(galstart && galend){
                            parttodelete.push(a);
                            continue;
                        }
                        if(!galstart && !galend && textisgallery){
                            parttodelete.push(a);
                            continue;
                        }
                    }else{
                        if(galstart && !galend) textisgallery = true;
                        if(!galstart && galend) textisgallery = false;
                        continue;
                    }
                }
                var newtext = ;
                for(var a=0,l=textsplit.length;a<l;a++){
                    if(parttodelete.indexOf(a) === -1) newtext.push(textsplit);
                }
                text = newtext.join("\n");
                // --------------------------------------------------------------------------------------- Images "thumb"
                var REGEXPThumbStart = new RegExp("\\[\\["+FileTag,"g");
                var matchesTh = text.match(REGEXPThumbStart);
                if(matchesTh !== null){
                    filedelete = true;
                    for(var m=0,mlen=matchesTh.length;m<mlen;m++){
                        text = text.replace(matchesTh, FileTag);
                    }
                    textsplit = text.split(FileTag);
                    for(var a=1,l=textsplit.length;a<l;a++){
                        var thispart = textsplit;
                        var NextClosure = thispart.indexOf("]]");
                        var NextLinkStart = thispart.indexOf("[[");
                        if(NextLinkStart === -1) thispart = thispart.substring(NextClosure+2);
                        else{
                            while(NextLinkStart !== -1 && NextClosure !== -1 && NextLinkStart < NextClosure){
                                thispart = thispart.substring(NextClosure+2);
                                NextClosure = thispart.indexOf("]]");
                                NextLinkStart = thispart.indexOf("[[");
                            }
                            if(NextLinkStart === -1 || NextLinkStart > NextClosure) thispart = thispart.substring(NextClosure+2);
                        }
                        thispart = FileTag + thispart;
                        thispart = thispart.split(FileTag+"\n").join("");
                        thispart = thispart.split(FileTag).join("");
                        textsplit = thispart;
                    }
                    text = textsplit.join("");
                }
            }
        }else{  // ----------------------------------------------------- Liens
            var REGEXP = PaStec_CreateLinkRegExp(linktocheck);
            var matches = text.match(REGEXP);
            if(matches !== null){
                linkdelete = true;
                for(var m=0,mlen=matches.length;m<mlen;m++){
                    var linktext = matches.replace(/\*\|)?(.*)\]\]/, '$2');
                    text = text.replace(matches, linktext);
                }
            }
        }
    }
    var delpage = mw.config.get('wgPageName');
    if(linkdelete) summary += (summary === "" ? "" : " ; ") + PaStec_Texts.RemoveLinkComment.split("$1").join(thispage).split("$2").join(delpage);
    if(catdelete) summary += (summary === "" ? "" : " ; ") + PaStec_Texts.RemoveCatComment.split("$1").join(thispage).split("$2").join(delpage);
    if(filedelete) summary += (summary === "" ? "" : " ; ") + PaStec_Texts.RemoveFileComment.split("$1").join(thispage).split("$2").join(delpage);
    Datas.summary = summary;
    Datas.text = text;
    return Datas;
};

window.PaStec_CreateLinkRegExp = function(Page){
    var NS = PaStec_getNamespaceInfoFromPage(Page, "NamespaceName");
    var Title = PaStec_getNamespaceInfoFromPage(Page, "PageName");
    if(NS) NS = "(" + NS.PaStec_ucFirst() + "|" + NS.PaStec_lcFirst() + ")*( |_)*:( |_)*";
    Title = (PaStec_CaseSensitive ? PaStec_CreateRegExp(Title) : "("+PaStec_CreateRegExp(Title.PaStec_ucFirst())+"|"+PaStec_CreateRegExp(Title.PaStec_lcFirst())+")" );
    return (new RegExp("\\]*)?\\]\\]", "g"));
};

window.PaStec_CreateFileRegExp = function(File){
    var NS = mw.config.get('wgFormattedNamespaces');
    var NSString = ;
    NSString = "("+NSString.join("|")+")?( )*:?";
    var Title = PaStec_getNamespaceInfoFromPage(File, "PageName");
    Title = (PaStec_CaseSensitive ? PaStec_CreateRegExp(Title) : "("+PaStec_CreateRegExp(Title.PaStec_ucFirst())+"|"+PaStec_CreateRegExp(Title.PaStec_lcFirst())+")" );
    return (new RegExp(NSString+Title, "g"));
};

window.PaStec_CreateCatRegExp = function(Cat){
    var NS = mw.config.get('wgFormattedNamespaces');
    NS = NS.PaStec_ucFirst() + "|" + NS.PaStec_lcFirst();
    var Title = Cat.replace(new RegExp("^("+NS+"):"), "");
    Title = (PaStec_CaseSensitive ? PaStec_CreateRegExp(Title) : PaStec_CreateRegExp(Title.PaStec_ucFirst())+"|"+PaStec_CreateRegExp(Title.PaStec_lcFirst()) );
    return (new RegExp("(\\s?)\\]*)?\\]\\]", "g"));
};

window.PaStec_CreateRegExp = function(Page){
    return mw.util.escapeRegExp(Page).replace(/(( |_)+)/g, "( |_)+");
};

/* </syntaxhighlight> */