User:Dragon Rainbow/global.js

/* 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": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png", "speedTip": "Anführungszeichen", "tagOpen": "„", "tagClose": "“", "sampleText": "M" }; } /* chat hacks */ importScriptPage('User:Monchoman45/ChatHacks.js', 'c');

//Persönliche Styles importScriptPage('Benutzer:Dragon Rainbow/Styles.js', 'de.rain');

//Hacks importScriptPage('Benutzer:Dragon Rainbow/hacks.js', 'de.rain');

//ChatQuotes importScriptPage('User:Wildream/ChatQuote/code.js', 'ru.c');

//Persönliche Skripte importScriptPage('Benutzer:Dragon Rainbow/scripts.js', 'de.rain');

//Zusammenfassungen importScriptPage("MediaWiki:Zusammenfassungen.js", "de.rain");

/* Easily see removed messages on threads */ if ($('.removed-info.speech-bubble-message-removed').length && mw.config.get('wgCanonicalNamespace') == "Thread") { $('.removed-info.speech-bubble-message-removed').each(function {   var id = $(this).parent.attr('id');    $(this).append(' (see message)')  }); }

//Schnelles Erstellen der Benutzerseiten importScriptPage('MediaWiki:Benutzerseiten.js', 'de.rain');

//Skripte (die notwendigsten) importScriptPage('MediaWiki:Scripts.js', 'de.rain');

//Hide Rail importScriptPage('MediaWiki:HideRail/code.js', 'dev');

// Redirect management importScriptPage('MediaWiki:RedirectManagement/code.js', 'dev');

//SkinSwitch importScriptPage('MediaWiki:SkinSwitchButton/code.js', 'dev');

//NoImageLightbox window.NoImageLightbox = { novideo: true }; importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:NoImageLightbox/code.js',        //'u:de.disney:MediaWiki:Gadget-HotCat.js'    ] });

/* RC link in global nav by User:AmonFatalis $('Letzte Änderungen').appendTo('.global-navigation-container'); */ //Alle XY löschen importScriptPage('MediaWiki:MultipleFileDelete/code.js', 'dev');

/* Stuff written by @Bobogoobo */ // Add "infinite" value to expiry dropdowns (another thing that should be built-in) $('#mw-input-wpExpiry option:last').before(   $(' ', { 'value':'infinite', 'text':'infinite' }) ); //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

/* Add powerusers checkbox to Special:ListUsers - Credit to User:452 */ if (wgCanonicalSpecialPageName == "ListUsers") $("fieldset.lu_fieldset tr:last-child").prepend('  Power Users '); /* 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)); // QuickLogs importScriptPage('MediaWiki:QuickLogs/code.js', 'dev');

/* 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 " */

//Siehe Systemnachrichten mit einem Klick importScriptPage('QQX/code.js', 'dev');

//Link zum Community-Wiki importScriptPage('Benutzer:Professor_Hershel_Theodore_Layton/wikia.js', 'cct'); //Rollback where you can importScriptPage('MediaWiki:Rollback/code.js', 'dev');

//PrivateMessageMessage var blinkInterval = 1000; // Custom blink delay, 1000ms is default importScriptPage('MediaWiki:PrivateMessageAlert/code.js', 'dev');

// Handles special pages in monobook that that are "available only in Wikia skin" by RansomTime var monobookSpecialPageHandler = function { if (skin === "monobook") { if ((window.location.href.endsWith("Special:Chat")) ||            (window.location.href.endsWith("Special:CSS")) ||             (window.location.href.endsWith("Special:WikiFeatures"))) { window.location.href = window.location.href + "?useskin=Wikia"; }       if (window.location.href.endsWith("Special:WikiActivity")) { window.location.href = "/wiki/Special:RecentChanges"; }   } }; addOnloadHook(monobookSpecialPageHandler);

// don't save page when enter is pressed in summary box - credit to User:Ciencia Al Poder if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { $('#wpSummary').keypress(function (event) {       if (event.which === 13) {            return false;        }    }); }

// add button to show hidden messages in threads if (mw.config.get('wgNamespaceNumber') === 1201) { $('.removed-info').append('<button class="secondary showremovedmessage" style="margin:0 10px">Show '); $('.showremovedmessage').click(function (event) {       $(event.target).closest('.message-removed').removeClass('hide');    }); }

// add direct link on youtube video file pages if (window.playerParams && playerParams.provider === 'youtube') { var $ytLink = $('</a>') .attr('href', 'https://www.youtube.com/watch?v=' + playerParams.jsParams.videoId) .text(mw.config.get('wgTitle')); $('.video-provider').prepend($ytLink, ' – '); $('[id^="youtubeVideoPlayer"]').removeAttr('style'); }

// add 'used templates' button to oasis edit toolbar if (mw.config.get('wgIsEditPage')) { $(window).load(function {        $(' ').attr({ 'onclick': $('.tmpl_listused > a').attr('onclick'), 'src': '//images.wikia.nocookie.net/central/images/4/43/Button-template.png', 'title': $('.tmpl_listused > a').text }).appendTo('#cke_toolbar_source_1');   }); }

// ============================================================ // chat thingy by sactage // ============================================================ if (wgCanonicalSpecialPageName == 'Chat') { NodeChatDiscussion.prototype.ytInfoCache = {}; NodeChatDiscussion.prototype.ytInfo = function(chat) { if(mainRoom.isInitialized && !chat.attributes.isInlineAlert) { var text = chat.attributes.text, search = /https?:\/\/(?:www\.|m\.)?youtube\.com[^ ]+v=([^&# ]*)|https?:\/\/(?:www\.)?youtu\.be\/([^&#\? ]*)/im, match = text.match(search); if (match) { var $link = $("a[href='" + match[0] + "']").last, id = match[1] ? match[1] : match[2]; if (this.ytInfoCache.hasOwnProperty(id)) { return $link.attr('title', this.ytInfoCache[id]); }                               $.get("http://gdata.youtube.com/feeds/api/videos/" + id + "?v=2&alt=jsonc", function (data) {                                        try {                                                data = data.data;                                                var info = data.title + ' | ' + data.uploader + ' | ' + data.uploaded.split(/T/)[0] + ' | ' + (data.viewCount || 0) + ' views';                                                mainRoom.viewDiscussion.ytInfoCache[id] = info;                                                $link.attr('title', info);                                        } catch (e) {                                                console.log('fetching youtube data failed');                                                console.error(e);                                        }                                }); }               }        }        mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.ytInfo, mainRoom.viewDiscussion)); }

// AjaxRC - taken from StarmanW window.ajaxPages = ["Blog:Recent_posts","Special:WikiActivity","Spezial:Letzte_Änderungen","Especial:CambiosRecientes","Specjalna:Ostatnie_zmiany","Special:Senaste_ändringar","Spécial:Modifications_récentes","Speciális:Friss_változtatások","Speciale:UltimeModifiche","Especial:Mudanças_recentes","特別:最近の更新","Toiminnot:Tuoreet_muutokset","Special:最近更改","Özel:SonDeğişiklikler","Speciaal:RecenteWijzigingen","Đặc_biệt:Thay_đổi_gần_đây","Special:RecentChanges","Special:Log","Special:Log/newusers","Special:Log/useravatar","Special:Images","특수기능:최근바뀜","Служебная:RecentChanges"]; window.ajaxRefresh = 20000;