Improved contact form and responsive aspect
This commit is contained in:
1 parent
98d513acb7
commit
3b50843125
16 files changed
+192
-295
No files matched your search
@@ -0,0 +1,21 @@
|
||||
(function(){
|
||||
// Land at the top, even when the page is shown inside a frame (scrollIntoView also scrolls the parent page)
|
||||
if('scrollRestoration' in history)history.scrollRestoration='manual';
|
||||
function toTop(){window.scrollTo(0,0);var m=document.body;if(m&&m.scrollIntoView)m.scrollIntoView({block:'start',behavior:'instant'})}
|
||||
window.addEventListener('load',function(){if(!/^#(en|fr)-/.test(location.hash))toTop()});
|
||||
var arts={en:document.getElementById('en'),fr:document.getElementById('fr')};
|
||||
var links=[].slice.call(document.querySelectorAll('.lang-switch a'));
|
||||
function show(lang,top){
|
||||
Object.keys(arts).forEach(function(k){arts[k].hidden=k!==lang});
|
||||
links.forEach(function(a){a.setAttribute('aria-current',a.getAttribute('href')==='#'+lang)});
|
||||
document.documentElement.lang=lang;
|
||||
document.title=lang==='fr'?'Mentions légales – Nelson Thomas':'Legal notice – Nelson Thomas';
|
||||
if(top)toTop();
|
||||
}
|
||||
links.forEach(function(a){a.addEventListener('click',function(e){
|
||||
e.preventDefault(); var l=a.getAttribute('href').slice(1);
|
||||
history.replaceState(null,'','#'+l); show(l,true);
|
||||
})});
|
||||
var h=location.hash.slice(1,3);
|
||||
show(h==='fr'||h==='en'?h:(/^fr\b/i.test(navigator.language||'')?'fr':'en'),!/^#(en|fr)-/.test(location.hash));
|
||||
})();
|
||||
@@ -8,7 +8,6 @@ var LINKEDIN_URL = "https://www.linkedin.com/in/nelson-thomas-pr/";
|
||||
|
||||
(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';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Apply the saved light/dark choice before the page paints (no flash). */
|
||||
try{var t=localStorage.getItem('theme');if(t==='light'||t==='dark')document.documentElement.dataset.theme=t}catch(e){}
|
||||
Reference in new issue
Block a user