",(t=document.getElementsByClassName("challenge-popup")).length?$mkScreen.insertBefore(a,t[0]):$mkScreen.appendChild(a),r=0,function e(){r<1?(a.style.opacity=r,r+=.2,setTimeout(e,40)):a.style.opacity=1}(),focusOnChallengeClose())}function showChallengePopup(t,a){if(!document.getElementById("challenge-popup-"+t.id)){var e=a.pts,n=document.createElement("div");n.id="challenge-popup-"+t.id,n.className="challenge-popup",n.style.width=56*iScreenScale+"px",n.style.left=12*iScreenScale+"px",n.style.top=Math.round(4.5*iScreenScale)+"px",n.style.padding=Math.round(1.5*iScreenScale)+"px",n.style.paddingBottom=5*iScreenScale+"px",n.style.border="inset "+Math.round(.5*iScreenScale)+"px #7B0",n.style.fontSize=2*iScreenScale+"px",n.style.opacity=0;var o=language?"Challenge completed!":"Défi réussi !",i=t.description.main,r=(language?"You receive a reward of "+e+" pt"+(2<=e?"s":"")+".":"Vous recevez "+e+" pt"+(2<=e?"s":"")+" en récompense.")+" ",l="";a.pts_advent&&(s=(c=a.pts_advent)+"",a.pts_advent_extra&&(s+="+"+a.pts_advent_extra,c+=a.pts_advent_extra),l='
🎁 '+(language?"Advent calendar: you receive a bonus reward of "+s+" pt"+(2<=c?"s":"")+"!!":"Calendrier de l'avent : vous recevez un bonus de "+s+" pt"+(2<=c?"s":"")+" !!")+"
",e||(e=!0,r=""));var s=language?"Your challenge points go from "+a.pts_before+" to "+a.pts_after+"!":"Vos points défis passent de "+a.pts_before+" à "+a.pts_after+" !",c=language?"Close":"Fermer";if(n.innerHTML='
'+o+'
'+i+"
"+(e?'
'+r+l+s+"
":"")+(0<=a.rating?'
'+toLanguage("Rate this challenge:","Notez ce défi :")+'
',document.getElementById("infos0").style.border="solid 1px black",document.getElementById("infos0").style.opacity=.7,document.getElementById("infos0").style.fontSize=Math.round(1.77*iScreenScale-.5)+"pt",document.getElementById("infos0").style.fontFamily="Courier",document.getElementById("infos0").style.top=3*iScreenScale+"px",document.getElementById("infos0").style.left=Math.round(24*iScreenScale+10+(strPlayer.length-1)/2*(iWidth*iScreenScale+2))+"px",document.getElementById("infos0").style.backgroundColor=iTeamPlay?"blue":"#063",document.getElementById("infos0").style.color=primaryColor,document.getElementById("infos0").innerHTML=pe,handleRankingStyle(),(Re=document.createElement("input")).type="button",Re.id="octn",Re.value=toLanguage("CONTINUE","CONTINUER"),Re.style.width="100%",Re.style.height="100%",Re.style.fontSize=3*iScreenScale+"pt",Re.onclick=classement,document.getElementById("continuer").appendChild(Re),document.getElementById("infos0").style.display="";ge=document.body.scrollTop;for(Re.focus(),document.body.scrollTop=ge,n=0;nRe*Ae?a.maxspeed0=Re*Ae:a.maxspeed0-qe&&(a.maxspeed=qe,a.speed=Math.max(qe*cappedRelSpeed(a),a.speed)),a.turbodrift--),a.champi&&(a.maxspeed=11,a.champi--,a.champi||delete a.champiType),a.billball){if(a.z=2,a.heightinc=0,a.speed=Math.min(30,13*cappedRelSpeed()),null!=a.aipoint)(Ge=a.aipoints[a.aipoint])?(J=Ge[0]-a.x)*J+(_e=Ge[1]-a.y)*_e<2e3&&(inTeleport(Ge[0],Ge[1])||(a.aipoint++,a.aipoint>=a.aipoints.length&&(a.aipoint=0))):_e=J=0;else{var Ne=a.demitours+1;Ne>=oMap.checkpoint.length&&(Ne=0);var _e=(Fe=oMap.checkpointCoords[Ne])?(J=Fe.O[0]-a.x,Fe.O[1]-a.y):J=0;e:for(n=0;nFe[0]-35&&a.xFe[1]-35&&a.y=fTurboDriftCpt2){for(var a=0;a=fTurboDriftCpt){for(a=0;a':""}var s=document.getElementById("scroller"+e),c=document.getElementById("objet"+e);t.stash?(document.getElementById("reserve"+e).style.visibility="visible",c.style.left=Math.round(3*iScreenScale)+"px",c.style.top=Math.round(3*iScreenScale)+"px",s.style.left=Math.round(3*iScreenScale)+"px",s.style.top=Math.round(3*iScreenScale+ +iScreenScale)+"px"):(document.getElementById("reserve"+e).style.visibility="hidden",c.style.left=Math.round(iScreenScale)+"px",c.style.top=Math.round(iScreenScale)+"px",s.style.left=iScreenScale+"px",s.style.top=Math.round(iScreenScale+ +iScreenScale)+"px")}function updateItemCountdownHud(e,t){var a,n,o,i,r,l=document.getElementById("countdown"+e);l&&(0i-Math.PI+o&&t.push([a,n]),r>i-Math.PI-o&&t.push([a,0]),l.style.clipPath="polygon("+t.map(function(e){return e[0]+"px "+e[1]+"px"}).join(", ")):(l.style.display="none",l.style.clipPath=""))}function updateLapHud(e){for(var t=getPlayerAtScreen(e),a=document.querySelectorAll("#compteur"+e+" .tour"),n=0;n=e.aipoints.length){if(oMap.sections||e.tours>=oMap.tours)return 1/0;o=0}var i=e.aipoints[o];if(n+=Math.hypot(i[0]-a[0],i[1]-a[1]),t=o,a=e.aipoints[t],t==e.aipoint)return 1/0}}function hasShortcutItem(e,t){return!e.using.length&&(25==e.roulette&&isShortcutItem(e.arme,t))}function isShortcutItem(e,t){return isShortcutItemKey(e,t)}function isShortcutItemKey(e,t){return!!e&&(!t||t[2].itemsDict[e])}function hasExtraShortcutItem(e,t){if(25==e.roulette2&&isShortcutItem(e.stash,t))return 1;if(isShortcutItemKey("champi",t))switch(e.arme){case"champiX2":case"champiX3":return 1;case"champior":if(e.champior)return 1}}var fMaxRotInCp=10,nextBlueShellCooldown;function ai(u){var e=isBattle&&simplified,t=isBattle&&complete,a=!isBattle&&complete;if(null==u.aipoint)if(delete u.aishortcut,"BB"!=course)for(var n=1/0,o=0;ooMap.tours||u.ballons&&!u.ballons.length&&!u.loose)return u.speedinc=0,u.rotinc=0,void(u.rotincdir=0);if(u.tourne)return u.speedinc=!u.z&&1=u.aipoints.length&&(g=0),m=u.aipoints[g])):((L=y-1)<0&&(L+=u.aipoints.length),(g=y+1)>=u.aipoints.length&&(g=0),h=u.aipoints[L],d=u.aipoints[y],m=u.aipoints[g]);else if(e){h=[u.lastAI%6*100+50,100*Math.floor(u.lastAI/6)+50],d=[u.aipoint%6*100+50,100*Math.floor(u.aipoint/6)+50],m=[h[0]+2*(d[0]-h[0]),h[1]+2*(d[1]-h[1])];var f=Math.floor(u.x/100)+6*Math.floor(u.y/100);if(f!=u.lastAI){var S=!0;if(0<=u.speed&&!u.tombe){var v=(d[0]-u.x)*(d[0]-u.x)+(d[1]-u.y)*(d[1]-u.y);switch(oMap.skin){case 27:S=v<1500;break;case 48:S=v<900}}if(S){(P=u.aipoints[f])&&P.length||(P=[],f%6&&P.push(f-1),f%6<5&&P.push(f+1),6<=f&&P.push(f-6),f<30&&P.push(f+6),-1!=(E=P.indexOf(u.lastAI))&&P.splice(E,1));var b=u.lastAI;for(u.lastAI=f;u.aipoint=P[Math.floor(Math.random()*P.length)],b==u.aipoint&&1N&&(u.randShift=N*Math.sign(u.randShift))));var D,B,f=projete(u.x,u.y,h[0],h[1],d[0],d[1]),w=h[0]+f*(d[0]-h[0]),L=h[1]+f*(d[1]-h[1]),z=Math.hypot(u.x-w,u.y-L);if(k||I||(z=0,u.nextAiStop=0,f=1),!(f>=u.nextAiStop&&zu.recovertime&&(u.randShift=Math.random()*u.recovertime/2-u.recovertime/4,u.recovertime+=30,u.decision=-u.decision,u.collidesince=1,e&&(u.lastAI=u.aipoint)):(u.collidesince=1,u.decision||(H=direction(0,u.rotation),O=direction(1,u.rotation),R=u.horizontality[0],A=u.horizontality[1],u.decision=0=10*me&&(se+=.15*(se-u.rotation)*me)),isNaN(se)&&(se=u.rotation)),_=nearestAngle(180*_/Math.PI,se,360),isNaN(_)&&(_=se),isNaN(V)&&(V=d[0]),isNaN(F)&&(F=d[1]);var pe=_-se;u.rotinc=Math.max(Math.min(pe,fMaxRotInCp),-fMaxRotInCp);var de=Math.abs(pe),s=de;isBattle&&(de*=Math.pow(de/10,1.5)),l=Math.hypot(V-u.x,F-u.y);var ue,me=Math.atan2(V-h[0],F-h[1])-u.rotation,se=(Math.abs(Math.sin(me))+de*Math.PI/180/2)/y,c=l/se;"BB"!=course||(me=Math.max(5,se/1.57))250+50*Math.random()&&!e&&(u.aipoint=void 0);break}"BB"!=course?inTeleport(d[0],d[1])||(null!=u.aishortcut&&u.aishortcuts[u.aipoint]?(B=(D=u.aishortcuts[u.aipoint])[0],u.aishortcut=u.aipoints.length&&(u.aipoint=0))):(u.lastAI=u.aipoint,delete u.lastAIpt,-1!=u.nextAI?u.aipoint=u.nextAI:u.aipoint=void 0,u.nextAI=void 0),u.nextAiStop=void 0,u.randShift=void 0,u.lastAItime=0}if((25==u.roulette||u.using[0])&&!u.tourne&&!u.cannon){var he=!1;function ge(e,t,a,n,o){for(var i=e*e,r=t*t,l=(isOnline?aKarts:strPlayer).length,s=0;stimer-10||(ge(0,20,0,30)||ge(0,300,0,15)?(arme(aKarts.indexOf(u)),setTimeout(function(){arme(aKarts.indexOf(u))}),aKarts.lastUsedTimer=timer):(ge(0,20,0,30,!0)||ge(0,80,0,15,!0))&&(arme(aKarts.indexOf(u)),setTimeout(function(){arme(aKarts.indexOf(u),!0)}),aKarts.lastUsedTimer=timer)):he=!0;break;default:he=!0}}if(he&&.98oPlayers[0].place)||"BB"==course)&&.5=d*c[2][3]&&(c[2][2]=d,1==p?(c[3][0]=2,c[2][3]=-c[2][3]):(c[3][0]=0,c[2][3]=0,c[3][1]=1+Math.floor(50*Math.random())))}p&&c[0].redraw(c)}if(oMap.bumpers)for(a=0;a=l&&(v.theta-=l)}}var previouslyPressedBtns=[],cycleHandler;function handleGamepadEvents(){if(gameControls.gamepad)for(var e=0;emapMusic.opts.end:0===mapMusic.yt.getPlayerState()&&e>mapMusic.yt.getDuration()-1)||(t=mapMusic.opts.start||0)=aKarts.length&&(oSpecCam.playerId=0);break;case"quit":return document.location.reload(),!1;default:return!0}oSpecCam.reset();var t,a=getPlayerAtScreen(0);return(isBattle?!a.loose:a.tours<=oMap.tours)&&((t=document.getElementById("infoPlace0")).style.visibility="",t.innerHTML=a.place,-1!=a.team&&(t.style.color=cTeamColors.light[a.team])),isBattle?updateBalloonHud(document.getElementById("compteur0"),a):updateLapHud(0),!1}function releaseOverEvents(){for(var e=document.querySelectorAll(":hover"),t=0;tThe principle is simple: a private link is generated, you send this link to the concerned members, and you can start playing.":"L'option "partie privée" vous permet de jouer uniquement avec les personnes de votre choix. Le principe est simple : un lien privé est généré, vous envoyez ce lien aux membres concernés, et vous pouvez commencer à jouer.",e.appendChild(a);a=document.createElement("input");a.type="button",a.value=toLanguage("Generate private link","Générer un lien privé"),a.style.fontSize=3*iScreenScale+"px",a.style.position="absolute",a.style.width=35*iScreenScale+"px",a.style.left=23*iScreenScale+"px",a.style.top=28*iScreenScale+"px",a.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),privateLink(t)},e.appendChild(a),(a=document.createElement("input")).type="button",a.value=toLanguage("Back","Retour"),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=2*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),shareLink.options=null,selectPlayerScreen(0)},e.appendChild(a),(a=document.createElement("input")).type="button",a.value=toLanguage("Private game options...","Options de la partie privée..."),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=52*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),privateGameOptions(shareLink.options,function(e){e&&(shareLink.options=e,t=e),privateGame(t)})},e.appendChild(a),oContainers[0].appendChild(e)}function privateGameOptions(e,M){var x=document.createElement("div"),t=x.style;t.width=iWidth*iScreenScale+"px",t.height=iHeight*iScreenScale+"px",t.border="solid 1px black",t.backgroundColor="black",(g=toTitle(isOnline?toLanguage("Private game options","Options partie privée"):toLanguage("Online game options","Options mode en ligne"),0)).style.fontSize=7*iScreenScale+"px",x.appendChild(g);var a=document.createElement("form");a.style.position="absolute",a.style.left="0px",a.style.top=8*iScreenScale+"px",a.style.width=iWidth*iScreenScale+"px",a.onsubmit=function(e){e.preventDefault();var t=this.elements["option-teams"].checked?1:0,a=this.elements["option-manualTeams"].checked?1:0,n=this.elements["option-friendlyFire"].checked?1:0,o=+this.elements["option-nbTeams"].value,i=JSON.parse(this.elements["option-teamOpts"].value),r=this.elements["option-friendly"].checked?1:0,l=+this.elements["option-localScore"].checked?1:0;r||(l=0);var s=+this.elements["option-minPlayers"].value,c=+this.elements["option-maxPlayers"].value,p=parseInt(this.elements["option-cc"].value),d=this.elements["option-cc"].value.endsWith("m"),u=JSON.parse(this.elements["option-itemDistrib"].value),m=JSON.parse(this.elements["option-ptDistrib"].value),h=this.elements["option-cpu"].checked?1:0,g=+this.elements["option-cpuCount"].value,y=+this.elements["option-cpuLevel"].value,f=(f=this.elements["option-cpuNames"].dataset.value)&&JSON.parse(f),S=(S=this.elements["option-cpuChars"].dataset.value)&&JSON.parse(S),v=this.elements["option-timeTrial"].checked?1:0,b=this.elements["option-noBumps"].checked?1:0,C=this.elements["option-noJump"].checked?1:0,e=this.elements["option-doubleItems"].checked?0:1;t||(n=i=a=0),v&&(b=0),h||(g=defaultGameOptions.cpuCount,y=defaultGameOptions.cpuLevel,f=defaultGameOptions.cpuNames,S=defaultGameOptions.cpuChars),M({team:t,manualTeams:a,friendlyFire:n,nbTeams:o,teamOpts:i,friendly:r,localScore:l,minPlayers:s,maxPlayers:c,cc:p,mirror:d,itemDistrib:u,ptDistrib:m,cpu:h,cpuCount:g,cpuLevel:y,cpuNames:f,cpuChars:S,timeTrial:v,noBumps:b,noJump:C,doubleItems:e}),x.innerHTML="",oContainers[0].removeChild(x)};var n=document.createElement("div");n.style.height=Math.round(21*iScreenScale+18)+"px",n.style.overflow="auto";var o=document.createElement("table");o.style.marginLeft="auto",o.style.marginRight="auto";var i=document.createElement("tr");(l=document.createElement("td")).style.textAlign="center",l.style.width=8*iScreenScale+"px";var r=document.createElement("input");r.style.transform=r.style.WebkitTransform=r.style.MozTransform="scale("+Math.round(iScreenScale/3)+")",r.id="option-teams",r.name="option-teams",r.type="checkbox",e&&e.team&&(r.checked=!0),r.onchange=function(){this.checked?(document.getElementById("option-manualTeams-ctn").style.display="",isOnline&&(document.getElementById("option-nbTeams-ctn").style.display="",document.getElementById("option-friendlyFire-ctn").style.display="")):(document.getElementById("option-manualTeams-ctn").style.display="none",document.getElementById("option-nbTeams-ctn").style.display="none",document.getElementById("option-friendlyFire-ctn").style.display="none")},l.appendChild(r),i.appendChild(l);var l=document.createElement("td"),s=document.createElement("label");s.style.cursor="pointer",s.setAttribute("for","option-teams");var c=document.createElement("h1");c.style.fontSize=3*iScreenScale+"px",c.style.marginBottom="0px",c.innerHTML=toLanguage("Team games","Parties par équipe"),s.appendChild(c);var p=document.createElement("div");p.style.fontSize=2*iScreenScale+"px",p.style.color="white",p.innerHTML=toLanguage("If enabled, 2 teams are selected in each game. Your objective: defeat the opposing team.","Si activé, 2 équipes sont sélectionnées à chaque partie. Votre objectif : vaincre l'équipe adverse."),s.appendChild(p),l.appendChild(s),l.style.padding=Math.round(1.5*iScreenScale)+"px 0",i.appendChild(l),o.appendChild(i),(i=document.createElement("tr")).id="option-manualTeams-ctn",e&&e.team||(i.style.display="none"),(l=document.createElement("td")).style.textAlign="center",l.style.width=8*iScreenScale+"px",(r=document.createElement("input")).style.position="relative",r.style.left=Math.round(1.5*iScreenScale)+"px",r.style.transform=r.style.WebkitTransform=r.style.MozTransform="scale("+Math.round(iScreenScale/3)+")",r.id="option-manualTeams",r.name="option-manualTeams",r.type="checkbox",e&&e.team&&e.manualTeams&&(r.checked=!0),l.appendChild(r),i.appendChild(l);l=document.createElement("td");if((s=document.createElement("label")).style.cursor="pointer",s.style.display="inline-block",s.setAttribute("for","option-manualTeams"),(c=document.createElement("h1")).style.marginTop=0,c.style.marginLeft=Math.round(1.5*iScreenScale)+"px",c.style.fontSize=3*iScreenScale+"px",c.style.marginBottom="0px",c.innerHTML=toLanguage("Manual selection","Sélection manuelle"),s.appendChild(c),(p=document.createElement("div")).style.paddingLeft=Math.round(1.5*iScreenScale)+"px",p.style.fontSize=2*iScreenScale+"px",p.style.color="white",p.innerHTML=toLanguage("If enabled, teams are selected manually at each game.","Si activé, les équipes sont sélectionnées manuellement à chaque partie. Sinon, les équipes sont formées automatiquement en fonction du niveau de chaque joueur."),s.appendChild(p),l.appendChild(s),i.appendChild(l),!isOnline)for(var d=i.getElementsByTagName("td"),u=0;uthis.getAttribute("max")&&(e=this.getAttribute("max"),this.value=e);var t=JSON.parse(document.getElementById("option-teamOpts").value);if(t){t.length=e;for(var a=[],n=0;ni){e.insertBefore(n,s);break}if(s.value==n.value){n=s;break}}n.parentNode||e.insertBefore(n,r[r.length-1]),e.value=o}(l=document.createElement("td")).setAttribute("colspan",2),(m=document.createElement("div")).style.display="flex",m.style.flexDirection="row",m.style.alignItems="center",(h=document.createElement("div")).style.paddingLeft=3*iScreenScale+"px",h.style.paddingRight=3*iScreenScale+"px",(s=document.createElement("label")).style.cursor="pointer",s.setAttribute("for","option-cc"),(c=document.createElement("h1")).style.fontSize=3*iScreenScale+"px",c.innerHTML=toLanguage("Class","Cylindrée"),c.style.marginTop=iScreenScale+"px",c.style.marginBottom="0px",s.appendChild(c),h.appendChild(s),m.appendChild(h),(h=document.createElement("div")).style.display="inline-block",(y=document.createElement("select")).id="option-cc",y.name="option-cc",y.style.backgroundColor="black",y.style.width=12*iScreenScale+"px",y.style.fontSize=Math.round(2.5*iScreenScale)+"px",y.style.marginTop=Math.round(1.5*iScreenScale)+"px";var v=[50,100,150,150,200],b=[!1,!1,!1,!0,!1];isOnline||(b=[!(v=[150,150,200]),!0,!1]);var C=!1,P=150;e&&e.cc&&(P=e.cc);var k=!1;e&&e.mirror&&(k=!0);for(u=0;u×
'+toLanguage("Load private game options","Charger options partie privée")+"
"+toLanguage("This menu lets you import options from a previous private game.","Ce menu vous permet d'importer des options d'une partie privée précédente.")+'
',function(t){a.onclick=function(){o(t.url)},a.querySelector(".saved-link-edit").onclick=function(){var e=prompt(toLanguage("New options name:","Renommer ces options :"),t.name);e&&e!==t.name&&(t.name=e,l())},a.querySelector(".saved-link-del").onclick=function(){confirm(toLanguage('Delete options set "'+t.name+'"?',"Supprimer le jeu d'options \""+t.name+'" ?'))&&(r.splice(r.indexOf(t),1),l())},a.querySelector(".saved-link-options").onclick=function(e){e.stopPropagation()}}(t),i.appendChild(a)}r.length?shareLink.key||(n.querySelector(".saved-links-add").style.display="none"):(i.innerHTML='
",shareLink.key||(n.querySelector(".saved-links-ctn").style.display="none"))}function l(){storeOptionLinks(r),i.innerHTML="",t()}t();e=n.querySelector(".close");e.style.left=(iWidth-9)*iScreenScale+5+"px",e.onclick=function(e){e.preventDefault(),x.removeChild(n)},n.querySelector(".saved-links-add a").onclick=function(e){e.preventDefault();e=prompt(toLanguage("Name for your options set:","Nom pour le jeu d'options :"));e&&(r.push({name:e,url:document.location.href}),n.querySelector(".saved-links-add").style.display="none",l())},x.appendChild(n)},x.appendChild(g),oContainers[0].appendChild(x)}function loadOptionLinks(){var e=localStorage.getItem("privgameopts");return e?JSON.parse(e):[]}function storeOptionLinks(e){e.sort(function(e,t){return e.name.localeCompare(t.name)}),localStorage.setItem("privgameopts",JSON.stringify(e))}function privateLink(e){var l=document.createElement("div"),t=l.style;t.width=iWidth*iScreenScale+"px",t.height=iHeight*iScreenScale+"px",t.border="solid 1px black",t.backgroundColor="black",l.appendChild(toTitle(toLanguage("Private game","Partie privée"),0));var s=isCustomOptions(e);xhr("privateGame.php",s?"options="+encodeURIComponent(JSON.stringify(e)):null,function(e){if(e){var t=shareLink.url,a=shareLink.params.slice(0);a.push("key="+e);var n,o,i,r=t+"?"+a.join("&"),a=document.createElement("div");return a.style.position="absolute",a.style.left="0px",a.style.top=12*iScreenScale+"px",a.style.width=iWidth*iScreenScale+"px",a.style.textAlign="center",a.style.fontSize=3*iScreenScale+"px",a.style.color="#CFC",a.innerHTML=language?'The following private link has been generated: '+r+"
Enjoy game :)":'Le lien privé suivant a été généré : '+r+"
Bonne partie :)",l.appendChild(a),s&&((n=document.createElement("input")).type="button",n.style.position="absolute",n.style.right=+iScreenScale+"px",n.style.top=33*iScreenScale+"px",n.style.fontSize=Math.round(1.7*iScreenScale)+"px",n.value="☆ "+toLanguage("Save game options...","Sauvegarder options partie privée"),n.onclick=function(){var t,a,e=prompt(toLanguage("Options name:","Nom des options :"));e&&(t=loadOptionLinks(),a={name:e,url:r},t.push(a),storeOptionLinks(t),l.removeChild(n),l.appendChild(o),i.onclick=function(e){e.preventDefault(),t.splice(t.indexOf(a),1),storeOptionLinks(t),l.removeChild(o),l.appendChild(n)})},l.appendChild(n),(o=document.createElement("div")).style.color="white",o.style.position="absolute",o.style.left=+iScreenScale+"px",o.style.width=iScreenScale*(iWidth-2)+"px",o.style.top=33*iScreenScale+"px",o.style.textAlign="center",o.style.fontSize=2*iScreenScale+"px",o.innerHTML=toLanguage("Options saved, you can access them by clicking on "Load options..." in private game options screen ","Options sauvegardées, vous pourrez y accéder en cliquannt sur "Charger des options..." dans les options de partie privée "),(i=document.createElement("a")).href="#null",i.style.color="#ccf",i.style.textDecoration="none",i.innerHTML=toLanguage("[Undo]","[Annuler]"),o.appendChild(i)),!0}return!1}),oContainers[0].appendChild(l)}function selectTypeScreen(){var e=document.createElement("div"),t=e.style;t.width=iWidth*iScreenScale+"px",t.height=iHeight*iScreenScale+"px",t.border="solid 1px black",t.backgroundColor="black";var a=new Image;if(a.src="images/mariokart.png",a.style.position="absolute",a.style.width=Math.round(42.5*iScreenScale)+"px",a.style.height=5*iScreenScale+"px",a.style.left=Math.round((iWidth-42.5)/2*iScreenScale)+"px",a.style.top=2*iScreenScale+"px",e.appendChild(a),(t=e.style).width=iWidth*iScreenScale+"px",t.height=iHeight*iScreenScale+"px",t.border="solid 1px black",t.backgroundColor="black",oContainers[0].appendChild(e),"MK"==page){var n=11;(r=document.createElement("input")).type="button",r.value="Grand Prix",r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=10*iScreenScale+"px",r.style.top=n*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){course="GP",e.innerHTML="",oContainers[0].removeChild(e),selectPlayerScreen(0)},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("Time trial","Contre-la-montre"),r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=41*iScreenScale+"px",r.style.top=n*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){course="CM",e.innerHTML="",oContainers[0].removeChild(e),selectPlayerScreen(0)},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("VS","Course VS"),r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=iScreenScale+"px",r.style.top=(n+8)*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){course="VS",e.innerHTML="",oContainers[0].removeChild(e),selectNbJoueurs()},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("Battle","Bataille"),r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=50*iScreenScale+"px",r.style.top=(n+8)*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){course="BB",e.innerHTML="",oContainers[0].removeChild(e),selectNbJoueurs()},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("Track builder","Éditeur de circuit"),r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=10*iScreenScale+"px",r.style.top=(n+16)*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),selectTypeCreate()},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("Online race","Course en ligne"),r.style.fontSize=3*iScreenScale+"px",r.style.position="absolute",r.style.left=41*iScreenScale+"px",r.style.top=(n+16)*iScreenScale+"px",r.style.width=29*iScreenScale+"px",r.onclick=function(){course="VS",e.innerHTML="",oContainers[0].removeChild(e),selectOnlineScreen()},e.appendChild(r),(r=document.createElement("input")).type="button",r.value=toLanguage("Home","Accueil"),r.style.fontSize=2*iScreenScale+"px",r.style.position="absolute",r.style.left=2*iScreenScale+"px",r.style.top=35*iScreenScale+2+"px",r.onclick=function(){document.location.href="index.php"},e.appendChild(r)}else{var o,r,n=12,l=[toLanguage("VS","Course VS")],s=["VS"];for(isSingle||(l.unshift("Grand Prix"),s.unshift("GP")),(hasChallenges()||myCircuit)&&(l.push(toLanguage("Challenges","Défis")),s.push("CH")),!nid&&isSingle||(l.push(toLanguage("Time Trial","Contre-la-montre")),s.push("CM")),!nid||isSingle&&complete&&!cShared||(l.push(toLanguage("Online race","Course en ligne")),s.push("CL")),!isSingle&&cupScore&&((p=new Image).src="images/cups/cup"+(4-cupScore)+".png",p.style.width=Math.round(4*iScreenScale)+"px",p.style.height=Math.round(4*iScreenScale)+"px",p.style.position="absolute",l.length<5?(p.style.left=3*iScreenScale+"px",p.style.top=Math.round((n+4)*iScreenScale)+"px"):(p.style.left=5*iScreenScale+"px",p.style.top=Math.round((n-1)*iScreenScale)+"px"),p.className="pixelated",e.appendChild(p)),i=0;i
",r.onmouseover=function(){this.style.backgroundColor="rgb(38 85 177)"},r.onmouseout=function(){this.style.backgroundColor=""},r.style.cursor="pointer",o.appendChild(r)}t.appendChild(o);a=document.createElement("a");a.style.color="#CCF",a.style.fontSize=Math.round(2.5*iScreenScale)+"px",a.style.position="absolute",a.style.left=toLanguage(30,29)*iScreenScale+"px",a.style.top=36*iScreenScale+"px",a.href="creations.php",a.onclick=function(){},a.innerHTML=toLanguage("List of creations","Liste des créations"),t.appendChild(a),oContainers[0].appendChild(t);a=document.createElement("input");a.type="button",a.value=toLanguage("Back","Retour"),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=2*iScreenScale+"px",a.style.top=36*iScreenScale+"px",a.onclick=function(){t.innerHTML="",oContainers[0].removeChild(t),selectTypeCreate()},t.appendChild(a),oContainers[0].appendChild(t),updateMenuMusic(0)}function selectPlayerScreen(IdJ,newP,nbSels,additionalOptions){var isCustomSel=void 0!==nbSels,force=-1===IdJ;if(force&&(IdJ=0),!IdJ){for(joueurs in strPlayer=[],aPlayers=[],cp)aPlayers.push(joueurs);updateCommandSheet()}var itemMode=getItemMode(),modeItemDistributions=itemDistributions[itemMode].concat(customItemDistrib[itemMode]),modePtDistributions=ptDistributions.concat(customPtDistrib),selectedOpponents;fInfos=fInfos||{};var oScr=document.createElement("div");newP&&(oScr.style.visibility="hidden");var oStyle=oScr.style;oStyle.width=iWidth*iScreenScale+"px",oStyle.height=iHeight*iScreenScale+"px",oStyle.border="solid 1px black",oStyle.backgroundColor="black";var shrinkAll=("VS"==course||"BB"==course)&&!clSelected,oTitle,oMsg,oMsg,oTitle;isCustomSel?(oMsg=isOnline?toLanguage("Choose CPU","Choisissez ordi")+" "+(IdJ-1):IdJ>=oContainers.length?toLanguage("Choose CPU","Choisissez ordi")+" "+(IdJ+1-oContainers.length):1==oContainers.length?toLanguage("Choose player","Choisissez joueur"):toLanguage("Choose player ","Choisissez joueur ")+(IdJ+1),oTitle=toTitle(oMsg,-1),oTitle.style.color="#F90"):oTitle=toTitle(toLanguage("Select a player","Choisissez un joueur"),-1),shrinkAll&&(oTitle.style.fontSize=Math.round(7.5*iScreenScale)+"px"),oScr.appendChild(oTitle);var baseY=shrinkAll?8:10,customCharsEnabled=0!==cupOpts.customchars,cTable=document.createElement("table");cTable.style.display="none",cTable.style.position="absolute",cTable.style.zIndex=2,cTable.style.top=36*iScreenScale+16+"px",cTable.style.left=25*iScreenScale-60+"px",cTable.style.textAlign="left",cTable.style.fontSize=2*iScreenScale+"px",cTable.style.color="white",cTable.style.backgroundColor="black",cTable.style.backgroundColor="rgba(0,0,0, 0.8)",cTable.setAttribute("cellpadding",2),cTable.setAttribute("cellspacing",2),document.body.appendChild(cTable);var hTr=document.createElement("tr"),hTd1=document.createElement("td");hTd1.innerHTML=" ",hTr.appendChild(hTd1);var hTd2=document.createElement("td");hTd2.innerHTML=" ",hTd2.style.fontWeight="bold",hTr.appendChild(hTd2),cTable.appendChild(hTr);for(var sCaracteristiques=[toLanguage("Acceleration","Accélération"),toLanguage("Max speed","Vitesse max"),toLanguage("Handling","Maniabilité"),toLanguage("Weight","Poids")],dCaracteristiques=new Array,i=0,rotateHandler;i=oContainers.length;o--)aPlayers.push(strPlayer[o]);strPlayer.splice(oContainers.length)}else if(selectedOpponents){for(o=0;owithout playing on them","Cochez cette case pour voir les courses sans y participer"),style:function(e){return{left:e.left-10*iScreenScale+"px",top:e.top+4*iScreenScale+"px",backgroundColor:"rgba(51,51,160, 0.95)"}}}),oScr.appendChild($spectatorModeCtn)}else if("VS"==course||"BB"==course){var oForm=document.createElement("form");if(oForm.onsubmit=function(){return!1},oForm.style.position="absolute",oForm.style.top=(baseY+21)*iScreenScale-5+"px",oForm.style.left=18*iScreenScale+"px",oForm.style.fontSize=2*iScreenScale+"px",oForm.style.zIndex=2,IdJ||newP||(iDificulty=selectedDifficulty,fInfos.nbPlayers=selectedPlayers,fInfos.teams=selectedTeams,fInfos.nbteams=+selectedNbTeams,fInfos.friendlyFire=!!selectedFriendlyFire),"VS"==course){var oDiffDiv=document.createElement("label");oDiffDiv.appendChild(document.createTextNode(toLanguage("Difficulty: ","Difficulté : ")));var iDifficulties=[toLanguage("Easy","Facile"),toLanguage("Medium","Moyen"),toLanguage("Difficult","Difficile"),toLanguage("Extreme","Extrême"),toLanguage("Impossible","Impossible")],oSelect=document.createElement("select");oSelect.name="difficulty",oSelect.style.width="auto",oSelect.style.fontSize=2*iScreenScale+"px",oSelect.style.marginRight="10px",oSelect.onchange=function(){selectedDifficulty=this.selectedIndex};for(var i=0;iparseInt(t)){i=document.createElement("option");i.value=t,i.innerHTML=a,e.insertBefore(i,n[o]),e.selectedIndex=o;break}}e.value=t}oSelect.name="nbj",oSelect.style.width=3*iScreenScale+20+"px",oSelect.style.fontSize=2*iScreenScale+"px";for(var i=2;i<=8;i++){var oOption=document.createElement("option");oOption.value=i,oOption.innerHTML=i,oSelect.appendChild(oOption)}var oOption=document.createElement("option");oOption.value=-1,oOption.innerHTML=toLanguage("More...","Plus..."),oSelect.appendChild(oOption),setCustomValue(oSelect,fInfos.nbPlayers),oSelect.onchange=function(){var e;-1==this.value&&(e=parseInt(prompt(toLanguage("Number of players:","Nombre de joueurs :"))),!isNaN(e)&&1=itemDistributions[itemMode].length?"inline-block":"none")},tDiv.appendChild(oItemSelect);var oItemCustomActions=document.createElement("div");oItemCustomActions.style.display="none",oItemCustomActions.style.marginLeft=+iScreenScale+"px";var oItemCustomEdit=document.createElement("input");oItemCustomEdit.type="button",oItemCustomEdit.style.backgroundColor="rgb(51, 160, 51)",oItemCustomEdit.style.color="white",oItemCustomEdit.style.fontSize=Math.round(2.5*iScreenScale)+"px",oItemCustomEdit.value="✎",oItemCustomEdit.onclick=function(){selectItemScreen(oScr,function(e){customItemDistrib[itemMode][oItemSelect.value-itemDistributions[itemMode].length]=e,localStorage.setItem("itemsets",JSON.stringify(customItemDistrib)),localStorage.setItem("itemset."+itemMode,+oItemSelect.value),oScr.innerHTML="",oContainers[0].removeChild(oScr),selectPlayerScreen(IdJ,newP,nbSels,{openOptions:!0})},modeItemDistributions[oItemSelect.value])},oItemCustomActions.appendChild(oItemCustomEdit);var oItemCustomDel=document.createElement("input");oItemCustomDel.type="button",oItemCustomDel.style.marginLeft=Math.round(.5*iScreenScale)+"px",oItemCustomDel.style.backgroundColor="rgb(204, 51, 51)",oItemCustomDel.style.color="white",oItemCustomDel.value="×",oItemCustomDel.style.fontSize=Math.round(2.5*iScreenScale)+"px",oItemCustomDel.onclick=function(){var e=modeItemDistributions[oItemSelect.value].name;confirm(toLanguage('Delete item set "'+e+'"?','Supprimer le set "'+e+'" ?'))&&(customItemDistrib[itemMode].splice(oItemSelect.value-itemDistributions[itemMode].length,1),localStorage.setItem("itemsets",JSON.stringify(customItemDistrib)),localStorage.setItem("itemset."+itemMode,0),oScr.innerHTML="",oContainers[0].removeChild(oScr),selectPlayerScreen(IdJ,newP,nbSels,{openOptions:!0}))},oItemCustomActions.appendChild(oItemCustomDel),tDiv.appendChild(oItemCustomActions);var selectedItemSetId=localStorage.getItem("itemset."+itemMode);selectedItemSetId&&(oItemSelect.selectedIndex=selectedItemSetId,oItemSelect.onchange()),cDiv.appendChild(tDiv),oTd.appendChild(cDiv),oTr.appendChild(oTd),oTable.appendChild(oTr);var oTable=document.createElement("table");if(oTable.style.marginLeft="auto",oTable.style.marginRight="auto",oScroll.appendChild(oTable),"BB"!=course){var oTr=document.createElement("tr"),oTd=document.createElement("td");oTd.setAttribute("colspan",2);var cDiv=document.createElement("div");cDiv.style.display="flex",cDiv.style.flexDirection="row",cDiv.style.alignItems="center";var tDiv=document.createElement("div");tDiv.style.paddingLeft=3*iScreenScale+"px",tDiv.style.paddingRight=3*iScreenScale+"px";var oLabel=document.createElement("label");oLabel.style.cursor="pointer",oLabel.setAttribute("for","option-ptDistrib");var oH1=document.createElement("h1");oH1.style.fontSize=3*iScreenScale+"px",oH1.innerHTML=toLanguage("Point distribution :","Distribution des points :"),oH1.style.marginTop=iScreenScale+"px",oH1.style.marginBottom="0px",oLabel.appendChild(oH1),tDiv.appendChild(oLabel),cDiv.appendChild(tDiv);var tDiv=document.createElement("div");tDiv.style.display="inline-block",oPointSelect=document.createElement("select"),oPointSelect.id="option-ptDistrib",oPointSelect.name="option-ptDistrib",oPointSelect.style.backgroundColor="black",oPointSelect.style.width=24*iScreenScale+"px",oPointSelect.style.fontSize=Math.round(2.5*iScreenScale)+"px",oPointSelect.style.marginTop=Math.round(1.5*iScreenScale)+"px";for(var i=0;i=ptDistributions.length?"inline-block":"none")},tDiv.appendChild(oPointSelect);var oPtCustomActions=document.createElement("div");oPtCustomActions.style.display="none",oPtCustomActions.style.marginLeft=+iScreenScale+"px";var oPtCustomEdit=document.createElement("input");oPtCustomEdit.type="button",oPtCustomEdit.style.backgroundColor="rgb(51, 160, 51)",oPtCustomEdit.style.color="white",oPtCustomEdit.style.fontSize=Math.round(2.5*iScreenScale)+"px",oPtCustomEdit.value="✎",oPtCustomEdit.onclick=function(){selectPtScreen(oScr,function(e){customPtDistrib[oPointSelect.value-ptDistributions.length]=e,localStorage.setItem("ptsets",JSON.stringify(customPtDistrib)),localStorage.setItem("ptset",+oPointSelect.value),oScr.innerHTML="",oContainers[0].removeChild(oScr),selectPlayerScreen(IdJ,newP,nbSels,{openOptions:!0})},modePtDistributions[oPointSelect.value])},oPtCustomActions.appendChild(oPtCustomEdit);var oPtCustomDel=document.createElement("input");oPtCustomDel.type="button",oPtCustomDel.style.marginLeft=Math.round(.5*iScreenScale)+"px",oPtCustomDel.style.backgroundColor="rgb(204, 51, 51)",oPtCustomDel.style.color="white",oPtCustomDel.value="×",oPtCustomDel.style.fontSize=Math.round(2.5*iScreenScale)+"px",oPtCustomDel.onclick=function(){var e=modePtDistributions[oPointSelect.value].name;confirm(toLanguage('Delete point set "'+e+'"?','Supprimer le set "'+e+'" ?'))&&(customPtDistrib.splice(oPointSelect.value-ptDistributions.length,1),localStorage.setItem("ptsets",JSON.stringify(customPtDistrib)),localStorage.setItem("ptset",0),oScr.innerHTML="",oContainers[0].removeChild(oScr),selectPlayerScreen(IdJ,newP,nbSels,{openOptions:!0}))},oPtCustomActions.appendChild(oPtCustomDel),tDiv.appendChild(oPtCustomActions);var selectedPtSetId=localStorage.getItem("ptset");selectedPtSetId&&(oPointSelect.selectedIndex=selectedPtSetId,oPointSelect.onchange()),cDiv.appendChild(tDiv),oTd.appendChild(cDiv),oTr.appendChild(oTd),oTable.appendChild(oTr)}var oTr=document.createElement("tr"),oTd=document.createElement("td");oTd.style.textAlign="center",oTd.style.width=8*iScreenScale+"px",oTd.style.paddingLeft=2*iScreenScale+"px";var oDoubleItemCheckbox=document.createElement("input");oDoubleItemCheckbox.style.transform=oDoubleItemCheckbox.style.WebkitTransform=oDoubleItemCheckbox.style.MozTransform="scale("+Math.round(iScreenScale/3)+")",oDoubleItemCheckbox.id="option-doubleItems",oDoubleItemCheckbox.name="option-doubleItems",oDoubleItemCheckbox.type="checkbox",oDoubleItemCheckbox.checked=!selectedDoubleItems,oTd.appendChild(oDoubleItemCheckbox),oTr.appendChild(oTd);var oTd=document.createElement("td"),oLabel=document.createElement("label");oLabel.style.cursor="pointer",oLabel.setAttribute("for","option-doubleItems");var oH1=document.createElement("h1");oH1.style.fontSize=3*iScreenScale+"px",oH1.style.margin=Math.round(.5*iScreenScale)+"px auto",oH1.innerHTML=toLanguage("Disable double items","Désactiver les double objets"),oLabel.appendChild(oH1),oTd.appendChild(oLabel),oTd.style.padding=Math.round(1.5*iScreenScale)+"px 0",oTr.appendChild(oTd),oTable.appendChild(oTr),oMoreOptionsScreen.appendChild(oScroll);var oPInput=document.createElement("input");oPInput.type="button",oPInput.value=toLanguage("Back","Retour"),oPInput.style.fontSize=2*iScreenScale+"px",oPInput.style.position="absolute",oPInput.style.left=4*iScreenScale+"px",oPInput.style.top=32*iScreenScale+"px",oPInput.onclick=function(){oMoreOptionsScreen.style.display="none"},oMoreOptionsScreen.appendChild(oPInput)}oScr.appendChild(oForm),isCustomSel&&(oForm.style.display="none")}else if("CM"==course){if(clSelected){var ccConstraint=getCcConstraint(clSelected);150!=ccConstraint&&200!=ccConstraint||(oClassSelect=document.createElement("input"),oClassSelect.type="hidden",oClassSelect.value=ccConstraint)}else{var oDiv=document.createElement("div");oDiv.style.position="absolute",oDiv.style.left=10*iScreenScale-10+"px",oDiv.style.top=32*iScreenScale+"px",oDiv.style.width=60*iScreenScale+"px",oDiv.style.fontSize=3*iScreenScale+"px",oDiv.style.textAlign="center";var oLabel=document.createElement("label");oLabel.innerHTML=toLanguage("Class: ","Cylindrée : "),oClassSelect=document.createElement("select"),oClassSelect.name="cc",oClassSelect.style.width=12*iScreenScale+"px",oClassSelect.style.fontSize=3*iScreenScale+"px";for(var oClasses=[150,200],i=0;i"+toLanguage("Class","Cylindrée ")+': ','"],submitVal:toLanguage("Validate","Valider"),submit:function(e){var t=+e.target.elements.cc.value,e=+e.target.elements.mirror.checked;n(a,t,e),a.currentValue=a.value},close:function(){a.value=a.currentValue}}).querySelector('input[name="cc"]').select():a.currentValue=a.value}function selectItemScreen(r,l,s){s=s||{};var c=document.createElement("div");c.style.position="absolute",c.style.width="100%",c.style.height="100%",c.style.left="0px",c.style.top="0px",c.style.zIndex=4,c.style.backgroundColor="#000";var p=document.createElement("table");p.style.color="white",p.style.textAlign="center",p.style.position="absolute",p.style.left=5*iScreenScale+"px",p.setAttribute("cellpadding",0),p.setAttribute("cellspacing",0);var d=getItemMode(),u={},e=itemDistributions[d].concat(customItemDistrib[d]);selectedItemDistrib.value&&-1==e.indexOf(selectedItemDistrib)&&e.push(selectedItemDistrib);for(var t=0;t=m.length&&(v.style.display="none"),(g=document.createElement("td")).setAttribute("colspan",u.length+1),v.appendChild(g),(g=document.createElement("td")).style.paddingRight=iScreenScale+"px";var b=document.createElement("input");b.type="button",b.value="+",b.style.fontSize=2*iScreenScale+"px",b.style.lineHeight=2*iScreenScale+"px",b.style.padding=Math.round(iScreenScale/4-1)+" "+Math.round(iScreenScale/2+2)+"px",b.onclick=function(){p.insertBefore(S(f.length),v),f.length>=m.length&&(v.style.display="none")},s.readOnly&&(b.style.display="none"),g.appendChild(b),v.appendChild(g),p.appendChild(v),c.appendChild(p);b=document.createElement("input");function C(e){var t=[];if(e&&!f.length)return alert(toLanguage("You must have at least 1 row in your table","Votre table doit comporter au moins 1 ligne")),null;for(var a=0;a
'+toLanguage("Back","Retour")+'',n.querySelector(".item-submit a").onclick=function(){return c.removeChild(n),!1};var t,o=n.querySelector("form");for(t in o.onsubmit=function(e){for(var t in e.preventDefault(),k){var a=o.elements[t];"checkbox"===a.type?k[t]=a.checked:k[t]=a.value}c.removeChild(n)},k){var a=o.elements[t];s.readOnly&&(a.disabled=!0),"checkbox"===a.type?a.checked=!!k[t]:a.value=k[t]}s.readOnly&&(n.querySelector('.item-submit input[type="submit"]').style.display="none"),c.appendChild(n)},b.appendChild(M)),s.readOnly||((M=document.createElement("input")).type="submit",M.style.fontSize=2*iScreenScale+"px",M.value=toLanguage("Validate!","Valider !"),M.style.marginLeft=iScreenScale+"px",b.appendChild(M),(M=document.createElement("a")).href="#null",M.style.color="#CCF",M.innerHTML=toLanguage("Export/Import...","Exporter/importer"),M.style.fontSize=Math.round(1.6*iScreenScale)+"px",M.style.marginLeft=Math.round(2.5*iScreenScale)+"px",M.style.position="relative",M.style.top=-Math.round(iScreenScale/2)+"px",M.onclick=function(e){e.preventDefault();var r=document.createElement("div");r.className="fsmask item-export-screen",r.style.fontSize=2*iScreenScale+"px",r.innerHTML='
'+toLanguage("Export","Exporter")+'
'+toLanguage("Import","Importer")+'
';for(var t=r.querySelectorAll(".tab-buttons .tab-button"),a=r.querySelectorAll(".tabs .tab"),n=0;n=f.length&&p.insertBefore(S(f.length),v);for(var a=importedDistrib[t],n=f[t].querySelectorAll('.item-distrib input[type="number"]'),o=0;oimportedDistrib.length;)p.removeChild(f[f.length-1]);f.length>=m.length?v.style.display="none":v.style.display=""},c.appendChild(r)},b.appendChild(M),-1===u.indexOf("carapacenoire")&&(c.tabIndex=0,c.style.outline="none",x="darkshell",P="",c.onkeydown=function(e){e=e.key;if(1===e.length){if(e=e.toLowerCase(),!x.startsWith(P+=e))return P="",void(x.startsWith(e)&&(P=e));P===x&&confirm("Enable dark shell item?")&&(m[m.length-1].carapacenoire=0,r.removeChild(c),selectItemScreen(r,l,s))}},setTimeout(function(){c.focus()},1))),c.appendChild(b),r.appendChild(c)}function selectPtScreen(l,s,c){c=c||{};var p=document.createElement("div");p.style.position="absolute",p.style.width="100%",p.style.height="100%",p.style.left="0px",p.style.top="0px",p.style.zIndex=4,p.style.backgroundColor="#000";var e=document.createElement("form");e.onsubmit=function(){var e=this.elements["pt[]"];e.length||(e=[e]);for(var t=[],a=0;at.length;)n(t.length);for(;ee.onclick).filter(e=>!e.disabled).filter(e=>!e.dataset.noselect).filter(e=>{e=e.getBoundingClientRect();return 0=strPlayer.length){for(var t=new Array(selectedNbTeams).fill(0),e=0;e[Show]','Distribution personnalisée [Voir]'),(r=o.querySelector("a")).style.color="#CCF",r.onclick=function(){return selectedItemDistrib=l,selectItemScreen(e,function(){},Object.assign({},l,{readOnly:!0})),!1}):(r=getItemMode(),(l=itemDistributions[r][shareLink.options.itemDistrib]).value.length?o.innerHTML=l.name:o.innerHTML=toLanguage("No item","Aucun objet")),p.appendChild(o),c.appendChild(p),s.appendChild(c),t.appendChild(s)),shareLink.options.cpuCount&&(s=document.createElement("tr"),c=document.createElement("td"),p=document.createElement("label"),c.appendChild(p),(d=document.createElement("h1")).style.fontSize=3*iScreenScale+"px",d.innerHTML=toLanguage("Possible addition of bots","Ajout possible de bots"),d.style.marginBottom="0px",p.appendChild(d),(o=document.createElement("div")).style.fontSize=2*iScreenScale+"px",o.style.color="white",o.innerHTML=toLanguage("If there are not enough players, some bots will be added to the game so that there are at least "+shareLink.options.cpuCount+" participants.","S'il n'y a pas assez de joueurs, des bots seront ajoutés à la partie pour qu'il y ait au minimum "+shareLink.options.cpuCount+" participants"),p.appendChild(o),c.appendChild(p),s.appendChild(c),t.appendChild(s)),shareLink.options.timeTrial&&(s=document.createElement("tr"),c=document.createElement("td"),p=document.createElement("label"),c.appendChild(p),(d=document.createElement("h1")).style.fontSize=3*iScreenScale+"px",d.innerHTML=toLanguage("Time trial mode","Mode Contre-le-montre"),d.style.marginBottom="0px",p.appendChild(d),(o=document.createElement("div")).style.fontSize=2*iScreenScale+"px",o.style.color="white",o.innerHTML=toLanguage("Games are played like in time trial: no item boxes, no collisions with other players (they are ghosts), and you start with 3 shrooms.","Les parties se déroulent comme en CLM : pas de boîtes à objets, pas de collisions avec les autres joueurs (ce sont des fantômes), et vous commencez avec 3 champis."),p.appendChild(o),c.appendChild(p),s.appendChild(c),t.appendChild(s)),shareLink.options.noBumps&&(s=document.createElement("tr"),c=document.createElement("td"),p=document.createElement("label"),c.appendChild(p),(d=document.createElement("h1")).style.fontSize=3*iScreenScale+"px",d.innerHTML=toLanguage("No collisions between karts","Pas de collisions entre les karts"),d.style.marginBottom="0px",p.appendChild(d),(o=document.createElement("div")).style.fontSize=2*iScreenScale+"px",o.style.color="white",o.innerHTML=toLanguage("Karts are not impacted when they hit each other","Les karts ne sont pas impactés lorsqu'ils se rentrent dedans"),p.appendChild(o),c.appendChild(p),s.appendChild(c),t.appendChild(s)),shareLink.options.noJump&&(s=document.createElement("tr"),c=document.createElement("td"),p=document.createElement("label"),c.appendChild(p),(d=document.createElement("h1")).style.fontSize=3*iScreenScale+"px",d.innerHTML=toLanguage("No kart jumps","Sauts désactivés"),d.style.marginBottom="0px",p.appendChild(d),(o=document.createElement("div")).style.fontSize=2*iScreenScale+"px",o.style.color="white",o.innerHTML=toLanguage("It's impossible to perform a jump, drift or stunt","Il est impossible de faire des sauts, dérapages ou figures"),p.appendChild(o),c.appendChild(p),s.appendChild(c),t.appendChild(s)),n.appendChild(t),a.appendChild(n),(o=document.createElement("div")).style.textAlign="center",o.style.marginTop=2*iScreenScale+"px";n=document.createElement("input");n.type="button",n.value=toLanguage("Accept and play","Accepter et jouer"),n.style.fontSize=3*iScreenScale+"px",n.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),shareLink.accepted=!0,searchCourse()},o.appendChild(n),a.appendChild(o),e.appendChild(a);a=document.createElement("input");a.type="button",a.value=toLanguage("Back","Retour"),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=2*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){e.innerHTML="",oContainers[0].removeChild(e),selectPlayerScreen(0)},e.appendChild(a),oContainers[0].appendChild(e)}function selectChallengesScreen(){var n=document.createElement("div"),e=n.style;e.width=iWidth*iScreenScale+"px",e.height=iHeight*iScreenScale+"px",e.border="solid 1px black",e.backgroundColor="black";var t=toTitle(toLanguage("Challenges","Défis"),0);t.style.fontSize=7*iScreenScale+"px",n.appendChild(t);var a=document.createElement("div");a.style.position="absolute",a.style.left="0px",a.style.top=9*iScreenScale+"px",a.style.width=iWidth*iScreenScale+"px";var o,e=document.createElement("div");e.style.maxHeight=24*iScreenScale+"px",e.style.overflowX="hidden",e.style.overflowY="auto";t=hasChallenges();if(t){document.getElementById("comment-connect")&&((P=document.createElement("div")).style.width=(iWidth-5)*iScreenScale+"px",P.style.marginLeft="auto",P.style.marginRight="auto",P.style.marginBottom=Math.round(1.5*iScreenScale)+"px",P.style.textAlign="center",P.innerHTML=language?'You are not connected. The challenges you complete will not be saved. Click here to log in or register.':'Vous n\'êtes pas connecté. Les défis réussis ne seront pas sauvegardés. Cliquez ici pour vous connecter ou vous inscrire.',P.style.fontSize=Math.round(1.8*iScreenScale)+"px",e.appendChild(P));var i,r=document.createElement("table");for(i in r.style.width=(iWidth-3)*iScreenScale+"px",r.style.marginLeft="auto",r.style.marginRight="auto",r.style.borderCollapse="collapse",challenges)for(var l in challenges[i]){var s=challenges[i][l];if(s.main)o=s.id;else{(m=document.createElement("tr")).style.border="solid 1px white",(f=document.createElement("td")).setAttribute("colspan",2);var c=document.createElement("h1"),p="";switch(i){case"mcup":p=toLanguage("Multicup","Multicoupe");break;case"cup":p=toLanguage("Cup","Coupe");break;case"track":p=isBattle?toLanguage("Arena","Arène"):toLanguage("Track","Circuit")}c.innerHTML=p+' '+escapeSpecialChars(s.name)+"",c.style.textAlign="center",c.style.margin="0px",c.style.fontSize=Math.round(4*iScreenScale)+"px",c.style.paddingTop=Math.round(.5*iScreenScale)+"px",c.style.paddingBottom=Math.round(.5*iScreenScale)+"px",c.style.backgroundColor="#fa7c1b",c.style.color="white",f.appendChild(c),m.appendChild(f),r.appendChild(m)}for(var d=s.list,u=0;u✔'+toLanguage("Completed","Réussi"),b.style.whiteSpace="nowrap",b.style.fontSize=Math.round(iScreenScale*(language?2:2.2))+"px",b.style.backgroundColor="#33A033",b.style.display="inline-block",b.style.padding="0px "+Math.round(.8*iScreenScale)+"px",b.style.borderRadius=Math.round(.6*iScreenScale)+"px",b.style.color="white",b.style.marginBottom=Math.round(.5*iScreenScale)+"px",b.style.marginTop=Math.round(.5*iScreenScale)+"px",f.appendChild(b));var v,g=document.createElement("div"),y=document.createElement("img");if(y.src="images/challenges/difficulty"+h.difficulty.level+".png",y.alt="D",y.style.width=2*iScreenScale+"px",g.appendChild(y),(b=document.createElement("span")).style.color=h.difficulty.color,b.style.fontSize=Math.round(1.7*iScreenScale)+"px",b.style.position="relative",b.style.top="-1px",b.innerHTML=" "+h.difficulty.name,g.appendChild(b),f.appendChild(g),h.winners.length){(g=document.createElement("div")).style.cursor="help";var b,y=document.createElement("img");h.succeeded||(g.style.marginBottom=Math.round(.5*iScreenScale)+"px"),y.src="images/cups/cup1.png",y.alt="W",y.style.width=2*iScreenScale+"px",g.appendChild(y),(b=document.createElement("span")).style.color="white",b.style.fontSize=Math.round(1.7*iScreenScale)+"px",b.style.position="relative",b.style.top="-2px",b.innerHTML=" "+h.winners.length;for(var C=''+toLanguage("Succeeded by:","Réussi par :")+"",M=0;M✔'+h.winners[M].nick;g.dataset||(g.dataset={}),g.dataset.title=C,g.appendChild(b),g.onmouseover=function(e){var t;T||((T=document.createElement("div")).className="ranking_activeplayertitle",T.innerHTML=this.dataset.title,T.style.position="fixed",T.style.padding=Math.round(iScreenScale/2)+"px "+iScreenScale+"px",T.style.borderRadius=iScreenScale+"px",T.style.zIndex=10,T.style.backgroundColor="rgba(51,160,51, 0.95)",T.style.color="white",T.style.fontSize=Math.round(1.8*iScreenScale)+"px",T.style.lineHeight=Math.round(2*iScreenScale)+"px",T.style.visibility="hidden",$mkScreen.appendChild(T),t=this.getBoundingClientRect(),T.style.left=Math.round(t.left+(this.scrollWidth-T.scrollWidth)/2)+"px",T.style.top=t.top+this.scrollHeight+5+"px",T.style.visibility="visible")},g.onmouseout=function(){T&&($mkScreen.removeChild(T),T=void 0)},f.appendChild(g)}function x(e,t,a){n.innerHTML="",oContainers[0].removeChild(n),(clSelected=e).trackId=t,clSelected.trackType=a,localStorage.removeItem("itemset."+getItemMode()),xhr("challengeTry.php","challenge="+e.id,function(e){if(!e)return!1;try{e=JSON.parse(e)}catch(e){return!1}for(var t in clSelected.autoset=e,course="",e)window[t]=e[t];return course?selectPlayerScreen(0):selectMainPage(),delete window.selectedPerso,showClSelectedPopup(),!0})}h.succeeded?((k=document.createElement("a")).href="#null",k.innerHTML=toLanguage("Replay","Rejouer"),k.style.color="white",k.style.fontSize=Math.round(1.7*iScreenScale)+"px",function(e,t,a){k.onclick=function(){return x(e,t,a),!1}}(h,l,i),f.appendChild(k)):((v=document.createElement("input")).type="button",v.value=toLanguage("Take up","Relever"),v.style.width=11*iScreenScale+"px",v.style.fontSize=Math.round(2.4*iScreenScale)+"px",function(e,t,a){v.onclick=function(){x(e,t,a)}}(h,l,i),f.appendChild(v)),m.appendChild(f),r.appendChild(m)}}e.appendChild(r)}else{e.style.textAlign="center",(S=document.createElement("div")).style.fontSize=3*iScreenScale+"px",S.style.marginTop=3*iScreenScale+"px",S.style.marginBottom=2*iScreenScale+"px",S.style.marginLeft="auto",S.style.marginRight="auto",S.style.width=60*iScreenScale+"px",S.style.color="white",S.innerHTML=toLanguage("This circuit has no challenges. Create some right now, it's fast and easy!","Ce circuit ne comporte aucun défi. Créez-en dès maintenant, c'est facile et rapide !"),e.appendChild(S);var P=document.createElement("input");P.type="button",P.style.fontSize=3*iScreenScale+"px",P.style.paddingLeft=2*iScreenScale+"px",P.style.paddingRight=2*iScreenScale+"px",P.value=toLanguage("Go to challenge editor","Accéder à l'éditeur de défis"),P.onclick=function(){openChallengeEditor()},e.appendChild(P)}a.appendChild(e),n.appendChild(a);a=document.createElement("input");if((a.type="button",a.value=toLanguage("Back","Retour"),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=2*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){n.innerHTML="",oContainers[0].removeChild(n),selectMainPage()},n.appendChild(a),t)&&(myCircuit&&((a=document.createElement("input")).type="button",a.value=toLanguage("Manage challenges...","Gérer les défis..."),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.right=2*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){openChallengeEditor()},n.appendChild(a)),clRewards.length)){var k=document.createElement("a");o?k.href="persoLocked.php?cl="+o:"undefined"!=typeof commentType&&"undefined"!=typeof commentCircuit&&(k.href="persoLocked.php?cltype="+commentType+"&clrace="+commentCircuit),k.target="_blank",k.style.color="white",k.style.textDecoration="none",k.onclick=function(){return window.open(this.href,"persoLock","scrollbars=1, resizable=1, width=500, height=500"),!1};t=document.createElement("img");t.src="images/challenges/unlocking.png",t.alt=toLanguage("Unlocking characters","Persos à débloquer"),t.style.height=2*iScreenScale+"px",t.style.marginRight=Math.round(.55*iScreenScale)+"px",t.style.position="relative",t.style.top=Math.round(.2*iScreenScale)+"px",k.appendChild(t);var I=0;if(myCircuit)k.innerHTML+=clRewards.length;else{for(u=0;ucongratulations!","Tous les persos ont été débloqués, félicitations !"),k.style.color="#0F8",k.style.fontWeight="bold"):k.dataset.title=I?toLanguage(a,"Plus que "+a)+" "+toLanguage("character"+t+" left to unlock","perso"+t+" à débloquer"):a+" "+toLanguage("character"+t+" to unlock","perso"+t+" à débloquer"),k.onmouseover=function(){var e;this.style.opacity=.7,T||((T=document.createElement("div")).className="ranking_activeplayertitle",T.style.textAlign="center",T.innerHTML=this.dataset.title,T.style.position="fixed",T.style.padding=Math.round(iScreenScale/2)+"px "+iScreenScale+"px",T.style.borderRadius=iScreenScale+"px",T.style.zIndex=10,T.style.backgroundColor="rgba(102,153,160, 0.95)",T.style.color="white",T.style.fontSize=Math.round(1.8*iScreenScale)+"px",T.style.lineHeight=Math.round(2*iScreenScale)+"px",T.style.visibility="hidden",$mkScreen.appendChild(T),e=this.getBoundingClientRect(),T.style.left=Math.round(e.left+(this.scrollWidth-T.scrollWidth)/2)+"px",T.style.top=e.top-T.scrollHeight-5+"px",T.style.visibility="visible")},k.onmouseout=function(){this.style.opacity="",T&&($mkScreen.removeChild(T),T=void 0)},n.appendChild(k)}oContainers[0].appendChild(n)}function searchCourse(e){e=e||{};var n=document.createElement("div"),t=n.style;t.width=iWidth*iScreenScale+"px",t.height=iHeight*iScreenScale+"px",t.border="solid 1px black",t.backgroundColor="black";var a=document.createElement("div");a.style.position="absolute",a.style.left="0px",a.style.top=4*iScreenScale+"px",a.style.width=iScreenScale*iWidth+"px",a.style.fontSize=4*iScreenScale+"",a.style.textAlign="center",a.innerHTML=toLanguage("Searching for other players Please wait...","Recherche d'autres joueurs Veuillez patienter..."),n.appendChild(a);t=document.createElement("label");t.style.position="absolute",t.style.left="0px",t.style.top=15*iScreenScale-9+"px",t.style.width=iScreenScale*iWidth+"px",t.style.textAlign="center";var o=document.createElement("input");o.type="checkbox",o.id="iAlert",o.style.transform=o.style.WebkitTransform=o.style.MozTransform="scale("+iScreenScale/6+") translateY(8%)",o.style.transformOrigin=o.style.WebkitTransformOrigin=o.style.MozTransformOrigin="bottom right",t.appendChild(o);a=document.createElement("span");a.setAttribute("for","iAlert"),a.style.fontSize=2*iScreenScale+"pt",a.style.marginLeft="5px",a.innerHTML=toLanguage("Notify me when opponents have been found","M'alerter lorsque des adversaires ont été trouvés"),t.appendChild(a),n.appendChild(t);var i=0,r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top=21*iScreenScale+"px",r.style.width=41*iScreenScale*2+"px",r.style.height=Math.round(8.5*iScreenScale)+"px",r.style.overflow="hidden";for(var l=0;l<41;l++){var s=document.createElement("img");s.src="images/cLoading.png",s.className="pixelated",s.style.width=2*iScreenScale+"px",s.style.position="absolute",s.style.left=l*iScreenScale*2+"px",s.style.top="0px",r.appendChild(s)}n.appendChild(r);var c=document.createElement("div");c.style.position="absolute",c.style.left="0px",c.style.top=Math.round(17.5*iScreenScale)+"px",c.style.width=iScreenScale*iWidth+"px",c.style.textAlign="center",c.style.fontSize=2*iScreenScale+"px",c.style.color="#0B0",c.style.display="none",c.style.backgroundColor="rgba(0,0,0, 0.7)",c.innerHTML=toLanguage(' currently online. You\'ll join them as soon as they finish their '+(isBattle?"battle":"race"),' actuellement en ligne. Vous les rejoindrez une fois leur partie terminée'),n.appendChild(c);var p=document.createElement("div");p.style.position="absolute",p.style.left="0px",p.style.top=Math.round(17.5*iScreenScale)+"px",p.style.width=iScreenScale*iWidth+"px",p.style.textAlign="center",p.style.fontSize=2*iScreenScale+"px",p.style.color="#0B0",p.style.display="none",p.style.backgroundColor="rgba(0,0,0, 0.7)",p.innerHTML=toLanguage(' currently waiting, left before the game begins...',' actuellement en attente. Plus que pour que la partie commence'),n.appendChild(p);var d=1,u=iScreenScale/2,m=getOnlineCourseParams(e),h=m+(m?"&":"")+"nojoin",g=!!e.enableSpectatorMode;function y(){d&&(--d||xhr("getCourse.php",g?h:m,function(e){if(!e)return!1;try{e=JSON.parse(e)}catch(e){return!1}var t,a;return e.found?(t=o.checked,n.innerHTML="",oContainers[0].removeChild(n),t&&((a=document.createElement("embed")).src="musics/mkalert.wav",a.setAttribute("loop",!1),a.setAttribute("autostart",!0),a.style.position="absolute",a.style.left="-1000px",a.style.top="-1000px",document.body.appendChild(a),t=(new Date).getTime(),alert(toLanguage("Opponents have been found !\nGood luck !","Des adversaires ont été trouvés !\nBonne chance !")),e.time-=Math.round(((new Date).getTime()-t)/1e3),document.body.removeChild(a)),handleMatchmakingSuccess(e)):(d=10,e.nb_players?(e.nb_players<2&&(e.nb_players=2),document.getElementById("nb-active-players").innerHTML=e.nb_players+" "+toLanguage("players","joueurs"),p.style.display="none",c.style.display="block"):e.pending_players?((a=document.getElementById("nb-pending-players")).dataset.pendingCourse=e.pending_course,a.innerHTML=e.pending_players+" "+toLanguage("player","joueur")+(1"),t.innerHTML=e,t.style.left=Math.max(iScreenScale,Math.round(o.left+(o.width-t.scrollWidth)/2))+"px"):t.style.visibility="hidden",!0})}})}y(),f(c.querySelector("#nb-active-players"),"active_players"),f(p.querySelector("#nb-pending-players"),"pending_players"),shareLink.key||xhr("sendCourseNotifs.php",null,function(e){return!0});a=document.createElement("input");a.type="button",a.value=toLanguage("Back","Retour"),a.style.fontSize=2*iScreenScale+"px",a.style.position="absolute",a.style.left=2*iScreenScale+"px",a.style.top=35*iScreenScale+"px",a.onclick=function(){y=function(){},n.innerHTML="",oContainers[0].removeChild(n),selectPlayerScreen(0,void 0,void 0,{enableSpectatorMode:g})},n.appendChild(a),oContainers[0].appendChild(n);t=document.createElement("div");t.style.position="absolute",t.style.left=28*iScreenScale+"px",t.style.top=34*iScreenScale+"px",t.style.fontSize=Math.round(2.5*iScreenScale)+"px",t.style.display="flex",t.style.alignItems="center";e=document.createElement("label");e.style.display="inline-flex",e.style.alignItems="center",e.style.cursor="pointer",e.style.gap=Math.round(.5*iScreenScale)+"px",e.style.marginRight=iScreenScale+"px";a=document.createElement("input");a.type="checkbox",a.checked=g,a.style.transform="scale("+iScreenScale/6+")",a.style.transformOrigin="center",a.style.marginRight=Math.round(1.5*iScreenScale-6)+"px",a.onclick=function(){g=this.checked},e.appendChild(a);a=document.createElement("span");a.innerHTML=toLanguage("Spectator mode","Mode spectateur"),e.appendChild(a),t.appendChild(e);e=document.createElement("a");e.href="#null",e.style.color="#CCF",e.innerHTML="[?]",e.style.cursor="help",e.onclick=function(){return!1},e.dataset.noselect="1",t.appendChild(e),addFancyTitle({elt:e,title:toLanguage("Check this to see races without playing on them","Cochez cette case pour voir les courses sans y participer"),style:function(e){return{left:e.left-10*iScreenScale+"px",top:e.top-6*iScreenScale+"px",backgroundColor:"rgba(51,51,160, 0.95)"}}}),n.appendChild(t),updateMenuMusic(0)}function getOnlineCourseParams(e){var t="";return isCup?isMCups?t+="mid="+nid:isSingle?t+=(complete?"i":"id")+"="+nid+(isBattle?"&battle":""):t+=(complete?"c":"s")+"id="+nid:isBattle&&(t+="battle"),shareLink.key&&(t+=(t?"&":"")+"key="+shareLink.key),e.spectator?t+=(t?"&":"")+"spectator="+e.spectator:e.course&&(t+=(t?"&":"")+"course="+e.course),t}function handleMatchmakingSuccess(e){e.time<1&&(e.time=1),e.spectator&&(setSpectatorId(e.spectator),e.spectatorState&&(onlineSpectatorState=e.spectatorState)),selectMapScreen({racecountdown:e.time-5}),dRest(),setTimeout(setChat,1)}function addFancyTitle(t){var a,n,o=t.elt;o.onmouseover=function(){var e;a||(o.style.opacity=.9,(a=document.createElement("div")).className="ranking_activeplayertitle",a.innerHTML=t.title,a.style.position="fixed",a.style.padding=Math.round(iScreenScale/2)+"px "+iScreenScale+"px",a.style.borderRadius=iScreenScale+"px",a.style.zIndex=10,a.style.color="white",a.style.fontSize=Math.round(1.8*iScreenScale)+"px",a.style.lineHeight=Math.round(2*iScreenScale)+"px",a.style.visibility="hidden",$mkScreen.appendChild(a),t.style&&(e=o.getBoundingClientRect(),Object.assign(a.style,t.style(e))),a.style.visibility="visible",clearInterval(n),n=setInterval(function(){a&&(document.body.contains(o)||($mkScreen.removeChild(a),clearInterval(n),a=void 0))},1e3),t.onShow&&t.onShow(a))},o.onmouseout=function(){a&&(o.style.opacity="",$mkScreen.removeChild(a),clearInterval(n),a=void 0)}}function chooseRandMap(){"MK"==page?"BB"!=course?chooseWithin(0,NBCIRCUITS):chooseWithin(NBCIRCUITS,12):isSingle?choose(1):isBattle?isCup?chooseWithin(0,aAvailableMaps.length):chooseWithin(NBCIRCUITS,12):chooseWithin(0,NBCIRCUITS)}function chooseWithin(e,t){for(var a=e+t,n={},o=e+1;o<=a;o++)n[o]=1;for(o=0;o=g[I=R]&&(O=0,R++)):(T=Math.min(c,s-(v-v%c)),k=v%c,I=Math.floor(v/c)),h<=I)break;(I-=m)<0||((w=document.createElement("img")).className="pixelated",w.style.width=C*iScreenScale+"px",w.style.height=C*iScreenScale+"px",w.style.cursor="pointer",w.style.position="absolute",L=(iWidth+M+1)/2+(k-T/2)*(C+M),H=(x+P)/2+(I-d/2)*(C+x),w.style.left=Math.round(L*iScreenScale)+"px",w.style.top=Math.round(H*iScreenScale)+"px",cupOpts.icons?"number"==typeof cupOpts.icons[v]?w.src="images/cups/"+p[cupOpts.icons[v]]+".gif":function(e,t){w.onload=function(){this.naturalWidth>this.naturalHeight?(this.style.width=C*iScreenScale+"px",this.style.top=Math.round((t+C*(1-this.naturalHeight/this.naturalWidth)/2)*iScreenScale)+"px",this.style.height="auto"):(this.style.width="auto",this.style.height=C*iScreenScale+"px",this.style.left=Math.round((e+C*(1-this.naturalWidth/this.naturalHeight)/2)*iScreenScale)+"px")},w.src=cupOpts.icons[v]}(L,H):w.src="images/cups/"+p[v%p.length]+".gif","BB"==course?w.alt=v+NBCIRCUITS/4:w.alt=v,E=iScreenScale,w.onmouseover=function(){var e=new Image;e.src=getMapSelectorSrc(v),e.alt=4*this.alt+4,e.style.border="double 4px white",e.style.width="100%",e.style.height="100%",e.className="pixelated",bSelectedMirror&&(e.className+=" mirrored"),e.id="maps",document.getElementById("dMaps").appendChild(e),document.getElementById("dMaps").style.display="block",function e(t,a){var n,o;document.getElementById("maps")&&document.getElementById("maps").alt==a&&(a%4!=0?a++:a-=3,n=document.getElementById("dMaps"),o=mapNameOf(t,a-1),n.appendChild(o),document.getElementById("maps").alt=a,document.getElementById("maps").src=getMapSelectorSrc(a-1),setTimeout(function(){try{n.removeChild(o)}catch(e){return}e(t,a)},1e3))}(E,4*this.alt+4);var t,a=cupPayloads[this.alt];a&&(l.innerHTML="",(e=a.name)&&((a=a.prefix)&&((t=document.createElement("span")).innerText=a,t.style.fontSize="0.7em",l.appendChild(t)),(t=document.createElement("span")).innerText=e,l.appendChild(t),e=a?a+e:e,e=Math.min(Math.max(8/Math.sqrt(e.length),1.45),3),r.style.fontSize=Math.round(e*iScreenScale)+"px",r.style.display="flex",l.style.display="flex",l.style.alignItems="center",l.style.justifyContent="center",l.style.gap="0.25em"))},w.onmouseout=function(){document.getElementById("dMaps").style.display="none",document.getElementById("dMaps").innerHTML="",r.style.display="none"},w.onclick=function(){A(),selectRaceScreen(4*this.alt)},isCup||"BB"!=course||(D=[toLanguage("SNES Stages","Arènes SNES"),toLanguage("GBA Stages","Arènes GBA"),toLanguage("DS Stages","Arènes DS")],(B=document.createElement("div")).style.position="absolute",B.style.left=Math.round((L-M/2)*iScreenScale)+"px",B.style.top=Math.round((H+.9*C)*iScreenScale)+"px",B.style.width=(C+M)*iScreenScale+"px",B.style.fontSize=3*iScreenScale+"px",B.style.color="white",B.style.textAlign="center",B.innerHTML=D[v],n.appendChild(B)),n.appendChild(w),"GP"==course?(B=+ptsGP.charAt(v))&&((z=new Image).src="images/cups/cup"+(4-B)+".png",z.style.width=Math.round(4*iScreenScale*C/7)+"px",z.style.height=Math.round(4*iScreenScale*C/7)+"px",z.style.position="absolute",z.style.left=Math.round((L+4*C/7)*iScreenScale)+"px",z.style.top=Math.round((H+4*C/7)*iScreenScale)+"px",z.className="pixelated",n.appendChild(z)):isMCups&&!isOnline&&((z=document.createElement("a")).style.position="absolute",z.style.left=Math.round((L+5*C/7)*iScreenScale)+"px",z.style.top=Math.round((H+5*C/7)*iScreenScale)+"px",z.style.backgroundColor="rgba(0,50,128, 0.5)",z.style.padding="4px",z.style.borderRadius="50%",z.href="?cid="+cupIDs[v],z.title=toLanguage("Link to this cup","Lien vers cette coupe"),z.onmouseover=function(){this.style.backgroundColor="rgba(0,102,153, 0.8)"},z.onmouseout=function(){this.style.backgroundColor="rgba(0,50,128, 0.5)"},(H=document.createElement("img")).src="images/clink.png",H.style.width=Math.round(C*iScreenScale*2/7)+"px",z.appendChild(H),n.appendChild(z)))}"VS"==course||"BB"==course?((o=document.createElement("input")).type="button",o.value=toLanguage("Random","Aléatoire"),o.style.fontSize=3*iScreenScale+"px",o.style.position="absolute",o.style.left=34*iScreenScale-10+"px",o.style.top=30*iScreenScale+"px",o.onclick=function(){i=!1,A(),chooseRandMap()},n.appendChild(o)):"GP"==course?oContainers[0].appendChild(n):"CM"==course&&((o=document.createElement("input")).type="button",o.value=toLanguage("Rankings","Classement"),o.style.fontSize=3*iScreenScale+"px",o.style.position="absolute",o.style.left=33*iScreenScale-10+"px",o.style.top=30*iScreenScale+"px",o.onclick=openRankings,n.appendChild(o)),showRaceCountIfRelevant(n),cupOpts.pages&&cupOpts.pages.length&&((o=document.createElement("input")).type="button",o.value="◄",o.style.fontSize=Math.round(2.5*iScreenScale)+"px",o.style.position="absolute",o.style.left=72*iScreenScale+"px",o.style.top=(isOnline?31:34)*iScreenScale+"px",o.className="disablable",o.onclick=function(){e.page--,A(),selectMapScreen(e)},o.disabled=e.page<=0,n.appendChild(o),(o=document.createElement("input")).type="button",o.value="►",o.style.fontSize=Math.round(2.5*iScreenScale)+"px",o.style.position="absolute",o.style.left=76*iScreenScale+"px",o.style.top=(isOnline?31:34)*iScreenScale+"px",o.className="disablable",o.onclick=function(){e.page++,A(),selectMapScreen(e)},o.disabled=e.page>=cupOpts.pages.length,n.appendChild(o)),isOnline&&(handleSpectatorLink(function(){i=!1,A()}),setTimeout(function(){i&&(A(),chooseRandMap())},1e3*document.getElementById("racecountdown").innerHTML)),updateMenuMusic(1)}else selectRaceScreen(0);function A(){document.getElementById("dMaps").style.display="none",document.getElementById("dMaps").innerHTML="",n.innerHTML="",oContainers[0].removeChild(n)}}function setMapSrc(e,t,a,n){isCup?setTimeout(function(){e.src=n},100*(a-t)):e.src=n}function rankingsLink(e){var t=getActualCc();switch(page){case"MK":return"classement.php?map="+e.map+"&cc="+t;case"CI":return"classement.php?circuit="+e.id+"&cc="+t;case"MA":return"classement.php?draw="+e.map+"&cc="+t}}function globalRankingsLink(){var e=getActualCc();if(isMCups)return"classement.php?mcup="+nid+"&cc="+e;switch(page){case"MK":return"classement.php?cc="+e;case"CI":return"classement.php"+(isSingle?"?circuit="+nid:"?scup="+nid)+"&cc="+e;case"MA":return"classement.php"+(isSingle?"?draw="+nid:"?ccup="+nid)+"&cc="+e}}function openRankings(){open(globalRankingsLink())}function exitCircuit(){var e=document.getElementById("changeRace"),t=document.getElementById("supprRace");e&&!t?e.click():document.location.href="index.php"}function showRaceCountIfRelevant(e){var t,a;"CM"!=course&&iRaceCount&&isLocalScore()&&(t=document.createElement("div"),a="BB"==course?toLanguage("Battle","Bataille"):toLanguage("Race","Course"),t.innerHTML=a+" "+(iRaceCount+1),t.style.fontSize=2*iScreenScale+"px",t.style.position="absolute",t.style.color="#ccc",t.style.right=3*iScreenScale+"px",t.style.top=(isOnline?isSingle||isMCups||!isCup?31:27:35)*iScreenScale+"px",e.appendChild(t))}function appendContainers(){for(var e=1;e=gameRules.minPlayers){for(aPlayers=new Array,aIDs=new Array,aPlaces=new Array,aPseudos=new Array,aControllers=new Array,shareLink.options&&shareLink.options.cpu&&(cpuLevel=shareLink.options.cpuLevel||0,cpuLevel=2-cpuLevel,iDificulty=4+.5*cpuLevel,isBattle&&(iDificulty=4.5)),fSelectedClass=gameRules.cc?getRelSpeedFromCc(gameRules.cc):1,bSelectedMirror=!!gameRules.mirror,0<=gameRules.raceCount&&(iRaceCount=gameRules.raceCount),aTeams=new Array,i=0;i=tThen-(new Date).getTime()&&(e=!1)}e?(trs[cCursor].style.backgroundColor="",trs[cCursor].style.color="",++cCursor==nbChoices&&(cCursor=0),trs[cCursor].style.backgroundColor="#F80",trs[cCursor].style.color="white",cTime=Math.round(1.05*cTime),setTimeout(moveCursor,cTime)):clignote(0)}function clignote(e){trs[cCursor].style.backgroundColor=e%2?"":"#F80",trs[cCursor].style.color=e%2?"":"white",e<4?setTimeout(function(){clignote(e+1)},100):setTimeout(function(){$mkScreen.removeChild(oTable),proceedOnlineRaceSelection(rCode)},500),1==e&&(trs[cCursor].getElementsByTagName("td")[0].innerHTML=dCircuits[choixJoueurs[cCursor][2]-1])}oMap=oMaps[aAvailableMaps[choixJoueurs[rCode[1]][2]-1]],onlineSpectatorState?($mkScreen.removeChild(oTable),setTimeout(function(){proceedOnlineRaceSelection(rCode)},500)):moveCursor()}else{if(onlineSpectatorState)return setSpectatorId(void 0),backToSearch(),!0;var oDiv=document.createElement("div");oDiv.style.position="absolute",oDiv.style.left=10*iScreenScale+10+"px",oDiv.style.top=20*iScreenScale+10+"px",oDiv.style.fontSize=2*iScreenScale+"pt",oDiv.innerHTML=1choixJoueurs.length&&(selectedNbTeams=choixJoueurs.length,selectedTeamOpts&&(selectedTeamOpts.length=selectedNbTeams)),t.manualTeams?(setupTeamColors(),selectOnlineTeams(e,choixJoueurs,playerIsSelecter())):resetGame(e)}function rePosSpectatorLink(){var e,t=document.getElementById("spectatormode");t&&(e=oTable.getBoundingClientRect(),t.style.top=Math.max(e.bottom+5,38*iScreenScale+15)+"px")}onlineSpectatorId?(waitHandler=setTimeout(waitForChoice,1),onlineSpectatorState||showSpectatorLink({toggled:!0,click:function(){clearTimeout(waitHandler),waitHandler=null,$mkScreen.removeChild(oTable)}})):(xhr("chooseMap.php","joueur="+strPlayer+"&map="+map+("BB"==course?"&battle":"")+(rand?"&rand":""),refreshTab),hideSpectatorLink(),window.onbeforeunload=function(){return language?"Caution, if you leave the game, you are considered loser":"Attention, si vous quittez la partie, vous êtes considéré comme perdant"});var waitHandler=0;function waitForChoice(){var e=[];onlineSpectatorId&&e.push("spectator="+onlineSpectatorId),"BB"==course&&e.push("battle"),xhr("getMap.php",e.join("&"),refreshTab)}oTable.appendChild(oTBody),$mkScreen.appendChild(oTable),document.getElementById("waitrace").style.visibility="hidden",updateMenuMusic(1),formulaire.dataset.disabled=1,bMusic&&(startMusicHandler=setInterval(function(){oMapImg&&(loadMapMusic(),clearInterval(startMusicHandler))},onlineSpectatorState?10:500))}function leaveRaceWheelScreen(){clearRaceWheenScreen(),removeMenuMusic(),removeGameMusics(),chatting=!1;var e={enableSpectatorMode:!!onlineSpectatorId};setSpectatorId(void(iRaceCount=0)),searchCourse(e)}function clearRaceWheenScreen(){clearInterval(startMusicHandler),formulaire.dataset.disabled="",hideSpectatorLink()}function setSpectatorId(e){(onlineSpectatorId=e)||(onlineSpectatorState=void 0),rtcService&&rtcService.setSpectatorId(onlineSpectatorId)}function selectOnlineTeams(s,e,t){var y=document.createElement("div"),a=y.style;a.width=iWidth*iScreenScale+"px",a.height=iHeight*iScreenScale+"px",a.border="solid 1px black",a.backgroundColor="black";var n=selectedTeamOpts&&selectedTeamOpts.some(function(e){return e.name}),a=toTitle(toLanguage("Team selection","Sélection des équipes"),.5);n?(a.style.top="0px",a.style.fontSize=Math.round(5*iScreenScale)+"px"):a.style.fontSize=Math.round(7*iScreenScale)+"px",y.appendChild(a);var c=document.createElement("div");if(c.style.display="none",c.style.position="absolute",c.style.zIndex=5e4,c.style.left=iScreenScale+"px",c.style.top=10*iScreenScale+"px",c.style.width=(iWidth-2)*iScreenScale+"px",c.style.height=iScreenScale*(iHeight-10)+"px",c.style.overflow="auto",c.style.textAlign="center",n){c.style.top=7.5*iScreenScale+"px",c.style.paddingTop=2.5*iScreenScale+"px",(C=document.createElement("div")).style.position="absolute",C.style.left=iScreenScale+"px",C.style.top="0px",C.style.width=(iWidth-2)*iScreenScale+"px",C.style.textAlign="center",C.style.fontSize=2*iScreenScale+"px",C.style.whiteSpace="nowrap",C.style.color="white";for(var o=0;ochacun pour soi."),function(){clearTimeout(h);var e="noteams";isBattle&&(e+="&battle"),isSingle&&(e+="&single"),m(),xhr("chooseTeams.php",e,function(e){if(!e)return!1;var t;try{t=JSON.parse(e)}catch(e){return!1}return l(t),!0})})},p.appendChild(n);n=document.createElement("input");function r(e,t,a){var n=document.createElement("div");n.id="online-teams-confirm",n.style.position="absolute",n.style.left=0,n.style.top=0,n.style.width=iWidth*iScreenScale+"px",n.style.height=iHeight*iScreenScale+"px",n.style.backgroundColor="rgba(0,0,0, 0.5)",n.style.zIndex=6e4;var o=document.createElement("div");o.style.position="absolute",o.style.zIndex=6e4,o.style.left=Math.round(iScreenScale*iWidth/2)+"px",o.style.top=Math.round(iScreenScale*iHeight/2)+"px",o.style.width=40*iScreenScale+"px",o.style.transform=o.style.WebkitTransform=o.style.MozTransform="translate(-50%, -50%)",o.style.backgroundColor="gray",o.style.border="solid 1px silver",o.onclick=function(e){e.stopPropagation()};var i=document.createElement("div");i.style.marginTop=iScreenScale+"px",i.style.marginBottom=Math.round(iScreenScale/2)+"px",i.style.fontSize=Math.round(2.5*iScreenScale)+"px",i.style.textAlign="center",i.style.marginLeft=2*iScreenScale+"px",i.style.marginRight=2*iScreenScale+"px",i.style.color="#FE9",i.innerHTML=e,o.appendChild(i);i=document.createElement("div");i.style.marginBottom=iScreenScale+"px",i.style.textAlign="center",i.style.marginLeft=Math.round(1.5*iScreenScale)+"px",i.style.marginRight=Math.round(1.5*iScreenScale)+"px",i.style.fontSize=Math.round(1.8*iScreenScale)+"px",i.style.color="white",i.innerHTML=t,o.appendChild(i);t=document.createElement("div");t.style.textAlign="center",t.style.marginBottom=iScreenScale+"px";var r=document.createElement("input");r.type="button",r.style.marginRight=Math.round(iScreenScale/2)+"px",r.value="Ok",r.style.fontSize=Math.round(2*iScreenScale)+"px",r.onclick=function(){return y.removeChild(n),a(),!1},t.appendChild(r);i=document.createElement("input");return i.type="button",i.value=toLanguage("Cancel","Annuler"),i.style.marginLeft=Math.round(iScreenScale/2)+"px",i.style.fontSize=Math.round(2*iScreenScale)+"px",i.onclick=n.onclick=function(){return y.removeChild(n),!1},t.appendChild(i),o.appendChild(t),n.appendChild(o),y.appendChild(n),setTimeout(function(){r.focus()},1),n}function S(e){f.innerHTML="";for(var t=v.reduce(function(e,t){return Math.max(e,t.length)},0),a=0;afor all players. Use this option if you're waiting for more players for example.",'Attention, vous êtes sur le point d\'annuler la partie pour tous les joueurs. Utilisez cette option si vous attendez plus de joueurs par exemple.'),function(){clearTimeout(h);var e="cancel";isBattle&&(e+="&battle"),m(),xhr("chooseTeams.php",e,function(e){if(!e)return!1;try{JSON.parse(e)}catch(e){return!1}return u(),!0})})},p.appendChild(n),y.appendChild(p);for(var v=new Array(selectedNbTeams),o=0;o30 seconds left to choose the next race','Il vous reste 30 secondes pour choisir la prochaine course'),team:toLanguage('There are 10 seconds left to choose the teams','Il vous reste 10 secondes pour choisir les équipes')},(a=document.createElement("div")).id="wait"+e,a.className="wait",a.innerHTML=t[e],document.getElementById("mariokartcontainer").appendChild(a)),a.style.left=2*iScreenScale+10+"px",a.style.top=35*iScreenScale+10+"px",a.style.minWidth=iScreenScale*(iWidth-4)+"px",a.style.fontSize=3*iScreenScale+"px")}function showSpectatorLink(t){hideSpectatorLink();var e=document.createElement("div");e.id="spectatormode",e.style.left=2*iScreenScale+10+"px",e.style.top=38*iScreenScale+15+"px",e.style.width=iScreenScale*(iWidth-4)+"px",e.style.fontSize=Math.round(2.25*iScreenScale)+"px";var a=document.createElement("img");a.src="images/ic_spectator.png",a.alt="Toggle",a.style.height=Math.round(1.75*iScreenScale)+"px",a.style.marginRight=Math.round(iScreenScale/4)+"px",e.appendChild(a);var a=document.createElement("a"),n=!(a.href="#null");t.toggled?(a.innerHTML=toLanguage("Exit spectator mode","Quitter le mode spectateur"),a.onclick=function(e){e.preventDefault(),n||(n=!0,t.click(),xhr("getCourse.php",getOnlineCourseParams({spectator:onlineSpectatorId}),function(e){if(!e)return!1;try{e=JSON.parse(e)}catch(e){return!1}return e.found?(clearRaceWheenScreen(),setSpectatorId(void 0),handleMatchmakingSuccess(e)):(choose(),hideSpectatorLink(),showExitSpectatorFailMessage()),!0}))}):(a.title=toLanguage("You'll see games but not play on it","Vous verrez les parties mais ne jouerez pas dedans"),a.innerHTML=toLanguage("Switch to spectator mode","Passer en mode spectateur"),a.onclick=function(e){e.preventDefault(),n||(n=!0,t.click(),xhr("spectatorMode.php","",function(e){return 0",l=0;l'+(l+1)+". "+timeStr(n[l]);oPersoLapTimes.dataset.title=r}}function multiGhosts(n){oScr.innerHTML="";var e=gID-3,t=gID+4;e<0?t-=e:t>n.length&&(e-=t-n.length),e=Math.max(e,0),t=Math.min(t,n.length),(gIDs=new Array).length=t-e;for(var a=0,o=e;o=n.length&&(gIDs[e]=0),writeTime(n[gIDs[e]][1],n[gIDs[e]][2],n[gIDs[e]][3],n[gIDs[e]][4],t,a)}}(a,p,s),i.appendChild(u),l.appendChild(s),r.appendChild(l),i.appendChild(r),oScr.appendChild(i),a++}var m=gIDs.length,h=document.createElement("div");h.style.textAlign="center",h.style.position="absolute",h.style.left=2*iScreenScale+"px",h.style.top=29*iScreenScale+"px",h.style.width=76*iScreenScale+"px",h.style.color="white";var g=document.createElement("span");g.style.fontSize=Math.round(2.5*iScreenScale)+"px",g.innerHTML=toLanguage("Number of ghosts:","Nombre de fantômes :"),g.style.marginRight=Math.round(1.2*iScreenScale)+"px",h.appendChild(g);var y=document.createElement("input");y.type="button",y.value="-",y.style.fontSize=3*iScreenScale+"px",y.onclick=function(){m--,oScr.querySelectorAll(".igScr")[m].style.visibility="hidden",b()};var f=document.createElement("span");f.style.fontSize=Math.round(2.5*iScreenScale)+"px",f.style.marginLeft=f.style.marginRight=Math.round(1.5*iScreenScale)+"px";var S=document.createElement("input");S.type="button",S.value="+",S.onclick=function(){oScr.querySelectorAll(".igScr")[m].style.visibility="visible",m++,b()},y.className=S.className="disablable",y.style.borderRadius=S.style.borderRadius="50%",y.style.fontSize=y.style.lineHeight=S.style.fontSize=S.style.lineHeight=3*iScreenScale+"px",y.style.width=y.style.height=S.style.width=S.style.height=4*iScreenScale+"px",h.appendChild(y),h.appendChild(f),h.appendChild(S),oScr.appendChild(h);h=document.createElement("input");h.type="button",h.value=toLanguage("Back","Retour"),h.style.fontSize=2*iScreenScale+"px",h.style.position="absolute",h.style.left=2*iScreenScale+"px",h.style.top=36*iScreenScale+"px",h.onclick=function(){oScr.innerHTML="",oContainers[0].removeChild(oScr),selectFantomeScreen(ghostsData,map,{times:n,id:gID})},oScr.appendChild(h);var v=document.createElement("input");function b(){f.innerHTML=m,v.value=toLanguage("Face with "+m+" ghost"+(1=gIDs.length}v.type="button",b(),v.style.fontSize=Math.round(2.5*iScreenScale)+"px",v.style.position="absolute",v.style.right=5*iScreenScale-10+"px",v.style.top=35*iScreenScale+"px",v.onclick=function(){gIDs.length=m,seeGhost(!1)},oScr.appendChild(v);h=document.createElement("input");h.type="button",h.value=toLanguage("See race","Voir la course"),h.style.fontSize=Math.round(2.5*iScreenScale)+"px",h.style.position="absolute",h.style.right=33*iScreenScale-10+"px",h.style.top=35*iScreenScale+"px",h.onclick=function(){gIDs.length=m,seeGhost(!0)},oScr.appendChild(h)}function showGhosts(){if(gTimes.length){for(i=0;i=ghostsData[3];)gID--;!gID&&1=gTimes.length&&(gID=0),writeTime(gTimes[gID][1],gTimes[gID][2],gTimes[gID][3],gTimes[gID][4]),ghostsData)&&gTimes[gID][0]===ghostsData[0];e++);},oScr.appendChild(o);var r,o=document.createElement("input");o.id="ffDroite",o.type="button",o.value="⏭",o.style.fontSize=4*iScreenScale+"px",o.style.position="absolute",o.style.left=72*iScreenScale+"px",o.style.top=a+"px",o.style.height=n+"px",o.onclick=function(){gID=gTimes.length-1,writeTime(gTimes[gID][1],gTimes[gID][2],gTimes[gID][3],gTimes[gID][4])},oScr.appendChild(o),ghostsData?oScr.style.visibility="visible":oContainers[0].appendChild(oScr),writeTime(gTimes[gID][1],gTimes[gID][2],gTimes[gID][3],gTimes[gID][4]),OPFace&&(OPFace.style.display="none"),document.body.style.cursor="default",(OPFace7=document.createElement("input")).type="button",OPFace7.value=toLanguage("7 ghosts...","7 fantômes..."),OPFace7.style.fontSize=2*iScreenScale+"px",OPFace7.style.position="absolute",OPFace7.style.right=2*iScreenScale+"px",OPFace7.style.top=36*iScreenScale+"px",OPFace7.onmouseover=function(){r||((r=document.createElement("div")).style.position="absolute",r.style.textAlign="center",r.style.fontSize=2*iScreenScale+"px",r.style.width=30*iScreenScale+"px",r.style.right=2*iScreenScale+"px",r.style.bottom=4*iScreenScale+"px",r.style.backgroundColor="rgba(204,192,178,0.95)",r.style.padding=Math.round(iScreenScale/2)+" "+iScreenScale+"px",r.style.color="#363330",r.innerHTML=toLanguage("Play with 7 ghosts with the same level as the ghost above","Affronter 7 fantômes du même niveau que le fantôme ci-dessus"),r.style.borderBottomLeftRadius=iScreenScale+"px",r.style.borderTopRightRadius=iScreenScale+"px",oScr.appendChild(r))},OPFace7.onmouseout=function(){r&&(oScr.removeChild(r),r=null)},OPFace7.onclick=function(){r&&(oScr.removeChild(r),r=null),multiGhosts(gTimes)},oScr.appendChild(OPFace7)}else if(ghostsData)alert(language?"No other record for this circuit yet":"Aucun autre record pour ce circuit"),oScr.style.visibility="visible",gID=-1,document.body.style.cursor="default";else{oScr.innerHTML="";try{oContainers[0].removeChild(oScr)}catch(e){}document.body.style.cursor="default",gPersos.length=0,resetGame(aAvailableMaps[map])}}function otherGhosts(){document.body.style.cursor="progress",ghostsData&&(oScr.style.visibility="hidden"),xhr("otherghosts.php","map="+getCreationId(oMaps[aAvailableMaps[map]])+"&type="+getCreationTable()+"&cc="+getActualCc(),function(reponse){if(reponse){try{gTimes=eval(reponse)}catch(e){return!1}return showGhosts(),!0}return!1})}function seeGhost(replay){if(replay&&(pause=!0,fInfos.replay=!0,gSelectedPerso=strPlayer[0]),-1==gID)oScr.innerHTML="",oContainers[0].removeChild(oScr),gOverwriteRecord=1,replay?(strPlayer[0]=ghostsData[1],iRecord=ghostsData[3],iLapTimes=ghostsData[4],iTrajet=ghostsData[5]):(gPersos=[ghostsData[1]],iLapTimes=ghostsData[4],jTrajets=[ghostsData[5]]),resetGame(aAvailableMaps[map]);else{var xhrUrl,xhrData;if(oScr.innerHTML="",oContainers[0].removeChild(oScr),document.body.style.cursor="progress",gIDs){xhrUrl="ghostsrace.php",xhrData="";for(var i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'"):""}function stripSpecialChars(e){return e.replace(/&[#\w]+;/g,"_").replace(/<\w+>(.+?)<\/\w+>/g,"$1")}function mapNameOf(e,t){var a=document.createElement("div"),n=isCup?Math.min(Math.max(9/Math.sqrt(stripSpecialChars(lCircuits[t]).length),1.4),4):2.1;a.style.fontSize=Math.round(e*n)+"px",a.className="mapname",a.style.textAlign="center",a.innerHTML=dCircuits[t];t=a.querySelector("small");return t&&(t.style.fontSize=2*iScreenScale+"px"),a}function addOption(e,t,a,n,o,i){document.getElementById(e).innerHTML=t.replace(/ /g," "),document.getElementById(a).innerHTML="";var r,l=document.createElement("select");l.name=n;for(var s=0;s'+e+"
")+'',document.getElementById("commandes-edit").onclick=function(){editCommands()}}}function updateCommandSheet(){var a=getCommands(null,2),n=navigator.platform&&0<=navigator.platform.toUpperCase().indexOf("MAC");function e(e,t){var a=language?"P":"J";return 1==oContainers.length?e:a+"1 : "+e+"; "+a+"2 : "+t}function t(e){var t=a[e],e=t[0];return t[1]&&n&&(e=t[1]),getKeyName(e)}displayCommands(""+toLanguage("Move","Se diriger")+" : "+e(t("up")+t("left")+t("down")+t("right"),t("up_p2")+t("left_p2")+t("down_p2")+t("right_p2"))+' '+toLanguage("Use item","Utiliser un objet")+" : "+e(t("item"),t("item_p2"))+" "+toLanguage("Item backwards","Objet en arrière")+" : "+e(t("item_back"),t("item_back_p2"))+" "+("BB"==course?"":""+toLanguage("Item forwards","Objet en avant")+" : "+e(t("item_fwd"),t("item_fwd_p2"))+" ")+""+toLanguage("Jump/drift","Sauter/déraper")+" : "+e(t("jump"),t("jump_p2"))+("BB"==course?" "+toLanguage("Inflate a balloon","Gonfler un ballon")+" : "+e(t("balloon"),t("balloon_p2")):"")+" "+toLanguage("Rear/Front view","Vue arrière/avant")+" : "+e(t("rear"),t("rear_p2"))+" "+toLanguage("Pause","Mettre en pause")+" : "+t("pause")+" "+toLanguage("Quit","Quitter")+" : "+t("quit"))}function editCommands(n){clearInterval(pollingGamepadsHandler);var e=!!n,a=(n=n||{}).currentTab||0,u=n.selectedPlayer||0,m=n.selectedDevice||"keyboard",t=u+1,o=document.getElementById("control-editor-mask");if(!o||(document.body.removeChild(o),e)){(o=document.createElement("div")).id="control-editor-mask",o.onclick=function(){editCommands()};var i=document.createElement("div");i.className="control-editor",i.onclick=function(e){e.stopPropagation()};var r=document.createElement("div");r.className="control-header";e=document.createElement("div");e.innerHTML=toLanguage("Game settings","Paramètres du jeu"),r.appendChild(e);e=document.createElement("button");e.className="control-close",e.innerHTML="×",e.onclick=function(){editCommands()},r.appendChild(e),i.appendChild(r);var l=document.createElement("div");l.className="control-tabs";for(var s=[toLanguage("Edit controls","Modifier les contrôles"),toLanguage("Advanced settings","Paramètres avancés")],c=0;c div")[e].classList.add("control-window-active"),a=e},l.appendChild(t)}(c);i.appendChild(l);e=document.createElement("div");e.className="control-window";r=document.createElement("div");if(r.className="control-window-active",!n.pc&&isMobile()){var p=(p=localStorage.getItem("settings.ctrl"))?JSON.parse(p):{},d=document.createElement("div");d.className="control-main-title",d.innerHTML=toLanguage("Command interface","Interface de commandes"),r.appendChild(d);var h=document.createElement("div");h.className="control-type-values";for(var g=[{id:"keyboard",name:toLanguage("Virtual Keyboard","Clavier virtuel"),description:toLanguage("Shows buttons that behave like keys in a keyboard","Affiche des boutons pour simuler les touches d'un clavier"),dropdown:function(e){var t=document.createElement("label"),a=document.createElement("span");a.innerHTML=toLanguage("Keyboard layout:","Disposition des touches :"),t.appendChild(a);var n,o=document.createElement("select"),i={"":toLanguage("Default","Par défaut"),h_sym:toLanguage("Horizontal symmetry","Symétrie horizontale"),v_sym:toLanguage("Vertical symmetry","Symétrie verticale"),vh_sym:toLanguage("Both symmetries","Symétrie mixte"),old:toLanguage("Old version","Ancienne version")},r=p.layout||"";for(n in i){var l=document.createElement("option");(l.value=n)===r&&(l.selected="selected"),l.innerHTML=i[n],o.appendChild(l)}t.appendChild(o),o.onchange=function(){this.value?p.layout=this.value:delete p.layout,localStorage.setItem("settings.ctrl",JSON.stringify(p))},e.appendChild(t)}},{id:"gestures",name:toLanguage("Touch controls","Contrôles tactiles"),description:toLanguage("Swipe the screen to go in the desired direction. Controls similar to Mario Kart Tour","Balayez l'écran pour vous diriger dans la direction souhaitée. Contrôles similaires à Mario Kart Tour"),dropdown:function(e){var t=document.createElement("a");t.className="control-touch-help",t.href="#null",t.innerHTML=toLanguage("How touch controls work...","Aide sur les contrôles tactiles..."),t.onclick=function(){return window.open("helpTouchCtrls.php","help","scrollbars=1, resizable=1, width=500, height=500"),!1},e.appendChild(t)}},{id:"external",name:toLanguage("External controller","Contrôleur externe"),description:toLanguage("Connect an external keyboard or gamepad","Connetez un clavier ou une manette externe"),dropdown:function(e){var t=document.createElement("a");t.className="control-ext-settings",t.href="#null",t.innerHTML=toLanguage("Controller settings...","Paramètres du contrôlleur..."),t.onclick=function(){return n.pc=!0,editCommands(n),!1},e.appendChild(t)}}],y=p.mode||"keyboard",c=0;c🎮',t.innerHTML+="
"+toLanguage("Connect a gamepad and press any button to continue","Connectez une manette et appuyez sur n'importe quel bouton pour continuer")+"