User:Eladkse/global.js

/* add a button that increases the content size and hides the rail - 2/1/11 */ function CreateContentResizeButton { var headerWidth = $('header#WikiaPageHeader.WikiaPageHeader details').width; var contentWidth = $('article#WikiaMainContent.WikiaMainContent').width; var catlinksWidth = $('div#catlinks.catlinks').width; if(contentWidth < 1000) { $('section article header ul.wikia-menu-button').after('&#160;Hide Sidebar&#160;'); $('section article header a.wikia-button').after('&#160;Hide Sidebar&#160;'); $('section article header a.view-source').after('&#160;Hide Sidebar&#160;'); if(wgCanonicalNamespace == 'User_blog') { $('section article div#WikiaUserPagesHeader a.wikia-button').after('&#160;Hide Sidebar&#160;'); }	} } addOnloadHook(CreateContentResizeButton); function ExpandContent(headerWidth, contentWidth, catlinksWidth) { $('header#WikiaPageHeader.WikiaPageHeader details').css({"width": '980px'}); $('article#WikiaMainContent.WikiaMainContent').css({"width": '1000px'}); $('div#catlinks.catlinks').css({"width": '1000px'}); $('div#WikiaRail.WikiaRail').css({"display": 'none'}); $('nav.RelatedPagesModule ul').css({"margin-left": '165px'}); $('ul#resizeButton').replaceWith('<a onclick="CompressContent(' + headerWidth + ', ' + contentWidth + ', ' + catlinksWidth + ');" data-id="resizeButton" style="color:#fff;" title="Compress the content area back to its original width, and restore the sidebar.">&#160;Show Sidebar&#160;</a></ul>'); }

function CompressContent(headerWidth, contentWidth, catlinksWidth) { $('header#WikiaPageHeader.WikiaPageHeader details').css({"width": headerWidth}); $('article#WikiaMainContent.WikiaMainContent').css({"width": contentWidth}); $('div#catlinks.catlinks').css({"width": catlinksWidth}); $('div#WikiaRail.WikiaRail').css({"display": 'block'}); $('nav.RelatedPagesModule ul').css({"margin-left": '0px'}); $('ul#resizeButton').replaceWith('<a onclick="ExpandContent(' + headerWidth + ', ' + contentWidth + ', ' + catlinksWidth + ');" data-id="resizeButton" style="color:#fff;" title="Expands the content area. Note that this will hide the sidebar.">&#160;Hide Sidebar&#160;</a></ul>'); }

function HistoryDropdownMenuItem { if ($('ul.wikia-menu-button').length === 0) { $('#WikiaPageHeader a.wikia-button').removeClass('wikia-button').wrap('').wrap('<li/>'); $('ul.wikia-menu-button').append('<img class="chevron" src="http://images1.wikia.nocookie.net/__cb34175/common/skins/common/blank.gif"></ul>'); }		$('ul.wikia-menu-button ul').append('<li><a href="/index.php?title='+ encodeURIComponent (wgPageName) +'&action=history">History</a></li>'); } addOnloadHook(HistoryDropdownMenuItem);

function PurgeDropdownMenuItem { if ($('ul.wikia-menu-button').length === 0) { $('#WikiaPageHeader a.wikia-button').removeClass('wikia-button').wrap('').wrap('<li/>'); $('ul.wikia-menu-button').append('<img class="chevron" src="http://images1.wikia.nocookie.net/__cb34175/common/skins/common/blank.gif"></ul>'); }		$('ul.wikia-menu-button ul').append('<li><a href="/index.php?title='+ encodeURIComponent (wgPageName) +'&action=purge">Purge</a></li>'); } addOnloadHook(PurgeDropdownMenuItem);