From: Nick Downing Date: Wed, 26 Jan 2022 10:24:34 +0000 (+1100) Subject: Update /contact/index.html.jst to latest way, no accordion, placeholder company X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?p=ndcode_site.git;a=commitdiff_plain;h=e0dc8480bb1556b1d8974625dd49650e0c592417 Update /contact/index.html.jst to latest way, no accordion, placeholder company --- diff --git a/_lib/get_placeholder.jst b/_lib/get_placeholder.jst index 1d325e3..e1a9a7b 100644 --- a/_lib/get_placeholder.jst +++ b/_lib/get_placeholder.jst @@ -24,14 +24,35 @@ return async (env, session) => { if (Math.random() < .5) user = user.map(name => name.toLowerCase()) user = user.join( - data.separators[ - Math.floor(Math.random() * data.separators.length) + data.email_separators[ + Math.floor(Math.random() * data.email_separators.length) ] ) - let domain_name = data.domain_names[ - Math.floor(Math.random() * data.domain_names.length) + let email_domain = data.email_domains[ + Math.floor(Math.random() * data.email_domains.length) ] - let email = `${user}@${domain_name}` + let email = `${user}@${email_domain}` + + let company_prefix = + Math.random() < .5 ? + data.company_prefixes[ + Math.floor(Math.random() * data.company_prefixes.length) + ] : + data.family_names[ + Math.floor(Math.random() * data.family_names.length) + ] + ( + Math.random() < .5 ? + '' : + ' & ' + data.family_names[ + Math.floor(Math.random() * data.family_names.length) + ] + ) + let company_suffix = data.company_suffixes[ + Math.floor(Math.random() * data.company_suffixes.length) + ] + if (company_suffix.charAt(0) === '&') + company_prefix = company_prefix.replaceAll(' & ', ', ') + let company = `${company_prefix} ${company_suffix}` let expires = new XDate(env.now) expires.addDays(1) @@ -40,6 +61,7 @@ return async (env, session) => { given_names: given_name, family_name, email, + company: company, expires: expires.getTime() } session.set_json('placeholder', placeholder) diff --git a/_placeholder/company.json b/_placeholder/company.json new file mode 100644 index 0000000..5f3abef --- /dev/null +++ b/_placeholder/company.json @@ -0,0 +1,1180 @@ +{ + "prefixes": [ + "Abilene", + "Addison", + "Akron", + "Alameda", + "Albany", + "Albuquerque", + "Alexandria", + "Alhambra", + "Aliso Viejo", + "Allen", + "Allentown", + "Alpharetta", + "Altamonte Springs", + "Altoona", + "Amarillo", + "Ames", + "Anaheim", + "Anchorage", + "Anderson", + "Ankeny", + "Ann Arbor", + "Annapolis", + "Antioch", + "Apache Junction", + "Apex", + "Apopka", + "Apple Valley", + "Appleton", + "Arcadia", + "Arlington", + "Arlington Heights", + "Arvada", + "Asheville", + "Athens-Clarke County", + "Atlanta", + "Atlantic City", + "Attleboro", + "Auburn", + "Augusta-Richmond County", + "Aurora", + "Austin", + "Aventura", + "Avondale", + "Azusa", + "Bakersfield", + "Baldwin Park", + "Baltimore", + "Barnstable Town", + "Bartlett", + "Baton Rouge", + "Battle Creek", + "Bayonne", + "Baytown", + "Beaumont", + "Beavercreek", + "Beaverton", + "Bedford", + "Bell Gardens", + "Belleville", + "Bellevue", + "Bellflower", + "Bellingham", + "Beloit", + "Bend", + "Bentonville", + "Berkeley", + "Berwyn", + "Bethlehem", + "Beverly", + "Billings", + "Biloxi", + "Binghamton", + "Birmingham", + "Bismarck", + "Blacksburg", + "Blaine", + "Bloomington", + "Blue Springs", + "Boca Raton", + "Boise City", + "Bolingbrook", + "Bonita Springs", + "Bossier City", + "Boston", + "Boulder", + "Bountiful", + "Bowie", + "Bowling Green", + "Boynton Beach", + "Bozeman", + "Bradenton", + "Brea", + "Bremerton", + "Brentwood", + "Bridgeport", + "Bristol", + "Brockton", + "Broken Arrow", + "Brookfield", + "Brookhaven", + "Brooklyn Park", + "Broomfield", + "Brownsville", + "Bryan", + "Buckeye", + "Buena Park", + "Buffalo", + "Buffalo Grove", + "Bullhead City", + "Burbank", + "Burien", + "Burleson", + "Burlington", + "Burnsville", + "Caldwell", + "Calexico", + "Calumet City", + "Camarillo", + "Cambridge", + "Camden", + "Campbell", + "Canton", + "Cape Coral", + "Cape Girardeau", + "Carlsbad", + "Carmel", + "Carol Stream", + "Carpentersville", + "Carrollton", + "Carson", + "Carson City", + "Cary", + "Casa Grande", + "Casper", + "Castle Rock", + "Cathedral City", + "Cedar Falls", + "Cedar Hill", + "Cedar Park", + "Cedar Rapids", + "Centennial", + "Ceres", + "Cerritos", + "Champaign", + "Chandler", + "Chapel Hill", + "Charleston", + "Charlotte", + "Charlottesville", + "Chattanooga", + "Chelsea", + "Chesapeake", + "Chesterfield", + "Cheyenne", + "Chicago", + "Chico", + "Chicopee", + "Chino", + "Chino Hills", + "Chula Vista", + "Cicero", + "Cincinnati", + "Citrus Heights", + "Clarksville", + "Clearwater", + "Cleveland", + "Cleveland Heights", + "Clifton", + "Clovis", + "Coachella", + "Coconut Creek", + "Coeur d'Alene", + "College Station", + "Collierville", + "Colorado Springs", + "Colton", + "Columbia", + "Columbus", + "Commerce City", + "Compton", + "Concord", + "Conroe", + "Conway", + "Coon Rapids", + "Coppell", + "Coral Gables", + "Coral Springs", + "Corona", + "Corpus Christi", + "Corvallis", + "Costa Mesa", + "Council Bluffs", + "Covina", + "Covington", + "Cranston", + "Crystal Lake", + "Culver City", + "Cupertino", + "Cutler Bay", + "Cuyahoga Falls", + "Cypress", + "Dallas", + "Daly City", + "Danbury", + "Danville", + "Davenport", + "Davie", + "Davis", + "Dayton", + "Daytona Beach", + "DeKalb", + "DeSoto", + "Dearborn", + "Dearborn Heights", + "Decatur", + "Deerfield Beach", + "Delano", + "Delray Beach", + "Deltona", + "Denton", + "Denver", + "Des Moines", + "Des Plaines", + "Detroit", + "Diamond Bar", + "Doral", + "Dothan", + "Dover", + "Downers Grove", + "Downey", + "Draper", + "Dublin", + "Dubuque", + "Duluth", + "Duncanville", + "Dunwoody", + "Durham", + "Eagan", + "East Lansing", + "East Orange", + "East Providence", + "Eastvale", + "Eau Claire", + "Eden Prairie", + "Edina", + "Edinburg", + "Edmond", + "Edmonds", + "El Cajon", + "El Centro", + "El Monte", + "El Paso", + "Elgin", + "Elizabeth", + "Elk Grove", + "Elkhart", + "Elmhurst", + "Elyria", + "Encinitas", + "Enid", + "Erie", + "Escondido", + "Euclid", + "Eugene", + "Euless", + "Evanston", + "Evansville", + "Everett", + "Fairfield", + "Fall River", + "Fargo", + "Farmington", + "Farmington Hills", + "Fayetteville", + "Federal Way", + "Findlay", + "Fishers", + "Fitchburg", + "Flagstaff", + "Flint", + "Florence", + "Florissant", + "Flower Mound", + "Folsom", + "Fond du Lac", + "Fontana", + "Fort Collins", + "Fort Lauderdale", + "Fort Myers", + "Fort Pierce", + "Fort Smith", + "Fort Wayne", + "Fort Worth", + "Fountain Valley", + "Franklin", + "Frederick", + "Freeport", + "Fremont", + "Fresno", + "Friendswood", + "Frisco", + "Fullerton", + "Gainesville", + "Gaithersburg", + "Galveston", + "Garden Grove", + "Gardena", + "Garland", + "Gary", + "Gastonia", + "Georgetown", + "Germantown", + "Gilbert", + "Gilroy", + "Glendale", + "Glendora", + "Glenview", + "Goodyear", + "Goose Creek", + "Grand Forks", + "Grand Island", + "Grand Junction", + "Grand Prairie", + "Grand Rapids", + "Grapevine", + "Great Falls", + "Greeley", + "Green Bay", + "Greenacres", + "Greenfield", + "Greensboro", + "Greenville", + "Greenwood", + "Gresham", + "Grove City", + "Gulfport", + "Hackensack", + "Hagerstown", + "Hallandale Beach", + "Haltom City", + "Hamilton", + "Hammond", + "Hampton", + "Hanford", + "Hanover Park", + "Harlingen", + "Harrisburg", + "Harrisonburg", + "Hartford", + "Hattiesburg", + "Haverhill", + "Hawthorne", + "Hayward", + "Hemet", + "Hempstead", + "Henderson", + "Hendersonville", + "Hesperia", + "Hialeah", + "Hickory", + "High Point", + "Highland", + "Hillsboro", + "Hilton Head Island", + "Hoboken", + "Hoffman Estates", + "Hollywood", + "Holyoke", + "Homestead", + "Honolulu", + "Hoover", + "Houston", + "Huber Heights", + "Huntersville", + "Huntington", + "Huntington Beach", + "Huntington Park", + "Huntsville", + "Hurst", + "Hutchinson", + "Idaho Falls", + "Independence", + "Indianapolis", + "Indio", + "Inglewood", + "Iowa City", + "Irvine", + "Irving", + "Jackson", + "Jacksonville", + "Janesville", + "Jefferson City", + "Jeffersonville", + "Jersey City", + "Johns Creek", + "Johnson City", + "Joliet", + "Jonesboro", + "Joplin", + "Jupiter", + "Jurupa Valley", + "Kalamazoo", + "Kannapolis", + "Kansas City", + "Kearny", + "Keizer", + "Keller", + "Kenner", + "Kennewick", + "Kenosha", + "Kent", + "Kentwood", + "Kettering", + "Killeen", + "Kingsport", + "Kirkland", + "Kissimmee", + "Knoxville", + "Kokomo", + "La Crosse", + "La Habra", + "La Mesa", + "La Mirada", + "La Puente", + "La Quinta", + "Lacey", + "Lafayette", + "Laguna Niguel", + "Lake Charles", + "Lake Elsinore", + "Lake Forest", + "Lake Havasu City", + "Lake Oswego", + "Lakeland", + "Lakeville", + "Lakewood", + "Lancaster", + "Lansing", + "Laredo", + "Largo", + "Las Cruces", + "Las Vegas", + "Lauderhill", + "Lawrence", + "Lawton", + "Layton", + "League City", + "Lee's Summit", + "Leesburg", + "Lehi", + "Lenexa", + "Leominster", + "Lewisville", + "Lexington-Fayette", + "Lima", + "Lincoln", + "Lincoln Park", + "Linden", + "Little Rock", + "Littleton", + "Livermore", + "Livonia", + "Lodi", + "Logan", + "Lombard", + "Lompoc", + "Long Beach", + "Longmont", + "Longview", + "Lorain", + "Los Angeles", + "Louisville/Jefferson County", + "Loveland", + "Lowell", + "Lubbock", + "Lynchburg", + "Lynn", + "Lynwood", + "Macon", + "Madera", + "Madison", + "Malden", + "Manassas", + "Manchester", + "Manhattan", + "Mankato", + "Mansfield", + "Manteca", + "Maple Grove", + "Maplewood", + "Marana", + "Margate", + "Maricopa", + "Marietta", + "Marlborough", + "Martinez", + "Marysville", + "McAllen", + "McKinney", + "Medford", + "Melbourne", + "Memphis", + "Menifee", + "Mentor", + "Merced", + "Meriden", + "Meridian", + "Mesa", + "Mesquite", + "Methuen", + "Miami", + "Miami Beach", + "Miami Gardens", + "Middletown", + "Midland", + "Midwest City", + "Milford", + "Milpitas", + "Milwaukee", + "Minneapolis", + "Minnetonka", + "Minot", + "Miramar", + "Mishawaka", + "Mission", + "Mission Viejo", + "Missoula", + "Missouri City", + "Mobile", + "Modesto", + "Moline", + "Monroe", + "Monrovia", + "Montclair", + "Montebello", + "Monterey Park", + "Montgomery", + "Moore", + "Moorhead", + "Moreno Valley", + "Morgan Hill", + "Mount Pleasant", + "Mount Prospect", + "Mount Vernon", + "Mountain View", + "Muncie", + "Murfreesboro", + "Murray", + "Murrieta", + "Muskegon", + "Muskogee", + "Nampa", + "Napa", + "Naperville", + "Nashua", + "Nashville-Davidson", + "National City", + "New Bedford", + "New Berlin", + "New Braunfels", + "New Britain", + "New Brunswick", + "New Haven", + "New Orleans", + "New Rochelle", + "New York", + "Newark", + "Newport Beach", + "Newport News", + "Newton", + "Niagara Falls", + "Noblesville", + "Norfolk", + "Normal", + "Norman", + "North Charleston", + "North Las Vegas", + "North Lauderdale", + "North Little Rock", + "North Miami", + "North Miami Beach", + "North Port", + "North Richland Hills", + "Northglenn", + "Norwalk", + "Norwich", + "Novato", + "Novi", + "O'Fallon", + "Oak Lawn", + "Oak Park", + "Oakland", + "Oakland Park", + "Oakley", + "Ocala", + "Oceanside", + "Ocoee", + "Odessa", + "Ogden", + "Oklahoma City", + "Olathe", + "Olympia", + "Omaha", + "Ontario", + "Orange", + "Orem", + "Orland Park", + "Orlando", + "Ormond Beach", + "Oro Valley", + "Oshkosh", + "Overland Park", + "Owensboro", + "Oxnard", + "Pacifica", + "Palatine", + "Palm Bay", + "Palm Beach Gardens", + "Palm Coast", + "Palm Desert", + "Palm Springs", + "Palmdale", + "Palo Alto", + "Panama City", + "Paramount", + "Park Ridge", + "Parker", + "Parma", + "Pasadena", + "Pasco", + "Passaic", + "Paterson", + "Pawtucket", + "Peabody", + "Peachtree Corners", + "Pearland", + "Pembroke Pines", + "Pensacola", + "Peoria", + "Perris", + "Perth Amboy", + "Petaluma", + "Pflugerville", + "Pharr", + "Phenix City", + "Philadelphia", + "Phoenix", + "Pico Rivera", + "Pine Bluff", + "Pinellas Park", + "Pittsburg", + "Pittsburgh", + "Pittsfield", + "Placentia", + "Plainfield", + "Plano", + "Plantation", + "Pleasanton", + "Plymouth", + "Pocatello", + "Pomona", + "Pompano Beach", + "Pontiac", + "Port Arthur", + "Port Orange", + "Port St. Lucie", + "Portage", + "Porterville", + "Portland", + "Portsmouth", + "Poway", + "Prescott", + "Prescott Valley", + "Providence", + "Provo", + "Pueblo", + "Puyallup", + "Quincy", + "Racine", + "Raleigh", + "Rancho Cordova", + "Rancho Cucamonga", + "Rancho Palos Verdes", + "Rancho Santa Margarita", + "Rapid City", + "Reading", + "Redding", + "Redlands", + "Redmond", + "Redondo Beach", + "Redwood City", + "Reno", + "Renton", + "Revere", + "Rialto", + "Richardson", + "Richland", + "Richmond", + "Rio Rancho", + "Riverside", + "Riverton", + "Roanoke", + "Rochester", + "Rochester Hills", + "Rock Hill", + "Rock Island", + "Rockford", + "Rocklin", + "Rockville", + "Rockwall", + "Rocky Mount", + "Rogers", + "Rohnert Park", + "Romeoville", + "Rosemead", + "Roseville", + "Roswell", + "Round Rock", + "Rowlett", + "Roy", + "Royal Oak", + "Sacramento", + "Saginaw", + "Salem", + "Salina", + "Salinas", + "Salt Lake City", + "Sammamish", + "San Angelo", + "San Antonio", + "San Bernardino", + "San Bruno", + "San Buenaventura (Ventura)", + "San Clemente", + "San Diego", + "San Francisco", + "San Gabriel", + "San Jacinto", + "San Jose", + "San Leandro", + "San Luis Obispo", + "San Marcos", + "San Mateo", + "San Rafael", + "San Ramon", + "Sandy", + "Sandy Springs", + "Sanford", + "Santa Ana", + "Santa Barbara", + "Santa Clara", + "Santa Clarita", + "Santa Cruz", + "Santa Fe", + "Santa Maria", + "Santa Monica", + "Santa Rosa", + "Santee", + "Sarasota", + "Savannah", + "Sayreville", + "Schaumburg", + "Schenectady", + "Scottsdale", + "Scranton", + "Seattle", + "Shakopee", + "Shawnee", + "Sheboygan", + "Shelton", + "Sherman", + "Shoreline", + "Shreveport", + "Sierra Vista", + "Simi Valley", + "Sioux City", + "Sioux Falls", + "Skokie", + "Smyrna", + "Somerville", + "South Bend", + "South Gate", + "South Jordan", + "South San Francisco", + "Southaven", + "Southfield", + "Spanish Fork", + "Sparks", + "Spartanburg", + "Spokane", + "Spokane Valley", + "Springdale", + "Springfield", + "St. Charles", + "St. Clair Shores", + "St. Cloud", + "St. George", + "St. Joseph", + "St. Louis", + "St. Louis Park", + "St. Paul", + "St. Peters", + "St. Petersburg", + "Stamford", + "Stanton", + "State College", + "Sterling Heights", + "Stillwater", + "Stockton", + "Streamwood", + "Strongsville", + "Suffolk", + "Sugar Land", + "Summerville", + "Sumter", + "Sunnyvale", + "Sunrise", + "Surprise", + "Syracuse", + "Tacoma", + "Tallahassee", + "Tamarac", + "Tampa", + "Taunton", + "Taylor", + "Taylorsville", + "Temecula", + "Tempe", + "Temple", + "Terre Haute", + "Texarkana", + "Texas City", + "The Colony", + "Thornton", + "Thousand Oaks", + "Tigard", + "Tinley Park", + "Titusville", + "Toledo", + "Topeka", + "Torrance", + "Tracy", + "Trenton", + "Troy", + "Tucson", + "Tulare", + "Tulsa", + "Turlock", + "Tuscaloosa", + "Tustin", + "Twin Falls", + "Tyler", + "Union City", + "Upland", + "Urbana", + "Urbandale", + "Utica", + "Vacaville", + "Valdosta", + "Vallejo", + "Valley Stream", + "Vancouver", + "Victoria", + "Victorville", + "Vineland", + "Virginia Beach", + "Visalia", + "Vista", + "Waco", + "Walnut Creek", + "Waltham", + "Warner Robins", + "Warren", + "Warwick", + "Washington", + "Waterbury", + "Waterloo", + "Watsonville", + "Waukegan", + "Waukesha", + "Wausau", + "Wauwatosa", + "Wellington", + "Weslaco", + "West Allis", + "West Covina", + "West Des Moines", + "West Haven", + "West Jordan", + "West New York", + "West Palm Beach", + "West Sacramento", + "West Valley City", + "Westerville", + "Westfield", + "Westland", + "Westminster", + "Weston", + "Weymouth Town", + "Wheaton", + "Wheeling", + "White Plains", + "Whittier", + "Wichita", + "Wichita Falls", + "Wilkes-Barre", + "Wilmington", + "Wilson", + "Winston-Salem", + "Winter Garden", + "Woburn", + "Woodbury", + "Woodland", + "Woonsocket", + "Worcester", + "Wylie", + "Wyoming", + "Yakima", + "Yonkers", + "Yorba Linda", + "York", + "Youngstown", + "Yuba City", + "Yucaipa", + "Yuma", + + "Alabama", + "Alaska", + "Arizona", + "Arkansas", + "California", + "Colorado", + "Connecticut", + "Delaware", + "District of Columbia", + "Florida", + "Georgia", + "Hawaii", + "Idaho", + "Illinois", + "Indiana", + "Iowa", + "Kansas", + "Kentucky", + "Louisiana", + "Maine", + "Maryland", + "Massachusetts", + "Michigan", + "Minnesota", + "Mississippi", + "Missouri", + "Montana", + "Nebraska", + "Nevada", + "New Hampshire", + "New Jersey", + "New Mexico", + "New York", + "North Carolina", + "North Dakota", + "Ohio", + "Oklahoma", + "Oregon", + "Pennsylvania", + "Rhode Island", + "South Carolina", + "South Dakota", + "Tennessee", + "Texas", + "Utah", + "Vermont", + "Virginia", + "Washington", + "West Virginia", + "Wisconsin", + "Wyoming", + + "North", + "Northern", + "Northeast", + "Northeastern", + "North East", + "North Eastern", + "East", + "Eastern", + "Southeast", + "Southeastern", + "South East", + "South Eastern", + "South", + "Southern", + "Southwest", + "Southwestern", + "South West", + "South Western", + "West", + "Western", + "Northwest", + "Northwestern", + "North West", + "North Western" + ], + "suffixes": [ + "& Co", + "& Company", + "& Sons", + "Aerospace", + "Aid", + "Air", + "Airlines", + "Airways", + "Alliance", + "Aluminium", + "America", + "Analytics", + "Armour", + "Arts", + "Automation", + "Automotive", + "Bank", + "Beauty", + "Beverage", + "Brake", + "Brands", + "Bros", + "Brothers", + "Buy", + "Capital", + "Care", + "Chase", + "Chemical", + "Chemicals", + "Club", + "Co", + "Communications", + "Communities", + "Company", + "Computer", + "Connection", + "Consolidated", + "Construction", + "Consulting", + "Corp", + "Corporation", + "Data", + "Depot", + "Destinations", + "Devices", + "Diagnostics", + "Digital", + "Direct", + "Dynamics", + "Education", + "Electric", + "Electronics", + "Energy", + "Enterprise", + "Enterprises", + "Entertainment", + "Exchange", + "Express", + "Factory", + "Farms", + "Financial", + "Foods", + "Fragrances", + "Games", + "Gaming", + "Gas", + "General", + "Glass", + "Global", + "Goods", + "Group", + "Handling", + "Harbors", + "Health", + "Healthcare", + "Holding", + "Holdings", + "Home", + "Homes", + "Hotels", + "Inc", + "Incorporated", + "Industries", + "Ingredients", + "Instruments", + "Insurance", + "International", + "Intertechnology", + "Investment", + "Laboratories", + "Lease", + "Life", + "Lifesciences", + "Line", + "Lines", + "Living", + "Logistics", + "Lots", + "Management", + "Manufacturing", + "Market", + "Markets", + "Masonry", + "Materials", + "Media", + "Metals", + "Mills", + "Motion", + "Motor", + "Motors", + "Mountain", + "Mutual", + "National", + "Network", + "Networks", + "Oil", + "Outdoor", + "Outfitters", + "Pacific", + "Paper", + "Partners", + "Parts", + "Payments", + "Pet", + "Petroleum", + "Pharmaceuticals", + "Pizza", + "Power", + "Processing", + "Products", + "Properties", + "Rentals", + "Research", + "Residential", + "Resorts", + "Resources", + "Restaurants", + "Retail", + "Roadhouse", + "Rubber", + "Sands", + "Sciences", + "Scientific", + "Security", + "Semiconductor", + "Service", + "Services", + "Software", + "Solar", + "Solutions", + "Soup", + "Sportswear", + "Steel", + "Storage", + "Store", + "Stores", + "Supply", + "Surgical", + "System", + "Systems", + "Tech", + "Technologies", + "Technology", + "Television", + "Transfer", + "Tree", + "Trust", + "USA", + "Union", + "Wholesale", + "Works", + "Worldwide" + ] +} diff --git a/_placeholder/company.txt b/_placeholder/company.txt new file mode 100644 index 0000000..81d95d6 --- /dev/null +++ b/_placeholder/company.txt @@ -0,0 +1,12 @@ +company.json + +prefixes: +based on top 1000 cities +see https://gist.githubusercontent.com/Miserlou/11500b2345d3fe850c92/raw/e36859a9eef58c231865429ade1c142a2b75f16e/gistfile1.txt +divided into cities, states and compass directions + +suffixes: +see https://fueled.com/blog/2020-fortune-1000-companies/ +last word of multi-word fortune 1000 companies +list has been manually edited to remove specifics +and some obvious ones such as "Co" and "Inc" added diff --git a/_placeholder/data.json b/_placeholder/data.json index ee55f1d..ac3e9e7 100644 --- a/_placeholder/data.json +++ b/_placeholder/data.json @@ -1003,13 +1003,13 @@ "Yvonne", "Zachary" ], - "separators": [ + "email_separators": [ "", "-", ".", "_" ], - "domain_names": [ + "email_domains": [ "101mail.com", "99mail.com", "airmail.com", @@ -1244,5 +1244,1181 @@ "wemail.com", "xmail.com", "youmail.com" + ], + "company_prefixes": [ + "Abilene", + "Addison", + "Akron", + "Alameda", + "Albany", + "Albuquerque", + "Alexandria", + "Alhambra", + "Aliso Viejo", + "Allen", + "Allentown", + "Alpharetta", + "Altamonte Springs", + "Altoona", + "Amarillo", + "Ames", + "Anaheim", + "Anchorage", + "Anderson", + "Ankeny", + "Ann Arbor", + "Annapolis", + "Antioch", + "Apache Junction", + "Apex", + "Apopka", + "Apple Valley", + "Appleton", + "Arcadia", + "Arlington", + "Arlington Heights", + "Arvada", + "Asheville", + "Athens-Clarke County", + "Atlanta", + "Atlantic City", + "Attleboro", + "Auburn", + "Augusta-Richmond County", + "Aurora", + "Austin", + "Aventura", + "Avondale", + "Azusa", + "Bakersfield", + "Baldwin Park", + "Baltimore", + "Barnstable Town", + "Bartlett", + "Baton Rouge", + "Battle Creek", + "Bayonne", + "Baytown", + "Beaumont", + "Beavercreek", + "Beaverton", + "Bedford", + "Bell Gardens", + "Belleville", + "Bellevue", + "Bellflower", + "Bellingham", + "Beloit", + "Bend", + "Bentonville", + "Berkeley", + "Berwyn", + "Bethlehem", + "Beverly", + "Billings", + "Biloxi", + "Binghamton", + "Birmingham", + "Bismarck", + "Blacksburg", + "Blaine", + "Bloomington", + "Blue Springs", + "Boca Raton", + "Boise City", + "Bolingbrook", + "Bonita Springs", + "Bossier City", + "Boston", + "Boulder", + "Bountiful", + "Bowie", + "Bowling Green", + "Boynton Beach", + "Bozeman", + "Bradenton", + "Brea", + "Bremerton", + "Brentwood", + "Bridgeport", + "Bristol", + "Brockton", + "Broken Arrow", + "Brookfield", + "Brookhaven", + "Brooklyn Park", + "Broomfield", + "Brownsville", + "Bryan", + "Buckeye", + "Buena Park", + "Buffalo", + "Buffalo Grove", + "Bullhead City", + "Burbank", + "Burien", + "Burleson", + "Burlington", + "Burnsville", + "Caldwell", + "Calexico", + "Calumet City", + "Camarillo", + "Cambridge", + "Camden", + "Campbell", + "Canton", + "Cape Coral", + "Cape Girardeau", + "Carlsbad", + "Carmel", + "Carol Stream", + "Carpentersville", + "Carrollton", + "Carson", + "Carson City", + "Cary", + "Casa Grande", + "Casper", + "Castle Rock", + "Cathedral City", + "Cedar Falls", + "Cedar Hill", + "Cedar Park", + "Cedar Rapids", + "Centennial", + "Ceres", + "Cerritos", + "Champaign", + "Chandler", + "Chapel Hill", + "Charleston", + "Charlotte", + "Charlottesville", + "Chattanooga", + "Chelsea", + "Chesapeake", + "Chesterfield", + "Cheyenne", + "Chicago", + "Chico", + "Chicopee", + "Chino", + "Chino Hills", + "Chula Vista", + "Cicero", + "Cincinnati", + "Citrus Heights", + "Clarksville", + "Clearwater", + "Cleveland", + "Cleveland Heights", + "Clifton", + "Clovis", + "Coachella", + "Coconut Creek", + "Coeur d'Alene", + "College Station", + "Collierville", + "Colorado Springs", + "Colton", + "Columbia", + "Columbus", + "Commerce City", + "Compton", + "Concord", + "Conroe", + "Conway", + "Coon Rapids", + "Coppell", + "Coral Gables", + "Coral Springs", + "Corona", + "Corpus Christi", + "Corvallis", + "Costa Mesa", + "Council Bluffs", + "Covina", + "Covington", + "Cranston", + "Crystal Lake", + "Culver City", + "Cupertino", + "Cutler Bay", + "Cuyahoga Falls", + "Cypress", + "Dallas", + "Daly City", + "Danbury", + "Danville", + "Davenport", + "Davie", + "Davis", + "Dayton", + "Daytona Beach", + "DeKalb", + "DeSoto", + "Dearborn", + "Dearborn Heights", + "Decatur", + "Deerfield Beach", + "Delano", + "Delray Beach", + "Deltona", + "Denton", + "Denver", + "Des Moines", + "Des Plaines", + "Detroit", + "Diamond Bar", + "Doral", + "Dothan", + "Dover", + "Downers Grove", + "Downey", + "Draper", + "Dublin", + "Dubuque", + "Duluth", + "Duncanville", + "Dunwoody", + "Durham", + "Eagan", + "East Lansing", + "East Orange", + "East Providence", + "Eastvale", + "Eau Claire", + "Eden Prairie", + "Edina", + "Edinburg", + "Edmond", + "Edmonds", + "El Cajon", + "El Centro", + "El Monte", + "El Paso", + "Elgin", + "Elizabeth", + "Elk Grove", + "Elkhart", + "Elmhurst", + "Elyria", + "Encinitas", + "Enid", + "Erie", + "Escondido", + "Euclid", + "Eugene", + "Euless", + "Evanston", + "Evansville", + "Everett", + "Fairfield", + "Fall River", + "Fargo", + "Farmington", + "Farmington Hills", + "Fayetteville", + "Federal Way", + "Findlay", + "Fishers", + "Fitchburg", + "Flagstaff", + "Flint", + "Florence", + "Florissant", + "Flower Mound", + "Folsom", + "Fond du Lac", + "Fontana", + "Fort Collins", + "Fort Lauderdale", + "Fort Myers", + "Fort Pierce", + "Fort Smith", + "Fort Wayne", + "Fort Worth", + "Fountain Valley", + "Franklin", + "Frederick", + "Freeport", + "Fremont", + "Fresno", + "Friendswood", + "Frisco", + "Fullerton", + "Gainesville", + "Gaithersburg", + "Galveston", + "Garden Grove", + "Gardena", + "Garland", + "Gary", + "Gastonia", + "Georgetown", + "Germantown", + "Gilbert", + "Gilroy", + "Glendale", + "Glendora", + "Glenview", + "Goodyear", + "Goose Creek", + "Grand Forks", + "Grand Island", + "Grand Junction", + "Grand Prairie", + "Grand Rapids", + "Grapevine", + "Great Falls", + "Greeley", + "Green Bay", + "Greenacres", + "Greenfield", + "Greensboro", + "Greenville", + "Greenwood", + "Gresham", + "Grove City", + "Gulfport", + "Hackensack", + "Hagerstown", + "Hallandale Beach", + "Haltom City", + "Hamilton", + "Hammond", + "Hampton", + "Hanford", + "Hanover Park", + "Harlingen", + "Harrisburg", + "Harrisonburg", + "Hartford", + "Hattiesburg", + "Haverhill", + "Hawthorne", + "Hayward", + "Hemet", + "Hempstead", + "Henderson", + "Hendersonville", + "Hesperia", + "Hialeah", + "Hickory", + "High Point", + "Highland", + "Hillsboro", + "Hilton Head Island", + "Hoboken", + "Hoffman Estates", + "Hollywood", + "Holyoke", + "Homestead", + "Honolulu", + "Hoover", + "Houston", + "Huber Heights", + "Huntersville", + "Huntington", + "Huntington Beach", + "Huntington Park", + "Huntsville", + "Hurst", + "Hutchinson", + "Idaho Falls", + "Independence", + "Indianapolis", + "Indio", + "Inglewood", + "Iowa City", + "Irvine", + "Irving", + "Jackson", + "Jacksonville", + "Janesville", + "Jefferson City", + "Jeffersonville", + "Jersey City", + "Johns Creek", + "Johnson City", + "Joliet", + "Jonesboro", + "Joplin", + "Jupiter", + "Jurupa Valley", + "Kalamazoo", + "Kannapolis", + "Kansas City", + "Kearny", + "Keizer", + "Keller", + "Kenner", + "Kennewick", + "Kenosha", + "Kent", + "Kentwood", + "Kettering", + "Killeen", + "Kingsport", + "Kirkland", + "Kissimmee", + "Knoxville", + "Kokomo", + "La Crosse", + "La Habra", + "La Mesa", + "La Mirada", + "La Puente", + "La Quinta", + "Lacey", + "Lafayette", + "Laguna Niguel", + "Lake Charles", + "Lake Elsinore", + "Lake Forest", + "Lake Havasu City", + "Lake Oswego", + "Lakeland", + "Lakeville", + "Lakewood", + "Lancaster", + "Lansing", + "Laredo", + "Largo", + "Las Cruces", + "Las Vegas", + "Lauderhill", + "Lawrence", + "Lawton", + "Layton", + "League City", + "Lee's Summit", + "Leesburg", + "Lehi", + "Lenexa", + "Leominster", + "Lewisville", + "Lexington-Fayette", + "Lima", + "Lincoln", + "Lincoln Park", + "Linden", + "Little Rock", + "Littleton", + "Livermore", + "Livonia", + "Lodi", + "Logan", + "Lombard", + "Lompoc", + "Long Beach", + "Longmont", + "Longview", + "Lorain", + "Los Angeles", + "Louisville/Jefferson County", + "Loveland", + "Lowell", + "Lubbock", + "Lynchburg", + "Lynn", + "Lynwood", + "Macon", + "Madera", + "Madison", + "Malden", + "Manassas", + "Manchester", + "Manhattan", + "Mankato", + "Mansfield", + "Manteca", + "Maple Grove", + "Maplewood", + "Marana", + "Margate", + "Maricopa", + "Marietta", + "Marlborough", + "Martinez", + "Marysville", + "McAllen", + "McKinney", + "Medford", + "Melbourne", + "Memphis", + "Menifee", + "Mentor", + "Merced", + "Meriden", + "Meridian", + "Mesa", + "Mesquite", + "Methuen", + "Miami", + "Miami Beach", + "Miami Gardens", + "Middletown", + "Midland", + "Midwest City", + "Milford", + "Milpitas", + "Milwaukee", + "Minneapolis", + "Minnetonka", + "Minot", + "Miramar", + "Mishawaka", + "Mission", + "Mission Viejo", + "Missoula", + "Missouri City", + "Mobile", + "Modesto", + "Moline", + "Monroe", + "Monrovia", + "Montclair", + "Montebello", + "Monterey Park", + "Montgomery", + "Moore", + "Moorhead", + "Moreno Valley", + "Morgan Hill", + "Mount Pleasant", + "Mount Prospect", + "Mount Vernon", + "Mountain View", + "Muncie", + "Murfreesboro", + "Murray", + "Murrieta", + "Muskegon", + "Muskogee", + "Nampa", + "Napa", + "Naperville", + "Nashua", + "Nashville-Davidson", + "National City", + "New Bedford", + "New Berlin", + "New Braunfels", + "New Britain", + "New Brunswick", + "New Haven", + "New Orleans", + "New Rochelle", + "New York", + "Newark", + "Newport Beach", + "Newport News", + "Newton", + "Niagara Falls", + "Noblesville", + "Norfolk", + "Normal", + "Norman", + "North Charleston", + "North Las Vegas", + "North Lauderdale", + "North Little Rock", + "North Miami", + "North Miami Beach", + "North Port", + "North Richland Hills", + "Northglenn", + "Norwalk", + "Norwich", + "Novato", + "Novi", + "O'Fallon", + "Oak Lawn", + "Oak Park", + "Oakland", + "Oakland Park", + "Oakley", + "Ocala", + "Oceanside", + "Ocoee", + "Odessa", + "Ogden", + "Oklahoma City", + "Olathe", + "Olympia", + "Omaha", + "Ontario", + "Orange", + "Orem", + "Orland Park", + "Orlando", + "Ormond Beach", + "Oro Valley", + "Oshkosh", + "Overland Park", + "Owensboro", + "Oxnard", + "Pacifica", + "Palatine", + "Palm Bay", + "Palm Beach Gardens", + "Palm Coast", + "Palm Desert", + "Palm Springs", + "Palmdale", + "Palo Alto", + "Panama City", + "Paramount", + "Park Ridge", + "Parker", + "Parma", + "Pasadena", + "Pasco", + "Passaic", + "Paterson", + "Pawtucket", + "Peabody", + "Peachtree Corners", + "Pearland", + "Pembroke Pines", + "Pensacola", + "Peoria", + "Perris", + "Perth Amboy", + "Petaluma", + "Pflugerville", + "Pharr", + "Phenix City", + "Philadelphia", + "Phoenix", + "Pico Rivera", + "Pine Bluff", + "Pinellas Park", + "Pittsburg", + "Pittsburgh", + "Pittsfield", + "Placentia", + "Plainfield", + "Plano", + "Plantation", + "Pleasanton", + "Plymouth", + "Pocatello", + "Pomona", + "Pompano Beach", + "Pontiac", + "Port Arthur", + "Port Orange", + "Port St. Lucie", + "Portage", + "Porterville", + "Portland", + "Portsmouth", + "Poway", + "Prescott", + "Prescott Valley", + "Providence", + "Provo", + "Pueblo", + "Puyallup", + "Quincy", + "Racine", + "Raleigh", + "Rancho Cordova", + "Rancho Cucamonga", + "Rancho Palos Verdes", + "Rancho Santa Margarita", + "Rapid City", + "Reading", + "Redding", + "Redlands", + "Redmond", + "Redondo Beach", + "Redwood City", + "Reno", + "Renton", + "Revere", + "Rialto", + "Richardson", + "Richland", + "Richmond", + "Rio Rancho", + "Riverside", + "Riverton", + "Roanoke", + "Rochester", + "Rochester Hills", + "Rock Hill", + "Rock Island", + "Rockford", + "Rocklin", + "Rockville", + "Rockwall", + "Rocky Mount", + "Rogers", + "Rohnert Park", + "Romeoville", + "Rosemead", + "Roseville", + "Roswell", + "Round Rock", + "Rowlett", + "Roy", + "Royal Oak", + "Sacramento", + "Saginaw", + "Salem", + "Salina", + "Salinas", + "Salt Lake City", + "Sammamish", + "San Angelo", + "San Antonio", + "San Bernardino", + "San Bruno", + "San Buenaventura (Ventura)", + "San Clemente", + "San Diego", + "San Francisco", + "San Gabriel", + "San Jacinto", + "San Jose", + "San Leandro", + "San Luis Obispo", + "San Marcos", + "San Mateo", + "San Rafael", + "San Ramon", + "Sandy", + "Sandy Springs", + "Sanford", + "Santa Ana", + "Santa Barbara", + "Santa Clara", + "Santa Clarita", + "Santa Cruz", + "Santa Fe", + "Santa Maria", + "Santa Monica", + "Santa Rosa", + "Santee", + "Sarasota", + "Savannah", + "Sayreville", + "Schaumburg", + "Schenectady", + "Scottsdale", + "Scranton", + "Seattle", + "Shakopee", + "Shawnee", + "Sheboygan", + "Shelton", + "Sherman", + "Shoreline", + "Shreveport", + "Sierra Vista", + "Simi Valley", + "Sioux City", + "Sioux Falls", + "Skokie", + "Smyrna", + "Somerville", + "South Bend", + "South Gate", + "South Jordan", + "South San Francisco", + "Southaven", + "Southfield", + "Spanish Fork", + "Sparks", + "Spartanburg", + "Spokane", + "Spokane Valley", + "Springdale", + "Springfield", + "St. Charles", + "St. Clair Shores", + "St. Cloud", + "St. George", + "St. Joseph", + "St. Louis", + "St. Louis Park", + "St. Paul", + "St. Peters", + "St. Petersburg", + "Stamford", + "Stanton", + "State College", + "Sterling Heights", + "Stillwater", + "Stockton", + "Streamwood", + "Strongsville", + "Suffolk", + "Sugar Land", + "Summerville", + "Sumter", + "Sunnyvale", + "Sunrise", + "Surprise", + "Syracuse", + "Tacoma", + "Tallahassee", + "Tamarac", + "Tampa", + "Taunton", + "Taylor", + "Taylorsville", + "Temecula", + "Tempe", + "Temple", + "Terre Haute", + "Texarkana", + "Texas City", + "The Colony", + "Thornton", + "Thousand Oaks", + "Tigard", + "Tinley Park", + "Titusville", + "Toledo", + "Topeka", + "Torrance", + "Tracy", + "Trenton", + "Troy", + "Tucson", + "Tulare", + "Tulsa", + "Turlock", + "Tuscaloosa", + "Tustin", + "Twin Falls", + "Tyler", + "Union City", + "Upland", + "Urbana", + "Urbandale", + "Utica", + "Vacaville", + "Valdosta", + "Vallejo", + "Valley Stream", + "Vancouver", + "Victoria", + "Victorville", + "Vineland", + "Virginia Beach", + "Visalia", + "Vista", + "Waco", + "Walnut Creek", + "Waltham", + "Warner Robins", + "Warren", + "Warwick", + "Washington", + "Waterbury", + "Waterloo", + "Watsonville", + "Waukegan", + "Waukesha", + "Wausau", + "Wauwatosa", + "Wellington", + "Weslaco", + "West Allis", + "West Covina", + "West Des Moines", + "West Haven", + "West Jordan", + "West New York", + "West Palm Beach", + "West Sacramento", + "West Valley City", + "Westerville", + "Westfield", + "Westland", + "Westminster", + "Weston", + "Weymouth Town", + "Wheaton", + "Wheeling", + "White Plains", + "Whittier", + "Wichita", + "Wichita Falls", + "Wilkes-Barre", + "Wilmington", + "Wilson", + "Winston-Salem", + "Winter Garden", + "Woburn", + "Woodbury", + "Woodland", + "Woonsocket", + "Worcester", + "Wylie", + "Wyoming", + "Yakima", + "Yonkers", + "Yorba Linda", + "York", + "Youngstown", + "Yuba City", + "Yucaipa", + "Yuma", + "Alabama", + "Alaska", + "Arizona", + "Arkansas", + "California", + "Colorado", + "Connecticut", + "Delaware", + "District of Columbia", + "Florida", + "Georgia", + "Hawaii", + "Idaho", + "Illinois", + "Indiana", + "Iowa", + "Kansas", + "Kentucky", + "Louisiana", + "Maine", + "Maryland", + "Massachusetts", + "Michigan", + "Minnesota", + "Mississippi", + "Missouri", + "Montana", + "Nebraska", + "Nevada", + "New Hampshire", + "New Jersey", + "New Mexico", + "New York", + "North Carolina", + "North Dakota", + "Ohio", + "Oklahoma", + "Oregon", + "Pennsylvania", + "Rhode Island", + "South Carolina", + "South Dakota", + "Tennessee", + "Texas", + "Utah", + "Vermont", + "Virginia", + "Washington", + "West Virginia", + "Wisconsin", + "Wyoming", + "North", + "Northern", + "Northeast", + "Northeastern", + "North East", + "North Eastern", + "East", + "Eastern", + "Southeast", + "Southeastern", + "South East", + "South Eastern", + "South", + "Southern", + "Southwest", + "Southwestern", + "South West", + "South Western", + "West", + "Western", + "Northwest", + "Northwestern", + "North West", + "North Western" + ], + "company_suffixes": [ + "& Co", + "& Company", + "& Sons", + "Aerospace", + "Aid", + "Air", + "Airlines", + "Airways", + "Alliance", + "Aluminium", + "America", + "Analytics", + "Armour", + "Arts", + "Automation", + "Automotive", + "Bank", + "Beauty", + "Beverage", + "Brake", + "Brands", + "Bros", + "Brothers", + "Buy", + "Capital", + "Care", + "Chase", + "Chemical", + "Chemicals", + "Club", + "Co", + "Communications", + "Communities", + "Company", + "Computer", + "Connection", + "Consolidated", + "Construction", + "Consulting", + "Corp", + "Corporation", + "Data", + "Depot", + "Destinations", + "Devices", + "Diagnostics", + "Digital", + "Direct", + "Dynamics", + "Education", + "Electric", + "Electronics", + "Energy", + "Enterprise", + "Enterprises", + "Entertainment", + "Exchange", + "Express", + "Factory", + "Farms", + "Financial", + "Foods", + "Fragrances", + "Games", + "Gaming", + "Gas", + "General", + "Glass", + "Global", + "Goods", + "Group", + "Handling", + "Harbors", + "Health", + "Healthcare", + "Holding", + "Holdings", + "Home", + "Homes", + "Hotels", + "Inc", + "Incorporated", + "Industries", + "Ingredients", + "Instruments", + "Insurance", + "International", + "Intertechnology", + "Investment", + "Laboratories", + "Lease", + "Life", + "Lifesciences", + "Line", + "Lines", + "Living", + "Logistics", + "Lots", + "Management", + "Manufacturing", + "Market", + "Markets", + "Masonry", + "Materials", + "Media", + "Metals", + "Mills", + "Motion", + "Motor", + "Motors", + "Mountain", + "Mutual", + "National", + "Network", + "Networks", + "Oil", + "Outdoor", + "Outfitters", + "Pacific", + "Paper", + "Partners", + "Parts", + "Payments", + "Pet", + "Petroleum", + "Pharmaceuticals", + "Pizza", + "Power", + "Processing", + "Products", + "Properties", + "Rentals", + "Research", + "Residential", + "Resorts", + "Resources", + "Restaurants", + "Retail", + "Roadhouse", + "Rubber", + "Sands", + "Sciences", + "Scientific", + "Security", + "Semiconductor", + "Service", + "Services", + "Software", + "Solar", + "Solutions", + "Soup", + "Sportswear", + "Steel", + "Storage", + "Store", + "Stores", + "Supply", + "Surgical", + "System", + "Systems", + "Tech", + "Technologies", + "Technology", + "Television", + "Transfer", + "Tree", + "Trust", + "USA", + "Union", + "Wholesale", + "Works", + "Worldwide" ] } diff --git a/_placeholder/data.mjs b/_placeholder/data.mjs index ebfb81f..86e5db2 100755 --- a/_placeholder/data.mjs +++ b/_placeholder/data.mjs @@ -35,10 +35,10 @@ let given_names = ).map(capitalize) given_names.sort() -let separators = ['', '.', '-', '_'] -separators.sort() +let email_separators = ['', '.', '-', '_'] +email_separators.sort() -let domain_names = +let email_domains = ( (new Domain('email', 'common')).generate() ).concat( @@ -50,7 +50,18 @@ let domain_names = ).concat( (new Domain('mail', 'suffix')).generate() ) -domain_names.sort() +email_domains.sort() -let names = {family_names, given_names, separators, domain_names} +let company = JSON.parse( + await fsPromises.readFile('company.json', 'utf-8') +) + +let names = { + family_names, + given_names, + email_separators, + email_domains, + company_prefixes: company.prefixes, + company_suffixes: company.suffixes +} process.stdout.write(JSON.stringify(names, null, 2) + '\n') diff --git a/contact/index.html.jst b/contact/index.html.jst index fd46d2f..5691020 100644 --- a/contact/index.html.jst +++ b/contact/index.html.jst @@ -1,7 +1,7 @@ -let XDate = require('xdate') - return async env => { let breadcrumbs = await _require('/_lib/breadcrumbs.jst') + let fa_envelope = await env.site.get_min_svg('/_svg/fa_envelope.svg') + let get_placeholder = await _require('/_lib/get_placeholder.jst') let get_session = await _require('/_lib/get_session.jst') let icon_cross = await env.site.get_min_svg('/_svg/icon_cross.svg') let icon_tick = await env.site.get_min_svg('/_svg/icon_tick.svg') @@ -9,29 +9,23 @@ return async env => { // preload draft details if any let transaction = await env.site.database.Transaction() - let draft_details + let placeholder + let contact_draft try { let root = await transaction.get({}) let session = await get_session(env, root) - let contact_draft = await session.get('contact_draft') - draft_details = - contact_draft !== undefined && - XDate.now() < await contact_draft.get_json('expires') ? - { - email: await contact_draft.get_json('email'), - given_names: await contact_draft.get_json('given_names'), - family_name: await contact_draft.get_json('family_name'), - company: await contact_draft.get_json('company'), - email: await contact_draft.get_json('email'), - message: await contact_draft.get_json('message') - } : - null + placeholder = await get_placeholder(env, session) + + contact_draft = await session.get_json('contact_draft') + if (contact_draft === undefined || env.now >= contact_draft.expires) + contact_draft = null + transaction.commit() } - finally { + catch (error) { transaction.rollback() + throw error } - console.log('draft_details', JSON.stringify(draft_details)) await navbar( env, @@ -43,231 +37,215 @@ return async env => { p {'Do you require more information, or assistance with integrating the projects on this site? We’d love to hear from you.'} - div.accordion#accordion.mb-5(role="tablist" aria-multiselectable="true") { - div.card#step-1 { - div.card-header#step-1-heading(role="tab") { - span#step-1-tick(style="display: none;") { - span.icon-color.pr-3 {_out.push(icon_tick)} - } - span#step-1-cross(style="display: none;") { - span.icon-color.pr-3 {_out.push(icon_cross)} - } - //span#step-1-spinner(style="display: none;") { - // span.icon-color.pr-3 { - // div.spinner-border(role="status") { - // span.sr-only {'Loading...'} - // } - // } - //} - a.h5(data-toggle="collapse" data-parent="#accordion" href="#step-1-collapse" aria-expanded="true" aria-controls="step-1-collapse") { - 'Enquiry details' + form#form { + div.row { + div.col-md-6 { + div.form-group { + label.form-label(for="given-names") {'Given names *'} + input.form-control#given-names(type="text" value=contact_draft ? contact_draft.given_names : '' placeholder=placeholder.given_names required maxlength=256) {} + div.invalid-feedback {'Please enter a name we can address you by.'} } } - div#step-1-collapse.collapse.show(role="tabpanel" aria-labelledby="step-1-heading" data-parent="#accordion") { - div.card-body { - div.row { - div.col-md-6 { - div.form-group { - label.form-label(for="given-names") {'Given names *'} - input.form-control#given-names(type="text" value=draft_details ? draft_details.given_names : '' placeholder="Your given names" required="required" maxlength=256) {} - } - } - div.col-md-6 { - div.form-group { - label.form-label(for="family-name") {'Family name'} - input.form-control#family-name(type="text" value=draft_details ? draft_details.family_name : '' placeholder="Your family name" maxlength=256) {} - } - } - } - div.row { - div.col-md-6 { - div.form-group { - label.form-label(for="company") {'Company'} - input.form-control#company(type="company" value=draft_details ? draft_details.company : '' placeholder="Your company" maxlength=256) {} - } - } - div.col-md-6 { - div.form-group { - label.form-label(for="email") {'Email *'} - input.form-control#email(type="email" value=draft_details ? draft_details.email : '' placeholder="Your email address" required="required" maxlength=256) {} - } - } - } - div.row { - div.col-md-12 { - div.form-group { - label.form-label(for="message") {'Message *'} - textarea.form-control#message(placeholder="Your message" required="required" rows=6 maxlength=65536) { - if (draft_details) - `${draft_details.message}` - } - } - } - } - - button.btn.btn-success#step-1-continue(type="button") {'Continue'} - p.'mt-3'.mb-0 {'* These fields are required.'} + div.col-md-6 { + div.form-group { + label.form-label(for="family-name") {'Family name'} + input.form-control#family-name(type="text" value=contact_draft ? contact_draft.family_name : '' placeholder=placeholder.family_name maxlength=256) {} } } } - div.card#step-2 { - div.card-header#step-2-heading(role="tab") { - span#step-2-tick(style="display: none;") { - span.icon-color.pr-3 {_out.push(icon_tick)} - } - span#step-2-cross(style="display: none;") { - span.icon-color.pr-3 {_out.push(icon_cross)} + div.row { + div.col-md-6 { + div.form-group { + label.form-label(for="company") {'Company'} + input.form-control#company(type="company" value=contact_draft ? contact_draft.company : '' placeholder=placeholder.company maxlength=256) {} } - span#step-2-spinner(style="display: none;") { - span.icon-color.pr-3 { - div.spinner-border(role="status") { - span.sr-only {'Loading...'} - } - } - } - a.h5.collapsed(data-toggle="collapse" data-parent="#accordion" href="#step-2-collapse" aria-expanded="false" aria-controls="step-2-collapse") { - 'Send enquiry' + } + div.col-md-6 { + div.form-group { + label.form-label(for="email") {'Email *'} + input.form-control#email(type="email" value=contact_draft ? contact_draft.email : '' placeholder=placeholder.email required maxlength=256) {} + div.invalid-feedback {'Please enter an email address we can contact you on.'} } } - div#step-2-collapse.collapse(role="tabpanel" aria-labelledby="step-2-heading" data-parent="#accordion") { - div.card-body { - p#step-2-message {'Please enter enquiry details first.'} - - button.btn.btn-outline-secondary#step-2-back(type="button") {'Back'} - button.btn.btn-outline-secondary.ml-3#step-2-resend-enquiry(type="button") {'Re-send enquiry'} + } + div.row { + div.col-md-12 { + div.form-group { + label.form-label(for="message1") {'Message *'} + textarea.form-control#message1(placeholder="I would like to..." required rows=6 maxlength=65536) { + if (contact_draft) + `${contact_draft.message}` + } + div.invalid-feedback {'Please let us know your application or question.'} } } } } - }, - // scripts - async _out => { - //script(src="/js/utils.js") {} - script { - let draft_timeout_running = false - let draft_timeout_handler = async () => { - draft_timeout_running = false - await api_call( - '/api/contact/set_draft.json', - { - given_names: document.getElementById('given-names').value.slice(0, 256), - family_name: document.getElementById('family-name').value.slice(0, 256), - company: document.getElementById('company').value.slice(0, 256), - email: document.getElementById('email').value.slice(0, 256).toLowerCase(), - message: document.getElementById('message').value.slice(0, 65536) + if (contact_draft !== null) + button.btn.btn-success#send-enquiry(type="button") { + div.icon24-outer.mr-2#icon { + div.icon24-inner {_out.push(fa_envelope)} + } + div.icon24-outer.mr-2#tick(hidden) { + div.icon24-inner {_out.push(icon_tick)} + } + div.icon24-outer.mr-2#cross(hidden) { + div.icon24-inner {_out.push(icon_cross)} + } + div.icon24-outer.mr-2#spinner(hidden) { + div.icon24-inner { + div.spinner-border.spinner-border-sm(role="status") {} } - ) - //console.log('draft', await api_call('/api/contact/get_draft.json')) - } - let draft_change_handler = () => { - if (!draft_timeout_running) { - draft_timeout_running = true - setTimeout(draft_timeout_handler, 5000) } + 'Send enquiry' } - - let details - let step_1 = async () => { - if ( - !document.getElementById('given-names').reportValidity() || - !document.getElementById('family-name').reportValidity() || - !document.getElementById('company').reportValidity() || - !document.getElementById('email').reportValidity() || - !document.getElementById('message').reportValidity() - ) { - $('#step-1-tick').hide() - $('#step-1-cross').show() - //$('#step-1-spinner').hide() - return false + else + button.btn.btn-success#send-enquiry(type="button" disabled) { + div.icon24-outer.mr-2#icon { + div.icon24-inner {_out.push(fa_envelope)} } - $('#step-1-tick').show() - $('#step-1-cross').hide() - //$('#step-1-spinner').hide() - - details = { - given_names: document.getElementById('given-names').value.slice(0, 256), - family_name: document.getElementById('family-name').value.slice(0, 256), - company: document.getElementById('company').value.slice(0, 256), - email: document.getElementById('email').value.slice(0, 256).toLowerCase(), - message: document.getElementById('message').value.slice(0, 65536) + div.icon24-outer.mr-2#tick(hidden) { + div.icon24-inner {_out.push(icon_tick)} } - return true - } - - let step_2 = async () => { - $('#step-2-tick').hide() - $('#step-2-cross').hide() - $('#step-2-spinner').show() - document.getElementById('step-2').scrollIntoView() - - try { - await api_call( - '/api/contact/send_enquiry.json', - details - ) + div.icon24-outer.mr-2#cross(hidden) { + div.icon24-inner {_out.push(icon_cross)} } - catch (error) { - let problem = Problem.from(error) - - $('#step-2-tick').hide() - $('#step-2-cross').show() - $('#step-2-spinner').hide() - - document.getElementById('step-2-message').textContent = problem.detail - $('#step-2-collapse').collapse('show') - return false + div.icon24-outer.mr-2#spinner(hidden) { + div.icon24-inner { + div.spinner-border.spinner-border-sm(role="status") {} + } } - $('#step-2-tick').show() - $('#step-2-cross').hide() - $('#step-2-spinner').hide() - - document.getElementById('step-2-message').textContent = 'We have received your enquiry. We will be in touch as soon as possible.' - return true + 'Send enquiry' } + p.'mt-3'.mb-0#message(hidden) {} + + p.text-muted.mt-3 {'* These fields are required.'} + }, + // scripts + async _out => { + //script(src="/js/utils.js") {} + + script { document.addEventListener( 'DOMContentLoaded', () => { - document.getElementById('given-names').addEventListener( - 'change', - draft_change_handler - ) - document.getElementById('family-name').addEventListener( - 'change', - draft_change_handler - ) - document.getElementById('company').addEventListener( - 'change', - draft_change_handler - ) - document.getElementById('email').addEventListener( - 'change', - draft_change_handler - ) - document.getElementById('message').addEventListener( - 'change', - draft_change_handler - ) + let id_company = document.getElementById('company') + let id_cross = document.getElementById('cross') + let id_email = document.getElementById('email') + let id_family_name = document.getElementById('family-name') + let id_form = document.getElementById('form') + let id_given_names = document.getElementById('given-names') + let id_icon = document.getElementById('icon') + let id_message = document.getElementById('message') + let id_message1 = document.getElementById('message1') + let id_send_enquiry = document.getElementById('send-enquiry') + let id_spinner = document.getElementById('spinner') + let id_tick = document.getElementById('tick') - document.getElementById('step-1-continue').addEventListener( - 'click', + let input_semaphore = new BinarySemaphore(false) + ;( async () => { - if (await step_1() && await step_2()) - $('#step-2-collapse').collapse('show') + while (true) { + await input_semaphore.acquire() + await new Promise(resolve => setTimeout(resolve, 3000)) + input_semaphore.try_acquire() + await api_call( + '/api/contact/set_draft.json', + id_given_names.value.length === 0 && + id_family_name.value.length === 0 && + id_company.value.length === 0 && + id_email.value.length === 0 && + id_message1.value.length === 0 ? + null : + { + given_names: id_given_names.value.slice(0, 256), + family_name: id_family_name.value.slice(0, 256), + company: id_company.value.slice(0, 256), + email: id_email.value.slice(0, 256).toLowerCase(), + message: id_message1.value.slice(0, 65536) + } + ) + } } - ) + )() // ignore returned promise (start thread) - document.getElementById('step-2-back').addEventListener( - 'click', - () => {$('#step-1-collapse').collapse('show')} - ) + let edited = () => { + input_semaphore.release() - document.getElementById('step-2-resend-enquiry').addEventListener( + id_send_enquiry.disabled = + id_given_names.value.length === 0 && + id_family_name.value.length === 0 && + id_company.value.length === 0 && + id_email.value.length === 0 && + id_message1.value.length === 0 + id_icon.hidden = false + id_tick.hidden = true + id_cross.hidden = true + id_spinner.hidden = true + id_message.hidden = true + } + + id_given_names.addEventListener('input', edited) + id_family_name.addEventListener('input', edited) + id_company.addEventListener('input', edited) + id_email.addEventListener('input', edited) + id_message1.addEventListener('input', edited) + + id_send_enquiry.addEventListener( 'click', async () => { - if (await step_2()) - $('#step-2-collapse').collapse('show') + id_icon.hidden = false + id_tick.hidden = true + id_cross.hidden = true + id_spinner.hidden = true + // the below causes an ugly flicker, so just keep the message + //id_message.hidden = true + + if (!id_form.checkValidity()) { + id_form.classList.add('was-validated'); + + id_icon.hidden = true + id_cross.hidden = false + return + } + id_form.classList.remove('was-validated'); + + let details = { + given_names: id_given_names.value.slice(0, 256), + family_name: id_family_name.value.slice(0, 256), + company: id_company.value.slice(0, 256), + email: id_email.value.slice(0, 256).toLowerCase(), + message: id_message1.value.slice(0, 65536) + } + + id_icon.hidden = true + id_spinner.hidden = false + try { + await api_call( + '/api/contact/send_enquiry.json', + details + ) + } + catch (error) { + let problem = Problem.from(error) + + id_cross.hidden = false + id_spinner.hidden = true + + id_message.textContent = problem.detail + //id_message.classList.remove('text-success') + id_message.classList.add('text-danger') + id_message.hidden = false + return + } + id_tick.hidden = false + id_spinner.hidden = true + id_message.textContent = 'We have received your enquiry. We will be in touch as soon as possible.' + //id_message.classList.add('text-success') + id_message.classList.remove('text-danger') + id_message.hidden = false } ) }