User:Thundergod121/global.js

// Ajax Page Delete importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxDelete/code.js',        'u:dev:MediaWiki:AjaxBatchDelete.js',        'u:dev:MediaWiki:Nuke/code.js',        'u:dev:MediaWiki:MassPatrol/code.js',        'u:dev:MediaWiki:AjaxThreadDelete/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:MassEdit/code.js',        //'u:dev:MediaWiki:WHAM/code.2.js',        'u:dev:MediaWiki:AjaxBlock/code.js',        'u:dev:MediaWiki:AdminDashboard block/code.js',        'u:dev:MediaWiki:SandboxTab/code.js',        //'u:dev:MediaWiki:AjaxDiff/code.js',  <-- DISABLED        'u:dev:MediaWiki:AjaxRename/code.js',        'u:dev:MediaWiki:AdminDashboard JS-Button/code.js',        'u:dev:MediaWiki:AjaxPatrol/code.js',        'u:dev:MediaWiki:AjaxBatchUndelete.js',        //'u:dev:MediaWiki:UsefulDropdown/code.js',        'u:dev:MediaWiki:MassRename/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:MassRedirect/code.1.js', 'u:dev:MediaWiki:ViewDeleted/code.js', 'u:dev:MediaWiki:CommentPreview/code.js', 'u:dev:MediaWiki:MessageWallImprovements.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:QuickToolsv2/code.js', 'u:dev:MediaWiki:QuickDiff/code.js', 'u:dev:MediaWiki:PowerDelete.js', //'u:dev:MediaWiki:PowerDelete.js', 'u:dev:MediaWiki:SearchEnhancements.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:GlobalEditcount/code.js', 'u:dev:MediaWiki:FindAndReplace/code.js', 'u:dev:MediaWiki:AjaxCommentDelete/code.js', //'u:dev:MediaWiki:AjaxUndo/code.js' <-- DISABLED 'u:dev:MediaWiki:DupImageList/code.js', 'u:dev:MediaWiki:TemplateTypeButtons/code.js', 'u:dev:MediaWiki:MultipleFileDelete/code.js', //'url:c.wikia.com:User:Thundercraft5/global.js/fixedUseful', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', ] }); // Quick Comment Delete Config window.AjaxCommentDeleteConfig = {   fastDelete: "Comment Was #|Off Topic/Spam/Vandalism" }; // Mass Delete Script Config window.batchDeleteDelay = 5; window.batchUnDeleteDelay = 5; // Mass Edit Config window.MassEditConfig = {  interval: 10,  placement: {    element: "toolbar",    type: "append"  } }; //Nuke Config window.nukeDelay = 5; //WHAM tool config window.WHAMBlockReason = "vandalism"; window.WHAMDelay = 5; window.WHAMDeleteReason = "reverting/deleting spam/vandalism"; //AutoRenamePages Config window.PRAoptions = {    editSummary: 'Updating page links (automatic)' }; //QuickToolsv2 Config window.QuickToolsAdvancedtop = true; // window.AjaxThreadDeleteConfig = {    fastDelete: false,    reason: 'Thread/Comment Deleted: The Thread/Comment Has Containted the Following: Spam / Vandalism / #|Roasting/Heated Arguments' }; //MassProtect Delay window.massProtectDelay = 5; //MassUndelete delay window.batchUndeleteDelay = 5; /*                               ################################################                 # LIST OF USED SCRIPTS AND THEIR SOURCES/LINKS # ################################################

=
==================================================================== u:dev:MediaWiki:AjaxDelete/code.js - https://dev.fandom.com/wiki/AjaxDelete u:dev:MediaWiki:AjaxBatchDelete.js - https://dev.fandom.com/wiki/AjaxBatchDelete u:dev:MediaWiki:Nuke/code.js - https://dev.fandom.com/wiki/Nuke u:dev:MediaWiki:MassPatrol/code.js - https://dev.fandom.com/wiki/MassPatrol u:dev:MediaWiki:AjaxThreadDelete/code.js - https://dev.fandom.com/wiki/AjaxThreadDelete u:dev:MediaWiki:MassProtect/code.js - https://dev.fandom.com/wiki/MassProtect u:dev:MediaWiki:MassEdit/code.js - https://dev.fandom.com/wiki/MassEdit u:dev:MediaWiki:WHAM/code.2.js - https://dev.fandom.com/wiki/WHAM u:dev:MediaWiki:AdminDashboard block/code.js - https://dev.fandom.com/wiki/AdminDashboard_block u:dev:MediaWiki:SandboxTab/code.js - https://dev.fandom.com/wiki/SandboxTab u:dev:MediaWiki:AjaxRename/code.js - https://dev.fandom.com/wiki/AjaxRename u:dev:MediaWiki:AjaxPatrol/code.js - https://www.fandom.com/topics/movies u:dev:MediaWiki:AjaxBatchUndelete.js - https://dev.fandom.com/wiki/AjaxBatchUndelete u:dev:MediaWiki:MassRename/code.js - https://dev.fandom.com/wiki/MassRename u:dev:MediaWiki:AjaxRedirect/code.js - https://dev.fandom.com/wiki/AjaxRedirect u:dev:MediaWiki:MassRedirect/code.1.js - https://dev.fandom.com/wiki/MassRedirect u:dev:MediaWiki:ViewDeleted/code.js - https://dev.fandom.com/wiki/ViewDeleted u:dev:MediaWiki:CommentPreview/code.js - https://dev.fandom.com/wiki/CommentPreview u:dev:MediaWiki:MessageWallImprovements.js - https://dev.fandom.com/wiki/MessageWallImprovements u:dev:MediaWiki:AjaxBlock/code.js - https://dev.fandom.com/wiki/AjaxBlock u:dev:MediaWiki:QuickToolsv2/code.js - https://dev.fandom.com/wiki/QuickToolsv2 u:dev:MediaWiki:QuickDiff/code.js - https://dev.fandom.com/wiki/QuickDiff u:dev:MediaWiki:PowerDelete.js - https://dev.fandom.com/wiki/PowerDelete u:dev:MediaWiki:SearchEnhancements.js - https://dev.fandom.com/wiki/PowerDelete u:dev:MediaWiki:MassCategorization/code.js - https://dev.fandom.com/wiki/MassCategorization u:dev:MediaWiki:GlobalEditcount/code.js - https://dev.fandom.com/wiki/GlobalEditcount u:dev:MediaWiki:FindAndReplace/code.js - https://dev.fandom.com/wiki/FindAndReplace u:dev:MediaWiki:AjaxCommentDelete/code.js - https://dev.fandom.com/wiki/AjaxCommentDelete u:dev:MediaWiki:AjaxUndo/code.js - https://dev.fandom.com/wiki/AjaxUndo u:dev:MediaWiki:DupImageList/code.js -https://dev.fandom.com/wiki/DupImageList

=
==================================================================== importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:QuickDiff/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:ViewDeleted/code.js',        'u:dev:MediaWiki:CodeLinksDropdown.js',        'u:dev:MediaWiki:Rollback/code.2.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js',        'u:dev:MediaWiki:RevealAnonIP/usercode.js',    ] }); LIRoptions = { bottomMessage: '', editSummary: 'Updating file links (automatic)', singleButtonText: 'Rename and update', queueButtonText: 'Add to queue', delay: 10 }; /** * A variant of WHAM with a different modal * Includes functionality to delete forum/message wall threads and selective * deleting of pages, which the original lacks * Original "WHAM" - https://dev.fandom.com/wiki/MediaWiki:WHAM/code.js * @author Ozank Cx */ require(['jquery', 'mw', 'wikia.window'], function($, mw, window) {   'use strict';    mw.loader.using(['mediawiki.api', 'mediawiki.user']).then(function { var config = mw.config.get([           'wgCanonicalSpecialPageName',            'wgFormattedNamespaces',            'wgPageName',            'wgUserGroups',            'wgUserName'        ]); if (           config.wgCanonicalSpecialPageName !== 'Contributions' ||            !/rollback|content-moderator|threadmoderator|sysop|vstf|staff|helper|global-discussions-moderator|wiki-manager|content-team-member/.test(config.wgUserGroups.join) ||            window.WHAMLoaded        ) { return; }       window.WHAMLoaded = true; if (!window.dev || !window.dev.i18n) { importArticle({               type: 'script',                article: 'u:dev:MediaWiki:I18n-js/code.js'            }); }       importArticle({            type: 'style',            article: 'u:dev:MediaWiki:WHAM.css'        }); var username = config.wgPageName.split('/')[1], token = mw.user.tokens.get('editToken'), delay = window.WHAMDelay || 100, deleteReason, duration, blockReason, Api = new mw.Api, i18n, progress = '//images.wikia.nocookie.net/common/skins/common/progress-wheel.gif', $button; function apiDelete(page, reason) { Api.post({               action: 'delete',                title: page,                reason: reason,                bot: true,                token: token            }).done(function(d) {                if (d.error) {                    console.log( i18n.msg('do-delete-fail', page, d.error.code).plain );               } else {                    console.log(i18n.msg('do-delete-success', page).plain);                }            }).fail(function {                console.log( i18n.msg(                       'do-delete-fail',                        page,                        i18n.msg('ajax-error').plain                    ).plain );           });        }        function doRollback { var $links = $('.mw-rollback-link a'), len = $links.length; if (len === 0) { $('#status-wham').text(i18n.msg('do-rollback-done').plain); }           $links.each(function(i) {                var href = new mw.Uri($(this).attr('href')).extend({ bot: 1 }).toString;               setTimeout(function { $.get(href); $('#status-wham').html(                       i18n.msg('do-rollback-status').escape +                        $(' ', { src: progress }).prop('outerHTML')                   ); if (i === len - 1) { $('#status-wham').text(                           i18n.msg('do-rollback-done').plain                        ); }               }, i * delay);            }); }       function doDelete { deleteReason = prompt(               i18n.msg('do-delete-reason').plain,                window.WHAMDeleteReason || "Mass removal of pages created by " + user.replace(/_/)            ); if (!deleteReason) { return; }           var deleteArray = []; $('#mw-content-text ul li').each(function {               var $children = $(this).children('a'),                    title = $children.first.attr('title'),                    uri = new mw.Uri($children.eq(1).attr('href'));                if ( // If it's not a thread... !title.match(/\/@comment-/) || (                       // ...or if it's a thread edit...                        title.match(/\/@comment-/) &&                        uri.query.diff === 'prev'                    ) ) {                   // ...don't process it.                    return;                }                deleteArray.push(title);            }); $('li .newpage ~ a').each(function {               var title = new mw.Title($(this).attr('title'));                if ( title.namespace === 1200 || title.namespace === 1201 && title.getNamespacePrefix < 9 ) {                   return;                }                deleteArray.push(title.getPrefixedText);            }); $.each(deleteArray, function(i, v) {               setTimeout(function { $('#status-wham').html(                       i18n.msg('do-delete-status').escape +                        $(' ', { src: progress }).prop('outerHTML')                   ); apiDelete(v, deleteReason); if (i === deleteArray.length - 1) { $('#status-wham').text(i18n.msg('do-delete-done').plain); }               }, i * delay);            }); }       function doBlock { duration = prompt(               i18n.msg('do-block-duration').plain,                window.WHAMBlockDuration || '2 weeks'            ); if (!duration) { return; }           blockReason = prompt(                i18n.msg('do-block-reason').plain,                window.WHAMBlockReason || i18n                    .inContentLang                    .msg('default-block-reason')                    .plain            ); if (!blockReason) { return; }           Api.post({                action: 'block',                user: username,                expiry: duration,                nocreate: 0,                autoblock: 0,                reason: blockReason,                bot: true,                token: token            }).done(function(d) {                if (d.error) {                    alert( i18n.msg('do-block-fail', username, d.error.code).plain );               } else {                    console.log(i18n.msg('do-block-success', username).plain);                }            }).fail(function {                alert( i18n.msg(                       'do-block-fail',                        username,                        i18n.msg('ajax-error').plain                    ).plain );           });        }        function doBot { Api.get({               action: 'query',                list: 'users',                ustoken: 'userrights',                ususers: config.wgUserName            }).done(function(data) {                var params = {                    action: 'userrights',                    user: config.wgUserName,                    reason: window.WHAMBotReason || i18n                        .inContentLang                        .msg('default-delete-reason')                        .plain,                    bot: true,                    token: data.query.users[0].userrightstoken                };                params[                    config.wgUserGroups.indexOf('bot') === -1 ?                        'add' :                        'remove'                ] = 'bot';                Api.post(params).done(function(d) { if (d.error) { console.log(i18n.msg('bot-me-fail', d.error.code).plain); } else { console.log(i18n.msg('bot-me-done').plain); }               });            });        }        function doSelectiveDelete { deleteReason = prompt(               i18n.msg('do-delete-reason').plain,                window.WHAMDeleteReason || i18n                    .inContentLang                    .msg('default-delete-reason')                    .plain            ); if (!deleteReason) { return; }           $('.selectiveDel').each(function {                var $this = $(this),                    title = new mw.Title($('.mw-revdelundel-link').exists ? $this.parent.children('a').eq(0).attr('title') : $this.parent.find('a').first.attr('title'));               if ($this.prop('checked') && title.namespace !== 1200) {                    apiDelete(title.getPrefixedText, deleteReason);                    $this                        .parent                        .addClass('wham-resolved')                        .children                        .removeAttr('href')                        .addClass('wham-resolved');                }            }); setTimeout(function {               window.location.reload;            }, 5000); }       function checkSelectiveDelete { var $this = $(this), uncheck = $this.text === i18n.msg('selective-delete-uncheck').plain; $('.selectiveDel').each(function {               var chkObj = $(this);                if (uncheck) {                    chkObj.removeAttr('checked');                } else {                    chkObj.attr('checked', 'checked');                }            }); $this.text(               i18n.msg( uncheck ? 'selective-delete-check' : 'selective-delete-uncheck' ).plain           ); }       function startSelectiveDelete { $('#form-main').closeModal; if ($('#btn-wham-del').exists && $('#btn-wham-check').exists) { return; }           var $chk = $(' ', {                'class': 'selectiveDel',                'type': 'checkbox'            }); $('#mw-content-text') .find('ul') .last .before(                   $('', { 'class': 'button', 'id': 'btn-wham-del', 'text': i18n.msg('start-selective-delete').plain }),                   ' ',                    $('', { 'class': 'button', 'id': 'btn-wham-check', 'text': i18n.msg('selective-delete-check').plain })               );            $('li .newpage ~ a').each(function {                if (!$(this).parent.find('input').length) {                    $(this).parent.prepend($chk.clone);                }            }); $('#mw-content-text ul li').each(function {               var $children = $(this).children('a'),                    title = $children.first.attr('title'),                    uri = new mw.Uri($children.eq(1).attr('href'));                if ( // If it's a thread... title.match(/\/@comment-/) && // ...and not a thread edit... uri.query.diff !== 'prev' && // ...and there's no checkbox currently... !$(this).find('input').length ) {                   // ...append it.                    $(this).prepend($chk.clone);                }            }); $('#btn-wham-del').click(doSelectiveDelete); $('#btn-wham-check').click(checkSelectiveDelete); }       function doAll { doBlock; if (duration || blockReason) { doDelete; if ($('.tabs li:first-child a:not(.new)').exists) { if (confirm(i18n.msg('userpage-delete-confirm').plain)) { apiDelete(config.wgFormattedNamespaces[2] + ':' + username, window.WHAMDeleteReason || i18n.inContentLang.msg('default-delete-reason').plain); }               }                if (deleteReason) { doRollback; }           }        }        function click { var self = ((username === config.wgUserName) ? true : false); var $self_warn_html = $(' ', {               html: i18n.msg('self-use-warn').parse,                id: 'wham-self-use-warn',                class: 'error'            }); $.showCustomModal(i18n.msg('title').escape, (self ? $self_warn_html : ''), {               id: 'form-main',                width: 285,                height: (self ? 280 : 190),               buttons: [{                    message: i18n.msg('do-delete').escape,                    defaultButton: true,                    handler: doDelete,                    id: 'wham-delete-all'                }, {                    message: i18n.msg('start-selective-delete').escape,                    defaultButton: true,                    handler: startSelectiveDelete,                    id: 'wham-selective-delete'                }, {                    message: i18n.msg('do-rollback').escape,                    defaultButton: true,                    handler: doRollback,                    id: 'wham-rollback'                }, {                    message: i18n.msg('do-block').escape,                    defaultButton: true,                    handler: doBlock,                    id: 'wham-block'                }, {                    message: i18n.msg('do-all').escape, defaultButton: true, handler: doAll, id: 'wham-all' }, {                   message: i18n.msg('close-wham').escape, id: 'close-wham' }]           });            $('#close-wham').after($(' ', {                id: 'status-wham'            }));            $('#close-wham,.close').click(function { $('#form-main').closeModal; window.location.reload; });           // Bot button            if ( window.WHAMBotMe === true || /vstf|staff|helper|wiki-manager/.test(config.wgUserGroups.join) ) {               $('#form-main .modalToolbar .wikia-button:nth-child(5)').after( $('', {                       'id': 'wham-bot',                        'class': 'wikia-button',                        'text': i18n.msg( config.wgUserGroups.indexOf('bot') === -1 ? 'bot-me' : 'unbot-me' ).plain                   }).click(doBot) );           }        }        function qlIntegration(QuickLogs) {            $button.remove;            QuickLogs.addLink('wham', { click: click, message: i18n.msg('contribs-wham').plain });       }        function init(i18no) {            i18n = i18no;            $button = $('', { id: 'contribs-wham', click: click, title: i18n.msg('contribs-wham-title').plain, text: i18n.msg('contribs-wham').plain });           $('#contentSub').append(' ', $button);            mw.hook('QuickLogs.loaded').add(qlIntegration);        }        function preload(i18no) {            i18no.loadMessages('WHAM').then(init);        }        mw.hook('dev.i18n').add(preload);    }); });