User:Gary/printable.js

/*	PRINTABLE VERSION function printableVersion {	var isPrintable = location.href.match(/&printable=yes/) ? true : false; if (!isPrintable) return false; $('.rellink').remove; // Remove "rellink" class $('.thumb').remove; // Remove thumbbed images $('.topicon').remove; // Remove top icons $('.infobox').remove; // Remove infoboxes $('.sidebar').remove; // Remove navboxes $('.dablink').remove; // Remove dablinks $('.toc').remove; // Remove TOCs $('span[title="pronunciation:"]').remove; // "Pronounciation" images $('span.IPA').remove; // "IPA" help $('a.image').remove; // Inline image-links

// Super- and sub-script stuff to remove $('sup.reference').remove; // Remove inline references $('sup.Inline-Template').remove; // "dead link", etc. $('sup.Template-Fact').remove; // "citation needed", etc.

// Unwrap all italics $('#mw-content-text i').each(function { $(this).replaceWith($(this).contents); });

// Retitle the page var title = $('title:eq(0)').text; $('title:eq(0)').text(title.replace(', the free encyclopedia', ''));

var firstParagraph = $('.mw-content-ltr').children('p:eq(0)'); // Remove first paragraph if it contains "Coordinates" if (firstParagraph.text.indexOf('Coordinates:') == 0) {		firstParagraph = firstParagraph.next; firstParagraph.prev.remove; }	// FIXME Strip ONLY bold formatting from first paragraph; eventually needs to be fixed elsewhere. // Replace all HTML in the first paragraph, because  and , among others, cause problems. firstParagraph.html(firstParagraph.text); // Remove fixed width for TOC $('.ns-0 .toc').css('max-width', 'none'); // Remove lists of references, but indicate how many were removed $('.references').each(function	{		var ref = $(this);		var numberOfReferences = ref.children.length;		if (ref.parent.hasClass('reflist')) ref.parent.replaceWith(ref);		ref.replaceWith(' ' + numberOfReferences + ' notes ' + (numberOfReferences == 1 ? 'was' : 'were') + ' in this section. ');	}); // Change categories heading to an actual heading var cats = $('#mw-normal-catlinks'); cats.contents.eq(1).remove; cats.contents.eq(0).replaceWith(' ' + cats.contents.eq(0).text + ' '); $('h2, h3, h4, h5, h6').before(' '); // Add more lines before headings // Remove links $('a').each(function	{		var link = $(this);		if (!link.children.length) link.replaceWith(link.contents.eq(0));	}); }

$(printableVersion);