User:Outriggr/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
function winc(s) { s = s.replace(/^\[\[/, '').replace(/\]\]$/, ''); document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=' + s + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); } winc('[[User:Outriggr/metadatatest.js]]'); assessmentMyProjects = ["WPBiography", "Visual arts", "Environment", "WPMILHIST"]; assessmentDefaultWorkGroup = "s&a-work-group"; //winc('[[User:Dr_pda/prosesize.js]]'); winc('[[User:Gimmetrow/fixRefs.js]]'); winc('[[User:Omegatron/monobook.js/addlink.js]]'); winc('[[User:Lupin/popups.js]]'); popupFixDabs=true; popupRedlinkRemoval=true; //winc('[[User:Dschwen/wikiminiatlas2.js]]'); //begin - Adds category template button addOnloadHook( 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 = "[[Category:|" + name + "]]" + (years[0] ? "\n[[Category:" + years[0] + " births|" + name + "]]" : "") + (years[1] ? "\n[[Category:" + years[1] + " deaths|" + name + "]]" : ""); mwCustomEditButtons[mwCustomEditButtons.length] = {"imageFile": 'http://upload.wikimedia.org/wikipedia/en/b/b1/Button_key.PNG', "speedTip": 'Insert category key', "tagOpen": '', "tagClose": newTxt, "sampleText": ''}; } ); // end