@@ -49,53 +49,27 @@ document.addEventListener("DOMContentLoaded", () => {
4949 } ) ;
5050} ) ;
5151
52- // EMAIL
53-
5452document . 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.
53+
5854 const headerLeft = document . querySelector ( '.header-left' ) ;
59- if ( ! headerLeft ) return ;
60-
61- // The paragraph containing the links and "EMAIL"
6255 const infoPara = headerLeft . querySelector ( 'p' ) ;
63- if ( ! infoPara ) return ;
64-
65- // The <sub> element that contains the text nodes and links
6656 const subEl = infoPara . querySelector ( 'sub' ) ;
67- if ( ! subEl ) return ;
6857
69- // Replace the plain "EMAIL" text with a clickable span
70- // We'll traverse child nodes to find the text node containing "EMAIL"
7158 for ( let node of subEl . childNodes ) {
72- if ( node . nodeType === Node . TEXT_NODE && node . textContent . includes ( 'EMAIL' ) ) {
73- const span = document . createElement ( 'span' ) ;
59+ if ( node . nodeType === Node . TEXT_NODE && node . textContent . includes ( 'CONTACT' ) ) {
7460 span . id = 'email-toggle' ;
75- span . textContent = 'EMAIL ' ;
61+ span . textContent = 'CONTACT ' ;
7662 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 ) ;
8163 break ;
8264 }
8365 }
8466
8567 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- }
9268
93- // --- Prepare elements to hide/show ---
94- const mainBlockquote = document . querySelector ( 'blockquote' ) ; // the first blockquote in content
69+ const mainBlockquote = document . querySelector ( 'blockquote' ) ;
9570 const paperItems = document . querySelectorAll ( '.paper-item' ) ;
9671 const footer = document . querySelector ( 'footer' ) ;
9772
98- // Create the email blockquote (hidden initially)
9973 const emailBlockquote = document . createElement ( 'blockquote' ) ;
10074 emailBlockquote . id = 'email-blockquote' ;
10175 emailBlockquote . style . display = 'none' ;
@@ -105,50 +79,41 @@ document.addEventListener('DOMContentLoaded', function() {
10579 <p><small>Feel free to reach out via the active addresses.</small></p>
10680 ` ;
10781
108- // Insert the email blockquote right after the main blockquote (or before if main is missing)
10982 if ( mainBlockquote ) {
11083 mainBlockquote . insertAdjacentElement ( 'afterend' , emailBlockquote ) ;
11184 } else {
112- // If no blockquote exists, insert at the top of the content area
85+
11386 const contentDiv = document . querySelector ( '.col-xs-12' ) ;
11487 if ( contentDiv ) {
11588 contentDiv . insertBefore ( emailBlockquote , contentDiv . firstChild ) ;
11689 }
11790 }
11891
119- // State tracking
12092 let showingEmails = false ;
12193
122- // Function to toggle between views
12394 function toggleView ( ) {
12495 if ( ! showingEmails ) {
125- // Switch to EMAILS view
126- // Hide normal content
96+
12797 if ( mainBlockquote ) mainBlockquote . style . display = 'none' ;
12898 paperItems . forEach ( item => item . style . display = 'none' ) ;
12999 if ( footer ) footer . style . display = 'none' ;
130100
131- // Show email blockquote
132101 emailBlockquote . style . display = 'block' ;
133102
134- // Change button text
135- toggleBtn . textContent = 'PAPERS' ;
103+ toggleBtn . textContent = 'HOME' ;
136104 showingEmails = true ;
137105 } else {
138- // Switch back to PAPERS view
106+
139107 if ( mainBlockquote ) mainBlockquote . style . display = '' ;
140108 paperItems . forEach ( item => item . style . display = '' ) ;
141109 if ( footer ) footer . style . display = '' ;
142110
143- // Hide email blockquote
144111 emailBlockquote . style . display = 'none' ;
145112
146- // Change button text back
147- toggleBtn . textContent = 'EMAIL' ;
113+ toggleBtn . textContent = 'CONTACT' ;
148114 showingEmails = false ;
149115 }
150116 }
151117
152- // Attach click handler
153118 toggleBtn . addEventListener ( 'click' , toggleView ) ;
154119} ) ;
0 commit comments