User:Sankura/common.js

mw.loader.using('mediawiki.util', function {

$(document).ready(function {		var pageBeforeEdit;		var modifiedPage;		var previousSummary;

//add a tab on the left var slink = mw.util.addPortletLink("p-tb", "#", "Fix shit", "t-fix-shit", "fix sickeningly bad writing"); $(slink).click(function (event) {			event.preventDefault;			editPage;		}); function doEdit { document.editform.wpTextbox1.value = modifiedPage; }		function setEditSummary(summary) { previousSummary = document.editform.wpSummary.value; if (previousSummary !== "") { if (!previousSummary.includes(summary)) { document.editform.wpSummary.value = document.editform.wpSummary.value + " | " + summary; }			}			else { document.editform.wpSummary.value = summary; }		}		function editPage { pageBeforeEdit = document.editform.wpTextbox1.value; modifiedPage = pageBeforeEdit.replace(/([bB])ased off of/g,"$1ased on").replace(/([bB])ased off/g,"$1ased on"); doEdit; setEditSummary("grammar"); document.getElementById("wpDiff").click }	}); });