Fandom

Terraria Wiki

Comments4

How to Hide the Sidebar

Dzylon March 7, 2012 User blog:Dzylon

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Introduction

You are all aware of the sidebar positioned to the right of every page. This bar contains the wiki chat box, hot spots list, and search bar. However, the bar takes up a whopping 400 pixels, leaving the article with only 600. That's right, the sidebar takes up 40% of all article space. Did you know that you know that you can disable the sidebar, leaving an article width of one thousand pixels? Thanks to Monchoman45, famous for his contributions to community central, you can do just that.

Implementation

Implementation instructions are as follows:

  1. Navigate to your global.js file.
  2. Create the page with the following text:
/* adds a button that increases the content size and hides the rail */
function CreateContentResizeButton() {
	var headerWidth = $('header#WikiaPageHeader.WikiaPageHeader details').width();
	var contentWidth = $('article#WikiaMainContent.WikiaMainContent').width();
	var catlinksWidth = $('div#catlinks.catlinks').width();
	if(contentWidth < 1000) {
		$('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'});
		$('section article header ul.wikia-menu-button').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="CompressContent();" data-id="resizeButton" style="color:#fff;" title="Restore the side rail.">Compress</a></ul>');
		$('section article header a.wikia-button').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="CompressContent();" data-id="resizeButton" style="color:#fff;" title="Restore the side rail.">Compress</a></ul>');
		$('section article header a.view-source').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="CompressContent();" data-id="resizeButton" style="color:#fff;" title="Restore the side rail.">Compress</a></ul>');
		if(wgCanonicalNamespace == 'User_blog') {
			$('section article div#WikiaUserPagesHeader a.wikia-button').after('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="CompressContent();" data-id="resizeButton" style="color:#fff;" title="Restore the side rail.">Compress</a></ul>');
		}
	}
}
 
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('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="CompressContent(' + headerWidth + ', ' + contentWidth + ', ' + catlinksWidth + ');" data-id="resizeButton" style="color:#fff;" title="Restore the side rail.">Compress</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('<ul class="wikia-menu-button" id="resizeButton" style="margin-left:10px"><a onclick="ExpandContent(' + headerWidth + ', ' + contentWidth + ', ' + catlinksWidth + ');" data-id="resizeButton" style="color:#fff;" title="Hide the side rail.">Expand</a></ul>');
}

3.  Bypass your browser's cache (detailed on the top of the global.js page). Your sidebar is now disabled! What of the functions that existed on the sidebar before it was disabled?

Reform

You can always expand the bar once more, but it's often not necessary...

On Standard Pages

  • For chat, click "chat" on the "On the Wiki" tab. You can find this on the wiki's Navigation bar, near the top of every page.
  • To search, simply visit the home page, where the search bar remains.
  • Community Messages can not be seen without the sidebar. However, you can usually check out the front page for community messages.
  • You must restore the sidebar to see Community Hot Spots.

On Your Profile and Talk Page

Oddly, on user pages, the sidebar can not be restored. Here are other ways to access the functions that were found there:

  • To view your followed pages, visit Special:Following.
  • You may miss easy access to your point count and badge progression statuses. To view these, you must stop the page from loading the JavaScript, which can be accomplished easily, but in a very roundabout way. First, navigate to your user page. Note how the sidebar disappears after the content is loaded. To view the sidebar as before, simply stop the page from loading before the sidebar is hidden. If you stop the page too early or too soon, simply reload and try again.

Closing

Note: I made some very minor changes to the original JavaScript. The original can be found on the page I reference directly below.
Source: http://community.wikia.com/wiki/Forum:Increase_content_area_width
Special thanks and credits: Monchoman45

Also on Fandom

Random Wiki