User:Heaven Sent/common.js

/* add 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) { $('section article header ul.wikia-menu-button').after(' Expand <--> '); $('section article header a.wikia-button').after(' Expand <--> '); $('section article header a.view-source').after(' Expand <--> '); if(wgCanonicalNamespace == 'User_blog') { $('section article div#WikiaUserPagesHeader a.wikia-button').after(' Expand <--> '); }	} } 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 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('<a onclick="ExpandContent(' + headerWidth + ', ' + contentWidth + ', ' + catlinksWidth + ');" data-id="resizeButton" style="color:#fff;" title="Expands the content area. Note that this will hide the side rail."> Expand <--> </a></ul>'); }

/* Saft's Weekly Penguin Tool */ (function (mw, $) {	'use strict';	var		wgAction = mw.config.get( 'wgAction' ),		wgPageName = mw.config.get( 'wgPageName' ),		scripts = [],		styles = [];	if ((wgPageName === 'User:Saftzie/Penguins') && (wgAction === 'view')) {		scripts.push('User:Saftzie/app.phsl.js'); // User:Saftzie/app.phsl.js	}	if (scripts.length) {		importArticles({ type: 'script', articles: scripts });	}	if (styles.length) {		importArticles({ type: 'style', articles: styles });	} }(mediaWiki, jQuery));