User:Lunarity/global.js

/* * JavaScript to Toggle the Wikia Rail on and off. * Adds a button to the toolbar that allows expand/shrink. * * Exploits oasis-one-column for formatting. one-column occurs normally * on special pages like Edit, RecentChanges, Diff, etc so we don't do * anything on those pages. (Edit still has the Rail but it provides a * built-in collapser for it) */

if (skin === "oasis") { $(function($) {   var _expandMsg = "Expand Content -->",        _shrinkMsg = "Shrink Content <--";

function expandContent {       $("#WikiaRail").hide; $("#WikiaPageHeader").append($("#WikiaSearch").detach); $(document.body).addClass("oasis-one-column"); }   function shrinkContent {       $(document.body).removeClass("oasis-one-column"); $("#WikiaRail").prepend($("#WikiaSearch").detach).show; }   function handleClick(event) {       var $this = $(event.target); if ($this.text === _expandMsg) { expandContent; $this.text(_shrinkMsg); } else { shrinkContent; $this.text(_expandMsg); }       return false; }

if (!$(document.body).hasClass("oasis-one-column")) { var toolbar = $("#WikiaFooter > .toolbar > .tools"); if (toolbar.length) { $("", {               href: "#",                text: _expandMsg,            }).click(handleClick).appendTo("").parent.appendTo(toolbar); }   } }); }