User:Dorumin/global.js

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

// Always show bots, definitely not the best way to do it, but meh $('a').each(function {  if ( $(this).attr('href') == '/wiki/Special:RecentChanges' ) {      $(this).attr('href', '/wiki/Special:RecentChanges?hidebots=0');   } });

// 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';

// Stuff function createUndoLink(diffUndoUrl) {var $ajaxUndoLink = $('').text('AJAX Undo').attr('href', '#').click(function {var $ajaxUndoLinkob = $(this),undoValue = $('a[data-action="undo"]').attr('href').split('/wiki/')[1].split('?action=')[0];undoIdRegex = /&undo=([^&]*)/,undoId = undoIdRegex.exec(diffUndoUrl)[1],editToken, etUrl = wgServer + wgScriptPath + '/api.php?action=query&prop=info|revisions&intoken=edit&titles=' + encodeURIComponent(undoValue) + '&format=json';$ajaxUndoLinkob.html(' ');$.getJSON(etUrl, function(data) {editToken = data.query.pages[wgArticleId].edittoken;$.ajax({url: wgScriptPath + '/api.php?',data: 'action=edit&format=json&title=' + encodeURIComponent(undoValue) + '&undo=' + encodeURIComponent(undoId) + '&bot=1&token=' + encodeURIComponent(editToken),dataType: 'json',type: 'POST',success: function(data) {if (data.edit && data.edit.result === 'Success') {$ajaxUndoLinkob.text('(undone)');} else if (data.error && data.error.code === 'undofailure') {$ajaxUndoLinkob.text('(error)');alert(data.error.info);} else {$ajaxUndoLinkob.text('(error)');alert('Error: Unknown result from API.');}},error: function {$ajaxUndoLinkob.text('(error)');}});});});return $ajaxUndoLink;} if ( wgPageName == 'Special:WikiActivity' ) { setInterval(function{       if ( $('a[data-action="undo"]:not(.old)').length ) {            $('#diff-preview > h1').hide.html('Diff Preview of: ' + $('.mw-rev-head-action > a').eq(0).attr('title')).fadeIn;            $('a[data-action="undo"]').addClass('old');            var $diffUndoLink = $( '.diff-ntitle > #mw-diff-ntitle1 a:last' ),            diffUndoUrl = $diffUndoLink.attr( 'href' ),            $ajaxDiffUndoLink = createUndoLink( diffUndoUrl );            $diffUndoLink.parent.append( ' (', $ajaxDiffUndoLink, ')' );        }    }, 1000); }

/****************** 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:AjaxDiff/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:RedirectManagement/code.js',        'u:dev:Standard_Edit_Summary/code.js', 'u:dev:ViewRemoved/code.js' ] });