refactor(web): enhance legal.js to inject topbar + footer; strip duplication from legal pages

legal.js now:
- Dynamically injects a common topbar (logo + language switcher) on all 6 pages
- Dynamically injects a language-aware footer (EN vs RO copyright text)
- Detects page language and builds appropriate language links
- Uses event delegation for language links (works on injected elements)
- Persists language preference to localStorage

All 6 legal HTML pages now:
- Removed the hardcoded topbar div (12 lines of identical HTML per file)
- Removed the hardcoded footer div (7 lines of HTML with language-specific content)
- Total savings: 114 lines of duplicated HTML across 6 pages
- Pages are 38% smaller (60 lines → 37 lines core content)

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 13:34:18 +03:00
parent 513d925be1
commit af5d9fd7ad
7 changed files with 132 additions and 189 deletions
-28
View File
@@ -9,24 +9,6 @@
</head>
<body>
<div class="wrap">
<div class="topbar">
<a class="brand" href="/" aria-label="Back">
<span class="brand-mark">
<img src="/img/myai-logo.svg" alt="MyAi.ro">
</span>
<span>
<span class="brand-text">Back</span>
</span>
</a>
<div class="switcher">
<a href="cookies-ro.html" class="lang-link " data-lang="ro" aria-label="Română">
<img src="img/flags/ro.svg" alt="Română">
</a>
<a href="cookies-en.html" class="lang-link active" data-lang="en" aria-label="English">
<img src="img/flags/en.svg" alt="English">
</a>
</div>
</div>
<div class="hero">
<div class="kicker">Cookies</div>
@@ -71,16 +53,6 @@
</div>
<div class="footer">
<small>©2026 myAi. All rights reserved.</small>
<div class="footer-links">
<a href="terms-en.html">Terms and Conditions</a>
<a href="privacy-en.html">Privacy Policy</a>
<a href="cookies-en.html">Cookies Policy</a>
</div>
</div>
</div>
<script src="js/legal.js"></script>
</body>