User:RainA/global.js

importScriptURI('http://internal-community.wikia.com/index.php?title=MediaWiki:ChatConnect.2.js&action=raw&ctype=text/javascript');

// Imports importScriptPage('MediaWiki:QuickCreateUserPage/code.js', 'dev');      // Userpage importScriptPage('MediaWiki:PortableCSSPad/code.js', 'dev');           // PortableCSSPad importScriptPage('MediaWiki:WHAM/code.2.js', 'dev');                   // WHAM! importScriptPage('MediaWiki:MassRenameRevert/code.js', 'dev');         // MassRenameRevert importScriptPage('MediaWiki:NullEditButton/code.js', 'dev');           // NullEditButton importScriptPage("MediaWiki:FileUsageAuto-update/code.js", "dev");     // FileUsageAuto-update importScriptPage("MediaWiki:QuickContribs/code.js", "dev");            // QuickContribs importScriptPage('MediaWiki:ViewRemovedAlways/code.js', 'dev');        // ViewRemovedAlways importScriptPage('MediaWiki:ListFiles/code.js', 'dev');                // ListFiles importScriptPage('MediaWiki:FindAndReplace/code.js', 'dev');           // FindAndReplace importScriptPage('MediaWiki:ChatHacks.js', 'dev');                     // ChatHacks importScriptPage('MediaWiki:HideRail/code.js', 'dev');                 // HideRail importScriptPage('MediaWiki:RedirectManagement/code.js', 'dev');       // Redirect managment importScriptPage('MediaWiki:SkinSwitchButton/code.js', 'dev');         // SkinSwitch importScriptPage('MediaWiki:VSTFReport/code.js', 'kocka');             // Faster report importScriptPage('MediaWiki:AjaxDiff/code.js', 'dev');                 // AjaxDiff importScriptPage('MediaWiki:AjaxUndo/code.js', 'dev');                 // AjaxUndo importScriptPage('MediaWiki:CategoryRenameAuto-update/code.js', 'dev'); // CategoryRenameAuto-update importScriptPage('MediaWiki:DupImageList/code.js', 'dev');             // DupImageList importScriptPage('MediaWiki:MultiUpload/code.js', 'dev');              // MultiUpload importScriptPage('MediaWiki:PurgeButton/code.js', 'dev');              // PurgeButton importScriptPage('MediaWiki:RecentChangesMultiple/code.js', 'dev');    // RecentChangesMultiple importScriptPage('MediaWiki:RevealAnonIP/code.js', 'dev');             // RevealAnonIP importScriptPage('MediaWiki:TopEditors/code.js', 'dev');               // TopEditors importScriptPage('MediaWiki:Benutzerseiten.js', 'de.rain');            // Benutzerseiten importScriptPage('MediaWiki:FastDelete.js', 'de.rain');                // FastDelete importScriptPage("MediaWiki:PageRenameAuto-update/code.js", "dev");    // PageRenameAuto-update importScriptPage('QuickComments/code.js', 'dev');                      // QuickComments importScriptPage('User:AmonFatalis/ShowUserGroupsFork.js', 'c');       // Usergroups importScriptPage('MediaWiki:TabKeyInserter/code.js', 'dev');           // TabKeyInserter importScriptPage('MediaWiki:AjaxEmoticons/code.js', 'dev');            // AjaxEmoticons importScriptPage('AjaxThreadUnfollow/code.js', 'dev');                 // AjaxThreadUnfollow importScriptPage('ChatCount/code', 'korniux');                         // Chat Count importScriptPage("MediaWiki:PageMakerPro/code.js", "dev");		       // PageMakerPro importScriptPage("MediaWiki:OldWindowTitles.js", "de.trollocool");		// OldWindowTitles // LastEdit importArticles( {   type: 'script',    articles: [        'u:dev:MediaWiki:LastEdited/code.js',    ] } ); window.lastEdited = { avatar: true, position: 'top', size: true, diff: true, comment: true, lang: 'de', time: true }; // AjaxRC window.ajaxRefresh = 30000; window.ajaxPages = ["Special:RecentChanges","Special:WikiActivity","Special:Watchlist","Special:Log","Special:Contributions","Spezial:Letzte_Änderungen","Spezial:WikiActivity" ,"Spezial:Beiträge"]; importScriptPage('MediaWiki:AjaxRC/code.js', 'dev'); //Custom Edit Buttons by AmonFatalis if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "https://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", "speedTip": "Weiterleitung", "tagOpen": "#REDIRECT ",   "tagClose": "", "sampleText": "R" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png", "speedTip": "Anführungszeichen", "tagOpen": "„", "tagClose": "“", "sampleText": "M" }; } //NoImageLightbox window.NoImageLightbox = { novideo: true }; importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:NoImageLightbox/code.js',        //'u:de.disney:MediaWiki:Gadget-HotCat.js'    ] }); //Highlight whitespace characters in diffs when they're the only thing in the change //Winner of most conspicuous missing feature for five consecutive years if (window.location.href.indexOf('diff=') !== -1) { $('.diffchange-inline').each(function {       if (!(new RegExp('\\S+').test($(this).text))) {            $(this).css('background-color', 'red');        }    }); } //end /* Makes edit count on user page link to Special:Editcount - Credit to User:452 */ if ($("#UserProfileMasthead").size) $("#UserProfileMasthead .tally em").wrap($("").attr("href", "/Special:Editcount/"+$("#UserProfileMasthead h1[itemprop=name]").html));

/* Revert to old Wikia Activity Module */ if ($('#WikiaRail').length) { $('#WikiaRail').bind('DOMNodeInserted', function {   $(this).removeClass('wikia-rail');   }); }

//QuickThreads QuickThreads = { message: "Regelverstoß", 'notify-admin': false }; importScriptPage('QuickThreads/code.js', 'dev'); // Zusammenfassung für defekte Weiterleitungen if (mw.config.get('wgAction') == "delete" && $('#wpReason').val.slice(0,23) == 'content was: \"#REDIRECT' ) $('#wpReason').val('Defekte Weiterleitung'); // Versionsgeschichte-Button bei Diffs if ($('strong:contains("Changes:")').length)  $('#WikiaPageHeader').find('p').children('a').after(' (Versionsgeschichte)');  //Zusammenfassungen window.dev = window.dev || {}; window.dev.editSummaries = {    css: false,    select: [        '(Wählen)',        'Standard', [            'Neuer Artikel',            'typo',            'Korrektur',            'Ergänzt',            'Erweitert',            '+Interwiki',            'Aktualisiert',            'Aufgeräumt',            'Format korrigiert',            'Bereits vorhanden',            'Kategorie ausgetauscht'        ],        'Vandalismus/Spam EN', [            'Reverting vandalism', 'Reverting Spam', ],       'Vandalismus/Spam DE', [ 'Spam', 'Vandalismus' ]   ] }; importScriptPage("MediaWiki:Standard_Edit_Summary/code.js", "dev"); /*Verhinderung vom Infobox-Builder bei neuen Vorlagen | Code by Kopcap94*/ (function( $, mw ) {   if ( mw.config.get( 'wgNamespaceNumber' ) !== 10 && !$( '.noarticletext' ).lenght ) return;    var default_infobox =         ' \n' +        '    \n' +        '         \n' +        '    \n' +        '    \n' +        '    \n' +        '         \n' +        '         \n' +        '    \n' +        ' ',        i18n = {            en: 'Create infobox',            de: 'Infobox erstellen'        },        name = ( typeof i18n[ mw.config.get('wgUserLanguage') ] !== 'undefined' ) ?                i18n[ mw.config.get('wgUserLanguage') ] :                i18n.en ;    $( ' ', { id: 'createTemplate', style: 'margin-top: 2px;', text: name }).appendTo( '#WikiaPageHeader' );   $( '#createTemplate' ).on( 'click', function { if ( !confirm( 'Du möchtest eine Infobox erstellen, richtig?' ) ) return; $( this ).html(''); $.post('/api.php', {           action: 'edit',            title: mw.config.get( 'wgPageName' ),            summary: 'Creating new PI',            text: default_infobox,            token: mw.user.tokens.get('editToken'),            format: 'json'        }, function( data ) {            var articleID = data.edit.pageid;            $.post( '/wikia.php?controller=TemplateClassificationApi&method=classifyTemplate&format=json', { type: 'infobox', pageId: articleID, editToken: mw.user.tokens.get('editToken') }, function { var link = location.toString, type = ( link.indexOf( '?' ) > -1 ) ? '&' : '?';               location = link + type + 'action=edit&useeditor=source'; });       });    }); })( this.jQuery, this.mediaWiki ); //DEV Rollvback by Robyn Grayson and Ozuzanna var main = { init: function { //check if user has rollback permission already var userGroups = ["rollback","content-moderator","sysop","vstf","helper","staff"], ownGroups = mw.config.get('wgUserGroups'), hasPermissionAlready = false; for (var i in ownGroups) { if (userGroups.indexOf(ownGroups[i]) !== -1) { hasPermissionAlready = true; break; }		}		if (hasPermissionAlready) return; if (mw.config.get('wgAction') == "history" && $('#pagehistory li').length > 1) $('#pagehistory li:first .mw-history-undo a').before(' rollback | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [rollback] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length == 0) $('.mw-usertoollinks:last').after('   [rollback] '); $('.mw-custom-rollback-link a').click(function {			main.getRevisionIdAndContent($(this).attr('data-id'));		}); },	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 rollback (failed to get page content): ' + d.error.code,'error').show; })					.fail(function { new BannerNotification('Unable to rollback: failed to get page content!','error').show; });				}				else					new BannerNotification('Unable to rollback: no different editor found!','error').show;			}			else				new BannerNotification('Unable to rollback (failed to get revisions): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to get revisions!','error').show;		}); },	performRollback: function(page,text,user,user2) { var API = new mw.Api; API.post({		action: 'edit',		title: page,		text: text,		summary: 'Vandalism. Undo revision by ' + user + '',		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; }) (this.jQuery, this.mediaWiki); /* -Adds edit links to WLH page -- */ function addEditLinksToWLH { if(wgCanonicalSpecialPageName=='Whatlinkshere')  {    var links = document.getElementById("mw-whatlinkshere-list").getElementsByTagName('li');    for(var i = 0; i(edit) ';      links[i].insertBefore(editLinkSpan,tools[0]);    }  } } addOnloadHook(addEditLinksToWLH); // Have the user icon on the global nav link to userpage from TyA $('#globalNavigation > div > div.wds-global-navigation__user-menu.wds-dropdown > div.wds-dropdown__toggle.wds-global-navigation__dropdown-toggle > img').wrap($("", { 		href: mw.config.get("wgServer") + "/wiki/User:" + mw.config.get("wgUserName") } ));
 * (function($, mw) {

/* changing "Start a wikia" in RC by AmonFatalis */ $('.start-wikia').attr('href','/wiki/Special:RecentChanges?hidebots=0').attr('title','Special:RecentChanges').text('Änderungen');

//Add links to toolbar $('Global.css</li>' +  '<li>Global.js</a></li>' +   '<li>Mypage/wikia.css</a></li>' +   '<li>MediaWiki:Recentchangestext?</a></li>' +   '<li>SpecialPages</a></li>' +   '<li>DoubleRedirects</a></li>' +   '<li>MediaWiki:ImportJS</a></li>' +   '<li>JSPages</a></li>' +   '<li>AllPages</a></li>' +   '<li>PrefixIndex</a></li>' +   '<li>UnusedFiles</a></li>' +   '<li>ListGroupRights</a></li>' + '<li>ListUsers</a></li>' + '<li>ListAdmins</a></li>')   .insertBefore('.WikiaBarWrapper .tools-menu li:first');

/* Create an edit link on Special:MovePage for easy redirecting */ if (c.wgCanonicalSpecialPageName == "Movepage") { href = $('fieldset').find('a').attr('href') + '?action=edit', link = ' (Bearbeiten)</a>'; $('#mw-movepage-table').find('a').first.after(link); }