// ==UserScript==
// @name Carly Sandstrom - Salesforce Contact
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author turker
// @grant none
// @include *
// ==/UserScript==
document.getElementsByClassName("panel panel-primary")[0].innerHTML = "";
document.getElementsByClassName("panel panel-primary")[1].innerHTML = "";
document.getElementsByName("FirstNameAnswer")[0].checked = true;
document.getElementsByName("LastNameAnswer")[0].checked = true;
document.getElementsByName("Q1Answer")[0].checked = true;
document.getElementsByName("TitleConfidence")[0].checked = true;
document.getElementById("submitButton").focus();
var firstLetter = "";
var nextLetter = "";
var firstName = document.getElementsByClassName("container")[0].getElementsByTagName("h3")[0].innerText.replace("First Name: ","");
var lastName = document.getElementsByClassName("container")[0].getElementsByTagName("h3")[1].innerText.replace("Last Name: ","");
//firstLetter = lastName.substr(0,1);
//if (firstLetter == firstLetter.toLowerCase()) {
// firstLetter = firstLetter.toUpperCase();
// lastName = lastName.replace(lastName.substr(0,1),firstLetter);
// document.getElementsByName("UpdatedLastName")[0].value = lastName;
// document.getElementsByName("LastNameAnswer")[1].checked = true;
//}
for (a=1;a<lastName.length;a++) {
nextLetter = lastName.substr(a,1);
if (nextLetter == nextLetter.toUpperCase()) {
nextLetter = nextLetter.toLowerCase();
lastName = lastName.replace(lastName.substr(a,1),nextLetter);
document.getElementsByName("UpdatedLastName")[0].value = lastName;
document.getElementsByName("LastNameAnswer")[1].checked = true;
}
}
var title = document.getElementsByClassName("row col-xs-12 col-md-12")[1].getElementsByTagName("section")[0].getElementsByTagName("h3")[0].innerText;
title = title.replace("Title: ","");
var fragment = title.indexOf("(");
if (fragment > -1) {
title = title.substr(0,fragment);
document.getElementsByName("Q1Answer")[1].checked = true;
document.getElementsByName("CorrectTitle")[0].value = title;
}
var replaceThis = [];
replaceThis[0] = "EVP";
replaceThis[1] = "SVP";
replaceThis[2] = "svp";
replaceThis[3] = ",";
replaceThis[4] = "CFO";
replaceThis[5] = "cfo";
replaceThis[6] = "CEO";
replaceThis[7] = "ceo";
replaceThis[8] = "AVP";
replaceThis[9] = "vp";
replaceThis[10] = " - ";
replaceThis[11] = "?";
replaceThis[12] = " / ";
replaceThis[13] = "/";
replaceThis[14] = "Govt";
replaceThis[15] = "Gov't";
replaceThis[16] = "Sr.";
replaceThis[17] = "AA";
replaceThis[18] = "Dev.";
replaceThis[19] = "Mgr";
replaceThis[20] = "Exec ";
replaceThis[21] = "Asst";
replaceThis[22] = "COO";
replaceThis[23] = "Corp.";
replaceThis[24] = "Corp ";
replaceThis[25] = "Govt.";
replaceThis[26] = "Gov.";
replaceThis[27] = "Gov ";
replaceThis[28] = "PR ";
replaceThis[29] = "Dir ";
replaceThis[30] = "Admin ";
replaceThis[31] = "Admin.";
replaceThis[32] = " & ";
replaceThis[33] = "&";
replaceThis[34] = "GM";
replaceThis[35] = " Rep ";
replaceThis[36] = " Fed ";
replaceThis[37] = "Assoc.";
replaceThis[38] = "Comm.";
replaceThis[39] = " Comm ";
replaceThis[40] = "Exec.";
replaceThis[41] = "Exec ";
replaceThis[42] = " PAC ";
replaceThis[43] = "HR ";
replaceThis[44] = "VP";
var newWord = [];
newWord[0] = "Executive Vice President";
newWord[1] = "Senior Vice President";
newWord[2] = "Senior Vice President";
newWord[3] = " of";
newWord[4] = "Chief Financial Officer";
newWord[5] = "Chief Financial Officer";
newWord[6] = "Chief Executive Officer";
newWord[7] = "Chief Executive Officer";
newWord[8] = "Assistant Vice President";
newWord[9] = "Vice President";
newWord[10] = " of ";
newWord[11] = "";
newWord[12] = " and ";
newWord[13] = " and ";
newWord[14] = "Government";
newWord[15] = "Government";
newWord[16] = "Senior";
newWord[17] = "Administrative Assistant";
newWord[18] = "Development";
newWord[19] = "Manager";
newWord[20] = "Executive ";
newWord[21] = "Assistant";
newWord[22] = "Chief Operating Officer";
newWord[23] = "Corporate";
newWord[24] = "Corporate";
newWord[25] = "Government";
newWord[26] = "Government";
newWord[27] = "Government ";
newWord[28] = "Public Relations ";
newWord[29] = "Director ";
newWord[30] = "Administrative ";
newWord[31] = "Administrative";
newWord[32] = " and ";
newWord[33] = "and";
newWord[34] = "General Manager ";
newWord[35] = " Representative ";
newWord[36] = " Federal ";
newWord[37] = "Associate";
newWord[38] = "Communication";
newWord[39] = " Communication ";
newWord[40] = "Executive";
newWord[41] = "Executive ";
newWord[42] = " Political Action Committee ";
newWord[43] = "Human Resources ";
newWord[44] = "Vice President";
for (i=0;i<replaceThis.length;i++) {
if (title.indexOf(replaceThis[i]) > -1) {
document.getElementsByName("Q1Answer")[1].checked = true;
title = title.replace(replaceThis[i],newWord[i]);
document.getElementsByName("CorrectTitle")[0].value = title;
}
}