User:Renamed user QaFQqK56bnsHrz/lowercaseheadings.js

// if someone wants to tell me the 'right' way to set up a gadget like this these days, please do.

if (document.editform && typeof document.editform.wpTextbox1 !== 'undefined') { mw.util.addPortletLink('p-tb', '#', 'Lower-case headings', 'tb-lowercaseheadings', 'Makes all headings sentence case',	''); $('#tb-lowercaseheadings').click(lchOnClick); }

function lchOnClick{ txt = document.editform.wpTextbox1; txt.value = txt.value.replace(/(=+ *\w)(.+ *=+ *\n)/g, function($0,$1,$2) {return $1+$2.toLowerCase;}); }