User:Dark Yada/global.js

/* Multiploader */ mw.loader.using(['site', 'mediawiki.util']).then(function {   i18n = {        multiupload: "Upload multiple files:",        yes: "Yes",        no: "No",        sourcefiles: "Source files:",        uploadfiles: "Upload files",        nofiles: "Please select some files first.",        uploading: "Uploading files...",        uploaded: "Uploaded:",        failed: "Failed:",        done: "Done."    };    if (mw.config.get("wgCanonicalSpecialPageName")!=="Upload") return;        $("#wpUploadFile").parent.parent.addClass("regularFileSelect");    $("tr.regularFileSelect").before(' '+i18n.multiupload+'   '+i18n.yes+'    '+i18n.no+'  ');    $("tr.regularFileSelect").after(''+i18n.sourcefiles+'   '); $("input[name='wpUpload']").addClass("regularFileSelect"); $("#wpDestFile").parent.parent.addClass("regularFileSelect"); $("#wpIgnoreWarning").parent.parent.addClass("regularFileSelect"); $("span.mw-htmlform-submit-buttons").append(''); $("input[name='multipleFiles']").change(function{       if (this.value===i18n.yes) {            $(".regularFileSelect").hide;            $(".multipleFileSelect").show;        }        else {            $(".regularFileSelect").show;            $(".multipleFileSelect").hide;        }    }); $("#multiFileSubmit").click(function {       files = $("#multiupload")[0].files;        if (files.length === 0) {            alert(i18n.nofiles);            return false;        }        summary = $("#wpUploadDescription").val;        if (summary !== "") summary = summary;        text = summary + "\n";        watch = "preferences";        if ($("#wpWatchthis").is(":checked")) watch = "watch";        else watch = "nochange";        curFile = 0;        $("#firstHeading").text(i18n.uploading);        $("#mw-content-text").html(" "+i18n.uploaded+"  "+i18n.failed+"  ");        function gNF {            if(curFile>files.length) {                $("#mw-content-text").append(" "+i18n.done+" ");                return;            }            if(files[curFile] === undefined) {                curFile++;                gNF;                return;            }            $.ajax({url: mw.util.wikiScript('api'),data:{action:'query',meta:'tokens',format:'json'},dataType:'json'}).done(function(data) { fd = new FormData; fd.append("action","upload"); fd.append("token",data.query.tokens.csrftoken); fd.append("filename",files[curFile].name); fd.append("file",files[curFile]); fd.append("text",text); fd.append("watchlist",watch); fd.append("ignorewarnings",1); fd.append("format","json"); $.ajax({                   url: mw.util.wikiScript('api'),                    method:'POST',                    data:fd,                    cache:false,                    contentType:false,                    processData:false,                    type:'POST'                  }).done(function(d){                      if (d.error == undefined) {                          $("#mw-content-text > ul").append(''+d.upload.filename+'</li>');                      }                      else {                          $("#multiUploadFailed ul").append('<li>'+files[curFile].name+'</li>');                        $("#multiUploadFailed").show;                      }                    curFile++;                    gNF;                }).fail(function(d) {                    $("#multiUploadFailed ul").append('<li>'+files[curFile].name+'</li>'); $("#multiUploadFailed").show; curFile++; gNF; });           });        }        gNF; }); });

/* Imports */ importArticles({   type: "script",    articles: [        "u:dev:MediaWiki:AjaxBatchDelete.js",        "u:dev:MediaWiki:WHAM/code.2.js",        "u:dev:MediaWiki:SandboxTab/code.js",                 "u:dev:MediaWiki:VanguardTools.js",        "u:dev:MediaWiki:PurgeButton/code.js",        "u:dev:MediaWiki:PortableCSSPad/code.js",        "u:dev:MediaWiki:QuickCreateUserPage/code.js"    ] }); var qtUserPageTemplate = ''; var qtEnableUserPageOverwrite = true; massBlockDelay = 1000; WHAMBotMe = true; WHAMBotReason = "Cleanup"; WHAMDelay = 100; batchDeleteDelay = 1000; massRenameDelay = 1000; massRenameSummary = 'Nom français'; QuickCommentsdeletereason = "Commentaire inutile";

importArticles({   type: 'script',    articles: [        "u:dev:AddBlockUserTag/code.js",        'u:dev:MediaWiki:AjaxCommentDelete/code.js',        'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',        'u:dev:MediaWiki:AjaxBatchUndelete/code.js',        'u:dev:MediaWiki:AjaxRC/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        "u:dev:MediaWiki:AnchoredRollback/code.js",        'u:dev:MediaWiki:CategoryRenameAuto-update/code.js',        'u:dev:MediaWiki:DiscussionsFeed.js',        'u:dev:MediaWiki:DiscussionsViewer/code.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js',        'u:dev:MediaWiki:GlobalEditcount/code.js',        'u:dev:MediaWiki:MassBlock/code.js',        'u:dev:MediaWiki:MassCategorization/code.js',        'u:dev:MediaWiki:MassRename/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',        'u:dev:MediaWiki:NewPagesUser.js',        'u:dev:MediaWiki:Nuke/code.js', 'u:dev:MediaWiki:PageRenameAuto-update/code.js', 'u:dev:MediaWiki:QuickCreateUserPage/code.js', 'u:dev:MediaWiki:QuickComments/advanced.js', 'u:dev:MediaWiki:RemoveLegacyThreads.js', 'u:dev:MediaWiki:SandboxTab/code.js', 'u:dev:MediaWiki:Sine/code.js', 'u:dev:MediaWiki:ThemeToggler.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', 'u:dev:MediaWiki:VanguardTools.js', 'u:dev:MediaWiki:VSTFReport.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:WikiActivity.js', 'u:dev:MediaWiki:YouShallNotPass/code.js', 'u:dev:QuickIW/code.js' ] });