User:Yxtqwf/global.js

/****************Personal JavaScript applied to all wikis***************/ /***********************************************************************/ /***********************************************************************/ /**********************************TOC**********************************/ /***********************************************************************/ /************************************************************************ TABLE OF CONTENTS MAIN CONTENT IMPORTS CONFIGURATIONS Mass Delays SeeMoreActivityButton Snowstorm COPIED AND ALTERED Editcount Rollback TASKS /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /******************************MAIN CONTENT*****************************/ /***********************************************************************/ /***********************************************************************/ /*IMPORTS*/ importArticles({       type: 'script',        articles: [            'u:dev:AjaxBatchDelete/code.2.js',            'u:dev:AjaxThreadDelete/code.js',            'u:dev:AutoEditPages/code.js',            'u:dev:BlankBlogBugfix/code.js',            'u:dev:BlogLink/code.js',            'u:dev:ChatReload/code.js',            'u:dev:EditConflictAlert/code.js',            'u:dev:GlobalChatJS.js',            'u:dev:Linksweeper/code.js',            'u:dev:MassCategorization/code.js',            'u:dev:MassProtect/code.js',            'u:dev:MassRenameRevert/code.js',            'u:dev:OldFilePages/code.js',            'u:dev:PageCreator/code2.js',            'u:dev:PortableCSSPad/code.js',            'u:dev:ReferencePopups/code.js',            'u:dev:RevealAnonIP/usercode.js',            'u:dev:RollbackSpamUserContribs/code.js',            'u:dev:SeeMoreActivityButton/code.js',            'u:dev:SnowStorm.js', 'u:dev:VisualSpellCheck/code.js', 'u:dev:WallGreetingButton/code.js', //'u:dev:Rollback/code.2.js', (See COPIED AND ALTERED > Rollback)// ]   });

/*CONFIGURATIONS*/ /*Mass Delays*//*The delay in milleseconds between each edit*/ batchDeleteDelay       = 100; window.linkSweeperDelay = 100; massCategorizationDelay = 100; massProtectDelay       = 100;

/*SeeMoreActivityButton*/ window.SeeMoreActivityButtonRC = true;

/*Snowstorm*//*w:c:diepio:MediaWiki:Gadget-Emberfall.js*/ this.snowColor = '#F05E1B'; //Color of snow: Don't eat (or use?) yellow snow; Default: #FFF (white)// this.flakesMax = 10000; //Amount of snow made; Default: 128// this.flakesMaxActive = 10000; //Amount of snow falling at once; Default: 64// this.animationInterval = 60; this.className = 'snow'; //CSS class; Default: (none)// this.followMouse = false; //Whether snowflakes follow the mouse// this.snowStick = false; //Whether snow collects at the bottom; Default: True// this.useTwinkleEffect = true; //Whether snow flickers randomly; Default: False// this.freezeOnBlur = false; //Whether snow stops moving when out of focus; Default: True// this.flakeWidth = 6; //Width of flake (pixels); Default: 8// this.flakeHeight = 6; //Height of flake; Default: 8// this.vMaxX = 1; //Horizontal snow speed; Default: 5// this.vMaxY = 1; //Vertical snow speed; Default: 4// this.useMeltEffect = false; //Snow melt or not; Default: True// this.zIndex = 10; //Layering of snow; Default: 1//

/*COPIED AND ALTERED*/ /*Editcount*//*w:c:town-of-salem:MediaWiki:Wikia.js*/ $(function {           var olds = $(".tabs-container > ul.tabs").html;            var address = "/wiki/Special:Editcount/" + wgTitle;            var adds = "Editcount";            var news = olds + adds;            $(".tabs-container > ul.tabs").html(news);        }); /*Rollback*//*w:c:dev:MediaWiki:Rollback.2.js*/ (function {       if ($('.mw-rollback-link').length) {            return;        }        var config = mw.config.get([ 'wgAction', 'wgPageName', 'wgUserLanguage', 'wgCanonicalSpecialPageName' ]),       i18n = {            'en': {                title: 'Rollback reverts edit(s) to this page of the last contributor in one click',                failGeneral: 'Unable to rollback',                failRevisions: 'Failed to get revisions',                failContent: 'Failed to get page content',                failEditor: 'No different editor found',                failPublish: 'Failed to publish edit',                success: 'Rollback successful',                rollback: 'rollback',                summary1: 'Reverted edits by ',                summary2: ' to last version by ',                script: 'script',                talk: 'talk',                block: 'block'            }        },        lang = i18n[config.wgUserLanguage] || i18n[config.wgUserLanguage.split('-')[0]] || i18n.en;        function init {            var rollbackLinkParams = {                style: 'cursor: pointer', title: lang.title };           if (                config.wgAction === 'history' &&                $('#pagehistory li').length > 1            ) { rollbackLinkParams['data-id'] = config.wgPageName; $('#pagehistory li:first .mw-history-undo a').before(                   $(' ', { class: 'mw-custom-rollback-link' }).html( buildElement('a', lang.rollback, rollbackLinkParams) + ' | ' )               );            } else if (                config.wgCanonicalSpecialPageName === 'Contributions'            ) { rollbackLinkParams['data-id'] = $('#mw-content-text ul').find('a:first').attr('title'); $('#mw-content-text ul').find('li').each(                   function {                        if ($(this).find('.mw-uctop').length) {                            $(this).append( $(' ', {                                   class: 'mw-custom-rollback-link'                                }).html(                                    '[' + buildElement('a', lang.rollback, rollbackLinkParams) + ']'                                ) );                       }                    }                );            } else if (                $('#differences-nextlink').length === 0 &&                ( $.getUrlVar('diff') || $.getUrlVar('oldid') )           ) {                rollbackLinkParams['data-id'] = config.wgPageName; $('.mw-usertoollinks:last').after(                   '    ' +                    '[' + buildElement('a', lang.rollback, rollbackLinkParams) + '] '                ); }           $('.mw-custom-rollback-link a').click(                function {                    getRevisionIdAndContent($(this).attr('data-id'), handleData);                    $(this).parent.remove;                }            ); }       function buildElement(tag, html, attrs) { if (typeof(html) !== 'string') { attrs = html; html = null; }           var h = '<' + tag; for (var attr in attrs) { if (attrs[attr] === false) { continue; }               h += ' ' + attr + '="' + attrs[attr] + '"'; }           return h += html ? ">" + html + "" : "/>"; }       function getRevisionIdAndContent(title, callback) { new mw.Api.get({               action: 'query',                prop: 'revisions',                titles: title,                rvprop: 'user|ids',                rvlimit: 500,                cb: new Date.getTime            }).done(                function(d) {                    if (!d.error) {                        callback(title, d);                    } else {                        new BannerNotification( lang.failGeneral + ' (' + lang.failRevisions + '): ' + d.error.code, 'error' ).show;                   }                }            ).fail(                function {                    new BannerNotification( lang.failGeneral + ' (' + lang.failRevisions + ')', 'error' ).show;               }            ); }       function handleData(title, data) { var revisions; for (var i in data.query.pages) { revisions = data.query.pages[i].revisions; }           var currentUser = revisions[0].user, lastUser, revId; for (var i in revisions) { if (revisions[i].user != currentUser) { lastUser = revisions[i].user; revId = revisions[i].revid; break; }           }            if (lastUser) { new mw.Api.get({                   action: 'query',                    prop: 'revisions',                    rvprop: 'content',                    revids: revId,                    cb: new Date.getTime                }).done(                    function(d) {                        if (!d.error) {                            var content = "";                            for (var i in d.query.pages) {                                if (d.query.pages[i].revisions) {                                    content = d.query.pages[i].revisions[0]["*"];                                }                            }                            performRollback(title, content, currentUser, lastUser);                        } else {                            new BannerNotification( lang.failGeneral + ' (' + lang.failContent + '): ' + d.error.code,'error' ).show;                       }                    }                ).fail(                    function {                        new BannerNotification( lang.failGeneral + ' (' + lang.failContent + ')','error' ).show;                   }                ); } else { new BannerNotification(                   lang.failGeneral + ' (' + lang.failEditor + ')','error'                ).show; }       }        function performRollback(page, text, user, user2) { var summary = lang.summary1 + ' ' + user + ' (' + lang.talk +                   ' | ' + lang.block + ') ' + lang.summary2 + user2; if (summary.length > 150) { summary = lang.summary1 + '' + user + ' (talk)' + lang.summary2 + user2; }           new mw.Api.post({                action: 'edit',                title: page,                text: text,                summary: summary,                token: mw.user.tokens.values.editToken            }).done(                function(d) {                    if (!d.error) {                        new BannerNotification( lang.success + '!', 'confirm' ).show;                   } else {                        new BannerNotification( lang.failGeneral + ' (' + lang.failPublish + '): ' + d.error.code,'error' ).show;                   }                }            ).fail(                function {                    new BannerNotification( lang.failGeneral + ' (' + lang.failPublish + ')', 'error' ).show;               }            ); }       init; }); /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/

/***********************************************************************/ /***********************************************************************/ /**********************************TASKS********************************/ /***********************************************************************/ /************************************************************************ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/