Jump to content

User:Jamesofur/global.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// This file contains global JavaScript, loaded or to be loaded on every wiki.

/**
 * Forces left-to-right layout and editing on RTL wikis.
 * @see https://meta.wikimedia.org/wiki/Force_ltr
 * @update-token [[File:pathoschild/forceltr.js]]
 */
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.forceltr.js');

/**
 * Ajax sysop
 * @see https://meta.wikimedia.org/wiki/Ajax_sysop
 * @update-token [[File:pathoschild/ajaxsysop.js]]
 */
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.ajaxsysop.js');

/*###############################################
###  UTC clock
###  by [[w:User:AzaToth]]
###############################################*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript');


//Xwiki rollback script from User:Erwin
$(function() {
    //Check if we're comparing revisions and we want to rollback the edit
    if (document.location.href.indexOf('diff=') != -1 && document.location.href.indexOf('&xwikirollback') != -1) {
        //The rollback link is in a span with the "mw-rollback-link" class
        var s = getElementsByClassName(document, 'span', 'mw-rollback-link');
        //If there's no such span or more than one don't do anything
        if (s.length != 1 ) {
            return false;
        } else {
            //There should only be one link in this span, i.e. the rollback link
            var a = s[0].getElementsByTagName('a');
            if (a.length != 1 ) {
                return false;
            } else {
                //Check if it's indeed a rollback link
                if (a[0].href.indexOf('action=rollback') != -1) {
                    window.location = a[0].href;
                }
            }
        }
    }
});

// Clean delete Reasons script by User:Mike Lifeguard
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CleanDeleteReasons.js&action=raw&ctype=text/javascript');

mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-contribsrange.js&action=raw&ctype=text/javascript');

//autodelete
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Mike.lifeguard/autoDelete.js&action=raw&ctype=text/javascript');

/* User:NuclearWarfare/Mark-blocked script.js */
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:NuclearWarfare/Mark-blocked script.js&action=raw&ctype=text/javascript' );// Backlink: [[w:en:User:NuclearWarfare/Mark-blocked script.js]]