User:Dai ca superman/global.js

/*  */

/* Adds a 'Back to page' link under the preview header when previewing an edit. */ $(function {   if (wgAction == "submit") {        $('#WikiaEditBoxHeader p').clone.appendTo('#WikiaPageHeader:first-child');    } });

/* 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 '); })

// Skin Switch Button for monobook to oasis and vice versa // and for monobook and oasis to wikiamobile $( function {	if ( !document.getElementById( 'ca-skins' ) ) {		if ( skin === 'oasis' || skin === 'wikia' ) {			$( 'MB' ).prependTo( '#AccountNavigation' ); $( 'WM' ).prependTo( '#AccountNavigation' ); $( 'Bản in' ).prependTo( '#AccountNavigation' );		} else {			$( 'Oasis</a></li>' ).prependTo( '#p-cactions > .pBody > ul' ); $( '<a href="/index.php?title=' + encodeURIComponent( wgPageName ) + '&useskin=wikiamobile">Mobile</a></li>' ).prependTo( '#p-cactions > .pBody > ul' ); } 	} } );

importScriptPage('MediaWiki:WhamAPI.js', 'monchbox'); importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:B3.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:Torus.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptURI('http://kangaroopower.wikia.com/index.php?title=MediaWiki:Scope.js/dev.js&action=raw&ctype=text/javascript&t=' + (new Date).getTime);

/* 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("<a style=\"color:#F0F0F0\" href=\"http://myip.ms/info/whois/" + (mw.config.get("wgPageName").split("/")[1]) + "\"> (Lookup)</a>"); } mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/autoedit.js&action=raw&ctype=text/javascript');

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 = ' <a style="color:white" href="'+href+'">(lookup)</a>'; $('.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 = ' <a href="'+href+'">(edit)</a>'; $('#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 = ' | <a href="'+href+'">abuse</a>';    $(this).children('span.mw-usertoollinks').find('a:last-child').after(link);  }); } /* Create move link on Special:ListFiles for users' files listed */ if (specialpage === "ListFiles") { $('td.TablePager_col_img_name').each(function {   link = ' (<a href="/wiki/Special:MovePage/File:' + $(this).find('a').first.text + '">move</a>)';     $(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('<a href="/wiki/'+page+'" style="font-size:14px">Back to thread</a>'); /* Special:WhatLinksHere to page dropdown menu */ $('#WikiaPageHeader > .wikia-menu-button > .WikiaMenuElement > li:last-child').after(  $('').append('<a href="/wiki/Special:WhatLinksHere/'+page+'">What links here</a>') ); /* Prevent visual editor links and load normal instead */ if ($.getUrlVar('veaction') === 'edit')  location.replace(document.URL.replace('veaction','action')); /* Special:WhatLinksHere on redirect page */ var h2header = $('#WikiaPageHeader').find('h2'); if (h2header.text.split('Redirected from').length == 2) { link = ' <a href="/wiki/Special:WhatLinksHere/'+h2header.children('a').attr('title')+'">(links)</a> <a href="/wiki/'+h2header.children('a').attr('title')+'?action=history">(history)</a>'; h2header.append(link); } /* Special:SearchDigest better functionality */ if (specialpage == "SearchDigest") { $('#mw-content-text ul li').each(function {   link = $(this).children('a'),    title = link.attr('title'),    href = link.attr('href');    if (title.split('(page does not exist)').length == 1)      $(this).remove;    link.click(function { document.open(href+"&digest=redirect",'_blank'); }); }); } }) (this.jQuery, this.mediaWiki);
 * (function($, mw) {

//Special CSS controller jQuery(function ($) {   if (mw.config.get('wgCanonicalSpecialPageName') === 'CSS') {        $(".css-editor").prepend(" 100% ");    };    var countcss = 0;    $("#buttom-css").click(function  { countcss += 1; if (countcss == 1) { $(this).text("Default"); $(".css-editor-wrapper").css("width", "100%"); $(".css-side-bar").css("display", "none"); $(".ace_gutter").css("display", "none"); $(".ace_scroller").css("left", "0px"); }       if (countcss == 2) { $(this).text("100%"); $(".css-editor-wrapper").css("width", "auto"); $(".css-side-bar").css("display", "block"); $(".ace_gutter").css("display", "block"); $(".ace_scroller").css("left", "49px"); countcss = 0 }   }); });

/* 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('<textarea id="output-box" rows="10" cols="100"> '); 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

if ((wgAction == 'submit' || wgAction == 'edit') && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://img2.wikia.nocookie.net/__cb1408628901/common/avatars/thumb/f/ff/4572079.png/20px-4572079.png", "speedTip": "Create user page", "tagOpen": "", "tagClose": "", "sampleText": ""}; }

/*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('<img src="' + UrlImg + '" style="display:none" id="realsize-img-' + ChangesCount + '">'); $('#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; });