User:Dorumin/global.js

// Redirect to base page if ends with '/' if (window.location.href.match("/$")) { window.location.href = window.location.href.slice(0, -1); }

// Always show bots, definitely not the best way to do it, but meh $('a').each(function {  if ( $(this).attr('href') == '/wiki/Special:RecentChanges' && wgCityId == "621556" ) {      $(this).attr('href', '/wiki/User:Dorumin/RC');   } });

// Remove MPC without muting tab '3' if ( $(".youtubeplayer").length ) { $('ul.tools li:first-child:not(.tools-menu li)').after('Remove MPC'); $(".removeMPC").click(function {       $(".youtubeplayer").remove;        $(".removeMPC").remove;    }); } // Quick Access to EditCount if ( $('.tally').length ) { var $tally = $('.tally'); $tally.attr('title', 'EditCount'); $tally.click(function {       window.location.href = wgServer + '/wiki/Special:EditCount/' + $('h1[itemprop="name"]').text;    }); }

// Delay Settings batchDeleteDelay = 600; massCategorizationDelay = 600; nullEditDelay = 600; WHAMDelay = 600; massRenameDelay = 600;

// AjaxRC window.ajaxPages = ["Blog:Recent_posts","Special:Chat","Special:WikiActivity","Special:RecentChanges","Special:Watchlist","Special:Log","Special:Log/upload","Special:Contributions"]; window.ajaxIndicator = 'http://vignette2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif'; window.ajaxRefresh = 30000; window.AjaxRCRefreshText = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh the page';

// Quick Deletion var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'HK'}; $(window).load(function {   importScriptPage('User:Dorumin/WHAM', 'starmanw');    if ( $("#backtotop").length ) { // Damn back to top button        mw.util.addCSS('#displayTimer { position: absolute;  margin-left: 700px; }');    }    switch( wgCanonicalNamespace ) {        case 'User':        case 'User_talk':        $('.UserProfileActionButton .wikia-menu-button').css('margin-left','24px').appendTo('.UserProfileActionButton');        break;    }    $('.UserProfileActionButton .wikia-button').show; });

// QuickCreateUserPage var qtUserPageTemplate = ''; var qtEnableUserPageOverwrite = true; massRenameSummary = 'automatic';

// add link to RC in WikiActivity if ( wgPageName == 'Special:WikiActivity' ) $('ul.tools li:first-child:not(.tools-menu li)').before('Advanced RC'); // Stuff (function {var original = document.title;if (typeof blinkInterval === 'undefined') {window.blinkInterval = 1000;}var timeout;window.blinkTitle = function(newMsg) {function step {document.title = (document.title == original) ? newMsg : original;timeout = setTimeout(step, blinkInterval);}cancelBlinkTitle(timeout);step;};window.cancelBlinkTitle = function {clearTimeout(timeout);document.title = original;};});

$(window).focus(function {   cancelBlinkTitle; });

$(window).load(function {    if ( wgPageName == 'User:Dorumin/RC' && wgAction == 'view' ) {        Notification.requestPermission;        window.onbeforeunload = function(e) {            return 'Man you must be out of your mind!';        };        $('#WikiaPageHeader, #WikiHeader').remove;        $('.rcm-options legend').click(function{ $('.rcm-options').remove; });       importScriptPage('MediaWiki:Novasis14/code.js', 'dev');        $('#globalNavigation').toggleClass('global-navigation').addClass('hidden');        $('.WikiaSiteWrapper').css('padding-top', '0');        mw.util.addCSS('#globalNavigation.inverse #novasis-label { background: #fff !important; } #novasis-label { position: fixed !important; top: 0 !important; } .global-navigation-container { display: none; } .novasis-navbar-forced .global-navigation-container { display: block !important; }');        var target = document.querySelector('#globalNavigation'),            lngth = $('.novasis-navbar-forced').length;        var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) {               if ($('.novasis-navbar-forced').length > lngth) {                    lngth = $('.novasis-navbar-forced').length;                    $('#globalNavigation').addClass('global-navigation');                    $('#novasis-label').attr('style', 'top: 46px !important;');                }                else if ($('.novasis-navbar-forced').length < lngth) {                    lngth = $('.novasis-navbar-forced').length;                    $('#globalNavigation').removeClass('global-navigation');                    $('#novasis-label').attr('style', 'top: 0 !important;');                }            }); });       var config = {            attributes: true,            childList: false,            characterData: true        };        observer.observe(target, config);        setInterval(function { if ( $('.rcm-status button:not(.old)').length ) { $('.rcm-status button').addClass('old'); $('.rc-conntent a[href]').attr('target', '_blank'); }           if ( $('.modalToolbar:not(.old)').length ) { // Rollback $('.modalToolbar').addClass('old'); var ttl = $('#rcm-diff-viewer h1').text; ttl = ttl.substring(0, ttl.length - 14); $.getJSON('/api.php?action=query&prop=revisions&rvtoken=rollback&titles=' + ttl + '&format=json', function(data2) {                   var code = JSON.stringify(data2);                    Usrnm = code.substring( code.lastIndexOf(',"user":"') + 9,code.lastIndexOf('","timestamp":') ).replace(/\s/g, '+');                    RBTokn = encodeURI( code.substring( code.lastIndexOf('"rollbacktoken":') + 17,code.lastIndexOf('\\"}]}}}}') ) ).replace('+', '%2B');                    $('.modalToolbar a').first.before('Rollback');                });            } // End of Rollback            if ( $('.rcm-previouslyLoaded:not(.old)').length ) {                $('.rcm-previouslyLoaded').addClass('old');                if (!document.hasFocus) { blinkTitle('New edits!'); // Display desktop notification. var notification = new Notification("New edits!"); }           }            if(document.querySelector(this.modID+" .rcm-autoRefresh-checkbox").checked) { if ( $('.rcm-noNewChanges:not(.old)').length ) { $('.rcm-rcm-noNewChanges').addClass('old'); setTimeout(function{                       if (!document.hasFocus) {                            $('.rcm-status button').click;                        }                    }, 15000); }           }        }, 3000);    } });

// test 2 mainRoom.model.chats.bind('afteradd', function(chat) {   console.log(chat.attributes.name); });

/****************** Import scripts ******************/ importArticles({   type: 'script',    articles: [        'u:starmanw:User:Dorumin/QuickLogs',        'u:starmanw:MultiUpload/code.js',        'u:starmanw:QuickCreateUserPage/code.js',        'u:kocka:AjaxCommentDelete/code.js',        'u:dev:AjaxBatchDelete/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:AjaxThreadUnfollow/code.js',        'u:dev:AjaxUndo/code.js',         'u:dev:AnchoredRollback/code.js',        'u:dev:AutoEditDropdown/code.js',        'u:dev:ChatTimestamps/code.js',        'u:dev:DisplayTimer/code.js',        'u:dev:DupImageList/code.js',        'u:dev:FastDelete/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:ListFiles/code.js',        'u:dev:MassCategorization/code.js',        'u:dev:MassNullEdit/code.js',        'u:dev:PrivateMessageAlert/code.js',        'u:dev:QuickComments/code.js',        "u:dev:MediaWiki:RecentChangesMultiple/code.2.js",        'u:dev:RedirectManagement/code.js', 'u:dev:Standard_Edit_Summary/code.js', 'u:dev:ViewRemoved/code.js' ] });