User:Cörey/global.js

var qtEnableUserPageOverwrite = true; window.ajaxRefresh = 5000; var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'Spam' }; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'Housekeeping' }; importArticles({   type: 'script',    articles: [        'w:c:dev:WHAM/code.2.js',        "u:dev:FastDelete/code.js",        'w:dev:WallGreetingButton/code.js',        'w:dev:AjaxRC/code.js',        'w:dev:AjaxPatrol/code.js',        'w:dev:QuickCreateMessageWallGreeting/code.js',        'w:dev:QuickCreateUserPage/code.js',        'u:dev:ChatBlockButton/code.2.js',    ] });

if (mw.config.get('wgPageName') === 'Special:Torus') { importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:Torus.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); $('head').append(' \            #torus { \                 position: fixed !important; \	         margin-top: 0 !important; \                 top: 0 !important; \	         left: 0 !important; \	         width: 100% !important; \	         height: 100% !important; \             } \             #WikiHeader, \             #WikiaHeader, \             #WikiaBar, \             #globalNavigation { \                 display: none; \             } \        '); }

importScriptPage('MediaWiki:RedirectManagement.js', 'corey'); importScriptPage('MediaWiki:EasyPublish.js', 'corey'); importScriptPage('AjaxUndo/code.js', 'dev'); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); $.getScript('https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js'); $("a[title^='Special:ListFiles/']").text('Uploaded Files'); $(function { $('Contributions').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('Log').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('Interlanguage Wikis').insertBefore('.AccountNavigation .subnav li:first'); }); $('ul.tools li:first-child').before('Abuse Filter'); $('ul.tools li:first-child').before('<a href="/wiki/Special:ListGroupRights">Group Rights</a></li>'); /** * To use this script, install it and view:  Special:BlankPage?blankspecial=interlanguage * Borrowed from Thisismyrofl, made by Mathmagician */ if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'Blankpage' && $.getUrlVar('blankspecial') === 'interlanguage') { (function ($, mw) {		var url = mw.config.get('wgServer') + '/api.php?action=query&meta=siteinfo&siprop=interwikimap&format=json';		// get local interwiki map		$.getJSON(url, function (data) { var interlanguageWikis = [], map = data.query.interwikimap; for (var i = 0, len = map.length; i < len; i++) { if (map[i].language) { interlanguageWikis[interlanguageWikis.length] = map[i]; }			}			// display results in an HTML table $(function {				// generate html				var wiki, link, html, message;				message = ' The ' + mw.config.get('wgSiteName') + ' appears to be available in ' + interlanguageWikis.length + ' language(s).  Do you know of a version of this wiki in a language not listed here? You can make a request <a title="Community Central:Interlanguage link requests" href="http://community.wikia.com/wiki/Community_Central:Interlanguage_link_requests">here</a> for it to be <a title="Help:Interlanguage links" href="http://community.wikia.com/wiki/Help:Interlanguage_links">interlanguage linked</a>. ';				html = ' ' + message + ' ';				// insert html				document.title = 'Interlanguage wikis';				$('#firstHeading, #WikiaArticle h1').first.text('Interlanguage wikis');				$('#mw-content-text').html(html);			}); });	}(jQuery, mediaWiki)); } if (mw.config.get('wgPageName') == "Special:Torus") { importScriptPage('MediaWiki:Torus.js', 'monchbox'); }   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));    } /*
 * Advanced chatconnect log interface
 * @description Filter the log to have unique entries and adds IP lookup and other links; notifies of duplicates. Note that it strips the timestamp of when a user entered chat to condense entries.
 * @author Ozuzanna


 * (function($, mw) {

if (mw.config.get('wgPageName') == "Special:Log/chatconnect") {

var path = mw.config.get('wgArticlePath').slice(0,-2), splicer = ' ' + new Date.getFullYear + ' ', //used to strip timestamp, though its not 100% safe IPs = [], names = [], dupeIPs = [], newList = [], IP, name, line, summary;

//Construct entries of new list $('.mw-logline-chatconnect').each(function {   IP = $(this).text.match(/((?:\d{1,3}\.){3}\d{1,3})/)[0];    name = decodeURIComponent($(this).children('a.mw-userlink,a.new mw-userlink').attr('href').split(':')[1]);    line = $(this).html.split(splicer)[1] + '(<a href="http://myip.ms/info/whois/' + IP + '">lookup</a> | <a href="' + path + 'Special:Contributions/' + IP + '">contribs</a> | <a href="' + path + 'Special:Block/' + IP + '">block</a><a style="font-style: italic" href="' + path + 'Special:Block/' + IP + '/16">16</a> | <a href="' + path + 'Special:CheckUser?user=' + IP + '&reason=">check</a> | <a href="' + path + 'Special:Log/chatconnect?user=' + name + '">connect</a>)';

if ($.inArray(line, newList) == -1) { newList.push(line); if ($.inArray(IP, IPs) == -1) { IPs.push(IP); }     else if ($.inArray(IP, dupeIPs) == -1) { dupeIPs.push(IP); }   }  });  //Determine the multiple accounts from the detected duplicate IP addresses  $.each(dupeIPs, function(i,v) { $.each(newList, function(i2,v2) {     if (v2.indexOf(v) !== -1)        names.push(v + ' ' + $(v2).filter('a.mw-userlink,a.new mw-userlink').text);    }); }); //Listify the list array  $.each(newList, function(i,v) { newList[i] = '' + v + '</li>'; }); //Listify the duplicate IPs and add useful links alongside them  $.each(dupeIPs, function(i,v) { dupeIPs[i] = '<a href="' + path + 'Special:Contributions/' + v + '">' + v + '</a> (<a href="http://myip.ms/info/whois/' + v + '">lookup</a> | <a href="' + path + 'Special:Block/' + v + '">block</a><a style="font-style: italic" href="' + path + 'Special:Block/' + v + '/16">16</a> | <a href="' + path + 'Special:Log/block?page=' + v + '">log</a> | <a href="' + path + 'Special:CheckUser?user=' + v + '&reason=">check</a>)</li>'; }); //Listify the names and add useful links alongside them  $.each(names, function(i,v) { IP = v.match(/((?:\d{1,3}\.){3}\d{1,3})/)[0]; name = v.replace(/((?:\d{1,3}\.){3}\d{1,3})/,'').trim.replace(' ','_'); names[i] = ' ' + IP + ' <a href="' + path + 'Special:Contributions/' + name + '">' + name + '</a> (<a href="' + path + 'Special:Block/' + name + '">block</a> | <a href="' + path + 'Special:Log/block?page=' + name + '">log</a> | <a href="' + path + 'Special:CheckUser?user=' + name + '&reason=">check</a> | <a href="' + path + 'Special:Log/chatconnect?user=' + name + '">connect</a>)</li>'; });   //Add the new list and breakdown summary  $('#mw-content-text ul').html(newList.sort.join('\n').trim);   $('#mw-content-text ul').before(' Breakdown  IPs A total of ' + dupeIPs.length + ' duplicate IP entries were found. <ul>' + dupeIPs.sort.join('\n').trim + '</ul> Accounts A total of ' + names.length + ' unique account entries were found. <ul>' + names.sort.join('\n').trim + '</ul> Entries '); //Change the page title if we have at least one duplicate IP detected  if (dupeIPs.length !== 0)    document.title = '(' + dupeIPs.length + ') ' + document.title;  //Refresh every minute  if (document.URL.split('?').length == 1) {    setTimeout(function { location.reload(1); }, 60000); } }

}) (this.jQuery, this.mediaWiki);

var navColour = window.getComputedStyle(document.querySelector('.navbackground')).getPropertyValue('background-color'); $(".global-navigation-item").css("background-color", navColour);