Skip to content

Commit f5706fb

Browse files
committed
email
1 parent 9cab1e1 commit f5706fb

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

assets/script.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,65 +64,65 @@ document.addEventListener('DOMContentLoaded', function() {
6464

6565
const toggleText = {
6666
default: 'CONTACT',
67-
alternate: 'HOME' // or 'PAPERS'
67+
alternate: 'HOME'
6868
};
6969

7070
// --- Selectors ---
7171
const toggleBtn = document.querySelector('sub a[href="#"]');
7272
const mainBlockquote = document.querySelector('blockquote');
7373
const paperItems = document.querySelectorAll('.paper-item');
7474
const footer = document.querySelector('footer');
75-
76-
if (!toggleBtn || toggleBtn.textContent.trim() !== 'CONTACT') {
77-
console.warn('CONTACT link not found or has unexpected text.');
78-
return;
79-
}
8075

81-
// --- Helper: Create email panel (Bootstrap well) ---
82-
function createEmailPanel({ active, inactive }) {
83-
const panel = document.createElement('div');
84-
panel.id = 'email-panel';
85-
panel.classList.add('well', 'well-sm', 'hidden-view');
76+
// --- Helper: Create email blockquote ---
77+
function createEmailBlockquote({ active, inactive }) {
78+
const blockquote = document.createElement('blockquote');
79+
blockquote.id = 'email-blockquote';
80+
blockquote.classList.add('hidden-view'); // use CSS class instead of inline style
8681

87-
panel.innerHTML = `
88-
<p><strong>Active emails</strong><br>${active.join(', ')}</p>
89-
<p><strong>Inactive emails</strong><br>${inactive.join(', ')}</p>
90-
<p class="small text-muted">Feel free to reach out via the active addresses.</p>
82+
blockquote.innerHTML = `
83+
<p><strong>Active emails:</strong> ${active.join(', ')}</p>
84+
<p><strong>Inactive emails:</strong> ${inactive.join(', ')}</p>
85+
<p><small>Feel free to reach out via the active addresses.</small></p>
9186
`;
92-
return panel;
87+
return blockquote;
9388
}
9489

95-
// --- Inject CSS class for hiding ---
90+
// --- Inject CSS class for hiding elements (add to your stylesheet or inject here) ---
9691
const style = document.createElement('style');
9792
style.textContent = `.hidden-view { display: none !important; }`;
9893
document.head.appendChild(style);
9994

100-
// --- Build and insert email panel ---
101-
const emailPanel = createEmailPanel(emailData);
95+
// --- Build and insert email blockquote ---
96+
const emailBlockquote = createEmailBlockquote(emailData);
10297
const insertionPoint = mainBlockquote || document.querySelector('.col-xs-12');
10398
if (insertionPoint) {
104-
insertionPoint.insertAdjacentElement('afterend', emailPanel);
99+
insertionPoint.insertAdjacentElement('afterend', emailBlockquote);
105100
}
106101

107102
// --- Collect elements to toggle ---
108103
const elementsToToggle = [
109104
mainBlockquote,
110105
...paperItems,
111106
footer
112-
].filter(el => el !== null);
107+
].filter(el => el !== null); // remove any missing elements
113108

114109
// --- Toggle state ---
115110
let showingEmails = false;
116111

117112
function toggleView(event) {
118113
event.preventDefault();
119114

115+
// Toggle visibility classes
120116
elementsToToggle.forEach(el => el.classList.toggle('hidden-view'));
121-
emailPanel.classList.toggle('hidden-view');
117+
emailBlockquote.classList.toggle('hidden-view');
122118

119+
// Update button text
123120
toggleBtn.textContent = showingEmails ? toggleText.default : toggleText.alternate;
121+
122+
// Flip state
124123
showingEmails = !showingEmails;
125124
}
126125

126+
// --- Attach event listener ---
127127
toggleBtn.addEventListener('click', toggleView);
128128
});

0 commit comments

Comments
 (0)