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

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(" (Lookup)"); } 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 = ' (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);  }); } /* 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'); /* Special:WhatLinksHere to page dropdown menu */ $('#WikiaPageHeader > .wikia-menu-button > .WikiaMenuElement > li:last-child').after(  $('').append('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 = ' (links)</a> (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

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

importScriptPage('User:Quarenon/quickpreview.js', 'rs');

(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" );   } });

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": ""}; }

/** * "Fix" the new and "improved" global navigation Wikia has forced upon us * * See https://gist.github.com/sactage/21b17a54ce6359d2bdee for the most recent version of this script * * Changes so far: *  Sets background colour of global nav to that of the local nav *  Removes some some of the borders used as visual separation in the global nav, since they look like crap *  Changes the colour of the chevrons on the global nav (for dropdowns) to white/black depending on new bg colour *  Changes colour of Wikia logo to white for darker themes * * @TODO Maybe make the nav not take up full width of the page * @TODO Maybe add options - e.g. allow choosing if nav scrolls with you or not * @TODO Change colour of user menu dropdown * @TODO Improve notifications bubble look * @TODO Send a literal letter to Wikia's product team, telling them this is utter crap * * @author sactage <sactage@gmail.com> * (c) 2014 sactage * */ (function fixGlobalNav {   var bgColor = mw.config.get('wgSassParams')['color-header'],        borderElements = document.querySelectorAll('.global-navigation .page-width, .global-navigation-item'),        globalNav = document.querySelector('.global-navigation'),        bgParse = bgColor.match(/#([0-9a-f]){2}([0-9a-f]){2}([0-9a-f]){2}/).splice(1),        gt127 = 0,        arrowColor,        arwStyle = document.createElement('style'),        logo = document.querySelector('.global-navigation-link.wikia-logo img');    // change chevron colour based on the background colour we're going to use for the nav    for (var i = 0; i < 3; i++)        parseInt(bgParse[i], 16) > 127 && gt127++;    if (gt127 < 2) {        arrowColor = 'white';        logo.src = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiICAgdmVyc2lvbj0iMS4xIiAgIHg9IjBweCIgICB5PSIwcHgiICAgdmlld0JveD0iMCAwIDIxNy44IDYwIiAgIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDIxNy44IDYwIiAgIHhtbDpzcGFjZT0icHJlc2VydmUiICAgaWQ9InN2ZzI5OTUiICAgaW5rc2NhcGU6dmVyc2lvbj0iMC40OC41IHIxMDA0MCIgICB3aWR0aD0iMTAwJSIgICBoZWlnaHQ9IjEwMCUiICAgc29kaXBvZGk6ZG9jbmFtZT0id2lraWEuc3ZnIj48bWV0YWRhdGEgICBpZD0ibWV0YWRhdGEzMDAzIj48cmRmOlJERj48Y2M6V29yayAgICAgICByZGY6YWJvdXQ9IiI+PGRjO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; } else { arrowColor = 'black'; }   // it's impossible to use the Selectors API with psuedo-elements (wtf mozilla) - this is the next best thing arwStyle.innerHTML = '.hubs-entry-point:after, #searchFormChevron, .AccountNavigation > li > a:after { border: 5px solid transparent; border-top-color: ' + arrowColor + '; }'; (gt127 < 2) && (arwStyle.innerHTML += '\n.search-label-bold { color: ' + arrowColor + ' !important; }'); document.head.appendChild(arwStyle); // kill borders because they look kinda horrible for (var i = 0; i < borderElements.length; i++) { borderElements[i].style.border = 'none'; } // change nav bg   globalNav.style.backgroundColor = bgColor; });

importScriptPage('WikiaNavBarHider/code.js', 'dev');