Skip to content

Instantly share code, notes, and snippets.

@roustem
Created September 22, 2021 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roustem/1ab2afae922c1f11d2cebd693698eac2 to your computer and use it in GitHub Desktop.
Save roustem/1ab2afae922c1f11d2cebd693698eac2 to your computer and use it in GitHub Desktop.
(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