Skip to content

Instantly share code, notes, and snippets.

@zanbaldwin
Last active March 10, 2017 13:37
Show Gist options
  • Save zanbaldwin/ab974fc54016a43705fa3b469e902d47 to your computer and use it in GitHub Desktop.
Save zanbaldwin/ab974fc54016a43705fa3b469e902d47 to your computer and use it in GitHub Desktop.
Insert a test email address into the active DOM element. Update with your email user and domain. Save to your bookmarks bar.
javascript:for(var n=new Date,m="Seconds Minutes Hours Date Month FullYear".split(" "),s="",i=m.length,a=document.activeElement;i;i--)f=n["get"+m[i-1]](),s+=10>f?"0"+f:f;if(a.isContentEditable||["input","textarea"].indexOf(a.tagName.toLowerCase())>-1)a.value="email.user+"+s+"@domain.tld";
(function(user, domain) {
var now = new Date(),
methods = ['getFullYear', 'getMonth', 'getDate', 'getHours', 'getMinutes', 'getSeconds'].reverse(),
string = '',
field;
for (var i = methods.length; i; i--) {
field = now[methods[i - 1]]();
string += field < 10 ? '0' + field : field;
}
if (document.activeElement.isContentEditable
|| ['input', 'textarea'].indexOf(document.activeElement.tagName.toLowerCase()) > -1
) {
document.activeElement.value = user + '+' + string + '@' + domain;
}
})('email.user', 'domain.tld');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment