From a1c679b60aa5cdda76139afc6a0fd5c4b76e378e Mon Sep 17 00:00:00 2001 From: N0Xx_ Date: Fri, 9 Oct 2026 20:07:59 +0200 Subject: [PATCH] Initial commit of the project --- .gitignore | 12 ++ README.md | 46 ++++++++ www/css/style.css | 146 ++++++++++++++++++++++++ www/index.html | 277 ++++++++++++++++++++++++++++++++++++++++++++++ www/js/main.js | 72 ++++++++++++ 5 files changed, 553 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 www/css/style.css create mode 100644 www/index.html create mode 100644 www/js/main.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ba811c --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Secrets +portfolio-private/smtp-config.php +.env +*.key +*.pem + +# Données du conteneur (logs, clés, config) +config/ +*.log + +# CV (contiennent e-mail et téléphone) +www/docs/*.pdf diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb82657 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# ePortfolio – Nelson Thomas + +My personal portfolio, live at **[nelson-thomas.fr](https://nelson-thomas.fr)**. + +I am an engineering student in Computer Science & Telecom at INP ENSEEIHT (Toulouse), on the apprenticeship track, working in networks and cybersecurity. This site is where I present who I am, what I have built and where I am heading, in one place I own and host myself. + +## Why this project + +- **A professional showcase.** Recruiters, tutors and teachers can see my background, my projects and my CV without digging through several platforms. +- **Part of my engineering programme.** At ENSEEIHT, apprenticeship students build an ePortfolio throughout the degree. It follows a set structure (welcome page, projects, career, mobility, passions, civic engagement) and is updated as the years go by, so it shows progress rather than a snapshot. +- **A real self-hosting project.** It replaces my former WordPress site with a lightweight static site, running on my own server next to my other services (such as this Gitea instance). + +## What's on the site + +| Section | Content | +|---|---| +| **Welcome** | Who I am in a few lines, my path shown as a `traceroute`, certifications and toolbox | +| **Background** | Education and work experience as two timelines | +| **Projects** | Internship and academic projects, each told as context → what I did → result, with links to the code | +| **Career** | My CV in English and French, and my LinkedIn profile | +| **Mobility** | Destinations I am considering for my semester abroad | +| **Passions** | Self-hosting, offensive security training, photography, geopolitics | +| **Civic engagement** | Volunteering and awareness actions, with hours tracked | +| **Contact** | A form that sends messages straight to my inbox | + +## Design choices + +- **Visual identity** inspired by Proton's purple and night-sky palette, with a light and a dark theme. +- **Simple by design**: one page, plain HTML, CSS and JavaScript. No framework, no build step, no tracking, no third-party requests: even the fonts are served from the site itself. +- **Accessible and responsive**: readable on a phone, usable with a keyboard and a screen reader, and respectful of reduced-motion settings. +- **Privacy-minded contact form**: no email address is published. Messages go through a small PHP script that sends them by SMTP, with the credentials kept outside the web root, plus anti-spam protections (honeypot, per-visitor rate limit, origin check). + +## Repository layout + +``` +www/ the website itself (the only folder served publicly) +``` + +Secrets, server logs and CVs are deliberately kept out of this repository. + +## Credits and licences + +- **Content** (texts, CV, personal photos): © Nelson Thomas, all rights reserved. +- **Fonts**: Chakra Petch and IBM Plex, SIL Open Font License 1.1. +- **[PHPMailer](https://github.com/PHPMailer/PHPMailer)**: LGPL-2.1. +- **Logos and icons** of schools, companies and tools belong to their respective owners and are used only to illustrate my background and skills. diff --git a/www/css/style.css b/www/css/style.css new file mode 100644 index 0000000..efc71a2 --- /dev/null +++ b/www/css/style.css @@ -0,0 +1,146 @@ +:root{ + --night:#14122b; --surface:rgba(32,28,66,.72); --surface-2:#262249; --line:#3a3566; + --text:#ece8f7; --muted:#a8a3c9; --rose:#f0708a; --signal:#74d4e6; --todo:#f3c969; --proton:#6d4aff; --proton-soft:#8a6eff; + --display:"Chakra Petch", "Segoe UI", system-ui, sans-serif; + --body:"IBM Plex Sans", "Segoe UI", system-ui, sans-serif; + --mono:"IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; + --grad:linear-gradient(100deg,var(--proton) 0%,var(--proton-soft) 45%,var(--rose) 100%); + box-sizing:border-box; + padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px); +} +:root[data-theme="light"]{ + --night:#f4f2fb; --surface:#ffffff; --surface-2:#ebe8f7; --line:#d3cfe8; + --text:#1c1936; --muted:#5c5780; --rose:#c43a5a; --signal:#12788c; --todo:#9a6b00; --proton:#6d4aff; --proton-soft:#5b3be6; +} +@media (prefers-color-scheme: light){ + :root:not([data-theme="dark"]){ + --night:#f4f2fb; --surface:#ffffff; --surface-2:#ebe8f7; --line:#d3cfe8; + --text:#1c1936; --muted:#5c5780; --rose:#c43a5a; --signal:#12788c; --todo:#9a6b00; --proton:#6d4aff; --proton-soft:#5b3be6; + } +} +:root[data-theme="dark"]{ + --night:#14122b; --surface:rgba(32,28,66,.72); --surface-2:#262249; --line:#3a3566; + --text:#ece8f7; --muted:#a8a3c9; --rose:#f0708a; --signal:#74d4e6; --todo:#f3c969; --proton:#6d4aff; --proton-soft:#8a6eff; +} +*,*::before,*::after{box-sizing:inherit} +body{margin:0;background-color:var(--night);color:var(--text);font:400 1rem/1.6 var(--body); + background-image:radial-gradient(1px 1px at 12% 18%,rgba(255,255,255,.5),transparent 60%), + radial-gradient(1px 1px at 72% 9%,rgba(255,255,255,.4),transparent 60%), + radial-gradient(1px 1px at 88% 32%,rgba(255,255,255,.35),transparent 60%), + radial-gradient(1px 1px at 34% 6%,rgba(255,255,255,.45),transparent 60%), + radial-gradient(70rem 40rem at 90% -10%,color-mix(in srgb,var(--proton) 38%,transparent),transparent 70%), + radial-gradient(55rem 35rem at -10% 110%,color-mix(in srgb,var(--rose) 18%,transparent),transparent 70%), + linear-gradient(165deg,color-mix(in srgb,var(--proton) 22%,var(--night)) 0%,var(--night) 45%,color-mix(in srgb,var(--proton) 12%,var(--night)) 100%); + background-attachment:fixed} +a{color:var(--signal)} +a:focus-visible,button:focus-visible{outline:2px solid var(--rose);outline-offset:3px} +img{max-width:100%} + +header{position:sticky;top:env(safe-area-inset-top,0px);z-index:10;background:color-mix(in srgb,var(--night) 72%,transparent); + backdrop-filter:blur(8px);border-bottom:1px solid var(--line)} +.bar{max-width:1080px;margin:0 auto;display:flex;align-items:center;gap:1rem;padding:.6rem 1.25rem} +.brand{font:600 1.05rem var(--display);letter-spacing:.02em;white-space:nowrap;color:var(--text);text-decoration:none} +nav{display:flex;gap:.25rem;overflow-x:auto;scrollbar-width:none;margin-left:auto} +nav::-webkit-scrollbar{display:none} +nav a{position:relative;font:500 .92rem var(--body);color:var(--muted);text-decoration:none;padding:.5rem .75rem;border-radius:6px;white-space:nowrap} +nav a:hover{color:var(--text)} +nav a::after{content:"";position:absolute;left:.75rem;right:.75rem;bottom:.15rem;height:2px;border-radius:2px;background:var(--proton-soft);transform:scaleX(0);transition:transform .25s ease} +nav a.active{color:var(--text)} +nav a.active::after{transform:scaleX(1)} +header::after{content:"";position:absolute;left:0;bottom:-1px;height:1px;width:var(--progress,0%);background:var(--proton-soft)} +.theme{background:none;border:1px solid var(--line);color:var(--muted);border-radius:6px;padding:.35rem .55rem;cursor:pointer;font-size:.9rem} + +main{max-width:1080px;margin:0 auto;padding:2.5rem 1.25rem 2rem} +html{scroll-behavior:smooth;scroll-padding-top:calc(env(safe-area-inset-top,0px) + 4.5rem)} +@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}} +main>section{padding:4.5rem 0;border-top:1px solid var(--line)} +main>section:first-child{border-top:0;padding-top:1rem} +h2{display:inline-block;padding-bottom:.35rem;background:linear-gradient(var(--proton-soft),var(--proton-soft)) left bottom/3.5rem 3px no-repeat} +h1,h2,h3{font-family:var(--display);line-height:1.15;margin:0 0 .6rem} +h1{font-size:clamp(2.2rem,6vw,3.6rem);font-weight:700} +h2{font-size:clamp(1.6rem,3.5vw,2.2rem);font-weight:600;margin-bottom:1rem} +h3{font-size:1.2rem;font-weight:600} +p{margin:0 0 1rem;max-width:68ch} +.lead{font-size:1.15rem;color:var(--muted);max-width:60ch} + +/* Hero: traceroute */ +.hero{display:grid;grid-template-columns:1.1fr 1fr;gap:2.5rem;align-items:center;margin-bottom:3rem} +.avatar{box-shadow:0 0 0 4px color-mix(in srgb,var(--proton) 25%,transparent);width:96px;height:96px;border-radius:50%;display:grid;place-items:center;font:700 1.8rem var(--display); + background:var(--surface-2);border:2px dashed var(--todo);color:var(--todo);margin-bottom:1.2rem} +.role{font:500 1.1rem var(--display);color:var(--proton-soft);margin-bottom:1rem} +.trace{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:1.1rem 1.2rem;font:400 .86rem/1.75 var(--mono);overflow-x:auto} +.trace .cmd{color:var(--muted);margin-bottom:.4rem} +.trace .cmd b{color:var(--text);font-weight:500} +.hop{display:grid;grid-template-columns:1.4rem 8.8rem 2.9rem minmax(0,1fr);gap:.6rem} +.hop>span:not(:last-child){white-space:nowrap} +.hop .n{color:var(--muted)} .hop .h{color:var(--signal)} .hop .y{color:var(--muted)} +.hop.last .h{color:var(--rose)} +.hop{opacity:0;animation:hop .35s ease-out forwards} +@keyframes hop{to{opacity:1}} +@media (prefers-reduced-motion:reduce){.hop{animation:none;opacity:1}} +.cta{display:flex;flex-wrap:wrap;gap:.7rem;margin-top:1.4rem} +.btn{display:inline-block;padding:.6rem 1rem;border-radius:6px;text-decoration:none;font-weight:500;border:1px solid var(--line);color:var(--text)} +.btn.primary{background:var(--proton);border-color:var(--proton);color:#fff} + +.uvp{border-left:3px solid var(--proton-soft);padding:.4rem 0 .4rem 1.2rem;margin:0 0 3rem;font:500 1.25rem/1.5 var(--display);max-width:52ch} + +.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:1.25rem} +.item{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:1.3rem} +.item.wide{grid-column:1/-1} +.meta{color:var(--muted);font-size:.9rem;margin-bottom:.7rem} +dl.star{display:grid;grid-template-columns:auto 1fr;gap:.35rem .9rem;margin:0;font-size:.95rem} +dl.star dt{color:var(--muted)} dl.star dd{margin:0} +.tags{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.9rem} +.tags span{font-size:.8rem;padding:.15rem .55rem;border-radius:4px;background:var(--surface-2);color:var(--muted)} +.result{color:var(--signal);font-weight:500} + +.todo{border:1px dashed var(--todo);border-radius:6px;padding:.1rem .4rem;color:var(--todo);font-size:.95em} +.item.todo-box{border-style:dashed;border-color:var(--todo)} +.sub{margin:2.5rem 0 1rem;font:600 1.25rem var(--display);color:var(--text)} + +.checklist{list-style:none;padding:0;margin:0 0 2rem;display:grid;gap:.5rem;max-width:720px} +.checklist li{display:flex;gap:.7rem;align-items:flex-start;padding:.7rem .9rem;background:var(--surface);border:1px solid var(--line);border-radius:8px} +.checklist .st{flex:none;width:1.3rem;height:1.3rem;border-radius:50%;border:2px solid var(--todo);margin-top:.15rem} +.checklist .st.ok{border-color:var(--signal);background:var(--signal)} +.video{aspect-ratio:16/9;display:grid;place-items:center;background:var(--surface-2);border:1px dashed var(--todo);border-radius:10px;color:var(--todo);text-align:center;padding:1rem} +.meter{height:10px;background:var(--surface-2);border-radius:5px;overflow:hidden;margin:.6rem 0 .3rem;max-width:520px} +.meter i{display:block;height:100%;width:0;background:var(--proton-soft)} + +.contact{display:grid;grid-template-columns:1fr 1.3fr;gap:2.5rem;align-items:start} +.form{position:relative;background:var(--surface);border-radius:12px;padding:1.6rem;border:1px solid var(--line)} +.field{display:grid;gap:.35rem;margin-bottom:1rem} +.row{display:grid;grid-template-columns:1fr 1fr;gap:1rem} +label{font-size:.9rem;color:var(--muted)} +input,textarea{font:inherit;color:var(--text);background:var(--night);border:1px solid var(--line);border-radius:8px;padding:.65rem .8rem;width:100%} +textarea{min-height:9rem;resize:vertical} +input:focus,textarea:focus{outline:none;border-color:var(--proton-soft);box-shadow:0 0 0 3px color-mix(in srgb,var(--proton) 30%,transparent)} +input:user-invalid,textarea:user-invalid{border-color:var(--rose)} +.hp{position:absolute;left:-9999px} +.form button{font:500 1rem var(--body);cursor:pointer;border:0;padding:.7rem 1.3rem;border-radius:8px;background:var(--proton);color:#fff;transition:background-color .2s,transform .2s} +.form button:hover{background:var(--proton-soft)} +.form button:disabled{opacity:.6;cursor:wait} +.status{margin:.9rem 0 0;font-size:.95rem;min-height:1.5em} +.status.ok{color:var(--signal)} .status.err{color:var(--rose)} +.direct{display:grid;gap:.6rem;margin-top:1.2rem} +@media (max-width:820px){.contact{grid-template-columns:1fr}.row{grid-template-columns:1fr}} +/* Hover: frames lift slightly and pick up the Proton purple */ +.item,.checklist li,.trace,.form,.video,.btn,.tags span{transition:transform .25s ease,border-color .25s ease,box-shadow .25s ease,background-color .25s ease} +@media (hover:hover){ + .item:hover,.trace:hover,.form:hover,.video:hover{transform:translateY(-3px);border-color:var(--proton-soft); + box-shadow:0 10px 28px -12px color-mix(in srgb,var(--proton) 55%,transparent)} + .item.todo-box:hover{border-color:var(--todo)} + .checklist li:hover{transform:translateX(4px);border-color:var(--proton-soft)} + .btn:hover{transform:translateY(-2px);border-color:var(--proton-soft);box-shadow:0 6px 18px -8px color-mix(in srgb,var(--proton) 70%,transparent)} + .btn.primary:hover{background:var(--proton-soft);filter:none} + .item:hover .tags span{background:color-mix(in srgb,var(--proton) 22%,var(--surface-2));color:var(--text)} + .form button:hover{transform:translateY(-1px)} +} +@media (prefers-reduced-motion:reduce){ + .item:hover,.trace:hover,.form:hover,.video:hover,.checklist li:hover,.btn:hover,.form button:hover{transform:none} +} +footer{border-top:1px solid var(--line);text-align:center;padding:1.5rem 1rem;color:var(--muted);font-size:.9rem} +@media (max-width:820px){ + .hero{grid-template-columns:1fr} + .bar{flex-wrap:wrap} nav{margin-left:0;width:100%;order:3} + .hop{grid-template-columns:1.2rem 7.6rem 2.6rem minmax(0,1fr);gap:.45rem} +} diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..8184548 --- /dev/null +++ b/www/index.html @@ -0,0 +1,277 @@ + + + + + + + +Nelson Thomas – ePortfolio + + + + + + +
+ +
+ +
+ +
+
+
+
NT
+

Nelson Thomas

+

Engineering student at INP ENSEEIHT and cybersecurity apprentice at [Company]

+

I keep networks running and find out when someone is trying to break in. From SOC alert triage to Proxmox clusters, I like work where a script or a well-read log saves real time.

+ +
+
+
$ traceroute nelson-thomas
+
1ups-toulouse2022Maths & CS double degree, year 1
+
2iut-blagnac2023BUT Networks & Telecom, cyber track
+
3iut-blagnac.lab2025Network technician intern
+
4itrust.soc2026SOC analyst L1 intern
+
5enseeiht.n72026Engineering apprentice, 3 years
+
+
+ +

I bring both sides of a network: I build the infrastructure, and I've sat in a SOC watching what attacks on it look like.

+ +
+

Now

First year of the Computer Science & Telecom engineering degree at N7, as an apprentice at [Company – team].

+

Certified

Cisco CCNA: Switching, Routing and Wireless Essentials. Cisco Ethical Hacker. TOEIC 845.

+

Heading for

Defensive security: detection engineering, SOC and secure network architecture.

+
+
+ + +
+

Projects

+

Each project follows the same frame: the context, what I did, the tools, and what came out of it. Company work is described without confidential details.

+ +

In my company

+
+
+

[Apprenticeship mission title]

+
[Company], 2026 to now
+
+
Context
[Team and need, in one line, no client names]
+
My part
[What you are responsible for]
+
Result
[A number, a delivery or a decision. Check with your tutor before publishing.]
+
+
+
+ +

Internships

+
+
+

Automated lab re-imaging

+
IUT de Blagnac, network technician intern, 2025
+
+
Context
Lab machines had to be re-imaged by hand between classes.
+
My part
Wrote a Bash script driving the FOG PXE API to redeploy images automatically.
+
Result
Redeployment time cut from 60 to 10 minutes.
+
+
BashFOG PXEProxmox HA
+
+
+

Wazuh SIEM deployment

+
IUT de Blagnac, 2025
+
+
Context
No central view of security events on the teaching network.
+
My part
Configured Wazuh, onboarded hosts, hardened the lab system images.
+
Result
Network incidents now detected and logged centrally.
+
+
WazuhLinuxHardening
+
+
+

Security alert triage

+
ITRUST, SOC analyst L1 intern, 2026
+
+
Context
Managed security service watching client environments.
+
My part
Qualified SIEM and EDR alerts, correlated events, notified clients.
+
Result
Client wiki extended with new alert signatures and analysis tips.
+
+
Reveelium SIEMEDRIncident analysis
+
+
+ +

Academic

+
+
+

Rebuilding a screen from its emissions

+
IUT, SAÉ 5.12
+

Processing chain that reconstructs the image of an LCD screen from its electromagnetic radiation, a side-channel eavesdropping attack.

+
Signal processingSide channel
+
+
+

Multi-site MPLS network

+
IUT
+

MPLS backbone with IPsec VPN and IPv6 between sites, simulated in GNS3.

+
MPLSIPsecIPv6GNS3
+
+
+

VoIP for a healthcare practice

+
IUT
+

Full ToIP infrastructure for a paramedical practice, running on a type 1 hypervisor.

+
ToIPVirtualisation
+
+
+

Securing an information system

+
IUT, SAÉ 4.1
+

Small network secured with VLAN segmentation, VRF and firewalling.

+
VLANVRFFirewall
+
+
+

[First N7 project]

+
ENSEEIHT, 2026–2027
+

[Add it as soon as it starts, then update it: the portfolio should show progress.]

+
+
+
+ + +
+

Career

+

One real job ad drives everything below: the CV, the cover letter, my LinkedIn headline and my pitch.

+ +
    +
  • Target job ad
    [Title, company, link or screenshot]
  • +
  • CV in English
    Download my CV (PDF) [tailor it to the ad, add the apprenticeship]
  • +
  • Cover letter in English
    [Answer the ad point by point]
  • +
  • LinkedIn
    linkedin.com/in/nelson-thomas-pr [set the apprenticeship as current position]
  • +
  • Two My Job Glasses interviews
    [0 of 2 done]
  • +
  • Elevator pitch video
    [3 min ± 30 s, spoken, not read]
  • +
+ +
+
+

Elevator pitch

+
Embed your YouTube (unlisted) or Vimeo video here.
Present, then a very short past, then where you're heading.
+
+
+

Interview 1: [Name, job, company]

+
+
Why
[e.g. a SOC or CERT analyst, the job I'm aiming for]
+
Learnt
[2–3 concrete takeaways]
+
+
+
+

Interview 2: [Name, job, company]

+
+
Why
[e.g. a network security architect, the other path]
+
Learnt
[2–3 concrete takeaways]
+
+
+
+
+ + +
+

Mobility

+

Seventeen weeks abroad in S9. Three options, why each one fits, and whether my employer can make it work. [The three below are suggestions: keep, swap or rewrite them.]

+
+
+

Tallinn, Estonia

+
Option 1
+
+
Why
Home of the NATO cyber defence centre and one of Europe's most digitised states.
+
Employer fit
[Does the company have partners or clients in the Baltics?]
+
+
+
+

Montréal, Canada

+
Option 2
+
+
Why
Large cybersecurity sector, French and English working environment.
+
Employer fit
[Subsidiary, partner lab, or university exchange?]
+
+
+
+

Dublin, Ireland

+
Option 3
+
+
Why
European base for many cloud providers, full English immersion to push past B2.
+
Employer fit
[Ask your tutor about timing within the apprenticeship calendar]
+
+
+
+
+ + +
+

Passions

+
+

Self-hosting

I run web services and a private cloud on my own NAS and a friend's, and handle their security and administration.

+

Offensive training

Hack The Box Academy and TryHackMe: learning how attackers think so I defend better.

+

Photography

Nature, wildlife and landmarks, including drone shots. [Add 3–4 of your photos]

+

Geopolitics

Following world affairs, which often explains the threats a SOC ends up seeing.

+
+
+ + +
+

Civic engagement

+

Forty hours required by S9. Here is what's done and what's planned.

+
+

[0] of 40 hours completed

+
+
+

[Planned action]

+

[e.g. cyber-awareness sessions for a school or an association, digital help for seniors, N7 student association]

+
[hours, dates]
+
+
+
+ + +
+
+
+

Contact

+

An apprenticeship question, a project, or just a chat about security? Send me a message and I'll reply within a few days.

+ +
+
+
+
+
+
+
+
+
+ + +

+
+
+
+
+ + + + + + diff --git a/www/js/main.js b/www/js/main.js new file mode 100644 index 0000000..d0157c8 --- /dev/null +++ b/www/js/main.js @@ -0,0 +1,72 @@ +/* ===== Contact form settings ===== + 1. Create a free key at https://web3forms.com with nelson.thomas.contact@pm.me + 2. Paste it below. Messages then arrive straight in your Proton inbox. + Without a key (or if the service is unreachable), the form opens the + visitor's mail app with the message already written. */ +var WEB3FORMS_KEY = "YOUR_ACCESS_KEY"; +var CONTACT_EMAIL = "nelson.thomas.contact@pm.me"; + +(function(){ + var root=document.documentElement; + try{var s=localStorage.getItem('theme');if(s)root.dataset.theme=s}catch(e){} + document.getElementById('theme').addEventListener('click',function(){ + var dark=root.dataset.theme?root.dataset.theme==='dark':!matchMedia('(prefers-color-scheme: light)').matches; + root.dataset.theme=dark?'light':'dark'; + try{localStorage.setItem('theme',root.dataset.theme)}catch(e){} + }); + + // Scroll-spy: highlight the section on screen + var links=[].slice.call(document.querySelectorAll('nav a')); + var nav=document.querySelector('nav'); + function setActive(id){ + links.forEach(function(a){ + var on=a.getAttribute('href')==='#'+id; + a.classList.toggle('active',on); + if(on){a.setAttribute('aria-current','true'); + var l=a.offsetLeft-nav.offsetLeft, r=l+a.offsetWidth; + if(lnav.scrollLeft+nav.clientWidth) nav.scrollTo({left:l-16,behavior:'smooth'}); + } else a.removeAttribute('aria-current'); + }); + } + var sections=[].slice.call(document.querySelectorAll('main>section')); + if('IntersectionObserver' in window){ + var io=new IntersectionObserver(function(entries){ + entries.forEach(function(e){if(e.isIntersecting)setActive(e.target.id)}); + },{rootMargin:'-45% 0px -50% 0px'}); + sections.forEach(function(s){io.observe(s)}); + } + // Reading progress line under the header + var header=document.querySelector('header'); + function progress(){ + var h=document.documentElement, max=h.scrollHeight-h.clientHeight; + header.style.setProperty('--progress',(max>0?h.scrollTop/max*100:0)+'%'); + if(h.scrollTop+h.clientHeight>=h.scrollHeight-4) setActive('contact'); + } + window.addEventListener('scroll',progress,{passive:true}); progress(); + + // Contact form + var form=document.getElementById('contact-form'), btn=document.getElementById('f-send'), st=document.getElementById('f-status'); + function say(msg,cls){st.textContent=msg;st.className='status '+(cls||'')} + function mailtoFallback(d){ + var body=d.message+'\n\n'+d.name+(d.company?' ('+d.company+')':'')+'\n'+d.email; + window.location.href='mailto:'+CONTACT_EMAIL+'?subject='+encodeURIComponent(d.subject)+'&body='+encodeURIComponent(body); + say('Your mail app should open with the message ready. If nothing happens, write to '+CONTACT_EMAIL+'.','ok'); + } + form.addEventListener('submit',function(e){ + e.preventDefault(); + if(!form.checkValidity()){form.reportValidity();say('Fill in your name, a valid email, a subject and a message.','err');return} + if(form.botcheck.checked)return; + var d={name:form.name.value.trim(),email:form.email.value.trim(),company:form.company.value.trim(),subject:form.subject.value.trim(),message:form.message.value.trim()}; + if(!WEB3FORMS_KEY||WEB3FORMS_KEY==='YOUR_ACCESS_KEY'){mailtoFallback(d);return} + btn.disabled=true;btn.textContent='Sending...';say(''); + fetch('https://api.web3forms.com/submit',{method:'POST',headers:{'Content-Type':'application/json',Accept:'application/json'}, + body:JSON.stringify({access_key:WEB3FORMS_KEY,from_name:'Portfolio: '+d.name,replyto:d.email,subject:'[Portfolio] '+d.subject,name:d.name,email:d.email,company:d.company,message:d.message})}) + .then(function(r){return r.json()}) + .then(function(r){ + if(r.success){form.reset();say('Message sent. Thanks, I\'ll get back to you soon.','ok')} + else throw new Error(r.message); + }) + .catch(function(){mailtoFallback(d)}) + .finally(function(){btn.disabled=false;btn.textContent='Send message'}); + }); +})();