document.title = "Nouvel onglet"; var webs=[ {name:"Gmail", key:"g", type:"hover", image:"icon/gmail.png", url:"https://mail.google.com/mail/u/0/#inbox", content:[ {name:"Agenda", key:"a", type:"small", image:"icon/calendar.png", url:"https://calendar.google.com/calendar/u/0/r"} ,{name:"Maps", key:"m", type:"small", image:"icon/maps.png", url:"https://www.google.fr/maps/@47.1875352,-1.5187646,15z"} ,{name:"Drive", key:"d", type:"small", image:"icon/drive.png", url:"https://drive.google.com/drive/recent"} ] } ,{name:"Comptoir.io", key:"c", type:"hover", image:"icon/comptoir.png", url:"https://www.comptoir.io", content:[ {name:"Conseil de Geek", image:"https://www.conseil-de-geek.com/img/logo.svg", url:"https://www.conseil-de-geek.com/"},{name:"Dealabs", image:"icon/dealabs.png", url:"https://www.dealabs.com/top"} ]} ,{name:"Facebook", key:"f", type:"hover", image:"icon/facebook.svg", url:"https://www.facebook.com", content:[ {name:"TinkerCad", image:"icon/tinkercad.svg", url:"https://www.tinkercad.com/dashboard/collections"} ]} ,{name:"Amazon", key:"z", type:"hover", image:"icon/amazon.png", url:"https://www.amazon.fr/gp/your-account/order-history?type=cmd", content:[ {name:"Carte Cadeau", image:"https://m.media-amazon.com/images/G/08/x-locale/cs/help/images/gateway/self-service/gift_card._CB659956101_.png", url:"https://www.amazon.fr/gp/css/gc/balance?ref_=ya_d_c_gc"} ,{name:"SAV", image:"https://m.media-amazon.com/images/G/08/x-locale/cs/help/images/gateway/self-service/contact_us._CB659956101_.png", url:"https://www.amazon.fr/hz/contact-us/foresight/hubgateway"} ,{name:"Messages", image:"https://m.media-amazon.com/images/G/08/x-locale/cs/help/images/gateway/self-service/YA_icon_Message_3._CB657833298_.png", url:"https://www.amazon.fr/gp/message?ref_=ya_d_c_msg_center#!/inbox"} ]} ,{name:"BoursoBank", key:"b", type:"hover", image:"icon/boursobank.png", url:"https://clients.boursobank.com/", content:[ {name:"CA", image:"icon/ca.png", url:"https://www.credit-agricole.fr/ca-morbihan/particulier/operations/synthese.html"} ,{name:"LCL", image:"icon/lcl.png", url:"https://monespace.lcl.fr/synthese/compte"} ,{name:"CE", image:"icon/ce.png", url:"https://www.caisse-epargne.fr/"} ]} ,{name:"Plex.tv", type:"folder", url:"https://app.plex.tv/desktop/#!/", image:"icon/plex.png", content:[ ,{name:"Allocine", image:"icon/allocine.png", url:"https://allocine.fr/series/nouvelles/?page=1"} ,{name:"MyEpisodes", image:"icon/tv.png", url:"https://www.myepisodes.com/cal/"} ]} ]; goOk=true; function goUrl(url){ if(goOk){ goOk=false; self.location.href=url; } } webs.forEach(function(w){ div=document.createElement('div'); div.id=w.name.replace('.',''); if(w.name) div.innerHTML=w.name; div.className=w.type; if(w.type=="hover") { div.onmouseover=function(){ document.querySelectorAll('div.hoversmall').forEach(function(d){if(d.id.replace('.','')!=w.name.replace('.','')) d.className="hover"}); this.className="hoversmall"; } div.onmouseout=function(){setTimeout(function(){document.querySelector("div#"+w.name.replace('.','')).className="hover";},5000)} k=0; if(w.content) w.content.forEach(function(c){ if(c.image){ divc=document.createElement('div'); divc.style.marginLeft=(114+(k++)*28)+'px'; divc.style.backgroundImage="url("+c.image+")"; divc.onclick=function(e){goUrl(c.url);e.preventDefault();return(false);}; div.appendChild(divc); }else k++; }); }else if(w.type=="folder") { div.onclick=function(e){ if(e.target.className!="folderexpand") e.target.className="folderexpand"; else e.target.className="folder";}; w.content.forEach(function(c){ if(c.image){ divc=document.createElement('div'); if(c.type) divc.className=c.type; if(c.name) divc.innerHTML=c.name; divc.style.backgroundImage="url("+c.image+")"; divc.onclick=function(e){goUrl(c.url);e.preventDefault();return(false);}; div.appendChild(divc); if(c.type=="hover"){ divc.onmouseover=function(){ document.querySelectorAll('div.hoversmall').forEach(function(d){if(d.id.replace('.','')!=c.name.replace('.','')) d.className="hover"}); this.className="hoversmall"; } divc.onmouseout=function(){setTimeout(function(){document.querySelector("div#"+c.name.replace('.','')).className="hover";},5000)} k=0; c.content.forEach(function(c2){ if(c2.image){ divc2=document.createElement('div'); divc2.style.marginLeft=(90+(k++)*40)+'px'; divc2.style.backgroundImage="url("+c2.image+")"; divc2.onclick=function(e){goUrl(c2.url);e.preventDefault();return(false);}; divc.appendChild(divc2); }else k++; }); } } }); }else { div.onmouseover=function(){ document.querySelectorAll('div.hoversmall').forEach(function(d){if(d.id.replace('.','')!=w.name.replace('.','')) d.className="hover"}); } } div.style.backgroundImage="url("+w.image+")"; if(w.url) div.onclick=function(){goUrl(w.url);}; document.querySelector('#websites').appendChild(div); }); document.body.style.backgroundImage="url(wp/"+(new Date()).getDate()+".jpg)"; /* document.addEventListener('keydown', function(event) { keyValues.forEach(function(k){ if (event.key === k.key) { window.location.href=k.url; } }); }); */ function extractKeyValues(data) { const result = []; data.forEach(function(d){ if (d.hasOwnProperty('key')) result.push(d); if (d.content && Array.isArray(d.content)) { d.content.forEach(item => { if (item.hasOwnProperty('key')) result.push(item); }); } }); return result; } // Utilisation de la fonction var keyValues = extractKeyValues(webs); document.body.focus();