Created
October 1, 2014 02:52
-
-
Save benjohnson77/0ea8cce722c5a41fba42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function alcGetUrlWithProtocol(url) | |
{ | |
var useSSL = 'https:' == document.location.protocol; | |
if (useSSL == true){ | |
var new_url = url.replace(/http:/,'https:'); | |
}else{ | |
var new_url = url ; | |
} | |
return new_url | |
} | |
function alcFindScriptElement(url){ | |
var alcTagElement = null; | |
var scripts = document.getElementsByTagName('script'); | |
if(scripts!=null){ | |
for(var i=scripts.length-1;alcTagElement==null && i >= 0 ;i--){ | |
var scriptElement=scripts[i];var scriptSrc=scriptElement.src; | |
if(scriptSrc.match(url)){alcTagElement=scriptElement;} | |
} | |
} | |
return alcTagElement; | |
} | |
function alcGetElementbySource(type,source){ | |
var allImages = document.getElementsByTagName(type); | |
var target; | |
for(var i = 0, max = allImages.length; i < max; i++) | |
if (allImages[i].src === source){ | |
target = allImages[i]; | |
break; | |
} | |
} | |
function alcCreatePixelElement(source){ | |
var image = document.createElement('img'); | |
image.src = alcGetUrlWithProtocol(source); | |
image.style.display = 'none'; | |
allScriptTags = document.getElementsByTagName('script'); | |
lastScriptTag = allScriptTags[allScriptTags.length - 1]; | |
lastScriptTag.parentNode.insertBefore(image, lastScriptTag); | |
} | |
function alcCreateScriptElement(source){ | |
var script = document.createElement('script'); | |
script.src = alcGetUrlWithProtocol(source); | |
script.type = 'text/javascript'; | |
script.async = true; | |
allScriptTags = document.getElementsByTagName('script'); | |
lastScriptTag = allScriptTags[allScriptTags.length - 1]; | |
lastScriptTag.parentNode.insertBefore(script, lastScriptTag); | |
} | |
// add crypto to the page. | |
alcCreateScriptElement("http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha1.js"); | |
function alc_submit_form() | |
{ | |
var alcEmail = document.frmMain.elements["email"].value; | |
emailReturned1 = CryptoJS.SHA1(alcEmail.toUpperCase()); | |
emailReturned2 = CryptoJS.SHA1(alcEmail.toLowerCase()); | |
alcCreatePixelElement("http://ei.rlcdn.com/382379.gif?s="+emailReturned1+"&n=1"); | |
document.frmMain.submit(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment