User:ThundercraftBot/global.js

//Mirrored from main account // Quick Comment Delete Config window.AjaxCommentDeleteConfig = { fastDelete: "Comment Was #|Off Topic/Spam/Vandalism" }; // Batch Delete Script Config window.batchDeleteDelay = 5; window.batchUnDeleteDelay = 5; // Mass Edit Config window.MassEditConfig = { interval: 10, placement: { element: "toolbar", type: "append" } }; //MassBlock delay window.massBlockDelay = 5; // AjaxBlock Config window.AjaxBlock = { blockReasons: { 'General Spam/Vandalism': 'General', 'Removing Content From Pages': 'Content Removal', 'Abusing Multiple Accouts (Sockpuppetry)': 'Sockpuppety', 'Vandalism-Only Account': 'VoA Account', 'Inserting False Information': 'False Info', 'Creating Spam/Vandalism Only Articles': 'Spam Articles', 'Inappropriate username': 'Unacceptable Username', 'Long-Term Abuse/Vandalism': 'LTA', 'Spamming Nonsense Comments': 'Nonsense Comments', 'Inserting nonsense/gibberish into pages': 'Nonsense/Gibberish in Pages', 'Spamming Links to External Sites': 'External Link Spam', 'Personal Attacks': 'Personal Attacks', 'Edit Warring': 'Edit Warring', },   expiryTimes: { '24 hours': '1 day', '3 days': '3 days', '1 week': '1 week', '2 weeks': '2 weeks', '3 weeks': '3 weeks', '1 month': '1 month', '6 weeks': '6 weeks', '2 months': '2 months', '3 months': '3 months', '4 months': '4 months', '6 months': '6 months', '9 months': '9 months', '1 year': '1 year', '18 months': '18 months', '3 years': '3 years', 'infinite': 'all of eternity', },   check: { talk: true, autoBlock: true, override: true }, }; //MassBlock config window.massBlockDelay = 5; //Nuke Config window.nukeDelay = 5; //WHAM tool config window.WHAMBlockReason = "vandalism"; window.WHAMDelay = 5; window.WHAMBlockDuration = '3 months'; window.WHAMDeleteReason = "deleting spam/vandalism"; //AutoRenamePages Config window.PRAoptions = { editSummary: 'Updating page links (automatic)' }; // Mass Rename Pages Config window.massRenameDelay = 25; //ThreadDelete config 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; LIRoptions = { bottomMessage: '', editSummary: 'Updating file links (automatic)', singleButtonText: 'Rename and update', queueButtonText: 'Add to queue', delay: 10 }; // Global userpage window.qtUserPageTemplate = ''; //Imports 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:QuickCreateUserPage/code.js',        //'u:dev:MediaWiki:WHAM/code.2.js',        'u:dev:MediaWiki:FastOldImageDelete/code.js',        'u:dev:MediaWiki:AjaxBlock/code.js',        'u:dev:MediaWiki:AdminDashboard block/code.js',        'u:dev:MediaWiki:AddArticleToCategory/code.js',        'u:dev:MediaWiki:AjaxRename/code.js',        'u:dev:MediaWiki:AdminDashboard JS-Button/code.js',        'u:dev:MediaWiki:AjaxPatrol/code.js',        'u:dev:MediaWiki:PurgeButton/code.js',        'u:dev:MediaWiki:AjaxBatchUndelete.js', 'u:dev:MediaWiki:MassRename/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:MassRedirect/code.1.js', 'u:dev:MediaWiki:MassBlock/code.js', 'u:dev:MediaWiki:ViewDeleted/code.js', 'u:dev:MediaWiki:RefreshThreads/code.js', 'u:dev:MediaWiki:AjaxUserRights.js', 'u:dev:MediaWiki:CommentPreview/code.js', 'u:dev:MediaWiki:MessageWallImprovements.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:CodeEditor.js', 'u:dev:MediaWiki:QuickToolsv2/code.js', 'u:dev:MediaWiki:QuickDiff/code.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:DupImageList/code.js', 'u:dev:MediaWiki:TemplateTypeButtons/code.js', 'u:dev:MediaWiki:MultipleFileDelete/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:MassRenameRevert/code.js', '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.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:VanguardTools.js', 'u:dev:MediaWiki:UnsafeScripts/code.js', ] }); /*                               ################################################                 # 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

=
==================================================================== // Custom WHAM (Taken From Dev) /** * 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, href: '#', title: i18n.msg('contribs-wham-title').plain, text: i18n.msg('contribs-wham').plain });           $('#contentSub').append(' ', $button);            mw.hook('QuickLogs.loaded').add(qlIntegration);        }        var $anchor = $('#wham-button');        if (!$anchor) return;        $anchor.append(' ',$button);        function preload(i18no) {            i18no.loadMessages('WHAM').then(init);        }        mw.hook('dev.i18n').add(preload);    }); });