automatic voter reg_v2

Early Vote Redirect

Please wait while we redirect you

 

 

 

 

 

 

 

 

 

 

  var count = 0; //var cycle = setInterval(processForm, 500); var clicked = false; var iserr = false;     function getParameterByName(name, url) {        if (!url) url = window.location.href;        name = name.replace(/[\[\]]/g, '\\$&');        var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),            results = regex.exec(url);        if (!results) return null;        if (!results[2]) return '';        return decodeURIComponent(escape(results[2]));    } function convertString(str) {   console.log(str);   var arr = str.split('&');   console.log(arr.length);   var convertedString = '';   for(var i=0;i0) {         var code = arr[i].replace(/\#/g,'');         var codearr = code.split(';');         console.log(codearr[0]);         if(codearr.length>1) {          convertedString = convertedString + String.fromCharCode(codearr[0]) + codearr[1];         } else {           convertedString = convertedString + String.fromCharCode(codearr[0])   }      } else {         convertedString = convertedString+arr[i];      }   }   return convertedString; } function getStateRedirect() { var url = ''; switch(state) { case 'AL': url='https://www.vote411.org/alabama#early-voting'; break; case 'AK': url='https://www.vote411.org/alaska#early-voting'; break; case 'AZ': url='https://www.vote411.org/arizona#early-voting'; break; case 'AR': url='https://www.vote411.org/arkansas#early-voting'; break; case 'CA': url='https://www.vote411.org/california#early-voting'; break; case 'CO': url='https://www.vote411.org/colorado#early-voting'; break; case 'CT': url='https://www.vote411.org/connecticut#early-voting'; break; case 'DE': url='https://www.vote411.org/delaware#early-voting'; break; case 'DC': url='https://www.vote411.org/district-of-columbia#early-voting'; break; case 'FL': url='https://www.vote411.org/florida#early-voting' ; break; case 'GA': url='https://www.vote411.org/georgia#early-voting'; break; case 'HI': url='https://www.vote411.org/hawaii#early-voting'; break; case 'ID': url='https://www.vote411.org/idaho#early-voting'; break; case 'IL': url='https://www.vote411.org/illinois#early-voting'; break; case 'IN': url='https://www.vote411.org/indiana#early-voting'; break; case 'IA': url='https://www.vote411.org/iowa#early-voting'; break; case 'KS': url='https://www.vote411.org/kansas#early-voting'; break; case 'KY': url='https://www.vote411.org/kentucky#early-voting'; break; case 'LA': url='https://www.vote411.org/louisiana#early-voting'; break; case 'ME': url='https://www.vote411.org/maine#early-voting'; break; case 'MD': url='https://www.vote411.org/maryland#early-voting'; break; case 'MA': url='https://www.vote411.org/massachusetts#early-voting'; break; case 'MI': url='https://www.vote411.org/michigan#early-voting'; break; case 'MN': url='https://www.vote411.org/minnesota#early-voting'; break; case 'MS': url='https://www.vote411.org/mississippi#early-voting'; break; case 'MO': url='https://www.vote411.org/missouri#early-voting'; break; case 'MT': url='https://www.vote411.org/montana#early-voting'; break; case 'NE': url='https://www.vote411.org/nebraska#early-voting'; break; case 'NV': url='https://www.vote411.org/nevada#early-voting'; break; case 'NH': url='https://www.vote411.org/new-hampshire#early-voting'; break; case 'NJ': url='https://www.vote411.org/new-jersey#early-voting'; break; case 'NM': url='https://www.vote411.org/new-mexico#early-voting'; break; case 'NY': url='https://www.vote411.org/new-york#early-voting'; break; case 'NC': url='https://www.vote411.org/north-carolina#early-voting'; break; case 'ND': url='https://www.vote411.org/north-dakota#early-voting'; break; case 'OH': url='https://www.vote411.org/ohio#early-voting'; break; case 'OK': url='https://www.vote411.org/oklahoma#early-voting'; break; case 'OR': url='https://www.vote411.org/oregon#early-voting'; break; case 'PA': url='https://www.vote411.org/pennsylvania#early-voting'; break; case 'RI': url='https://www.vote411.org/rhode-island#early-voting'; break; case 'SC': url='https://www.vote411.org/south-carolina#early-voting'; break; case 'SD': url='https://www.vote411.org/south-dakota#early-voting'; break; case 'TN': url='https://www.vote411.org/tennessee#early-voting'; break; case 'TX': url='https://www.vote411.org/texas#early-voting'; break; case 'UT': url='https://www.vote411.org/utah#early-voting'; break; case 'VT': url='https://www.vote411.org/vermont#early-voting'; break; case 'VA': url='https://www.vote411.org/virginia#early-voting'; break; case 'WA': url='https://www.vote411.org/washington#early-voting'; break; case 'WV': url='https://www.vote411.org/west-virginia#early-voting'; break; case 'WI': url='https://www.vote411.org/wisconsin#early-voting'; break; case 'WY': url='https://www.vote411.org/wyoming#early-voting'; break; default: url='https://www.vote411.org/register'; } return url; } //var email = convertString(unescape(getParameterByName('email'))); var state = getParameterByName('state'); var stateRedirect = getStateRedirect(); setTimeout(function(){ if (stateRedirect.length > 0) {       window.location = stateRedirect;  } else { window.location = "https://ace.turbovote.org/?r=FB-fallback";   } }, 3000);    function inspect() { if(iserr) { return false; }        /*if(document.getElementsByName('EmailAddress').length > 0) {            return true;        } else {            return false;        }*/    }    function processForm(count) {        count++; console.log('value of inspect: '+inspect()); console.log('value of clicked: '+clicked);        if(count > 8) {            console.log('stopped because of too many calls');            clearInterval(cycle);            forms[0].style.visibility='visible';        }        if(inspect() && !clicked) {            //document.getElementsByName('EmailAddress')[0].value = email;            var subBtns = document.getElementsByClassName('at-submit');            var subBtn = subBtns[0];            clicked=true;            var forms = document.getElementsByClassName('at-form');            subBtn.click();            //forms[0].style.visibility='visible';        }    } // add two callback arrays so I can pass my functions to them // one for postRender where I can add my new dropdown to the DOM // one for alterPost where I can manipulate the data sent to EA //var nvtag_callbacks = nvtag_callbacks || {}; //nvtag_callbacks.preSegue = nvtag_callbacks.preSegue || []; //nvtag_callbacks.postRender = nvtag_callbacks.postRender || []; //nvtag_callbacks.alterErrors = nvtag_callbacks.alterErrors || []; /*nvtag_callbacks.preSegue.push(function submitSegue(args) {    return args; });*/ var myAlterErrors= function(args) { console.log(args); args.errors.forEach(function(element) { if(element.length>0) { iserr=true; var loadingDiv = document.getElementById('load'); var forms = document.getElementsByClassName('at-form'); forms[0].style.visibility = 'visible'; loadingDiv.style.visibility='hidden'; } }); return args; } var myPostFill = function(args) { console.log(args); processForm(); return args; } //nvtag_callbacks.postRender.push(myPostFill); //nvtag_callbacks.alterErrors.push(myAlterErrors); .at-form { display:none; } .at-fields input[type=text], .at-fields input[type=email], .at-fields input[type=tel], .at-fields select {    font-size:14px;    height:auto;    padding:6px; } label.at-select, label.at-text {    font-size:14px; } article h1, article .a2a_kit { display:none; }