User:PassionFruitMaster/global.js

/* test (again) */ if ( wgCanonicalSpecialPageName == 'Chat' ) { alert('Loaded through global.js'); } // Redirect to base page if ends with '/' if (window.location.href.match("/$")) { window.location.href = window.location.href.slice(0, -1); } // 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;    }); }

// More flexible AjaxUndo jQuery(document).ready(function($) {   "use strict";    function createUndoLink(diffUndoUrl) {        var $ajaxUndoLink = $('').text('AJAX Undo').attr('href', '#').click(function { var $ajaxUndoLinkob = $(this), undoIdRegex = /&undo=([^&]*)/, undoId = undoIdRegex.exec(diffUndoUrl)[1], editToken, etUrl = wgServer + wgScriptPath + '/api.php?action=query&prop=info|revisions&intoken=edit&titles=' + encodeURIComponent(wgPageName) + '&format=json', usrUnd = $('#mw-diff-ntitle2 .mw-userlink').html, smry = prompt('Undo summary', 'Undo revision ' + undoId + ' by ' + usrUnd + ' (talk)'); if (smry === null) return; else if (!smry) smry = 'Undo revision ' + undoId + ' by ' + usrUnd + ' (talk)'; $ajaxUndoLinkob.html(' '); $.getJSON(etUrl, function(data) {               editToken = data.query.pages[wgArticleId].edittoken;                $.ajax({ url: wgScriptPath + '/api.php?', data: 'action=edit&format=json&title=' + encodeURIComponent(wgPageName) + '&undo=' + encodeURIComponent(undoId) + '&bot=1&summary=' + encodeURIComponent(smry) + '&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 ($('.mw-history-undo > a').length && wgAction === 'history') {        $('.mw-history-undo > a').each(function { var diffUndoUrl = $(this).attr('href'), $ajaxUndoLink = createUndoLink(diffUndoUrl); $(this).replaceWith($ajaxUndoLink); });   } else if ($('table.diff').length && typeof $.getUrlVar('diff') !== 'undefined') {        var $diffUndoLink = $('table.diff').find('.diff-ntitle > #mw-diff-ntitle1 a:last'),            diffUndoUrl = $diffUndoLink.attr('href'),            $ajaxDiffUndoLink = createUndoLink(diffUndoUrl);        $diffUndoLink.replaceWith($ajaxDiffUndoLink);    } }); // anti-spam +	$('head').append('#WikiaPage .Chat .message { word-wrap: break-word; } '); // Ajax Block settings AjaxBlock = { blockReasons: { 'Vandalism': 'Vandalism', 'Spam': 'Spam', 'Repeated policy violations': 'Repeated violations', 'Sockpuppetry/ban evasion': 'Sockpuppetry', 'Removing content/blanking pages': 'Page blanking', 'Inserting false information or nonsense': 'Gibberish', 'Intimidating behaviour/harassment/trolling': 'Troll/harassment', 'Unacceptable username, avatar, or global masthead': 'Name/avatar', 'Under the legal age': 'COPPA', 'Failing to comply with the file policy.': 'File Policy' },   check: { creation: true, talk: true, autoBlock: true, override: true } }; /* Auto updating recent changes opt-in. * Something I found on Dorumin's global.js.  * See w:c:dev:AjaxRC for info & attribution. */ window.ajaxPages = ["Blog:Recent_posts", "Special:RecentChanges", "Special:WikiActivity", "Special:Chat", "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'; /* Vector skin configuration. * See w:c:dev:Pseudo-Vector JS for info & attribution. */ window.pseudoVector = { loadCss: true, addReadTab: true, addContributionsTab: true, disableWatchIcon: false, newDiffStyle: true }; /* Removes backlinks from pages. * See w:c:dev:Linksweeper for info & attirbution. */ window.linkSweepConfirmation = true; window.LinkSweeperDelay = 1000; /* Places "QuickToolsv2" button on the "My Tools" section. * Something I found on Zmario's global.js.  * See w:c:dev:QuickToolsv2 for info & attribution. */ var QuickToolsAdvancedtop = true; /* Import JavaScript and Stylesheet articles from any wiki. * See  for info & attribution. */ importArticles({	type: 'script',	articles: [           // ...            'u:dev:MediaWiki:AjaxRC/code.js',            'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',            'u:dev:MediaWiki:AjaxBatchUndelete.js',            'u:dev:MediaWiki:AjaxBlock/code.js',            'u:dev:MediaWiki:AjaxPatrol/code.js',            'u:dev:MediaWiki:ArchiveTool/code.js',            'u:dev:MediaWiki:DisplayClock/code.js',            'u:dev:MediaWiki:Linksweeper/code.js',            'u:dev:MediaWiki:MassBlock/code.js',            'u:dev:MediaWiki:MassCategorization/code.js',            'u:dev:MediaWiki:MassProtect/code.js',            'u:dev:MediaWiki:MassRename/code.js',            'u:dev:MediaWiki:MassUserRights/code.js',            'u:dev:MediaWiki:Pseudo-Vector.js',            'u:dev:Mediawiki:QuickToolsv2/code.js',            'u:dev:MediaWiki:WHAM/code.2.js',            // ...	] });