Update email rendering in More info tab

main
Elbert Alias 3 years ago
parent f50273a103
commit 2d81fe5932

@ -42,6 +42,10 @@ p {
margin: 0 0 .5rem 0; margin: 0 0 .5rem 0;
} }
.light-text {
color: var(--color-text-lighten);
}
.popup { .popup {
background: white; background: white;
max-height: 34rem; max-height: 34rem;
@ -331,19 +335,6 @@ small {
padding-bottom: 0; padding-bottom: 0;
} }
.chip, .chip:focus, .chip:hover {
border: 1px solid var(--color-secondary-darken);
border-radius: 4px;
margin: 0 .5rem .5rem 0;
display: inline-block;
padding: .2rem .5rem;
text-decoration: none;
}
.chip:focus, .chip:hover {
background: var(--color-primary-lighten)
}
.plus-configure { .plus-configure {
margin: 1.5rem; margin: 1.5rem;
} }
@ -842,12 +833,12 @@ body.dynamic-icon .category__heading:hover .category__pin {
color: var(--color-primary-text); color: var(--color-primary-text);
} }
.input[type="text"], .input[type="password"] { .dark .light-text {
border-color: var(--color-primary-darken); color: var(--color-primary-text);
} }
.dark .chip:focus, .dark .chip:hover { .input[type="text"], .input[type="password"] {
background: var(--color-primary); border-color: var(--color-primary-darken);
} }
.dark .message { .dark .message {

@ -193,6 +193,14 @@ function csvEscape(value = '') {
return String(value).replace(/"/g, '""') return String(value).replace(/"/g, '""')
} }
function parseEmail(fullEmail) {
const email = fullEmail.replace(/^[^<]*<([^>]+)>/, '$1')
const [name, title] = fullEmail.replace(/ <([^>]+)>$/, '').split(' -- ')
return { email, name, title }
}
const Popup = { const Popup = {
/** /**
* Initialise popup * Initialise popup
@ -758,13 +766,32 @@ const Popup = {
a.href = value.to a.href = value.to
a.textContent = value.text a.textContent = value.text
if ( if (['email', 'verifiedEmail', 'safeEmail'].includes(key)) {
['social', 'keywords'].includes(set) || const { email, name, title } = parseEmail(value.text)
['phone', 'email'].includes(key)
) { a.textContent = email
a.classList.add('chip')
const elName = document.createElement('span')
const elTitle = document.createElement('span')
const elBreak1 = document.createElement('br')
const elBreak2 = document.createElement('br')
elName.textContent = name
elTitle.textContent = `${title}`
elTitle.className = 'light-text'
td.appendChild(a) td.appendChild(a)
if (name) {
td.appendChild(elBreak1)
td.appendChild(elName)
if (title) {
td.appendChild(elBreak2)
td.appendChild(elTitle)
}
}
} else { } else {
div.appendChild(a) div.appendChild(a)
td.appendChild(div) td.appendChild(div)
@ -774,14 +801,18 @@ const Popup = {
const [name, title] = value.split(' -- ') const [name, title] = value.split(' -- ')
const strong = document.createElement('strong') const elName = document.createElement('span')
const span = document.createElement('span') const elTitle = document.createElement('span')
const elBreak = document.createElement('br')
elTitle.className = 'light-text'
strong.textContent = name elName.textContent = name
span.textContent = title elTitle.textContent = title
div.appendChild(strong) div.appendChild(elName)
div.appendChild(span) div.appendChild(elBreak)
div.appendChild(elTitle)
td.appendChild(div) td.appendChild(div)
} else { } else {
attributeValues[key].push(value) attributeValues[key].push(value)