PageSourceSearch

https://www.dreamfactory.com/assets/df-business-email-guard.js

js dreamfactory.com collected 2026-09-24 08:56:37 UTC 4,298 bytes, 90 lines download raw bytes

1/*
2 * DreamFactory — homepage business-email guard (client-side).
3 *
4 * Gives the visitor INSTANT feedback when they type a free / personal mailbox
5 * into the hero form, before any round-trip to the form-bridge worker. The
6 * worker (df-form-bridge.*.workers.dev) stays the authoritative gate — it does
7 * the real business-email enforcement, Turnstile check and HubSpot contact
8 * creation. This script only short-circuits the obvious free providers so the
9 * UX is snappy and we don't burn a Turnstile token / network call on them.
10 *
11 * MUST load BEFORE df_form_bridge_v4 so this capture-phase listener registers
12 * first and can stopImmediatePropagation() the bridge for a known-bad domain.
13 * For everything not on this list we do nothing and let the bridge + worker
14 * decide (a denylist can never be exhaustive — that's the worker's job).
15 */
16(function () {
17  'use strict';
18
19  // Well-known free / personal / disposable mailbox providers. Intentionally
20  // not exhaustive — see header. Keyed for O(1) lookup, exact-domain match.
21  var FREE_DOMAINS = [
22    // Google / Microsoft / Apple / Yahoo / AOL
23    'gmail.com', 'googlemail.com',
24    'outlook.com', 'hotmail.com', 'hotmail.co.uk', 'live.com', 'live.co.uk',
25    'msn.com', 'passport.com', 'windowslive.com',
26    'icloud.com', 'me.com', 'mac.com',
27    'yahoo.com', 'yahoo.co.uk', 'yahoo.co.in', 'yahoo.ca', 'yahoo.com.au',
28    'yahoo.fr', 'yahoo.de', 'yahoo.es', 'yahoo.it', 'ymail.com', 'rocketmail.com',
29    'aol.com', 'aim.com',
30    // Privacy / indie mail
31    'proton.me', 'protonmail.com', 'pm.me', 'tutanota.com', 'tuta.io',
32    'hushmail.com', 'fastmail.com', 'hey.com', 'mailfence.com',
33    // GMX / mail.com / web.de / t-online / Zoho / Yandex
34    'gmx.com', 'gmx.net', 'gmx.de', 'gmx.at', 'gmx.ch',
35    'mail.com', 'email.com', 'web.de', 't-online.de', 'freenet.de',
36    'zoho.com', 'zohomail.com', 'yandex.com', 'yandex.ru',
37    // US ISP mailboxes (personal)
38    'comcast.net', 'verizon.net', 'att.net', 'sbcglobal.net', 'bellsouth.net',
39    'cox.net', 'charter.net', 'earthlink.net', 'roadrunner.com', 'optonline.net',
40    // Asia consumer mail
41    'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'foxmail.com',
42    'naver.com', 'daum.net', 'hanmail.net', 'rediffmail.com',
43    // Common disposable / throwaway
44    'mailinator.com', 'guerrillamail.com', '10minutemail.com', 'temp-mail.org',
45    'tempmail.com', 'trashmail.com', 'yopmail.com', 'getnada.com', 'nada.email',
46    'sharklasers.com', 'dispostable.com', 'maildrop.cc', 'throwaway.email',
47    'mailnesia.com', 'fakeinbox.com', 'mintemail.com', 'mohmal.com'
48  ].reduce(function (m, d) { m[d] = 1; return m; }, {});
49
50  var MSG = 'Please enter your business email.';
51
52  // Mirror df_form_bridge_v4's error renderer (the E() helper) exactly so the
53  // message appears in the same place with the same styling whether it is shown
54  // by this guard or returned by the worker.
55  function showError(form, msg) {
56    var host = form.closest('.hero-form-w') || form.parentElement;
57    var parent = host.parentElement;
58    var el = parent.querySelector(':scope > .df-form-error');
59    if (!el) {
60      el = document.createElement('div');
61      el.className = 'df-form-error';
62      el.style.cssText = 'color:#e51520;margin-top:10px';
63      parent.insertBefore(el, host.nextSibling);
64    }
65    el.textContent = msg || '';
66    el.style.display = msg ? '' : 'none';
67  }
68
69  function isFreeEmail(email) {
70    var at = email.lastIndexOf('@');
71    if (at < 0) return false;
72    var domain = email.slice(at + 1).trim().toLowerCase();
73    return !!FREE_DOMAINS[domain];
74  }
75
76  document.addEventListener('submit', function (e) {
77    var form = e.target;
78    if (!form || !form.classList || !form.classList.contains('hero-form')) return;
79    var input = form.querySelector('input[type="email"]');
80    if (!input) return;
81    var email = (input.value || '').trim().toLowerCase();
82    // Empty / malformed is handled by the native required + type=email check;
83    // anything not obviously a free provider is the worker's call.
84    if (!email || !isFreeEmail(email)) return;
85    e.preventDefault();
86    e.stopImmediatePropagation(); // keep df_form_bridge from POSTing a known-bad email
87    showError(form, MSG);
88    try { input.focus(); } catch (_) {}
89  }, true);
90})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.