User:Cans48/global.js

/* Credit to HM100 */ /* Quick Revert Spam and Vandalism */ massBlockDelay = 1000; massProtectDelay = 1000; massUserRightsDelay = 1000; batchDeleteDelay = 1000; WHAMDelay = 1000; WHAMBotMe = true; WHAMBotReason = "Διαγραφή βανδαλισμού"; massUserRightsCustom = [ "el.alpha-technologies|bot|Ρομπότ" ]; importArticles( {   type: 'script',    articles: [        'u:dev:MediaWiki:Rollback/code.js',        'u:dev:MediaWiki:MassBlock/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:FastDelete/code.js',        'u:dev:MediaWiki:Wikia_Essentials/code.js',        'u:dev:MediaWiki:MassUserRights/code.js',        'u:dev:MediaWiki:ExternalImageLoader/code.js',        'u:dev:MediaWiki:WHAM/code.2.js',        "u:dev:MediaWiki:AjaxBatchDelete/code.2.js",        "u:nanaki:MediaWiki:MessagingCleanup.js",        'u:dev:MediaWiki:GlobalEditcount/code.js',        'u:dev:MediaWiki:Multikick.js'    ] } ); /* End - Extra Scripts */ /* Το παρακάτω σενάριο θα βάλει το "Start a new Wiki" στο Monobook */ /* Το παρακάτω σενάριο θα βάλει το "Community Central" στο Monobook */ /* Το παρακάτω σενάριο θα βάλει το "RandomWiki" στο Monobook */ /* Το παρακάτω σενάριο θα βάλει το "Apiwiki" στο Monobook */ /* Το παρακάτω σενάριο θα βάλει το "wlb" στο Monobook */ $( function {	if ( !document.getElementById( 'ca-wikiamb' ) ) {		if ( skin === 'oasis' || skin === 'wikia' ) {		} else {			$( 'Δημιούργησε ένα Wiki' ).appendTo( '#p-wikicities-nav  > .pBody > ul' ); $( 'Τυχαίο wiki' ).appendTo( '#p-wikicities-nav  > .pBody > ul' );    }  }  if ( !document.getElementById( 'ca-central' ) ) {    if ( skin === 'oasis' || skin === 'wikia' ) {        $( 'Techinal Updates' ).appendTo(  '#my-tools-menu'  );		} else {      $( 'Community Central' ).appendTo( '#p-wikicities-nav  > .pBody > ul' );       $( '<a href="/index.php?title=w:c:community:Blog:Wikia Technical Updates">Techinal Updates</a></li>' ).appendTo( '#p-wikicities-nav  > .pBody > ul' ); } }  if ( !document.getElementById( 'ca-apiwiki' ) ) { if ( skin === 'oasis' || skin === 'wikia' ) { } else { $( '<a href="/index.php?title=w:c:api">Wikia API</a></li>' ).appendTo( '#p-wikicities-nav > .pBody > ul' ); } }  if ( !document.getElementById( 'ca-wlb' ) ) { if ( skin === 'oasis' || skin === 'wikia' ) { } else { $( '<a href="/index.php?title=w:c:wlb">Wikia Language Brigade</a></li>' ).appendTo( '#p-wikicities-nav > .pBody > ul' ); } } } );    if ( !document.getElementById( 'ca-contact' ) ) {    if ( skin === 'oasis' || skin === 'wikia' ) {        $( '<a href="/index.php?title=Special:Contact">Contact Wikia</a></li>' ).appendTo(  '#my-tools-menu'  );		} else {      /*$( '<a href="/index.php?title=w:c:community">Community Central</a></li>' ).appendTo( '#p-wikicities-nav  > .pBody > ul' );       $( '<a href="/index.php?title=Special:Contact">Contact</a></li>' ).appendTo( '#p-wikicities-nav  > .pBody > ul' );*/    } } /*Restores old Wikia Logo*/ importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:ChatHacks.js' ]}); /* Restoring old wikia logo */ $('svg.wds-global-navigation__logo-fandom').replaceWith('<img src="http://vignette4.wikia.nocookie.net/csydes-test/images/2/2d/Wikia_The_Home_of_Fandom_250x30.png/revision/latest?cb=20161009023141" />'); /*Rollback*/ /* mw.loader.using('mediawiki.api', function { var main = { init: function { //check if conventional rollback links are present if ($('.mw-rollback-link').length) return; if (mw.config.get('wgAction') == "history" && $('#pagehistory li').length > 1) $('#pagehistory li:first .mw-history-undo a').before(' <a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a> | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + $(this).find('a:first').attr('title') + '">rollback</a>] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length === 0) $('.mw-usertoollinks:last').after('   [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a>] '); $('.mw-custom-rollback-link a').click(function {			main.getRevisionIdAndContent($(this).attr('data-id'));			$(this).parent.remove;		}); },	getRevisionIdAndContent: function(title) { var API = new mw.Api; API.get({		action: 'query',		prop: 'revisions',		titles: title,		rvprop: 'user|ids',		rvlimit: 500,		cb: new Date.getTime		}) .done(function(d) {			if (!d.error) {				var revisions;				for (var i in d.query.pages) {					revisions = d.query.pages[i].revisions;				}				var currentUser = revisions[0].user, //current user rollbacking from				lastUser,				revId;				for (var i in revisions) {					if (revisions[i].user != currentUser) {						lastUser = revisions[i].user; //remember last author						revId = revisions[i].revid; //get revision to revert to						break;					}				}				if (lastUser) {					API.get({ action: 'query', prop: 'revisions', rvprop: 'content', revids: revId, cb: new Date.getTime })					.done(function(d) { if (!d.error) { var content = ""; //can be no content on page so initialise empty as failsafe for (var i in d.query.pages) { if (d.query.pages[i].revisions) content = d.query.pages[i].revisions[0]["*"]; }							main.performRollback(title,content,currentUser,lastUser); }						else new BannerNotification('Unable to do that thing you wanted to do (failed to get page content): ' + d.error.code,'error').show; })					.fail(function { new BannerNotification('Unable to do that thing you wanted to do: failed to get page content!','error').show; });				}				else					new BannerNotification('Unable to do that thing you wanted to do: no different editor found!','error').show;			}			else				new BannerNotification('Unable to do that thing you wanted to do(failed to get revisions): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to do that thing you wanted to do: failed to get revisions!','error').show;		}); },	performRollback: function(page,text,user,user2) { var API = new mw.Api, summary = 'Reverted edits by a vandaliser to last version by ' + user2 + ' (script) (rollbacker)'; if (summary.length > 150) summary = 'Reverted edits by ' + user + ' (script)'; API.post({		action: 'edit',		title: page,		text: text,		summary: summary,		token: mw.user.tokens.values.editToken		}) .done(function(d) {			if (!d.error) {				new BannerNotification('Rollback successful!','confirm').show;							}			else				new BannerNotification('Unable to rollback (failed to publish edit): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to publish edit!','error').show;		}); } }; main.init; });
 * Rollback
 * Perform rollbacks without needing to be in the usergroup
 * @author Ozuzanna