Skip to content

Commit c5b00f0

Browse files
committed
email
1 parent 7b0b5d8 commit c5b00f0

3 files changed

Lines changed: 108 additions & 63 deletions

File tree

_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: Mo Shakiba
33

44
about_content: |
55
**<sub>[CV](https://moneuron.github.io/drive/cv.pdf) /
6-
[NEWS](https://moneuron.github.io/news)</sub>**
6+
[NEWS](https://moneuron.github.io/news) /
7+
EMAIL</sub>**
8+
9+
710
811
papers: |
912
<br>

assets/drive.css

Lines changed: 0 additions & 62 deletions
This file was deleted.

assets/script.js

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,108 @@ document.addEventListener("DOMContentLoaded", () => {
4747
}
4848
});
4949
});
50+
});
51+
52+
// EMAIL
53+
54+
document.addEventListener('DOMContentLoaded', function() {
55+
// --- Locate the "EMAIL" text and make it clickable ---
56+
// Find the container that holds CV, NEWS, and EMAIL.
57+
// Based on the HTML, it's the <sub> inside the <strong> inside the header paragraph.
58+
const headerLeft = document.querySelector('.header-left');
59+
if (!headerLeft) return;
60+
61+
// The paragraph containing the links and "EMAIL"
62+
const infoPara = headerLeft.querySelector('p');
63+
if (!infoPara) return;
64+
65+
// The <sub> element that contains the text nodes and links
66+
const subEl = infoPara.querySelector('sub');
67+
if (!subEl) return;
68+
69+
// Replace the plain "EMAIL" text with a clickable span
70+
// We'll traverse child nodes to find the text node containing "EMAIL"
71+
for (let node of subEl.childNodes) {
72+
if (node.nodeType === Node.TEXT_NODE && node.textContent.includes('EMAIL')) {
73+
const span = document.createElement('span');
74+
span.id = 'email-toggle';
75+
span.textContent = 'EMAIL';
76+
span.style.cursor = 'pointer';
77+
span.style.textDecoration = 'underline';
78+
span.style.fontWeight = 'bold';
79+
// Replace the text node with our span
80+
node.replaceWith(span);
81+
break;
82+
}
83+
}
84+
85+
const toggleBtn = document.getElementById('email-toggle');
86+
if (!toggleBtn) {
87+
// Fallback: if the above didn't work, try to find by text content directly
88+
// (but the replacement method is cleaner)
89+
console.warn('Could not locate EMAIL text automatically.');
90+
return;
91+
}
92+
93+
// --- Prepare elements to hide/show ---
94+
const mainBlockquote = document.querySelector('blockquote'); // the first blockquote in content
95+
const paperItems = document.querySelectorAll('.paper-item');
96+
const footer = document.querySelector('footer');
97+
98+
// Create the email blockquote (hidden initially)
99+
const emailBlockquote = document.createElement('blockquote');
100+
emailBlockquote.id = 'email-blockquote';
101+
emailBlockquote.style.display = 'none';
102+
emailBlockquote.innerHTML = `
103+
<p><strong>Active emails:</strong> mo.shakiba@example.edu, m.shakiba@neuroai.org</p>
104+
<p><strong>Inactive emails:</strong> old.mo@alumni.university.edu, m.shakiba@formerlab.org</p>
105+
<p><small>Feel free to reach out via the active addresses.</small></p>
106+
`;
107+
108+
// Insert the email blockquote right after the main blockquote (or before if main is missing)
109+
if (mainBlockquote) {
110+
mainBlockquote.insertAdjacentElement('afterend', emailBlockquote);
111+
} else {
112+
// If no blockquote exists, insert at the top of the content area
113+
const contentDiv = document.querySelector('.col-xs-12');
114+
if (contentDiv) {
115+
contentDiv.insertBefore(emailBlockquote, contentDiv.firstChild);
116+
}
117+
}
118+
119+
// State tracking
120+
let showingEmails = false;
121+
122+
// Function to toggle between views
123+
function toggleView() {
124+
if (!showingEmails) {
125+
// Switch to EMAILS view
126+
// Hide normal content
127+
if (mainBlockquote) mainBlockquote.style.display = 'none';
128+
paperItems.forEach(item => item.style.display = 'none');
129+
if (footer) footer.style.display = 'none';
130+
131+
// Show email blockquote
132+
emailBlockquote.style.display = 'block';
133+
134+
// Change button text
135+
toggleBtn.textContent = 'PAPERS';
136+
showingEmails = true;
137+
} else {
138+
// Switch back to PAPERS view
139+
if (mainBlockquote) mainBlockquote.style.display = '';
140+
paperItems.forEach(item => item.style.display = '');
141+
if (footer) footer.style.display = '';
142+
143+
// Hide email blockquote
144+
emailBlockquote.style.display = 'none';
145+
146+
// Change button text back
147+
toggleBtn.textContent = 'EMAIL';
148+
showingEmails = false;
149+
}
150+
}
151+
152+
// Attach click handler
153+
toggleBtn.addEventListener('click', toggleView);
50154
});

0 commit comments

Comments
 (0)