User:Mooeypoo/User script demos/WrapHeadingsWithSimpleText.js

/** * User script demo: Wrap headings with simple text. * * NOTE: This is a super simple bear-bones demo for English/LTR wikis, only meant * to demonstrate the idea of replacing/wrapping and interacting with heading text. * In MediaWiki, we don't hard-code strings like this. We use the i18n library, * instead. If you want to work on an actual user script that does anything like * this, please see the expansion demo that showcases using i18n messages in * https://www.mediawiki.org/wiki/User:Mooeypoo/User_script_demos */ $( document ).ready( function {	// Select the first heading and all other heading in the article	$( '.firstHeading, .mw-headline' ).each( function  { // Get the original content var originalContent = $( this ).html; // Add a word before and a word after the original content // (But you should really do this using i18n library if you want		// to create an actual gadget/user script that does this!) $( this ).html( 'OMG, ' + originalContent + ', yo!' ); } ); } );