MediaWiki:ToggleSideBar/code.js

/** * Name:       ToggleSideBar * Author:     KockaAdmiralac <1405223@gmail.com> * Description: Adds a button for toggling the side bar */ $(function {   if($("#WikiaRail").length === 0) {        return;    }    $("#WikiHeader .buttons").append(mw.html.element("button", {        class: "wikia-menu-button secondary",        id: "ToggleSideBarButton"    }, "Toggle side bar"));    $("#ToggleSideBarButton").click(function { if($("#WikiaRail").css("display") === "block") { $("#WikiaRail").fadeToggle("slow", null, function {               $("#WikiaMainContent").animate({width: "100%"}, "slow");            }); } else { $("#WikiaMainContent").animate({width: ($("#WikiaPage").width - 320) + "px"}, "slow", null, function {               $("#WikiaRail").fadeToggle;            }); }   }); });