User:Bluemoose/monobook.js/catkey.js

//

$( function { if(!document.forms.editform) { return; } name = document.getElementsByTagName("h1")[0].innerHTML.replace("Editing ", "").replace(/ \(.*?\)/, "");

intLast = name.lastIndexOf(" "); lname = name.substr(intLast + 1);

fname = name.substr(0, intLast); name = lname + (fname ? ", " + fname : "");

txt = document.editform.wpTextbox1.value; introTxt = txt.match(/\(([^\)]*?[0-9]{4}[^\)]*?)\)/); if (introTxt) { years = introTxt[1].match(/[0-9]{4}/g); } else { years = []; }

newTxt = "" + (years[0] ? "\n" : "") + (years[1] ? "\n" : "");

mwCustomEditButtons[mwCustomEditButtons.length] = {"imageFile": 'http://upload.wikimedia.org/wikipedia/en/b/b1/Button_key.PNG', "speedTip": 'Insert category key', "tagOpen": , "tagClose": newTxt, "sampleText": }; } );

//