Created
September 22, 2021 22:18
-
-
Save roustem/1ab2afae922c1f11d2cebd693698eac2 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() { | |
var ziws = {typingTimeoutId: null,wsEvtListener: null}; | |
ziws.wsEvtListener = document.addEventListener('input', inputTypingHandler); | |
function inputTypingHandler(event) { | |
if (event.target.type === 'password') return; | |
var email = event.target.value; | |
clearTimeout(ziws.typingTimeoutId); | |
ziws.typingTimeoutId = null; | |
if (!_isValidEmail(email)) return; | |
ziws.typingTimeoutId = setTimeout(function () { | |
return _sendRequest("xxxxxxxxxxxx", email); | |
}, 750); | |
} | |
function _isValidEmail(email) { | |
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(String(email).toLowerCase()); | |
} | |
function _sendRequest(websiteId, email) { | |
var xhr = new XMLHttpRequest(); | |
var domain = email.split('@')[1]; | |
var url = "https://ws.zoominfo.com/pixel/ip/" + websiteId + "?domain=" + domain; | |
xhr.open("GET", url); | |
xhr.withCredentials = true; | |
xhr.send(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment