Jump to content

User:Auscompgeek/monobook.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Pathoschild (talk | contribs) at 03:51, 9 August 2015 (updated scripts, migrated deprecated functions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 * @update-token [[File:pathoschild/templatescript.js]]
 */
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
	pathoschild.TemplateScript.add([
		{
			name: 'Cleanup web jargon',
			script: function(context) {
				context.helper
					.replace(/\bi\b/g,"I")
					.replace(/\bu\b/g,"you")
					.replace(/\by?ur\b/g,"your")
					.replace(/\byoure\b/g,"you're")
					.replace(/\bwhats\b/g,"what's")
					.replace(/\bthats\b/g,"that's")
					.replace(/\bpl[ea]{0,2}(s|z)\b/g,"please")
					.replace(/\b(than(x|z)|thx)\b/g,"thanks")
					.replace(/\b(ty|thank ?(you|u|ya|ye)|ta)\b/g,"thank you")
					.replace(/\bsrr?y\b/g,"sorry")
					.replace(/\bdont\b/g,"don't")
					.replace(/\bb4\b/g,"before")
					.replace(/\bi\'?m\b/g,"I'm")
					.replace(/\bdunno\b/g,"don't know")
					.replace(/\bbrb\b/g,"be right back")
					.replace(/\bi ?dk\b/g,"I don't know")
					.replace(/\bi ?dr\b/g,"I don't remember")
					.replace(/\b(b?cuz)|(b\/c(uz)?)\b/g,"because")
					.replace(/\bdat\b/g,"that")
					.replace(/\br\b/g,"are")
					.replace(/\biirc\b/g,"if I recall/remember correctly")
					.replace(/\bd\/l\b/g,"download")
					.replace(/\bawsome\b/g,"awesome")
					.appendEditSummary("Cleaned up 'web jargon'");
			}
		},
	]);
});

document.title = document.title.replace(/, the free encyclopedia$/, "");