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

// PurgeButton PurgeButtonText = 'Purge'; if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null && wgNamespaceNumber != 500 && wgNamespaceNumber != 502 ) { addOnloadHook( addPurgeButton ); } var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code) function addPurgeButton { var theText = 'Refresh'; //default text, ala SMW if( typeof PurgeButtonText == "string" ) { theText = PurgeButtonText; }	switch( skin ) { case 'answers': /* forked from monaco, close enough, pass to monaco */ case 'awesome': /* you really shouldnt even have this value... */		case 'monaco_old': /* really, where are you getting these skin settings from... */		case 'monaco': $('#page_controls').append('<li id="control_purgebutton"><img src="/skins/common/blank.gif" class="sprite refresh" /><a id="ca-purge" href="/index.php?title='+encodeURIComponent(wgPageName)+'&action=purge" rel="nofollow" title="">'+ theText + '</a></li>'); break; case 'uncyclopedia': /* monobook clone, pass to monobook */ case 'wowwiki': /* monobook clone, pass to monobook */ case 'lostbook': /* monobook clone, pass to monobook */ case 'monobook': $('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a href="/index.php?title='+encodeURIComponent(wgPageName)+'&action=purge" title="">'+ theText + '</a></li>'); break; case 'oasis': case 'wikia': $(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? '#WikiaUserPagesHeader' : '#WikiaPageHeader') + ' > ul.wikia-menu-button > li > ul').append('<li><a href="/index.php?title='+encodeURIComponent(wgPageName)+'&action=purge" title="">'+ theText + '</a></li>'); break; } }