User:Dragon Rainbow/global.js

// Imports 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:SearchSuggest/code.js', 'dev');            // SearchSuggest 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:QuickLogs/code.js', 'dev');                // QuickLogs importScriptPage('MediaWiki:AjaxDiff/code.js', 'dev');                 // AjaxDiff importScriptPage('MediaWiki:Wikimarks/code.js', 'dev');                // Wikimarks importScriptPage('MediaWiki:AjaxUndo/code.js', 'dev');                 // AjaxUndo importScriptPage('MediaWiki:AnchoredRollback/code.js', 'dev');         // AnchoredRollback 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:Gadget-HotCat.js", "de.disney");           // HotCat importScriptPage('MediaWiki:FastDelete.js', 'de.rain');                // FastDelete importScriptPage("MediaWiki:PageRenameAuto-update/code.js", "dev");    // PageRenameAuto-update importScriptPage('QuickComments/code.js', 'dev');                      // QuickComments //importScriptPage('MediaWiki:Rollback/code.js', 'dev');                 // Rollback 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('ExpandGlobalNavDropdownsOnHover/code.js', 'dev'); //ExpandGlobalNavDropdownsOnHover 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)); /* Custom "NewFilesModule" by 452 (with fixes by JoshuaJSlone) This script displays Special:NewFiles in the right rail There are three ways to use this, by setting the NewFilesModuleCompact variable 0 - Normal, width is 212 1 - Compact, width is 106 2 - Random, if you're not sure which version you like best. In both modes, hovering over each displays the uploader info. NewFilesModuleCount can be used to specify the number of displayed images. var NewFilesModuleCompact = 1; //must be 0, 1, or 2. var NewFilesModuleCount = 13; //any integer if ($('#WikiaRail').length) { //only on pages where the rail is present $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.   if (!$("#NewFilesModule").length) { // Only add it once      if (typeof $temp == "undefined") { // Only load it once        $temp = $(' '); // this line, and the next, originate from http://dev.wikia.com/wiki/AjaxRC/code.js <3        $temp.load("/Special:NewFiles/" +NewFilesModuleCount + " #gallery-", function  { $('#WikiaRail section:last-of-type').after(" New FilesUpload "); if (typeof NewFilesModuleCompact == "undefined") NewFilesModuleCompact = 0; if (NewFilesModuleCompact == 2) NewFilesModuleCompact = Math.floor(Math.random*2); if (NewFilesModuleCompact) { $('#gallery-', $temp).html(             $('#gallery-', $temp).html              .replace(/\/revision\/latest\?/g, "/revision/latest/scale-to-width-down/106?")              .replace(/\/scale-to-width-down\/\d*\?/g, "/scale-to-width-down/106?") //-down is redundant on this line, but kept for consistency            ); $("#NewFilesModule").addClass("compact"); }         $("#NewFilesModule").append(' '); $(".wikia-gallery-item", $temp).each(function {            $(".lightbox-caption", this).prepend($("").attr("href",$(".gallery-image-wrapper>a", this).attr("href")).html($(".gallery-image-wrapper>a", this).attr("title")).append($(" ")));            $("#NewFilesModule #gallery-").append(this);          }); delete $temp; //delete it, in case the rail is wiped after this point. });       if (!$("#NewFilesModuleCSS").length) $('head').append('\n#gallery- { position:relative;overflow-y:auto; clear: both; text-align:center; height:452px; }\n#gallery-:hover {padding-bottom: 13em; }\n#NewFilesModule .gallery-image-wrapper { top: 0 !important; height: auto !important; border:none; background: none; }\n#NewFilesModule.compact .gallery-image-wrapper { width: auto !important; }\n#NewFilesModule .thumb { height:auto !important; }\n#NewFilesModule .wikia-gallery-item { margin: 1px !important; padding: 0 !important; height: auto !important; border: none !important; }\n#NewFilesModule.compact .wikia-gallery-item { width: auto !important; }\n#NewFilesModule .wikia-gallery-item .lightbox-caption { display: none; }\n#NewFilesModule .wikia-gallery-item:hover .lightbox-caption { display:block; padding: 5px; margin-top: 0; position: absolute; border: 1px solid; background-color: #fff; z-index: 2; right: 0; width: 250px !important; }\n#NewFilesModule h2 {margin: 0 2em 0 0;}\n#NewFilesModule h2 a:first-child {color:inherit;}\n#NewFilesModule img { display: block; height: auto !important; width: auto !important; margin-left: auto !important; margin-top: auto !important;}\n.wikia-gallery-item .gallery-image-wrapper a { width: auto !important; height: auto !important; }\n.wikia-gallery-item .gallery-image-wrapper a.image-no-lightbox { line-height: normal; display: block; padding: 1em; }\n '); }   }  });  //end of DOMNodeInserted block  $('#WikiaRail').trigger('DOMNodeInserted'); //Prevent race condition by firing the event. } /* End of custom "NewFilesModule " */ //Link zum Community-Wiki importScriptPage('Benutzer:Professor_Hershel_Theodore_Layton/wikia.js', 'cct');

/* Always go to IP contributions, not userpage */ if (mw.config.get('wgNamespaceNumber') == 2 && title.split('.').length == 4) location.replace("/wiki/Special:Contributions/"+mw.config.get('wgPageName').split(':')[1]);

/* Lets the join chat button open in a new tab + let the /chat.css and /chat.js pages work. Taken from Monchoman */ $(setTimeout('ChatCheck', 200)); function ChatCheck { if($('.chat-join button').length != 0) { $('.chat-join button').replaceWith('Join the Chat'); } else { setTimeout('ChatCheck', 200); }   }    function OpenChatWindow { window.chatwindow = window.open('/index.php?title=Special:Chat&useskin=wikia'); window.chatwindow.onload = function { //addOnloadHook, importScript, and importStylesheet window.chatwindow.$('body').prepend(' \nfunction importScript(b){var a=wgScript+"?title="+encodeURIComponent(b.replace(/ /g,"_")).replace(/%2F/ig,"/").replace(/%3A/ig,":")+"&action=raw&ctype=text/javascript";return importScriptURI(a)}\nfunction importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b}\nfunction importScriptPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/javascript";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importScriptURI(a)}\nfunction importStylesheet(a){return importStylesheetURI(wgScript+"?action=raw&ctype=text/css&title="+encodeURIComponent(a.replace(/ /g,"_")))}\nfunction importStylesheetURI(b,d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=b;if(d){a.media=d}document.getElementsByTagName("head")[0].appendChild(a);return a}\nfunction importStylesheetPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/css";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importStylesheetURI(a)}\n//This isn\'t the same as the regular addOnloadHook, because the regular one runs from a script tag in the body that I don\'t feel like appending. It\'s easier to just make it $(function), which is essentially equivalent\nfunction addOnloadHook(func) {$(func);}\n ');                   //global.js                    window.chatwindow.importScriptURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.js&action=raw&ctype=text/javascript');                    //chat.js                    window.chatwindow.importScriptURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.js&action=raw&ctype=text/javascript');                    //global.css                    window.chatwindow.importStylesheetURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.css&action=raw&ctype=text/css');                    //chat.css                    window.chatwindow.importStylesheetURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.css&action=raw&ctype=text/css');            }    } /* Revert to old Wikia Activity Module */ if ($('#WikiaRail').length) { $('#WikiaRail').bind('DOMNodeInserted', function {   $(this).removeClass('wikia-rail');   }); }

/* changing "Start a wikia" in RC by AmonFatalis */ $('.start-wikia').attr('href','/wiki/Special:RecentChanges?hidebots=0').attr('title','Special:RecentChanges').text('Änderungen'); // Thread history return to thread if(wgCanonicalNamespace == "Thread" && wgAction == "history") $('.SortingBar').after('Back to thread'); // Make Visual Editor links load the regular editor instead if($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action')); // Contributions Link by Jr_Mime (angepasst von Dragon_Rainbow) $('#UserProfileMasthead > div.masthead-info > div.masthead-info-lower > ul.wikis > ul > li:nth-child(1) > a, #UserProfileMasthead > div.masthead-info > div.masthead-info-lower > ul.wikis > ul > li:nth-child(2) > a, #UserProfileMasthead > div.masthead-info > div.masthead-info-lower > ul.wikis > ul > li:nth-child(3) > a, #UserProfileMasthead > div.masthead-info > div.masthead-info-lower > ul.wikis > ul > li:nth-child(4) > a').each(function {       var lnk2 = this.href;            this.href = lnk2.replace("User_talk:", "Special:Contributions/");    }); /* Fix for submit on 'Enter' in Special:CreatePage/Special:CreateBlogPage title input */ $('.mw-special-CreatePage input[name=wpTitle], .mw-special-CreateBlogPage input[name=wpTitle]').keydown(function(e){   if (e.keyCode == 13) {        $('#ok').click;        e.preventDefault;    } }); /* Kill Video Lightbox */ window.NoImageLightbox = { novideo: true };

/*AdvancedOasisUI*/ window.AdvancedOasisUI = { accountNavFollowedPages: false, accountNavWatchlist: false, categoryRedlink: true, RCHeader: true, DefaultSourceMode: true, lightbox: true, randomPageLimitedTo: '', activity2RC: true, userLang: true, }; importScriptPage('AdvancedOasisUI/code.js', 'dev');

//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('<img src="http://slot1.images.wikia.nocookie.net/__cb1396606660/common/skins/common/images/ajax.gif" />'); $.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</a> | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [rollback</a>] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length == 0) $('.mw-usertoollinks:last').after('   [rollback</a>] '); $('.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);
 * (function($, mw) {

/* -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<links.length; i++) {     aLink = links[i].getElementsByTagName('a'); var linkHref = aLink[0].href.replace("\?redirect=no","")+"?action=edit"; var tools = getElementsByClassName(links[i], 'span', 'mw-whatlinkshere-tools'); var editLinkSpan = document.createElement("span"); editLinkSpan.className = "mw-whatlinkshere-edit"; editLinkSpan.innerHTML = '(edit)</a> '; 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") } ));