User:RainingPain17/global.js

importScriptPage( 'MediaWiki:AjaxDiff/code.js', 'dev' ); importScriptPage('MediaWiki:Rollback/code.js', 'dev');

/**********************/ /* Back to top button by Loleil */ /**********************/ importScriptPage('BackToTopButton/code.js', 'dev');

//************ //Auto Refresh //************ window.ajaxPages = ["Special:RecentChanges","Special:Watchlist","Special:WikiActivity","Special:Contributions"]; importArticles({   type: 'script',    articles: [        'u:dev:AjaxRC/code.js',    ] }); //**************** //End Auto Refresh //****************

/** * "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 * * @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  * (c) 2014 sactage * */ (function fixGlobalNav {   var localNav = document.querySelector('.WikiHeader .navbackground'),        navStyle = window.getComputedStyle(localNav),        bgColor = navStyle.getPropertyValue('background-color'),        textColor = navStyle.getPropertyValue('color'),        borderElements = document.querySelectorAll('.global-navigation .page-width, .global-navigation-item'),        globalNav = document.querySelector('.global-navigation'),        bgParse = bgColor.match(/(\d+), (\d+), (\d+)/).splice(1),        gt127 = 0,        arrowColor,        arwStyle = document.createElement('style');    // 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]) > 127 && gt127++;    if (gt127 < 2)        arrowColor = 'white';    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 + '; }'; 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; globalNav.style.color = textColor; });

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

importArticle({   type: 'script',    article: 'u:dev:NullEditButton/code.js' });