User:WOSlinker/birth.js

function birth_queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }   return null; }

//Add a 'Birth edit' tab if(mw.config.get('wgNamespaceNumber') != -1 && mw.config.get('wgArticleId') != 0) { $( function birthqEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',birth:true}), 'birth', 'p-birth', 'Birth edit this page');   } )} if(mw.config.get('wgAction') == 'edit' && birth_queryString('birth') == 'true') { $(function birth {      var myContent = document.getElementById('wpTextbox1').value;       myContent = myContent.replace(/\| birthname     =/,'| birth_name    =');       myContent = myContent.replace(/\| birthdate     =/,'| birth_date    =');       myContent = myContent.replace(/\| birthplace    =/,'| birth_place   =');       myContent = myContent.replace(/\| deathdate     =/,'| death_date    =');       myContent = myContent.replace(/\| deathplace    =/,'| death_place   =');       myContent = myContent.replace(/\| birthplace[ ]*=/,'| birth_place   ='); /*       myContent = myContent.replace(/\|[ ]*dateofbirth[ ]*=/,'| birth_date  =');       myContent = myContent.replace(/\|[ ]*cityofbirth[ ]*=/,'| birth_place =');       myContent = myContent.replace(/\n\|[ ]*countryofbirth[ ]*=/,', ');       myContent = myContent.replace(/\|[ ]*dateofdeath[ ]*=/,'| death_date  =');       myContent = myContent.replace(/\|[ ]*cityofdeath[ ]*=/,'| death_place ='); myContent = myContent.replace(/\|[ ]*date_of_birth[ ]*=/,'| birth_date ='); myContent = myContent.replace(/\|[ ]*place_of_birth[ ]*=/,'| birth_place ='); myContent = myContent.replace(/\|[ ]*date_of_death[ ]*=/,'| death_date ='); myContent = myContent.replace(/\|[ ]*place_of_death[ ]*=/,'| death_place ='); myContent = myContent.replace(/\|[ ]*date of birth[ ]*=/,'| birth_date ='); myContent = myContent.replace(/\|[ ]*place of birth[ ]*=/,'| birth_place ='); myContent = myContent.replace(/\|[ ]*date of death[ ]*=/,'| death_date ='); myContent = myContent.replace(/\|[ ]*place of death[ ]*=/,'| death_place ='); myContent = myContent.replace(/\|birthname[ ]*=/,'|birth_name ='); myContent = myContent.replace(/\|birthdate[ ]*=/,'|birth_date ='); myContent = myContent.replace(/\|birthplace[ ]*=/,'|birth_place ='); myContent = myContent.replace(/\|deathdate[ ]*=/,'|death_date ='); myContent = myContent.replace(/\|deathplace[ ]*=/,'|death_place ='); myContent = myContent.replace(/\|[ ]*birthname[ ]*=/,'| birth_name ='); myContent = myContent.replace(/\|[ ]*birthdate[ ]*=/,'| birth_date ='); myContent = myContent.replace(/\|[ ]*birthplace[ ]*=/,'| birth_place ='); myContent = myContent.replace(/\|[ ]*deathdate[ ]*=/,'| death_date ='); myContent = myContent.replace(/\|[ ]*deathplace[ ]*=/,'| death_place ='); /*      myContent = myContent.replace(/\|birth date[ ]*=/,'|birth_date  ='); myContent = myContent.replace(/\|birthplace[ ]*=/,'|birth_place ='); myContent = myContent.replace(/\|birth place[ ]*=/,'|birth_place ='); myContent = myContent.replace(/\|death date[ ]*=/,'|death_date ='); myContent = myContent.replace(/\|death place[ ]*=/,'|death_place ='); if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='update birth/death params in infobox, see '+'Template talk:Infobox person/birth death params'; document.getElementById('wpMinoredit').checked = true; }   } )}