User:Ozuzanna/global.js

/* Configs */ cacheSkip = []; cacheSkipLimit = 1000;

/* Imports */ importArticles({   type: "script",    articles: [        'u:dev:AjaxBatchDeleteV2/code.js',        'u:dev:AjaxUndo/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:CacheCheck/code.js',        'u:dev:CategoryRenameAuto-update/code.js',        'u:a:MediaWiki:Gadget-HotCat.js',        'u:dev:MassCategorization/code.js',        'u:dev:MassNullEdit/code.js',        'u:dev:NoImageLightbox/code.js',        'u:dev:OldFilePages/code.js'    ] });

/* Conditional imports */ var ug = wgUserGroups.join(' '); if (mw.config.get('wgCanonicalSpecialPageName') === "Contributions" && (ug.indexOf('rollback') + ug.indexOf('sysop') > -2)) { importScriptPage('User:Ozuzanna/annihilate.js','community'); }

if (wgPageName.indexOf("Special:MovePage/File:") != -1 || mw.config.get('wgCanonicalNamespace') === "File" && Storage && mw.config.get('wgSiteName') !== '2007scape Wiki') { LIRoptions = { bottomMessage: 'This appears below the buttons on Special:MovePage', editSummary: 'Updating file link (automatic)', singleButtonText: 'Rename and replace', queueButtonText: 'Rename and add to queue' }  importScriptPage("FileUsageAuto-update/code.js", "dev"); }

/* Unchecks redirects when moving files */ if (mw.config.get('wgPageName').indexOf("Special:MovePage/File:") !== -1) { $('#wpLeaveRedirect').removeAttr('checked'); }

/* Create an edit link in Special:MovePage for easy redirecting */ if (mw.config.get('wgPageName').split('/')[0] === 'Special:MovePage') { var link = $('fieldset').find('a').attr('href'), editLink = document.createElement('a'); link += '?action=edit'; editLink.setAttribute('href', link); editLink.textContent = ' (edit)'; $('fieldset').find('a').first.after(editLink); }

/* Add quick link to IP location lookup for anon contributors */ if (mw.config.get('wgCanonicalSpecialPageName') === "Contributions" && ($('a:contains("Why create an account?")').length == 1)) { var link = 'http://myip.ms/info/whois/'; link += mw.config.get('wgPageName').split('/')[1]; var lookup = document.createElement('a'); lookup.setAttribute('href', link); lookup.setAttribute('style', 'color:white'); lookup.textContent = '(lookup)'; $('.masthead-info').find('h2').html(lookup); }

/* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(mw.config.get('wgPageName')) !== -1) { $('li.mw-logline-newusers').each(function {     var link = '/wiki/Special:AbuseLog?wpSearchUser=';      link += $(this).children('a.new.mw-userlink,a.mw-userlink').attr('href').substring(11);      var AbL = document.createElement('a');      AbL.setAttribute('href', link);      AbL.textContent = ' (abuse log)';      $(this).append(AbL);   }); }

/* if ("Special:Log/chatconnect".indexOf(mw.config.get('wgPageName')) !== -1) { $('#WikiaMainContentContainer').prepend(' Filter '); $('#WikiaArticle').prepend(' '); $('li.mw-logline-chatconnect').each(function {     var IP = $(this).text.match(/((?:\d{1,3}\.){3}\d{1,3})/)[0], //IP      text = IP + ' ' + decodeURIComponent($(this).children('a.mw-userlink,a.new mw-userlink').attr('href').split(':')[1])+'\n', //Username      IPLookup = '(lookup', IPContribs = ' | contribs', IPBlock = ' | block)';     $(this).append(IPLookup).append(IPContribs).append(IPBlock);      $('#output-box').append(text);   });
 * Advanced chatconnect log interface
 * Filter button for all unique IPs to users in chat in a text box + IP lookup, contribs and block links
 * @author Ozuzanna

$('#button-filter').click(function {      var uniqueDetails = [],       nameList = $('#output-box').val;      $.each(nameList.split(/\n/), function(i, details) { if ($.inArray(details, uniqueDetails) === -1) uniqueDetails.push(details); });          $('#output-box').val(uniqueDetails.sort.join('\n').trim);	      }); }

/* Quick edit for pages using a file */ if (wgCanonicalNamespace === "File") { var href = decodeURIComponent($('ul.FileTransclusions a').attr('href') + '?redirect=no&action=edit'), link = ' (edit)'; $('ul.FileTransclusions a').after(link); }

/* var specialpages = [ "Special:BrokenRedirects", "Special:DoubleRedirects", "Special:DeadendPages", "Special:BrokenRedirects", "Special:LonelyPages", "Special:UnusedFiles", "Special:UnusedTemplates" ]; if (specialpages.indexOf(mw.config.get('wgPageName')) !== -1) { $('#WikiaArticle').prepend(' '); if ("Special:UnusedFiles".indexOf(wgPageName) !== -1) { $('div.thumb img').each(function {       $('#output-box').append('File:'+$(this).attr('data-image-name')+'\n')}); } else { $('ol.special').find('li').each(function {       var text = $(this).find('a').first.text;        document.getElementById('output-box').value += text + '\n';}); } }
 * Display a list of text for certain special pages
 * Written by Shining-Armor
 * Added support for Special:UnusedFiles by Ozuzanna