User:Dai ca superman/global.js

var QuickToolsAdvancedtop = false;

window.cacheSkip = []; window.cacheSkipLimit = 1000; window.topLevelCat = '';

massRenameDelay = 1000; massRenameSummary = 'automatic'; var QuickContribs = { expiry : '3 days', reason : 'Vandalism' };

/** * Configure my list of global.js articles * Grab the list from sessionStorage if available * This allows me to easily turn on/off individual scripts * from the browser console for testing purposes */ importArticles({   type: 'script',    articles: [		'u:dev:NoImageLightbox/code.js',		'u:dev:MediaWiki:Wikimarks/code.js', 'u:creepypasta:MediaWiki:CPWEditTools.js', 'u:runescape:User:Suppa_chuppa/undoplus.js'    ] });

/* */

var usergroups = mw.config.get('wgUserGroups').join(' '), page = mw.config.get('wgPageName'), specialpage = mw.config.get('wgCanonicalSpecialPageName'), title = mw.config.get('wgTitle'), action = mw.config.get('wgAction'), sitename = mw.config.get('wgSiteName'), href, link; /* IP lookup on contribs */ if (specialpage === "Contributions" && title.split('.').length == 4) { href = 'http://myip.ms/info/whois/' + page.split('/')[1], link = ' (lookup)'; $('.masthead-info').find('h2').html(link); } /* Create an edit link on Special:MovePage for easy redirecting */ if (specialpage === "Movepage") { href = $('fieldset').find('a').attr('href') + '?action=edit', link = ' (edit)'; $('#mw-movepage-table').find('a').first.after(link); } /* Unchecks redirects when moving files */ if (page.indexOf("Special:MovePage/File:") !== -1) $('#wpLeaveRedirect').removeAttr('checked'); /* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(page) !== -1) { $('li.mw-logline-newusers').each(function {   href = '/wiki/Special:AbuseLog?wpSearchUser=' + $(this).children('a.new.mw-userlink,a.mw-userlink').attr('href').substring(11),    link = ' | abuse';    $(this).children('span.mw-usertoollinks').find('a:last-child').after(link);  }); }
 * (function($, mw) {

/* History button for diffs */ /* (doesn't work on some namespaces like User: and User talk: */ /*   because w:Special:MyPage/global.js and Special:MyPage/wikia.js */ /*   never get loaded) */ $(function {	$("h1:contains('Changes:')").after('History '); }) /* Create move link on Special:ListFiles for users' files listed */ if (specialpage === "ListFiles") { $('td.TablePager_col_img_name').each(function {   link = ' (move)';     $(this).append(link);  }); } /* Automatic broken redirect delete summary */ if (action === "delete" && $('#wpReason').val.slice(0,23) === 'content was: \"#REDIRECT' ) $('#wpReason').val('Broken redirect'); /* Revision delete */ if (action === 'revisiondelete' || specialpage === 'Revisiondelete') {  $('#wpHidePrimary,#wpHideComment,#wpHideUser').attr('checked','checked');  $('#wpReason').val('spam'); } /* Thread history return to thread */ if (page.split(':')[0] === "Thread" && action === "history")  $('.SortingBar').after('Back to thread'); }) (this.jQuery, this.mediaWiki);

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

/*Fluid images template by Wildream */ var InputsCount = $('.inp').size; var InputIDNumber = 0; $(".inp").each(function {    if ($(this).attr('id') == undefined) {        $(this).attr('id', 'inp-' + InputIDNumber);        InputIDNumber++;    } }); var OutputIDNumber = 0; $(".output").each(function {    if ($(this).attr('id') == undefined) {        $(this).attr('id', 'outimg-' + OutputIDNumber);        OutputIDNumber++;    } }); for (ChangesCount = 0; ChangesCount < InputsCount; ChangesCount++) { var UrlImg = $('#inp-' + ChangesCount).text; $('body').append(''); $('#out-' + ChangesCount).click(function {        window.open(UrlImg);    }); } function ChangeFlImgSize { for (ChangesCount = 0; ChangesCount < InputsCount; ChangesCount++) { var UrlBg = 'url("' + $('#inp-' + ChangesCount).text + '") no-repeat center'; var IndexSize = parseInt($("#realsize-img-" + ChangesCount).width, 10) / parseInt($("#realsize-img-" + ChangesCount).height, 10); $('#outimg-' + ChangesCount).css({           'background': UrlBg,            'width': parseInt($('#out-' + ChangesCount).width, 10),            'height': (parseInt($('#outimg-' + ChangesCount).width, 10) / IndexSize),            'background-size': 'contain',            '-o-background-size': 'contain',            '-webkit-background-size': 'contain',            '-moz-background-size': 'contain',            'margin': '5px'        }); } } window.onload = ChangeFlImgSize; $(window).resize(function {    ChangeFlImgSize; });

(function {   if (/suavis/.test(window.location.search) && mw.config.get('skin') == 'oasis') {        mw.loader.load( "http://matthew2602.wikia.com/wiki/MediaWiki:Suavis.min.js?action=raw&ctype=application/javascript" );   } });

/* Add quick link to IP location lookup for anon contributors */ if (mw.config.get("wgCanonicalSpecialPageName") === "Contributions" && ($('a:contains("Why create an account?")').length == 1)) { $('.masthead-info').find('h2').html(" (Lookup)"); }

/* Sidebar submenus */ function MonobookSubmenus { var ports = $('.generated-sidebar'); $('#p-search').before(' Wiki navigation <ul></ul> '); var ul = document.getElementById('p-generated').getElementsByTagName('ul')[0]; for(var i = 0; i < ports.length; i++) { var links = ''; for(var j = 0; j < ports[i].getElementsByTagName('li').length; j++) {links += ports[i].getElementsByTagName('li')[j].outerHTML;} ul.innerHTML += '<li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> ' + ports[i].getElementsByTagName('h5')[0].innerHTML + ' &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;">' + links + '</ul></li>'; }	ports.remove; document.getElementById('p-generated').className = 'generated-sidebar portlet'; //set here to avoid class list loop } if(skin != 'oasis') {addOnloadHook(MonobookSubmenus);} function ShowMBMenu { clearTimeout(window.sidebartime); //Clear existing timeout to prevent confusion when moving from one module to another module var uls = $('.sidebar-subnav'); for(var i = 0; i < uls.length; i++) { uls[i].style.display = 'none'; //Hide all other modules uls[i].parentNode.onmouseover = function(event) {window.sidebarpar = this; ShowMBMenu;} }	window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'block'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = undefined; clearTimeout(window.sidebartime);} window.sidebarpar.onmouseout = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('HideMBMenu', 400);} } function HideMBMenu { window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'none'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('ShowMBMenu', 300);} window.sidebarpar.onmouseout = function(event) {window.sibebarpar = undefined; clearTimeout(window.sidebartime);} } function ExtraPortlets { $('#p-search').before(' Tools <ul><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> Recent changes</a> &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li>Log</a></li><li>New pages</a></li><li>New files</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> Create page</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li>Upload</a></li><li>Multiple upload</a></li><li>Blog</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> List</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li>Admins</a></li><li>Bureaucrats</a></li><li>Chat mods</a></li></ul></li><li>Special pages</a></li><li>Chat</a></li></ul>  '); $('#p-logo').after($('#p-search').detach); } if(skin != 'oasis') {addOnloadHook(ExtraPortlets)}

/*User:Sactage*/ /* This moves the toolbox right below the logo... */ $(function {	$('#p-logo').after($('#p-tb').detach);       $('#p-tb').after($('#p-search').detach); });

// LookupUser: contribs -> listfiles $(function {	if (mw.config.get("wgCanonicalSpecialPageName") === "LookupUser") {		$("span#lu-tools").append(" | ").append("ListFiles-ify contribs</a>");		$("a#lu-tools-listfilesify").click(function(event) { event.preventDefault; var user = $("span#lu-tools").siblings("a").text; $("div#lookupuser-table_wrapper table#lookupuser-table tr td a[href$='Special:Contributions/" + user + "']").each(function(index, element) {				element.href = element.href.replace("Special:Contributions", "Special:ListFiles");				element.innerHTML = "ListFiles";			}); });               if (mw.user.options.get("language") === "it") {                        var email = $("a[href*='Special:EmailUser']").text;                        $("a[href*='Special:EmailUser']").after(" pi&ugrave;</a>");                }	} });

// User:Advieser

/** subpages **/ addOnloadHook( function {	var NSWithoutSubpages = new Array( -1, 6, 8, 12, 13, 14, 15, 104, 105);	if ( document.getElementById( 'p-tb' ) && NSWithoutSubpages.indexOf( wgNamespaceNumber ) == -1 ) {		var subpagesLink = '/wiki/Special:PrefixIndex/' + wgPageName + '/';		addPortletLink( 'p-tb', subpagesLink, 'Subpages', 't-subpages', 'Subpages of this page' );	} });

/* more stuff from sactwalrus */

importScript('User:Sactage/rbs.js');

/* cawd4's speedy template script */ var buttonLayout = false; // change to true for buttons instead of dropdown menu importScript('User:Callofduty4/FileTemplateAdder.js');

/* hairr's kick script */

function kickUserButton { var kickuser = prompt('write da naem here kthx','kat'); if (kickuser.length != 0) { mainRoom.kick({name:kickuser}); } } $('<div onclick="kickUserButton" style="left:50%; margin-left:2px;margin-right:2px; display:inline; text-align: center; cursor: pointer;" align="center"><a class="wikia-button">Kick</a> ').prependTo('.Rail'); // disable redirect links $('.mw-redirect, .allpagesredirect > a').each(function {  var link = new mw.Uri(this.href);  link.extend({ redirect: 'no' }); $(this).attr('href', link.toString); });

// run in Monobook only if (mw.config.get('skin') === 'monobook' &&  mw.config.get('wgServer') !== 'http://sonako.wikia.com') { // Vector style for Monobook importArticle({   type: 'style',    article: 'u:dev:Pseudo-Vector/code.css'  }); // move edit links next to heading, like Vector skin $('.editsection').each(function {    $(this).css({ 'float': 'none', 'margin-left': '1em' }).parent.append(this); }); // add contributions link on user pages if ([2, 3, 1200].indexOf(mw.config.get('wgNamespaceNumber')) !== -1) { mw.util.addPortletLink(     'p-cactions',      mw.util.getUrl('Special:Contributions/' + mw.config.get('wgTitle').split('/')[0]),      'Contributions',      'ca-contributions',      null,      null,      '#ca-edit'    ); } }

if (mw.config.get('wgServer') !== 'http://sonako.wikia.com') { window.popupOnEditSelection = false; window.popupStructure = 'menus'; window.popupAdminLinks = true; window.popupDelay = 0.5; window.popupImageSize = 150; window.popupImageSizeLarge = 150; mw.loader.load('https://vi.wikipedia.org/w/index.php?title=Thành_viên:Vinhtantran/strings-vi.js&action=raw&ctype=text/javascript'); mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript'); mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/css', 'text/css');

$(window).load(function {       importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:Nuke/code.js', 'u:dev:MediaWiki:Quick_Management/code.js', 'u:dev:MediaWiki:WHAM/code.js', 'u:dev:MediaWiki:WHAM/code.2.js' ]       });    });

window.ajaxPages = ["Special:NewPages", "Special:ListFiles"]; window.ajaxSpecialPages = ["Recentchanges", "WikiActivity", "Watchlist", "Log", "Images", "Contributions"]; window.AjaxRCRefreshText = "Auto-refresh"; window.AjaxRCRefreshHoverText = "Tự động làm mới trang"; window.ajaxIndicator = "http://images4.wikia.nocookie.net/__cb20100617113123/dev/images/6/6a/Snake_throbber.gif"; importArticles({       type: 'script',        articles: [            'u:dev:ListFiles/code.js',            'u:dev:QuickDiff/code.js',            'u:dev:CatNav/code.js',            'u:dcsuper:User:Dai_ca_superman/CatNav.javascript',            'u:dev:PortableCSSPad/code.js',            'u:dev:QuickToolsv2/code.js',            'u:dev:Quick_Management/code.js',            'u:dev:QuickComments/code.js',            'u:dev:QuickComments/advanced.js',            'u:dev:AjaxRC/code.js',            'u:dev:MassProtect/code.js',            'u:dev:LastEdited/code.js',            'u:dev:NullEditButton/code.js',            'u:dev:MassNullEdit/code.js',            'u:dev:AutoEditPages/code.js',            'u:dev:HideRail/code.js',            'u:dev:CacheCheck/code.js',            'u:dev:AjaxBatchDelete/code.2.js',            'u:dev:AjaxBatchUndelete/code.js',            'u:dev:MassRename/code.js', 'u:dev:QuickContribs/code.js', 'u:dev:AjaxRename/code.js', 'u:dev:Mediawiki:ContribRC/code.js', 'u:dev:PurgeButton/code.js', 'u:dev:MassRenameRevert/code.js', 'u:dev:QuickThreads/code.js', 'u:dev:RevealAnonIP/usercode.js', 'u:dev:PageRenameAuto-update/code.js', 'u:dev:Thread_Inspection/code.js', 'u:dev:MassCategorization/code.js', 'u:dev:FileUsageAuto-update/code.js', 'u:dev:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:MassBlock/code.js', 'u:dev:CategoryRenameAuto-update/code.js', 'u:dcsuper:User:Dai_ca_superman/GlobalScripts.javascript', 'u:dcsuper:User:Dai_ca_superman/Skin_Switch_Button.javascript' ]   }); } if (mw.config.get('skin') === 'monobook'  &&  mw.config.get('wgServer') !== 'http://sonako.wikia.com') {    importScriptURI('//en.wikipedia.org/w/index.php?title=User:Joeytje50/AWB.js/load.js&action=raw&ctype=text/javascript'); }