Guest User

Untitled

a guest
May 16th, 2026
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <script src="https://cdn.jsdelivr.net/npm/[email protected]/src/mailcheck.min.js"></script>
  2. <script>
  3. (function () {
  4. const DOMAINS = [
  5. 'gmail.com','yahoo.com','hotmail.com','outlook.com','aol.com',
  6. 'icloud.com','me.com','live.com','msn.com','comcast.net',
  7. 'verizon.net','att.net','sbcglobal.net','bellsouth.net','cox.net',
  8. 'ymail.com','protonmail.com','mac.com'
  9. ];
  10. const TLDS = ['com','net','org','co','io','us','edu','gov','uk','ca','au','de','fr'];
  11. const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[a-z]{2,}$/i;
  12.  
  13. function setInvalid(input) {
  14. input.style.borderColor = '#dc2626';
  15. input.style.boxShadow = '0 0 0 3px rgba(220,38,38,0.25)';
  16. }
  17. function setValid(input) {
  18. input.style.borderColor = '';
  19. input.style.boxShadow = '';
  20. }
  21.  
  22. function check(input, hint) {
  23. const v = input.value.trim();
  24. if (!v) { setValid(input); hint.style.display = 'none'; return; }
  25.  
  26. if (!EMAIL_RE.test(v)) {
  27. setInvalid(input);
  28. hint.textContent = 'Please enter a valid email address';
  29. hint.style.display = 'block';
  30. hint.onclick = null;
  31. return;
  32. }
  33.  
  34. Mailcheck.run({
  35. email: v,
  36. domains: DOMAINS,
  37. topLevelDomains: TLDS,
  38. suggested: function (s) {
  39. setInvalid(input);
  40. hint.innerHTML = 'Did you mean <strong style="text-decoration:underline;">' +
  41. s.full + '</strong>? (click to fix)';
  42. hint.style.display = 'block';
  43. hint.onclick = function () {
  44. input.value = s.full;
  45. input.dispatchEvent(new Event('input', { bubbles: true }));
  46. input.dispatchEvent(new Event('change', { bubbles: true }));
  47. setValid(input);
  48. hint.style.display = 'none';
  49. };
  50. },
  51. empty: function () {
  52. setValid(input);
  53. hint.style.display = 'none';
  54. }
  55. });
  56. }
  57.  
  58. function attach() {
  59. document
  60. .querySelectorAll('input[type="email"], input[type="text"][name*="email" i], input[name*="email" i]')
  61. .forEach(function (input) {
  62. if (input.dataset.vAttached) return;
  63. input.dataset.vAttached = '1';
  64.  
  65. const hint = document.createElement('div');
  66. hint.style.cssText =
  67. 'font-size:13px;line-height:1.3;color:#b54708;margin:4px 0 0;' +
  68. 'display:none;cursor:pointer;user-select:none;';
  69. input.parentNode.insertBefore(hint, input.nextSibling);
  70.  
  71. input.addEventListener('blur', function () { check(input, hint); });
  72. input.addEventListener('input', function () {
  73. if (input.style.boxShadow) check(input, hint);
  74. });
  75. });
  76. }
  77.  
  78. if (document.readyState === 'loading') {
  79. document.addEventListener('DOMContentLoaded', attach);
  80. } else {
  81. attach();
  82. }
  83. new MutationObserver(attach).observe(document.body, { childList: true, subtree: true });
  84. })();
  85. </script>
Advertisement
Add Comment
Please, Sign In to add comment