User:AndyZ/pdata.js

function pdata{ var persondata = new Array persondata[0] = new Array persondata[0][0] = /\'\'\'\s\((born\s|)(.{1,})[\-\)]/gi persondata[0][1] = /born\s[io]n\s.{0,}\[\[(January|February|March|April|May|June|July|August|September|October|November|December)(\s\d{1,})\]\]\, \[\[(\d{2,})/gi

thecat = /\[\[Category\:/gi var pd = new Array

if(thecat.test(document.editform.wpTextbox1.value)){

if(persondata[0][0].test(document.editform.wpTextbox1.value)){

pd[0] = RegExp.$2

} else if(persondata[0][1].test(document.editform.wpTextbox1.value)){ pd[0] = ""+RegExp.$1+RegExp.$2+", "+RegExp.$3 } else{ pd[0] = ""

}

// document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/(\n\[\[Category\:)/gi,"\n\n$1") //

} }

//adds peer review link to top bar (with your username, talk page, preferences, watchlist, etc.) $(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:pdata', 'persondata', 'ca-persondata', 'Adds template:persondata to the article', , );    } });