Update /contact/index.html.jst to latest way, no accordion, placeholder company
[ndcode_site.git] / _lib / get_placeholder.jst
index 1d325e3..e1a9a7b 100644 (file)
@@ -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)