User:WOSlinker/abi.js

function abi_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 'AbI edit' tab if(mw.config.get('wgNamespaceNumber') != -1 && mw.config.get('wgArticleId') != 0) { $( function abqEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',abi:true}), 'abi', 'p-abi', 'AbI edit this page');   } )} if(mw.config.get('wgAction') == 'edit' && abi_queryString('abi') == 'true') { $(function abi {       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(/\| 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(/\|birthdate=/,'|birth_date='); myContent = myContent.replace(/\|birthplace=/,'|birth_place='); myContent = myContent.replace(/\|dateofdeath=/,'|death_date='); myContent = myContent.replace(/\|deathdate=/,'|death_date='); myContent = myContent.replace(/\|deathplace=/,'|death_place=');

myContent = myContent.replace(/\| birthdate     =/,'| birth_date      ='); myContent = myContent.replace(/\| birthname     =/,'| birth_name     =');

myContent = myContent.replace(/\n\|\s*networth\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*ancestry\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*boards\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*current occupation\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*employer\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*father\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*grandchildren\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*home_town\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*languagesspoken\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*laterwork\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*law school\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*mother\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*party colour\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*email\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*ethnicity\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*salary\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*salary2\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*salary3\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*parents\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*death_cause\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*image_width\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*small_image\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*image_width\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*home_town\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*known_for\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*other_names\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*years_active\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*dead\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*dead\s*=\s*yes\n/,'\n'); myContent = myContent.replace(/\n\|\s*dead\s*=\s*dead\n/,'\n'); myContent = myContent.replace(/\n\|\s*dead\s*=\s*alive\n/,'\n'); myContent = myContent.replace(/\n\|\s*dead\s*=\s*\n/,'\n'); myContent = myContent.replace(/\n\|\s*Educational background\s*=\s*\n/,'\n');

myContent = myContent.replace(/\|birth_date   = /,'|birth_date     = '); myContent = myContent.replace(/\|placeofbirth  = /,'|birth_place    = '); myContent = myContent.replace(/\n\|countryofbirth = /,', ');

/*      myContent = myContent.replace(/\|\ playername = /,'| name = '); myContent = myContent.replace(/\|\ playername         = /,'| name                = '); myContent = myContent.replace(/\|\ dateofbirth =/,'| birth_date ='); myContent = myContent.replace(/\|\ dateofdeath =/,'| death_date ='); myContent = myContent.replace(/\|\ cityofdeath = /,'| death_place = '); myContent = myContent.replace(/\n\|\ countryofdeath = /,', '); myContent = myContent.replace(/\|\ cityofbirth =, /,'| birth_place = '); myContent = myContent.replace(/\|\ birth_place =, /,'| birth_place = '); myContent = myContent.replace(/\|\ death_place =, /,'| death_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(/\n\|\ countryofdeath     = /,', '); myContent = myContent.replace(/\|\ birth_place        =, /,'| birth_place         = '); myContent = myContent.replace(/\|\ death_place        =, /,'| death_place         = ');

myContent = myContent.replace(/\|\         playername = /,'|                name = '); 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(/\n\|\     countryofdeath = /,', '); myContent = myContent.replace(/\|\        birth_place =, /,'|         birth_place = '); myContent = myContent.replace(/\|\        death_place =, /,'|         death_place = ');

/*      myContent = myContent.replace(/\[\[North\]\]/,'North'); myContent = myContent.replace(/\[\[North\]\]/,'North'); myContent = myContent.replace(/\[\[north\]\]/,'north'); myContent = myContent.replace(/\[\[South\]\]/,'South'); myContent = myContent.replace(/\[\[south\]\]/,'south'); myContent = myContent.replace(/\[\[East\]\]/,'East'); myContent = myContent.replace(/\[\[east\]\]/,'east'); myContent = myContent.replace(/\[\[West\]\]/,'West'); myContent = myContent.replace(/\[\[west\]\]/,'west'); if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; //          document.getElementById('wpSummary').value='unlink compass directions'; document.getElementById('wpSummary').value='update infobox, see '+'Template talk:Infobox person/birth death params'; //          document.getElementById('wpSummary').value='update infobox, remove obsolete blank params'; document.getElementById('wpMinoredit').checked = true; }   } )}