User:Veralann/global.js

var qtUserPageTemplate = ''; massRenameSummary = 'automatic'; massRenameDelay = 1000; massCategorizationDelay = 1000; massProtectDelay = 1000; var qtEnableUserPageOverwrite = true; importScriptPage("User:M D N S/multikick.js"); importArticles({   type: 'script',    articles: [        'u:dev:QuickDiff/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:ViewRemoved/code.js',        'u:dev:MediaWiki:AnchoredRollback/code.js',        'u:dev:MediaWiki:AjaxDelete/code.js',        'u:dev:MediaWiki:AjaxPatrol/code.js',        'u:dev:QuickCreateUserPage/code.js',        'u:dev:QuickThreads/code.js',        'u:dev:MediaWiki:AjaxRedirect/code.js',        'u:dev:MediaWiki:MassCategorization/code.js',        'u:dev:MediaWiki:MassRename/code.js',        'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',        'u:dev:MediaWiki:PageMakerPro/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:PageMakerPro/code.js',        'u:dev:AjaxEmoticons/code.js',        'u:monchbox:MediaWiki:Torus.js',        'u:dev:MediaWiki:PageRenameAuto-update/code.js',        'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:WHAM/code.2.js' ] }); /** * Name:           AjaxThreadDelete * Version:         v1.1 * Author(s):       KockaAdmiralac <1405223@gmail.com> * Description:     Allows deleting threads without leaving the page. */ $(function {   var n = mw.config.get('wgNamespaceNumber'), ids = mw.config.get('wgNamespaceIds'); if(n !== ids.thread && n !== ids.board_thread) return; $.get("/load.php", { mode: "articles", articles: "u:kocka:MediaWiki:Custom-plugin-i18n/AjaxThreadDelete.json", only: "styles" }, function(d)   {        var i18n = JSON.parse(d.replace(/\/\*.*\*\//g, "")),        AjaxThreadDeleteApiInterval = setInterval(function {           if(typeof mw !== 'undefined' && typeof mw.Api !== 'undefined') {               clearInterval(AjaxThreadDeleteApiInterval); var lang = mw.config.get('wgUserLanguage'), langConfig = i18n[i18n[lang] ? lang : "en"]; if(typeof langConfig === 'string') langConfig = i18n[langConfig]; doStuff(langConfig); }       }, 100);    });    function doStuff(i18n) {       /**         * Main object */       var AjaxThreadDelete = { // MediaWiki API object api: new mw.Api, // Configuration config: $.extend({               // Deletion reason                reason: "Cleanup"            }, window.AjaxThreadDeleteConfig), // Internationalization data i18n: $.extend(i18n, window.AjaxThreadDeleteVocab), /**            * The initializing function * Inserts the "Delete" buttons into appropriate places */           init: function {               var el = "" + this.i18n.deleteText + "", oasis = (skin === "oasis"), selector = ".message-main ." + (oasis ? "WikiaMenuElement" : "tools"); if(oasis) el = $("").append(el).prop("outerHTML"); $(selector).append(el); $(selector + " .AjaxThreadDeleteButton").click(function(e)               {                    var id = $(e.currentTarget).closest(".SpeechBubble").data.id;                    if(this.config.fastDelete) this.deleteThread(id);                    else this.showModal(id);                }.bind(this)); },           /**             * Deletes a thread, if it's an original post, every child post of it, too. * @param [Number] id - The iD of the thread to delete */           deleteThread: function(id) {               if($(".SpeechBubble[data-id='" + id + "']").hasClass("message-main")) $(".SpeechBubble.message-main").find(".SpeechBubble").each(function(a, b)                   {                        var cid = $(b).data.id;                        if(cid) this.deleteThreadBase(cid);                    }.bind(this)); this.deleteThreadBase(id); },           /**             * Method for deleting a thread with specified iD             * @param [Number] id - The iD of the thread to delete */           deleteThreadBase: function(id) {               this.api.post({                    action: 'delete',                    pageid: id,                    reason: this.config.reason,                    bot: true,                    token: mw.user.tokens.get('editToken')                }).done(function(d)                {                    if(d.error) new BannerNotification(this.i18n.fail + ": " + d.error.code, 'error').show;                    else $("[data-id=" + id + "]").slideToggle;                }.bind(this)).fail(function(d) { new BannerNotification(this.i18n.fail, 'error').show; }.bind(this)); },           /**             * Shows a confirmation modal before deleting a thread * @param [Number] id - The iD of the thread to delete */           showModal: function(id) {               $.showCustomModal(this.i18n.modalTitle, " " + this.i18n.helpText + " ", {                    id: "AjaxThreadDeleteModal",                    buttons: [{                        id: "AjaxThreadDeleteDeleteButton",                        defaultButton: true,                        message: this.i18n.deleteText,                        handler: function                        {                            this.deleteThread(id);                            $("#AjaxThreadDeleteModal").closeModal;                        }.bind(this)                    },                    {                        id: "AjaxThreadDeleteCloseButton",                        defaultButton: true,                        message: this.i18n.close,                        handler: function { $("#AjaxThreadDeleteModal").closeModal; }                    }]                }); }       };        // Initialize AjaxThreadDelete.init; } }); importScriptPage('User:KockaAdmiralac/MastheadGender.javascript', 'kocka');