diff --git a/php/includes/mk/main.php b/php/includes/mk/main.php index 1e27d505..33ffd02e 100755 --- a/php/includes/mk/main.php +++ b/php/includes/mk/main.php @@ -2,5 +2,5 @@ if ($_SERVER['HTTP_HOST'] !== 'mkpc.malahieude.net') echo ''; else - echo ''; + echo ''; ?> diff --git a/scripts/mk.v190.js b/scripts/mk.v190.js new file mode 100644 index 00000000..84071da0 --- /dev/null +++ b/scripts/mk.v190.js @@ -0,0 +1 @@ +var pause,chatting=!1,aPlayers=new Array,aPlaces=new Array,aScores=new Array,aTeams=new Array,aPseudos=new Array,aControllers=new Array,aTracksHist=new Array,iRaceCount=0,fInfos,formulaire,baseCp,baseCp0,pUnlockMap,customDecorData={},customBgData={},nBasePersos,customPersos,selectedDifficulty,updateCtnFullScreen,isFirstLoad=!0,selectedCc=localStorage.getItem("cc")||"150",selectedMirror=!!localStorage.getItem("mirror"),selectedNbTeams=localStorage.getItem("nbTeams")||"2",selectedFriendlyFire=!!localStorage.getItem("friendlyFire"),selectedTeamOpts=0,selectedDoubleItems=0!=localStorage.getItem("doubleitems"),edittingCircuit,dCircuits;if(void 0===edittingCircuit&&(edittingCircuit=!1),void 0===cupOpts)var cupOpts={};else if(cupOpts.keyid){try{cupOpts=JSON.parse(sessionStorage.getItem("cupopt."+cupOpts.keyid))}catch(e){}cupOpts=cupOpts||{}}void 0===dCircuits&&(dCircuits=lCircuits);var isOnline="OL"==page,isMCups=isCup&&4
'+toLanguage("Custom FPS...","Choix des FPS...")+'
'+toLanguage("Cancel","Annuler")+"
";var a=t.querySelector(".customOptionDialog-cursor"),n=t.querySelector(".customOptionDialog-content");function o(){var e=15*a.value;t.querySelector(".customOptionDialog-textValue").innerHTML=e+" FPS"}function i(){document.body.removeChild(t)}function r(){var e=+a.value;addFpsOption(e),setFps(e),i()}return a.value=iFps,o(),a.oninput=function(){o()},t.onclick=function(e){r()},n.style.bottom="5px",n.onclick=function(e){e.stopPropagation()},n.onsubmit=function(){return r(),!1},t.querySelector(".customOptionDialog-submit a").onclick=function(){return i(),!1},void document.body.appendChild(t)}if(localStorage.setItem("nbFrames",e),formulaire&&formulaire.dataset.disabled)return showParamChangeDisclaimer();iFps=e}function openFullscreen(e){return e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():void 0}var $mkScreen=document.getElementById("mariokartcontainer");$mkScreen.dataset||($mkScreen.dataset={}),updateCtnFullScreen=function(e){if($mkScreen.dataset.fs=e?1:"",e){var t=Math.min(screen.width/(iWidth*iScreenScale),screen.height/(iHeight*iScreenScale)),a=Math.round(100*t),n=$mkScreen.scrollWidth,e=$mkScreen.style.zoom;if($mkScreen.style.zoom=a+"%",n!=$mkScreen.scrollWidth||e==$mkScreen.style.zoom||100==a){for(var o=0;o
'+toLanguage("Custom size...","Taille personnalisée...")+'
";var o=n.querySelector(".customOptionDialog-cursor"),i=n.querySelector(".customOptionDialog-content");function r(){var e=+o.value;n.querySelector(".customOptionDialog-textValue").innerHTML=e*iWidth+"×"+e*iHeight}function l(){document.body.removeChild(n)}function s(){var e=+o.value;addScreenScaleOption(e),setScreenScale(e),l()}return o.value=a,r(),o.oninput=function(){var e=+o.value;formulaire.dataset.disabled||previewScreenScale(a,e),r()},n.onclick=function(e){s()},i.style.bottom="80px",i.onclick=function(e){e.stopPropagation()},i.onsubmit=function(){return s(),!1},n.querySelector(".customOptionDialog-submit a").onclick=function(){return formulaire.dataset.disabled||previewScreenScale(a,a),l(),!1},void document.body.appendChild(n)}if(t||localStorage.setItem("iScreenScale",e),formulaire&&formulaire.dataset.disabled)return showParamChangeDisclaimer();iScreenScale=e,bRunning&&resetScreen(),previewScreenScale(a,iScreenScale),setSRest()}else{formulaire.screenscale.value=a;e=openFullscreen($mkScreen);e.then&&e.catch?e.then(function(){updateCtnFullScreen(!0),document.onfullscreenchange=function(){updateCtnFullScreen(document.fullscreenElement===$mkScreen)}}).catch(function(){updateCtnFullScreen(!0)}):updateCtnFullScreen(!0)}}}function addCustomOption(e,t,a,n){var o;n=n||1,e.querySelector('option[value="'+t+'"]')||((o=document.createElement("option")).value=t,o.innerHTML=a,e.insertBefore(o,e.childNodes[e.childNodes.length-n])),e.value=t}function addScreenScaleOption(e){addCustomOption(formulaire.screenscale,e,e*iWidth+"×"+e*iHeight,2)}function addFpsOption(e){addCustomOption(formulaire.fps,e,15*e+" FPS")}function previewScreenScale(e,t){for(var a=0;aThey'll apply to your next race.","Les paramètres ont été sauvegardés.
Ils s'appliqueront à la prochaine course"),document.body.appendChild(e),setTimeout(function(){e.classList.add("modes-change-fadeout"),setTimeout(function(){document.body.removeChild(e)},1e3)},3e3)}function setMusic(e){if(e?localStorage.setItem("bMusic",1):localStorage.removeItem("bMusic"),formulaire&&formulaire.dataset.disabled){if(e)return showParamChangeDisclaimer();removeIfExists(mapMusic),removeIfExists(lastMapMusic),removeIfExists(endingMusic)}bMusic=!!e,-1!=gameMenu&&updateMenuMusic(gameMenu,!0)}function setSfx(e){if(e?localStorage.setItem("iSfx",1):localStorage.removeItem("iSfx"),formulaire&&formulaire.dataset.disabled){if(e)return showParamChangeDisclaimer();removeSoundEffects(),oMusicEmbed&&unpauseMusic(mapMusic),removeGameMusics([mapMusic,lastMapMusic,endingMusic])}iSfx=!!e}function removeMenuMusic(e){clearTimeout(oMusicHandler),oMusicEmbed&&document.body.contains(oMusicEmbed)&&(e?document.body.removeChild(oMusicEmbed):fadeOutMusic(oMusicEmbed,1,.8),oMusicEmbed=void 0),muteOnBlur&&(window.removeEventListener("blur",muteOnBlur),muteOnBlur=void 0),unmuteOnResume&&(window.removeEventListener("focus",unmuteOnResume),unmuteOnResume=void 0)}function removeIfExists(e){e&&(e.yt&&(e.yt.destroy&&e.yt.destroy(),delete e.yt,delete e.tasks,delete e.opts),document.body.contains(e)&&document.body.removeChild(e),oMusicEmbed==e&&(oMusicEmbed=void 0))}function removeGameMusics(e){if(bMusic||iSfx){for(var t=document.getElementsByClassName("gamemusic"),a=t.length-1;0<=a;a--){var n=t[a];e&&-1!==e.indexOf(n)||document.body.removeChild(n)}oMusicEmbed=void 0}}function removeSoundEffects(){playingCarEngine=void 0,removeIfExists(carEngine),carEngine=void 0,removeIfExists(carEngine2),carEngine2=void 0,removeIfExists(carEngine3),carEngine3=void 0,removeIfExists(carDrift),carDrift=void 0,removeIfExists(carSpark),carSpark=void 0}function clearResources(){oMapImg&&oMapImg.clear&&oMapImg.clear()}function resetEvents(){document.onmousedown=void 0,document.onkeydown=void 0,document.onkeyup=void 0,window.removeEventListener("blur",window.releaseOnBlur),window.releaseOnBlur=void 0,window.removeEventListener("deviceorientation",window.turnOnRotate),window.turnOnRotate=void 0,hideVirtualKeyboard()}function pauseSounds(){if(bMusic||iSfx){clLocalVars.forcePause||(playSoundEffect("musics/events/pause.mp3").className="");for(var e=document.getElementsByClassName("gamemusic"),t=0;tt.length;)o.removeChild(e[0]),e.shift()}}function M(e,t,i,a){for(var n in e)if(oMap[n]){if(e[n].length
';for(var u=d.querySelectorAll("div"),m=0;m"+(oMap.sections?"SECTION":toLanguage("LAP","TOUR"))+' 1/'+oMap.tours+"",m||(c=Math.round(iScreenScale/8)+"px",p=Math.round(iScreenScale/4)+"px",u[m].style.textShadow="-"+p+" 0 black, 0 "+p+" black, "+p+" 0 black, 0 -"+p+" black, -"+c+" -"+c+" black, -"+c+" "+c+" black, "+c+" -"+c+" black, "+c+" "+c+" black")}else{var h=aTeams[i];null==h&&(h=-1),updateBalloonHud(d,{reserve:4,team:h})}l.appendChild(d);var g=document.createElement("div");g.id="objet"+i,g.className="itemWheel",pause&&fInfos.replay||(g.style.left=Math.round(iScreenScale)+"px",g.style.top=Math.round(iScreenScale)+"px",g.style.width=Math.round(26*iScreenScale/3)+"px",g.style.height=Math.round(18*iScreenScale/3)+"px",g.style.visibility="visible");h=document.createElement("div");h.id="roulette"+i,h.className="itemChamber",g.appendChild(h);d=document.createElement("div");d.id="countdown"+i,d.style.position="absolute",d.style.opacity=.8,d.style.width=Math.round(6.6*iScreenScale)+"px",d.style.height=Math.round(4.2*iScreenScale)+"px",d.style.border="solid "+Math.round(.75*iScreenScale)+"px "+primaryColor,d.style.borderRadius=Math.round(1.75*iScreenScale)+"px",d.style.display="none",g.appendChild(d),l.appendChild(g);d=document.createElement("div");d.id="reserve"+i,d.className="itemWheel",pause&&fInfos.replay||(d.style.left=Math.round(.75*iScreenScale)+"px",d.style.top=Math.round(iScreenScale)+"px",d.style.width=Math.round(26*iScreenScale/5)+"px",d.style.height=Math.round(18*iScreenScale/5)+"px",d.style.visibility="hidden"),(h=document.createElement("div")).id="roulette2"+i,h.className="itemChamber",d.appendChild(h),l.appendChild(d);h=document.createElement("div");h.id="lakitu"+i,h.className="pixelated",h.innerHTML="
",h.style.width=9*iScreenScale+"px",h.style.height=Math.round(6.6*iScreenScale)+"px",h.style.fontSize=Math.round(2.3*iScreenScale)+"px",l.appendChild(h);h=document.createElement("div");h.id="infoPlace"+i,h.style.right=Math.round(iScreenScale/2)+"px",h.style.bottom="0px",h.style.fontSize=8*iScreenScale+"px",l.appendChild(h);h=document.getElementById("infos"+i);h||((h=document.getElementById("infos0").cloneNode(!0)).id="infos"+i,$mkScreen.appendChild(h)),h.style.left=10+r+"px",h.style.top=10*iScreenScale+"px",h.style.width=iWidth*iScreenScale+"px",h.style.fontSize=16*iScreenScale+"px",h.style.fontFamily='"NSMBU", Impact',h.style.textAlign="center",h.style.textStroke=h.style.WebkitTextStroke=h.style.MozTextStroke=Math.round(iScreenScale/4)+"px "+primaryColor,h.style.visibility="hidden",h.style.display="",h.style.pointerEvents="none",h.innerHTML='3';var y=document.getElementById("scroller").cloneNode(!0);y.id="scroller"+i,y.className="itemScroller";y.style.left=iScreenScale+"px",y.style.top=Math.round(iScreenScale+ +iScreenScale)+"px",y.style.width=Math.round(26*iScreenScale/3)+"px",y.style.height=Math.round(18*iScreenScale/3-2*iScreenScale*1)+"px",y.style.lineHeight=iScreenScale+"px";for(var f=Math.round(4*iScreenScale),m=0;m=_){if(N=oMap.checkpoint.length&&(x=0),(P=oMap.checkpointCoords[x])&&(k=P.O[0],I=P.O[1],(T=Math.hypot(k-n.x,I-n.y)*Math.hypot(b[0]-C[0],b[1]-C[1]))&&(M-=150*((k-n.x)*(b[0]-C[0])+(I-n.y)*(b[1]-C[1]))/T)),M=oMap.checkpoint.length&&(x=0),(P=oMap.checkpointCoords[x])&&(k=P.O[0],I=P.O[1],(T=Math.hypot(k-n.x,I-n.y)*Math.hypot(b[0]-C[0],b[1]-C[1]))&&(M-=150*((k-n.x)*(b[0]-C[0])+(I-n.y)*(b[1]-C[1]))/T)),Mthis.duration-.44&&(this.currentTime=0,this.parentNode&&this.play())}function loopAfterIntro(e,t,a){var n;e.looper||(n=t+(a-=.15),e.looper=function(){this.currentTime>=n&&(this.currentTime-=a)},e.addEventListener("timeupdate",e.looper,!1))}function startEngineSound(){iSfx&&(carEngine=loadMusic("musics/events/engine.mp3",!0),carEngine2=loadMusic("musics/events/engine2.mp3",!1),carEngine3=loadMusic("musics/events/engine3.mp3",!1),carDrift=loadMusic("musics/events/drift.mp3",!1),carSpark=loadMusic("musics/events/spark.mp3",!1),(playingCarEngine=carEngine).addEventListener("timeupdate",loopWithoutGap,!1),carEngine2.addEventListener("timeupdate",loopWithoutGap,!1),carEngine.permanent=1,carEngine2.permanent=1,carEngine3.permanent=1,carDrift.permanent=1,carSpark.permanent=1,document.body.appendChild(carEngine),document.body.appendChild(carEngine2),document.body.appendChild(carEngine3),document.body.appendChild(carDrift),document.body.appendChild(carSpark))}function updateEngineSound(e){iSfx&&e!=playingCarEngine&&(playingCarEngine&&playingCarEngine.pause(),(playingCarEngine=e)&&playingCarEngine.play())}function startEndMusic(){bMusic&&(removeMenuMusic(!0),removeIfExists(mapMusic),removeIfExists(lastMapMusic)),iSfx&&removeSoundEffects(),bMusic&&(willPlayEndMusic=!0,setTimeout(function(){for(var e=document.getElementsByClassName("gamemusic"),t=[],a=0;a(new Date).getTime())&&oSpecCam.reset()),(itemDistribution=(itemDistribution=selectedItemDistrib)||itemDistributions[getItemMode()][0]).value||(itemDistribution={value:itemDistribution}),ptsDistribution=selectedPtDistrib,m){oMap.arme=[];for(e=0;e=oMap.h?oPlanWidth:oPlanWidth*(oMap.w/oMap.h);var me,i=oMap.w<=oMap.h?oPlanWidth:oPlanWidth*(oMap.h/oMap.w);if(oMap.iW&&oMap.iH&&(U=Math.min(oMap.w/oMap.iW,oMap.h/oMap.iH),oPlanWidth2*=U,i*=U),oPlanWidth2=Math.round(oPlanWidth2),i=Math.round(i),oPlanSize=59*iScreenScale,oPlanSize2=oPlanWidth2,oPlanRealSize=oMap.w,oCharRatio=.8,oPlanRatio=.5,(oPlanDiv=document.createElement("div")).style.backgroundColor="rgb("+oMap.bgcolor+")",oPlanDiv.style.position="absolute",oPlanDiv.style.zIndex=1,oPlanDiv.style.left=15+iScreenScale*iWidth+"px",oPlanDiv.style.top="9px",oPlanDiv.style.width=oPlanWidth+"px",oPlanDiv.style.height=oPlanWidth+"px",oPlanDiv.style.overflow="hidden",oPlanDiv.style.opacity=.01,(oPlanDiv2=document.createElement("div")).style.backgroundColor="rgb("+oMap.bgcolor+")",oPlanDiv2.style.position="absolute",oPlanDiv2.style.zIndex=1,oPlanDiv2.style.left=15+iScreenScale*iWidth+"px",oPlanDiv2.style.top=10+Math.round(iScreenScale/4)+oPlanWidth+"px",oPlanDiv2.style.width=oPlanWidth+"px",oPlanDiv2.style.height=oPlanWidth+"px",oPlanDiv2.style.overflow="hidden",oPlanDiv2.style.opacity=.01,(oPlanCtn=document.createElement("div")).style.position="absolute",oPlanCtn.style.transformOrigin=oPlanCtn.style.WebkitTransformOrigin=oPlanCtn.style.MozTransformOrigin="left",(oPlanCtn2=document.createElement("div")).style.position="absolute",oPlanCtn2.style.left=Math.round((oPlanWidth-oPlanWidth2)/2)+"px",oPlanCtn2.style.top=Math.round((oPlanWidth-i)/2)+"px",oPlanCtn2.style.width=oPlanWidth2+"px",oPlanCtn2.style.height=i+"px",oMapImg.src?((oPlanImg=document.createElement("img")).src=oMapImg.src,oPlanImg.style.width=oPlanSize+"px"):(me=Math.round(oPlanSize*oMap.h/oMap.w),(oPlanImg=document.createElement("canvas")).width=oPlanSize,oPlanImg.height=me,oPlanImg.getContext("2d").drawImage(oMapImg,0,0,oPlanSize,me)),oPlanImg.style.position="absolute",oPlanImg.style.left="0px",oPlanImg.style.top="0px",oPlanCtn.appendChild(oPlanImg),oMapImg.src?(oPlanImg2=document.createElement("img")).src=oMapImg.src:((oPlanImg2=document.createElement("canvas")).width=oPlanSize,oPlanImg2.height=me,oPlanImg2.getContext("2d").drawImage(oMapImg,0,0,oPlanSize,me)),oPlanImg2.style.position="absolute",oPlanImg2.style.left="0px",oPlanImg2.style.top="0px",oPlanImg2.style.width=oPlanWidth2+"px",oPlanCtn2.appendChild(oPlanImg2),bSelectedMirror&&(oPlanImg.className=oPlanImg2.className="mirrored"),oMap.decor)for(var te in oMap.decor)oPlanDecor[te]=new Array,oPlanDecor2[te]=new Array;oMap.sea&&((oPlanSea=document.createElement("canvas")).style.position="absolute",oPlanSea.style.left="0px",oPlanSea.style.top="0px",oPlanSea.setAttribute("width",oPlanSize+"px"),oPlanSea.setAttribute("height",oPlanSize+"px"),oPlanCtn.appendChild(oPlanSea),(oPlanSea2=document.createElement("canvas")).style.position="absolute",oPlanSea2.style.left="0px",oPlanSea2.style.top="0px",oPlanSea2.setAttribute("width",oPlanWidth2+"px"),oPlanSea2.setAttribute("height",oPlanWidth2+"px"),oPlanCtn2.appendChild(oPlanSea2),bSelectedMirror&&(oPlanSea.className=oPlanSea2.className="mirrored"));for(e=0;e"+toLanguage("GO!","PARTEZ !")+"",document.getElementById("infos"+e).style.fontSize=12*iScreenScale+"px",document.getElementById("infos"+e).style.top=Math.round(12.5*iScreenScale)+"px",1==oPlayers[e].speed?oPlayers[e].speed=11:1 '+(a?"":' ')+' ',l.onkeydown=function(e){var t,a;switch(e.keyCode){case 38:t=-1;break;case 40:t=1;break;case 13:(a=document.activeElement)&&a.onclick&&l.contains(a)&&iSfx&&setTimeout(function(){document.onkeydown||playSoundEffect("musics/events/select.mp3")})}if(t&&(a=document.activeElement)){var n=Array.prototype.slice.call(document.querySelectorAll("#infos0 input, #infos0 button")),o=a,i=n.indexOf(a);if(-1!=i){var r=i;do{if((r+=t)<0&&(r+=n.length),r>=n.length&&(r=0),(o=n[r])&&"none"!=o.style.display&&"hidden"!=o.style.visibility){o.focus(),iSfx&&playSoundEffect("musics/events/move.mp3");break}}while(r!=i)}}},document.getElementById("reprendre").onclick=reprendre,document.getElementById("recommencer").onclick=function(){interruptGame(),removeGameMusics(),removeHUD(),clearResources();for(var e=0;e'+toLanguage("Spectator mode","Mode spectateur")+""+toLanguage("Switch player:","Changer de joueur :")+' ← →'+toLanguage("Exit: Escape","Quitter : Echap")+"",l.style.left=10+iScreenScale+"px",l.style.top=10+iScreenScale+"px",l.style.fontSize=Math.round(1.75*iScreenScale)+"px",l.style.display="",l.style.visibility="",document.body.style.cursor="default")),bCounting=!1},onlineSpectatorState?1:1e3),pause&&fInfos.replay){for(pause=!1,e=0;e=fTurboDriftCpt&&(oPlayers[0].turbodrift=15,clLocalVars.miniTurbo++,clSelected&&clRuleVars[clSelected.id]&&(t=clRuleVars[clSelected.id].mini_turbo)&&updateChallengeHud("miniTurbo",clLocalVars.miniTurbo+t.miniTurbo),oPlayers[0].driftcpt>=fTurboDriftCpt2&&(oPlayers[0].turbodrift+=15,clLocalVars.superTurbo++,clSelected&&clRuleVars[clSelected.id]&&(t=clRuleVars[clSelected.id].super_turbo)&&updateChallengeHud("superTurbo",clLocalVars.superTurbo+t.superTurbo)),oPlayers[0].turbodrift0=oPlayers[0].turbodrift,resetDriftSprite(oPlayers[0])),oPlayers[0].driftcpt=0,oPlayers[0].driftSound&&(oPlayers[0].driftSound.pause(),oPlayers[0].driftSound=void 0)),oPlayers[0].ctrled=!1,oPlayers[0].jumped&&(oPlayers[0].z||oPlayers[0].heightinc)&&(oPlayers[0].ctrled=!0);break;case"rear":clLocalVars.rearView||showRearView(0);break;case"item_p2":case"item_back_p2":case"item_fwd_p2":oPlayers[1].tourne||oPlayers[1].cannon||pause||arme(1,"item_back_p2"===e,"item_fwd_p2"===e);break;case"up_p2":if(!oPlayers[1])return;oPlayers[1].speedinc=0;break;case"left_p2":case"right_p2":if(!oPlayers[1])return;oPlayers[1].rotincdir=0;break;case"down_p2":if(!oPlayers[1])return;oPlayers[1].speedinc=0;break;case"jump_p2":if(pause)break;if(!oPlayers[1])return;delete oPlayers[1].ctrl,oPlayers[1].driftinc&&(oPlayers[1].driftinc=0,oPlayers[1].driftcpt>=fTurboDriftCpt&&(oPlayers[1].turbodrift=15,oPlayers[1].driftcpt>=fTurboDriftCpt2&&(oPlayers[1].turbodrift+=15),oPlayers[1].turbodrift0=oPlayers[1].turbodrift,resetDriftSprite(oPlayers[1])),oPlayers[1].driftcpt=0,oPlayers[1].driftSound&&(oPlayers[1].driftSound.pause(),oPlayers[1].driftSound=void 0)),oPlayers[1].ctrled=!1,oPlayers[1].jumped&&(oPlayers[1].z||oPlayers[1].heightinc)&&(oPlayers[1].ctrled=!0);break;case"rear_p2":if(!oPlayers[1])return;showRearView(1)}}(t))},window.releaseOnBlur=function(){if(!onlineSpectatorId){l={};for(var e=0;e'+(language?"+ Jump
Drift":"+ Saut
Dérapage")+"
",["up","jump"],0,0),ctrlSettings.autoacc&&(e.style.display="none"),addButtonLegacy(" ↑ ","up",1,0).id="virtualbtn-accelerate",addButtonLegacy("Obj","item",2,0,null,null,25),addButtonLegacy("❚❚","pause",3,0,null,null,25),document.getElementById("virtualkeyboard").appendChild(document.createElement("br")),document.getElementById("virtualkeyboard").appendChild(document.createElement("br")),addButtonLegacy(language?"Jump
Drift":"Saut
Dérapage","jump",0,1,null,null,11),addButtonLegacy(" ↓ ","down",1,1),addButtonLegacy(" ← ","left",2,1).id="virtualbtn-left",addButtonLegacy(" → ","right",3,1).id="virtualbtn-right";break;case"h_sym":t(!0),a(!0);break;case"v_sym":a(),t();break;case"vh_sym":a(!0),t(!0);break;default:t(),a()}if(i.ontouchstart=function(e){return e.preventDefault(),!1},i.className="shown","old"===ctrlSettings.layout){i.classList.add("legacy");return i.style.width=Math.round(288)+"px",i.style.height=Math.round(130)+"px",i.style.left=(iScreenScale*iWidth-288)/2+"px",void(i.style.top=40*iScreenScale+"px")}posVirtualKeyboard(i)}function posVirtualKeyboard(e){var t=iScreenScale*iHeight+20;e.style.top=t+"px";var a=e.offsetWidth,n=window.innerHeight-t,n=Math.min(n,Math.round(.45*a)),t=Math.min(window.innerWidth,iWidth*iScreenScale);aMath.max(.2,3*Math.abs(e)))return releaseKey("up"),pressKey("down"),0Math.max(50,3*Math.abs(t))?doReleaseKey(0window.innerHeight,window.turnOnRotate=function(e){var t,a;n&&n.dataset.pressed||o&&o.dataset.pressed||(e=i?(t=e.beta,90<=Math.abs(t)&&(t=Math.sign(t)*(180-Math.abs(t))),a=15,1):(t=e.gamma,90<=e.beta&&(t=-t),a=15,2),a=-Math.sign(t)*Math.pow(Math.abs(t/90),e)*a,rotateToAngle(oPlayers[0],a))},window.addEventListener("deviceorientation",window.turnOnRotate))}function setupVibrate(){navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){}}function showSpectatorKeyboard(){setupVibrate();var e=document.getElementById("virtualkeyboard");addButton("←",{key:"left",src:"left"}),addButton("→",{key:"right",src:"right"}),e.className="shown spectator",posVirtualKeyboard(e),e.style.height="40px"}var oPressedKeys={},oMusicEmbed;function pressKey(e){oPressedKeys[e]||doPressKey(e)}function doPressKey(e){oPressedKeys[e]=1,document.onkeydown&&document.onkeydown({keyAction:e})}function releaseKey(e){oPressedKeys[e]&&doReleaseKey(e)}function doReleaseKey(e){oPressedKeys[e]=void 0,document.onkeyup&&document.onkeyup({keyAction:e})}function rotateToAngle(e,t){var a=getMirrorFactor();clLocalVars.invertDirs&&(a=-a);var n,a=(t-angleInc(e)*a)/2;return a>e.stats.handling/2?n="left":a<-e.stats.handling/2&&(n="right"),"left"!==n&&releaseKey("left"),"right"!==n&&releaseKey("right"),n&&pressKey(n),{targetDir:a,action:n}}function youtube_parser(e){e=e.match(/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/);return!(!e||11!=e[1].length)&&e[1]}var fSpriteScale=0,fLineScale=0,oContainers=[document.createElement("div")],oPrevFrameStates;oContainers[0].className="game-container",oContainers[0].tabindex=1,formulaire=null,updateCtnFullScreen(1==$mkScreen.dataset.fs),function(){for(var e,t=0;t<2;t++)(e=document.getElementById("infos"+t))&&$mkScreen.removeChild(e);(e=document.createElement("table")).id="infos0",e.setAttribute("cellspacing",1),e.setAttribute("cellpadding",0),e.style.display="none",$mkScreen.appendChild(e)}(),$mkScreen.appendChild(oContainers[0]),pause&&fInfos.player[1]&&(oContainers[1]=oContainers[0].cloneNode(!1),oContainers[1].style.left=12+iWidth*iScreenScale+"px",$mkScreen.appendChild(oContainers[1]));var oScreens=new Array,aStrips=new Array,iCamHeight=24,iCamDist=32,iViewHeight=-10,fFocal=1/Math.tan(Math.PI*Math.PI/360);function resetScreen(){fSpriteScale=iScreenScale/4,fLineScale=1/iScreenScale*iQuality,aStrips=[];for(var e=0;ePlaces'+toLanguage("Team","Équipe")+"Pts",t=0;t'+toPlace(t+1)+' '+r+''+a[i]+""}return n.style.visibility="hidden",n.style.position="absolute",n.style.zIndex=2e4,n.style.left=Math.round(.5*iScreenScale+10)+"px",n.style.top=10*iScreenScale+"px",n.style.backgroundColor="blue",n.style.color=primaryColor,n.style.opacity=.7,n.style.textAlign="center",n.style.fontSize=Math.round(1.5*iScreenScale+2)+"pt",n.style.fontFamily="Courier",n.style.fontWeight="bold",n.style.fontFamily="arial",n.innerHTML=o,$mkScreen.appendChild(n),n}function resetScores(){for(var e=0;e ':' id="enregistrer">')+'';var oTeamTable=document.getElementById("team-table");oTeamTable&&$mkScreen.removeChild(oTeamTable);var oContinue=document.createElement("input"),forceClic3,oQuit,oSave,oReplay,oChangeRace,oClassement;oContinue.type="button",oContinue.style.fontSize=3*iScreenScale+"pt",oContinue.style.width="100%","CM"!=course?oMap.ref%4||"GP"!=course?(isSingle&&!isOnline?oContinue.value=" "+toLanguage(" REPLAY","REJOUER")+" ":"BB"==course?oContinue.value=toLanguage(" NEXT BATTLE\t ","BATAILLE SUIVANTE"):oContinue.value=toLanguage(" NEXT RACE\t ","COURSE SUIVANTE"),forceClic3=!0,oContinue.onclick=function(){forceClic3=!1,nextRace()},isOnline&&setTimeout(function(){forceClic3&&nextRace()},5e3)):(oContinue.value=toLanguage(" NEXT "," SUIVANT "),oContinue.onclick=function(){$mkScreen=document.body,interruptGame();var posX=[29,22,36],posY=[15,17,19],oPlace;document.body.innerHTML=toLanguage("You are","Vous êtes")+' !
'+toLanguage("Back","Retour")+'.';for(var placement=new Array,i=1;i<=aKarts.length;i++)for(var j=0;j';else if(oPlace)break}document.getElementById("position").innerHTML=toPlace(oPlace),oPlace<=3?(document.body.innerHTML+='.',saveParams="pts="+(4-oPlace),"MK"==page?(saveUrl="saveGP.php",saveParams+="&change="+(oMap.map-4)/4):nid&&(saveUrl="cupsave.php",saveParams+=isMCups?"&cup="+cupIDs[oMap.ref/4-1]:"&cup="+nid),saveUrl&&xhr(saveUrl,saveParams,function(reponse){if(reponse){var newPerso,uwPerso,uwPerso;try{newPerso=eval(reponse)}catch(e){return!1}return newPerso&&(uwPerso=toPerso(newPerso),uwPerso=uwPerso.charAt(0).toUpperCase()+uwPerso.substring(1),document.body.innerHTML+='
'+toLanguage("You can now play
with "+uwPerso+" !","Vous pouvez désormais
jouer avec "+uwPerso+" !")+'
'),!0}return!1}),bMusic&&(endGPMusic=startMusic("musics/menu/congrats.mp3",!0,700))):bMusic&&(endGPMusic=startMusic("musics/menu/toobad.mp3",!0,700)),reinitChallengeVars(),clLocalVars.endGP=!0,challengeCheck("end_gp")}):(oQuit=document.getElementById("quitter"),oContinue.style.fontSize=oQuit.style.fontSize=3*iScreenScale+"px",oSave=oContinue.cloneNode(!1),oReplay=oContinue.cloneNode(!1),oChangeRace=oContinue.cloneNode(!1),oClassement=oContinue.cloneNode(!1),oContinue.value=gSelectedPerso?toLanguage(" FACE WITH "," AFFRONTER "):toLanguage(" RETRY "," RÉESSAYER "),oContinue.onclick=function(){interruptGame(),removeGameMusics(),removeHUD(),clearResources(),$mkScreen.removeChild(oContainers[0]),fInfos={player:strPlayer,distribution:itemDistribution,ptsdistrib:ptsDistribution,cc:fSelectedClass,mirror:bSelectedMirror,double_items:oDoubleItemsEnabled,map:oMap.ref,difficulty:iDificulty,perso:gPersos,cpu_route:jTrajets,my_record:gRecord,ow_record:gOverwriteRecord,lap_times:iLapTimes,cl:clSelected},gSelectedPerso?(fInfos.player=[gSelectedPerso],jTrajets||(fInfos.perso=[strPlayer[0]],fInfos.cpu_route=[iTrajet])):2==gOverwriteRecord&&lapTimers.length==oMap.tours&&(fInfos.cpu_route=[iTrajet],fInfos.perso=strPlayer,fInfos.lap_times=lapTimers),document.getElementById("infos0").style.display="none",1==strPlayer.length&&removePlan(),oBgLayers.length=0,resetEvents(),resetApp()},oSave.value=" "+toLanguage("SAVE","ENREGISTRER")+" ",oSave.onclick=function(){document.getElementById("infos0").style.display="none";var oForm=document.createElement("form"),savedRecord;oForm.style.color="black",oForm.style.position="absolute",oForm.style.left=5*iScreenScale+10+"px",oForm.style.top=5*iScreenScale+10+"px",oForm.style.fontSize=4*iScreenScale+"pt",oForm.style.backgroundColor="#FF6",oForm.style.opacity=.8,oForm.style.border="double 4px black",oForm.style.textAlign="center",oForm.style.width=70*iScreenScale-10+"px",oForm.style.zIndex=2e4,oForm.onsubmit=function(){var nom=this.pseudo.value;if(nom){document.body.style.cursor="progress",oValide.style.visibility="hidden",aPara2.style.visibility="hidden";var params="name="+nom+"&perso="+strPlayer[0]+"&time="+getActualGameTimeMS()+"&cc="+getActualCc();switch(page){case"MK":params+="&circuit="+oMap.map;break;case"CI":params+="&creation="+oMap.id;break;case"MA":params+="&map="+oMap.map}function postSaveRecord(reponse){if(reponse){var enregistre;document.body.style.cursor="default";try{enregistre=eval(reponse)}catch(e){return!1}function showBackUi(e){oInput.disabled=!0,oCheckbox.disabled=!0,oValide.parentNode.removeChild(oValide),aPara2.style.fontSize=Math.round(2.5*iScreenScale)+"px",e&&(aPara2.innerHTML=toLanguage("Congratulations "+nom+", your score has been saved successfully ! You placed ","Félicitations "+nom+", votre score a bien été enregistré ! Vous êtes ")+toPlace(enregistre[0])+toLanguage(" out of "+enregistre[1]+" in this race !"," sur "+enregistre[1]+" au classement de ce circuit !"),oSave.style.display="none"),aPara2.style.visibility="",oRetour.focus()}function rollbackUi(){oValide.style.visibility="",oValide.style.marginRight=2*iScreenScale+"px",aPara3.insertBefore(oValide,oRetour),oCheckbox.disabled=!1,oInput.disabled=!1,oInput.select()}if(Array.isArray(enregistre))if(savedRecord=enregistre,oCheckbox.checked){oSave.style.display="none",oValide.style.display="none";var aSmall=document.createElement("span");aSmall.style.fontSize=Math.round(2.5*iScreenScale)+"px",aSmall.innerHTML=toLanguage("Saving ghost...","Enregistrement du fantôme..."),aPara2.appendChild(aSmall),aPara2.style.visibility="";var oRequest="map="+getCreationId(oMap)+"&type="+getCreationTable()+"&perso="+strPlayer[0]+"&time="+getActualGameTimeMS()+"×="+JSON.stringify(lapTimers)+"&cc="+getActualCc();for(i=0;idelete ghosts to save space','Vous avez dépassé votre quota de fantômes enregistrés. Vous pouvez supprimer des fantômes pour gagner de l\'espace'),rollbackUi(),!0)})}else showBackUi(!0);else{switch(showBackUi(!1),enregistre){case 0:aPara2.innerHTML=toLanguage("You did a better score on this race before.
Your score has not been registered.","Vous avez fait un meilleur score sur ce circuit.
Votre temps n'a donc pas été enregistré.");break;case 1:aPara2.innerHTML=toLanguage('This nick is already used, please choose another one. If it\'s you, log-in to your account and try again.','Ce pseudo est déjà utilisé, veuillez en choisir un autre. S\'il s\'agit de vous, connectez-vous et réessayez.');break;default:aPara2.innerHTML=toLanguage("An unknown error occured, please try again later","Une erreur inconnue est survenue, veuillez réessayer ultérieurement")}0!=enregistre&&rollbackUi()}return!0}return!1}savedRecord?postSaveRecord(savedRecord):xhr("records.php",params,postSaveRecord),recorder=nom}return!1};var aPara1=document.createElement("p");aPara1.innerHTML=toLanguage("Nick : ","Pseudo : "),aPara1.style.margin=iScreenScale+"px";var oInput=document.createElement("input");oInput.type="text",oInput.name="pseudo",oInput.value=recorder,oInput.size=15,oInput.maxlength=18,oInput.style.fontSize=3*iScreenScale+"px",oInput.onkeydown=function(e){e.stopPropagation()},oInput.onkeyup=function(e){e.stopPropagation()},aPara1.appendChild(oInput);var aPara12=aPara1.cloneNode(!1),oCheckLabel=document.createElement("label");oCheckLabel.style.display="inline-block";var oCheckbox=document.createElement("input");oCheckbox.type="checkbox",oCheckbox.name="saveghost",oCheckbox.checked=!0,oCheckbox.style.transform=oCheckbox.style.WebkitTransform=oCheckbox.style.MozTransform="scale("+(iScreenScale/6).toFixed(1)+")",oCheckLabel.appendChild(oCheckbox);var oCheckSpan=document.createElement("span");oCheckSpan.style.fontSize=2*iScreenScale+"px",oCheckSpan.innerHTML=" "+toLanguage("Save ghost","Enregistrer le fantôme"),oCheckLabel.appendChild(oCheckSpan),aPara12.appendChild(oCheckLabel),gRecord<=timerMS&&(oCheckbox.checked=!1,aPara12.style.display="none");var aPara2=aPara1.cloneNode(!1),oValide=document.createElement("input");oValide.type="submit",oValide.value=" "+toLanguage("Submit","Valider")+" ",oValide.style.fontSize=5*iScreenScale+"px",oValide.onmouseover=function(){this.style.fontSize=5*iScreenScale+"px",oRetour.style.fontSize=4*iScreenScale+"px"},aPara2.appendChild(oValide);var aPara3=aPara1.cloneNode(!1),oRetour=document.createElement("input");oRetour.type="button",oRetour.value=" "+toLanguage("Back","Retour")+" ",oRetour.style.fontSize=4*iScreenScale+"px",oRetour.onmouseover=function(){this.style.fontSize=5*iScreenScale+"px",oValide.style.fontSize=4*iScreenScale+"px"},oRetour.onclick=function(){$mkScreen.removeChild(oForm),document.getElementById("infos0").style.display="",oContinue.focus()},aPara3.appendChild(oRetour),oForm.appendChild(aPara1),oForm.appendChild(aPara12),oForm.appendChild(aPara2),oForm.appendChild(aPara3),$mkScreen.appendChild(oForm),oForm.style.height=oForm.scrollHeight+"px",oInput.select()},gSelectedPerso&&(oSave.style.display="none"),document.getElementById("enregistrer").appendChild(oSave),oReplay.value=toLanguage("REPLAY","REVOIR"),oReplay.onclick=function(){interruptGame(),removeGameMusics(),removeHUD(),clearResources();for(var e=0;eiHeight*iScreenScale||t+n*iScreenScale<9*iScreenScale?l[o][0].style.display="none":(l[o][0].style.display="block",l[o][0].style.left=Math.round(e-i/2)+"px",l[o][0].style.top=Math.round(a)+"px",this.h!=this.w?l[o][1].style.width=Math.round(i)*this.nbSprites+"px":l[o][1].style.width="",l[o][1].style.height=Math.round(r)+"px",l[o][0].style.width=Math.round(i)+"px",l[o][0].style.height=Math.round(r)+"px",l[o][1].style.left=-(Math.round(i)*l[o][2])+"px")},this[t].render=function(e,t){var a=t.size||1,n=(t.x-e.x)*getMirrorFactor(),o=t.y-e.y,i=e.rotation*Math.PI/180*getMirrorFactor(),e=n*Math.cos(i)-o*Math.sin(i),n=n*Math.sin(i)+o*Math.cos(i),o=-iCamHeight,i=iCamDist+n,t=t.z?correctCamZ(t.z,i):0,i=o/i*iCamDist+iCamHeight-iViewHeight+t,e=-e/(n+iCamDist)*iCamDist;this.div.style.zIndex=Math.round(1e4-n);e=(iWidth/2+e)*iScreenScale,i=(iHeight-i)*iScreenScale,a*=fFocal/(fFocal+n);this.draw(e,i,a,t)},this[t].setState=function(e){l[this.i][2]=e},this[t].getState=function(){return l[this.i][2]},this[t].div=n,this[t].img=a,l.push([n,a,0])}var o=this;this[0].unshow=function(){o[0].suppr(),o[0].unshown=!0},this[0].suppr=function(){if(!o[0].unshown)for(var e=0;e>3]&1<<(7&s)&&(o|=1<=c.length?c.push(c[i].concat(c[i][0])):i!==p&&c.push(c[i].concat(c[o][0])),l=(r=c[o]).length,a=0;a>2,C.transparencyGiven=!!(1&e),C.delayTime=n.data[n.pos++]+(n.data[n.pos++]<<8),C.transparencyIndex=n.data[n.pos++],n.pos++):t===s.COMMENT?C.comment+=n.readSubBlocks():t===s.APPExt?(n.pos+=1,"NETSCAPE"===n.getString(8)?n.pos+=8:(n.pos+=3,n.readSubBlocks())):(t===s.UNKNOWN&&(n.pos+=13),n.readSubBlocks())}function y(){if(void 0!==C.cancel&&!0===C.cancel)return m(),void("function"==typeof C.cancelCallback&&C.cancelCallback.bind(C)({type:"canceled",path:[C]}));var e=n.data[n.pos++];if(e===s.IMAGE){if(d(),C.firstFrameOnly)return void m()}else{if(e===s.EOF)return void m();g()}C.frames.length&&"function"==typeof C.onloadone&&(C.image=C.frames[0].image,C.onloadone.bind(C)({type:"load",path:[C]}),delete C.onloadone),"function"==typeof C.onprogress&&C.onprogress({bytesRead:n.pos,totalBytes:n.data.length,frame:C.frames.length}),t=setTimeout(y,0)}function f(e){"function"==typeof C.onerror&&C.onerror.bind(this)({type:e,path:[this]}),C.onload=C.onerror=void 0,C.loading=!1}function S(){C.currentFrame=0,C.nextFrameAt=C.lastFrameAt=(new Date).valueOf(),"function"==typeof C.onload&&C.onload.bind(C)({type:"load",path:[C]}),C.onerror=C.onload=void 0}function v(e){(n=new c(e)).pos+=6,C.width=n.data[n.pos++]+(n.data[n.pos++]<<8),C.height=n.data[n.pos++]+(n.data[n.pos++]<<8),e=n.data[n.pos++],C.colorRes=(112&e)>>4,C.globalColourCount=1<<1+(7&e),C.bgColourIndex=n.data[n.pos++],n.pos++,128&e&&(C.globalColourTable=p(C.globalColourCount)),t=setTimeout(y,0)}function b(){var e;0===C.playSpeed?C.pause():(e=C.playSpeed<0?(--C.currentFrame,C.currentFrame<0&&(C.currentFrame=C.frames.length-1),e=C.currentFrame,--e<0&&(e=C.frames.length-1),-C.frames[e].delay/C.playSpeed):(C.currentFrame+=1,C.currentFrame%=C.frames.length,+C.frames[C.currentFrame].delay/C.playSpeed),C.image=C.frames[C.currentFrame].image,a=setTimeout(b,e))}var C={onload:null,onerror:null,onprogress:null,onloadall:null,paused:!1,playing:!1,waitTillDone:!0,loading:!1,firstFrameOnly:!1,width:null,height:null,frames:[],comment:"",length:0,currentFrame:0,frameCount:0,playSpeed:1,lastFrame:null,image:null,playOnLoad:!0,load:function(e){var t=new XMLHttpRequest;t.responseType="arraybuffer",t.onload=function(e){404===e.target.status?f("File not found"):200<=e.target.status&&e.target.status<300?v(t.response):f("Loading error : "+e.target.status)},t.open("GET",e,!0),t.send(),t.onerror=function(e){f("File error")},this.src=e,this.loading=!0},cancel:function(e){return!C.complete&&(C.cancelCallback=e,C.cancel=!0)},play:function(){C.playing||(C.paused=!1,C.playing=!0,b())},pause:function(){C.paused=!0,C.playing=!1,clearTimeout(a)},seek:function(e){clearTimeout(a),e<0&&(e=0),e*=1e3,e%=C.length;for(var t=0;e>C.frames[t].time+C.frames[t].delay&&tiHeight*iScreenScale||a+o*iScreenScale<12*iScreenScale?i.style.display="none":(i.style.display="block",n=Math.round(r.sprite[e].h*fSpriteScale*n),i.style.left=Math.round(t)+"px",i.style.top=Math.round(a-n/2)+"px")},e.render=function(e,t,a){var n=a.size||1,o=(a.x-t.x)*getMirrorFactor(),i=a.y-t.y,r=t.rotation*Math.PI/180*getMirrorFactor(),t=o*Math.cos(r)-i*Math.sin(r),o=o*Math.sin(r)+i*Math.cos(r),i=-iCamHeight,r=iCamDist+o,a=correctCamZ(a.z,r),r=i/r*iCamDist+iCamHeight-iViewHeight+a,t=-t/(o+iCamDist)*iCamDist;this.div[e].style.zIndex=Math.round(1e4-o);t=(iWidth/2+t)*iScreenScale,r=(iHeight-r)*iScreenScale,n*=fFocal/(fFocal+o);this.draw(e,t,r,n,a)},e}var prevScreenCur=0,prevScreenOpacity=0,prevScreenFade=0;function clonePreviousScreen(e,t){if(prevScreenDelay){var a=oPrevFrameStates[e];a[prevScreenCur].canvas.getContext("2d").drawImage(oScreens[e],0,0);for(var n=0;n=r&&(t.countstate++,t.countdown=0,t.countstate>=i.countdowns.length&&detruit(t))},del:function(e){if(e.sprites){for(var t=0;tMath.PI&&(c=p-c),Math.abs(c)>Math.PI/2)return m=s.using[0].x,h=s.using[0].y,t.x=m,t.y=h,detruit(t),void detruit(s.using[0],!0);s.using[0].x-=2*direction(0,s.rotation),s.using[0].y-=2*direction(1,s.rotation)}t.x=m,t.y=h,a=4}else{I=Math.sqrt(I);var d=(s.x-t.x)*n/I,u=(s.y-t.y)*n/I,m=t.x+d,h=t.y+u;75=e[4].length&&(e[5]-=2,e[6]=-1))}}},fire3star:{unbreaking:!0,transparent:!0,hidden:!0,preinit:function(e){oMap.decor.fireballs||(oMap.decor.fireballs=new Array),this.linkedSprite={type:"fireballs",start:oMap.decor.fireballs.length};for(var t=0;tr*r&&(e[5]=-1)}for(a=0;a=r.length&&(e[6]=0)):(a+=s*t/l,n+=c*t/l,t=0),0i+o?e[4]-=o:e[4]=i);for(var p=0;p=e[4].length&&(e[5]-=2,e[6]=-1);var c,p=e[4][e[5]];c=!i||0=e[4].length&&(e[5]=0),a-=l):(e[0]+=i*a/l,e[1]+=r*a/l,a=0)}var s=e[4][e[5]],c=e[4][(e[5]||e[4].length)-1],p=180*Math.atan2(s[0]-c[0],s[1]-c[1])/Math.PI;if(!isNaN(p))for(var d=0;do&&(a=o*Math.sign(a),e[5][3]=-e[5][3]),a+=Math.sqrt(2*(Math.cos(a)-Math.cos(t)))/16*e[5][3],e[4]=a;e[0]=e[5][0]+30*Math.sin(a)*Math.sin(n),e[1]=e[5][1]+30*Math.sin(a)*Math.cos(n);for(var i=-6*(1-Math.cos(a)),r=0;r=itemDistribution.value.length&&(e=itemDistribution.value.length-1,n=itemDistribution.value.length);for(var i,r=e;r'}var syncItems=[];function detruit(e,t){isOnline&&((e=getItemToDestroy(e)).deleted=1,syncItems.push(e)),supprime(e,t)}function supprime(e,t){var a=e.type,n=items[a].indexOf(e);if(-1!=n){var o=itemBehaviors[a];if(e.sprite){for(var i=0;ia[0]&&e<=a[0]+a[2]&&t>a[1]&&t<=a[1]+a[3]}function pointInPolygon(e,t,a){for(var n=!1,o=0,i=a.length-1;o=o[s]:i[s]>=o[s]+o[s+2]&&i[s]+r[s]<=o[s]+o[s+2]){var p=1-s,c=i[p]+((c?o[s]:o[s]+o[s+2])-i[s])*r[p]/r[s];if(c>=o[p]&&c<=o[p]+o[2+p])return 1}}}function pointCrossPolygon(e,t,a,n,o){for(var i=0;ih[0]-d&&lh[1]-d&&sh[0]-d&&eh[1]-d&&toMap.w-5||t>oMap.h-5||e<4||t<4)return 1}else if(e>=oMap.w||t>=oMap.h||e<0||t<0)return 1;for(var g=0,y=oMap.collision.rectangle,m=0;moMap.w-5||s>oMap.h-5||l<4||s<4)return}else if(l>=oMap.w||s>=oMap.h||l<0||s<0)return;for(m=0;moMap.w-5||f<4)&&(y.dir=[0,oMap.h]),(S>oMap.h-5||S<4)&&(y.dir=[oMap.w,0])):((f>=oMap.w||f<0)&&(y.dir=[0,oMap.h]),(S>=oMap.h||S<0)&&(y.dir=[oMap.w,0]))),oMap.decor&&!a.skipDecor)for(var n in oMap.decor)for(var o=0;oi[0]-7&&ei[1]-7&&tn.x-5&&en.y-5&&toMap.w?(e=oMap.w-.5,c=!0):e<=0&&(e=.5,c=!0),t>oMap.h?(t=oMap.h-.5,c=!0):t<=0&&(t=.5,c=!0),oMap.trous)for(var o in oMap.trous){for(var i=oMap.trous[o].rectangle,r=0;r"+t.title+": "+t.value+""+(null!=t.out_of?"/"+t.out_of+"":""),t=a.getElementsByTagName("span"),oChallengeCpts.appendChild(a),clHud[e]={$cpt:a,$label:t[0],$value:t[1],$outOf:t[2]})}function updateChallengeHud(e,t){clHud[e]&&(clHud[e].$value.innerText=t)}var challengeRules={finish_circuit:{verify:"end_game",reset_on_fail:!0,success:lambdaReturnsTrue},finish_circuit_first:{verify:"end_game",reset_on_fail:!0,success:function(e){return"CM"!=course&&1==oPlayers[0].place}},finish_circuit_time:{verify:"end_game",reset_on_fail:!0,success:function(e){return getActualGameTime()<=e.value}},finish_arena:{verify:"end_game",reset_on_fail:!0,success:lambdaReturnsTrue},finish_arena_first:{verify:"end_game",reset_on_fail:!0,success:function(e){return 1==oPlayers[0].place}},hit:{verify:"each_hit",initLocalVars:function(e){clLocalVars.myItems=[],clLocalVars.nbHits=0},initSelected:function(e){addChallengeHud("hits",{title:toLanguage("Hits","Touchés"),value:clLocalVars.nbHits,out_of:e.value})},success:function(e){if(clLocalVars.nbHits>=e.value)return!0}},eliminate:{verify:"each_kill",initLocalVars:function(e){clLocalVars.myItems=[],clLocalVars.killed=[],clLocalVars.nbKills=0,clLocalVars.nbHits=0},initSelected:function(e){addChallengeHud("kills",{title:toLanguage("Defeated","Eliminés"),value:clLocalVars.nbKills,out_of:e.value})},success:function(e){if(clLocalVars.nbKills>=e.value)return!0}},survive:{verify:"each_frame",success:function(e){if(getActualGameTime()>=e.value)return!0}},reach_zone:{verify:"each_frame",initLocalVars:function(e){e.zones||(e.zones=classifyByShape(e.value))},success:function(e){for(var e=e.zones,t=oPlayers[0].x,a=oPlayers[0].y,n=e.rectangle,o=0;o=o.length)return!0}}}},hit_items:{verify:"each_item",initLocalVars:function(e){clLocalVars.nbItems=0,clLocalVars.itemsHit=[],setTimeout(function(){clLocalVars.itemsHit.length=oMap.arme.length})},initSelected:function(e){setTimeout(function(){addChallengeHud("items",{title:toLanguage("Items","Objets"),value:clLocalVars.nbItems,out_of:oMap.arme.length})})},success:function(e){if(clLocalVars.nbItems>=oMap.arme.length)return!0}},collect_coins:{verify:"each_coin",initLocalVars:function(e){clLocalVars.nbCoins=0,e.nb||(e.nb=e.value.length)},initSelected:function(e){if(!oMap.coins){oMap.coins=[];for(var t=0;t=e.nb)return!0}},destroy_decors:{verify:"each_decor_hit",initLocalVars:function(t){var e;clLocalVars.nbDecorHits||(clLocalVars.nbDecorHits={}),clLocalVars.nbDecorHits[t.value]=0,t.nb||(e=oMap.decor[t.value]||[],t.nb=e.length,t.shouldInitToAll=!0),t.shouldInitToAll&&setTimeout(function(){var e=oMap.decor[t.value]||[];t.nb=e.length})},initSelected:function(e){setTimeout(function(){addChallengeHud("decors",{title:toLanguage("Destroyed","Détruit"),value:0,out_of:e.nb})})},success:function(e){if(clLocalVars.nbDecorHits[e.value]>=e.nb)return!0}},gold_cup:{verify:"end_gp",initRuleVars:function(){return{nbcircuits:0}},success:function(e,t){if(clLocalVars.endGP&&4==t.nbcircuits)return 1==oPlayers[0].place},next_circuit:function(e){e.nbcircuits++}},gold_cups:{verify:"end_gp",initRuleVars:function(e){return{challenge:e,nbcircuits:0}},success:function(e,t){if(clLocalVars.endGP&&4==t.nbcircuits)return 1==oPlayers[0].place},post_success:function(e,t){var a=(a=getSessionStorage("cl"+t.challenge.id+".gold_cups"))||"{}";if(a=JSON.parse(a),t.challenge.data.constraints.every(e=>"cc"===e.type))for(var n=0;n"cc"===e.type))for(var n=0;n=e.value?(deleteSessionStorage("cl"+t.challenge.id+".gold_cups"),!0):(setSessionStorage("cl"+t.challenge.id+".gold_cups",JSON.stringify(a)),showChallengePartialSuccess(t.challenge,{nb:Object.keys(a).length,total:e.value}),!1)},next_circuit:function(e){e.nbcircuits++}},finish_circuits_first:{verify:"end_game",initRuleVars:function(){return{nbcircuits:1}},initSelected:function(e,t){t&&t.nbcircuits&&addChallengeHud("races",{title:"BB"==course?toLanguage("Battle","Bataille"):toLanguage("Race","Course"),value:t.nbcircuits,out_of:e.value})},success:function(e,t){return 1==oPlayers[0].place&&(t.nbcircuits>=e.value||void 0)},next_circuit:function(e){e.nbcircuits++}},pts_greater:{verify:"end_game",initRuleVars:function(){return clGlobalVars.nbcircuits?{}:{nbcircuits:1,initialscore:0}},initSelected:function(e,t){t&&t.nbcircuits&&addChallengeHud("races",{title:"BB"==course?toLanguage("Battle","Bataille"):toLanguage("Race","Course"),value:t.nbcircuits,out_of:e.value})},success:function(e,t){if(t.nbcircuits==e.value&&aScores[0]>=e.pts)return!0},next_circuit:function(e){e.nbcircuits++}},pts_equals:{verify:"end_game",initRuleVars:function(){return clGlobalVars.nbcircuits?{}:{nbcircuits:1}},initSelected:function(e,t){t&&t.nbcircuits&&addChallengeHud("races",{title:"BB"==course?toLanguage("Battle","Bataille"):toLanguage("Race","Course"),value:t.nbcircuits,out_of:e.value})},success:function(e,t){if(t.nbcircuits==e.value&&aScores[0]==e.pts)return!0},next_circuit:function(e){e.nbcircuits++}},game_mode:{success:function(e){return course==["VS","CM"][e.value]}},game_mode_cup:{success:function(e){return course==["GP","VS"][e.value]}},difficulty:{success:function(e){return iDificulty==4+.5*(2-e.value)}},no_teams:{success:function(e){return!iTeamPlay}},participants:{success:function(e){return aKarts.length==e.value}},cc:{initRuleVars:function(e,t){return{relSpeed:getRelSpeedFromCc(+t.value)}},success:function(e,t){if(t)return t.relSpeed===fSelectedClass&&(null===e.mirror||!e.mirror==!bSelectedMirror)}},balloons:{success:function(e){return(!oPlayers[0].lost||clLocalVars.gagnant==oPlayers[0])&&oPlayers[0].ballons.length+oPlayers[0].reserve>=e.value}},balloons_lost:{initSelected:function(e,t){addChallengeHud("balloons",{title:toLanguage("Balloons","Ballons"),value:clLocalVars.lostBalloons,out_of:e.value})},success:function(e){return(!oPlayers[0].loose||clLocalVars.gagnant==oPlayers[0])&&clLocalVars.lostBalloons<=e.value}},balloons_inflate:{initSelected:function(e,t){addChallengeHud("inflated",{title:toLanguage("Inflated","Gonflés"),value:clLocalVars.inflatedBalloons,out_of:e.value})},success:function(e){return clLocalVars.inflatedBalloons<=e.value}},balloons_player:{initRuleVars:function(){return{}},initSelected:function(e,t){t.selected=!0,clLocalVars.isSetup=!0,oPlayers[0].reserve=e.value-oPlayers[0].ballons.length,updateBalloonHud(document.getElementById("compteur0"),oPlayers[0])},success:function(e,t){return!!t.selected}},balloons_cpu:{initRuleVars:function(){return{}},initSelected:function(e,t){t.selected=!0,clLocalVars.isSetup=!0;for(var a=oPlayers.length;a=e.value}},start_pos:{initSelected:function(e){if(clLocalVars.startPos=e.value,clLocalVars.isSetup=!0,e.no_cpu){aKarts.length=strPlayer.length;for(var t=0;t=e.value)return!0},next_circuit:function(e){e&&(e.miniTurbo+=clLocalVars.miniTurbo)}},super_turbo:{initRuleVars:function(){return{superTurbo:0}},initSelected:function(e,t){t&&addChallengeHud("superTurbo",{title:"Super Turbos",value:clLocalVars.superTurbo+t.superTurbo,out_of:e.value})},success:function(e,t){if(t&&t.superTurbo+clLocalVars.superTurbo>=e.value)return!0},next_circuit:function(e){e&&(e.superTurbo+=clLocalVars.superTurbo)}},stunts:{initRuleVars:function(){return{stunts:0}},initSelected:function(e,t){t&&addChallengeHud("stunts",{title:toLanguage("Stunts","Figures"),value:clLocalVars.stunts+t.stunts,out_of:e.value})},success:function(e,t){if(t&&t.stunts+clLocalVars.stunts>=e.value)return!0},next_circuit:function(e){e&&(e.stunts+=clLocalVars.stunts)}},position:{success:function(e){if(oPlayers[0].place==e.value)return!0}},position_lower:{success:function(e){if(oPlayers[0].place<=e.value)return!0}},with_pts:{verify:"end_game",initRuleVars:function(){return clGlobalVars.nbcircuits?{}:{firstAttempt:!0}},success:function(e,t){if(t.firstAttempt&&aScores[0]>=e.value)return!0}},different_circuits:{initRuleVars:function(){return{played_circuits:{}}},success:function(e,t){return!t.played_circuits[oMap.ref]},next_circuit:function(e){e.played_circuits[oMap.ref]=!0}}};function addCreationChallenges(e,t){t=challenges[e][t];if(t)for(var a=t.list,n=0;nstar

'+n+'

'+o+'
'+i+'
",(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='
star

'+o+'

'+i+"
"+(e?'
'+r+l+s+"
":"")+(0<=a.rating?'
'+toLanguage("Rate this challenge:","Notez ce défi :")+'
'+toLanguage("Thanks","Merci")+"
":"")+(a.publish?'
'+toLanguage("You can now","Vous pouvez maintenant")+' '+toLanguage("publish challenge","publier le défi")+".
":"")+'",0<=a.rating){var p=n.getElementsByClassName("challenge-rating-stars");(p=p[0]).style.position="relative",p.style.marginLeft=Math.round(.4*iScreenScale)+"px",p.style.marginRight=Math.round(.4*iScreenScale)+"px",p.style.top=Math.round(.4*iScreenScale)+"px";function d(){for(var e=+this.rating,t=0;t"+e.name+"!":"Vous pouvez désormais jouer avec "+e.name+" !",(i=document.createElement("img")).src=getSpriteSrc(e.sprites),i.alt=e.name,i.className="pixelated",i.style.visibility="hidden",o=language?"Close":"Fermer",t.innerHTML='
star

'+a+'

'+n+'
",t.getElementsByClassName("challenge-popup-reward-ch")[0].appendChild(i),i.onload=function(){var e=this.parentNode,t=iScreenScale/8,a=Math.round(t*this.naturalWidth/24),t=Math.round(t*this.naturalHeight);e.style.width=a+"px",e.style.height=t+"px",this.style.width=24*a+"px",this.style.height=t+"px",this.style.visibility=""},(i=document.getElementsByClassName("challenge-popup")).length?$mkScreen.insertBefore(t,i[0]):$mkScreen.appendChild(t),r=0,function e(){r<1?(t.style.opacity=r,r+=.2,setTimeout(e,40)):t.style.opacity=1}())}function focusOnChallengeClose(){var e=document.querySelectorAll(".challenge-popup .challenge-popup-close a");e.length?e[e.length-1].focus():(e=document.getElementById("reprendre"))?e.focus():(e=document.getElementById("octn"))&&e.focus()}function showClSelectedPopup(){var t=document.createElement("div");t.style.fontSize=2*iScreenScale+"px",t.className="clselected-popup",t.style.left=27*iScreenScale+"px",t.style.top=iHeight*iScreenScale+"px",t.innerHTML='
'+toLanguage("Challenge selected :","Défi sélectionné:")+" "+(clSelected.name||clSelected.description.main)+"
",t.querySelector(".clselected-close a").onclick=function(){return document.body.removeChild(t),!1},document.body.appendChild(t);var a=1;setTimeout(function e(){0o.x-4&&eo.y-4&&to.x-4&&eo.y-4&&tn.x-4&&en.y-4&&to.x-4&&eo.y-4&&ta.x-5&&ea.y-5&&ta.x-5&&ea.y-5&&to.x-5&&eo.y-5&&t=oMap.checkpoint.length&&(t=0);var a=oMap.checkpointCoords[t];if(!a)return 0;var n=projete(e.x,e.y,a.A[0],a.A[1],a.B[0],a.B[1]),t=a.A[0]+n*a.u[0],a=a.A[1]+n*a.u[1],a=Math.hypot(t-e.x,a-e.y);return e.tours*oMap.checkpoint.length+getCpScore(e)-a/1e4}function getRankScores(){return aKarts.map(function(e){return getRankScore(e)})}function places(e,t,a){for(var n=aKarts[e],o=!a,i=0;ioMap.tours||r.loose?onlineSpectatorId&&!finishing&&(document.getElementById("infoPlace"+i).style.visibility="hidden"):o=!1}if(!o){var l=1;if("BB"==course||!(n.tours>oMap.tours)&&oMap.checkpoint.length){for(var s=t[e],i=0;iaKarts[i].initialPlace)&&l++}n.loose||(n.place=l),finishing||(e=getScreenPlayerIndex(e))=oMap.checkpoint.length&&(r=0,i++);var l=oMap.checkpointCoords[r],s=l.O[0],l=l.O[1];a+=Math.hypot(s-n,l-o),n=s,o=l}return a+=Math.hypot(t.x-n,t.y-o)}function checkpoint(e,t,a){var n,o=[e.x-t,e.y-a],i=200=oMap.checkpoint.length&&(d-=oMap.checkpoint.length),d!=l;d++)if(!oMap.checkpoint[d][4]){p=!1;break}if(p)return l==n||void(e.demitours=l)}}}function getCheckpointCoords(e){var t=e[0],a=e[1],n=e[2];switch(e[3]){case 0:case 1:var o=e[3],i={A:[t,a],u:[o?n:0,o?0:n],v:[o?0:15,o?15:0],O:[t+(o?n/2:8),a+(o?8:n/2)]};break;default:var r=e[3]*Math.PI/2,l=Math.cos(r),s=Math.sin(r),c=t+7.5,p=a+7.5,o=e[2]/2-7.5,r=c+o*s,c=p+o*l,p=n*s,o=15*l,l=-n*l,s=15*s;i={A:[r-(p+o)/2,c-(l+s)/2],u:[p,l],v:[o,s],O:[r,c]}}return i.B=[i.A[0]+i.u[0],i.A[1]+i.u[1]],i.C=[i.A[0]+i.v[0],i.A[1]+i.v[1]],i.D=[i.B[0]+i.v[0],i.B[1]+i.v[1]],i}function int8ToHexString(e){return[].slice.call(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("")}function hexStringToInt8(e){return new Uint8Array(e.match(/../g).map(function(e){return parseInt(e,16)})).buffer}function itemDataToHex(e,t){switch(e){case"double":return int8ToHexString(new Uint8Array(new Float64Array([t]).buffer,0,8));case"float":return int8ToHexString(new Uint8Array(new Float32Array([t]).buffer,0,4));case"int":return int8ToHexString(new Uint8Array(new Int32Array([t]).buffer,0,4));case"short":return int8ToHexString(new Uint8Array(new Int16Array([t]).buffer,0,2));case"byte":return int8ToHexString(new Uint8Array(new Int8Array([t]).buffer,0,1))}}function hexToItemData(e,t){switch(e){case"double":return new Float64Array(hexStringToInt8(t))[0];case"float":return new Float32Array(hexStringToInt8(t))[0];case"int":return new Int32Array(hexStringToInt8(t))[0];case"short":return new Int16Array(hexStringToInt8(t))[0];case"byte":return new Int8Array(hexStringToInt8(t))[0]}}function itemDataLength(e){switch(e){case"double":return 16;case"float":case"int":return 8;case"short":return 4;case"byte":return 2}}function resetDatas(){var e=oPlayers[0],Z="BB"!=course?["x","y","z","speed","speedinc","heightinc","rotation","rotincdir","rotinc","drift","driftinc","driftcpt","size","tourne","tombe","arme","stash","tours","demitours","champi","etoile","megachampi","billball","place"]:["x","y","z","speed","speedinc","heightinc","rotation","rotincdir","rotinc","drift","driftinc","driftcpt","size","tourne","tombe","arme","stash","ballons","reserve","champi","etoile","megachampi"],t="BB"!=course?["finaltime"]:[],ee=Z.concat("aipoint"),a={player:[],extra:{},item:[],lastcon:connecte},n=[{params:a.player,mapping:Z,kart:e}];if(onlineSpectatorId)delete a.player;else{for(var o=0;oI;){var T=L.ballons.length-1;L.ballons[T][0].suppr(),L.ballons.pop()}}break;default:L[x[P]]=I}}if(25<=L.billball&&!f?(L.sprite[0].img.src="images/sprites/sprite_billball.png",resetSpriteHeight(L.sprite[0]),L.aipoint=void 0):50<=L.etoile&&!y?L.sprite[0].img.src=getStarSrc(L.personnage):(y&&!L.etoile||f&&!L.billball)&&(L.sprite[0].img.src=getSpriteSrc(L.personnage),resumeSpriteSize(L.sprite[0])),C&&C.startsWith("champi")&&(C!==L.arme||"champior"===C)&&L.champi>b?L.champiType=CHAMPI_TYPE_ITEM:L.champi||delete L.champiType,L.aipoint>=L.aipoints.length&&(L.aipoint=0),M!==L.tours&&(p=getScreenPlayerIndex(s))=fTurboDriftCpt&&L.driftSprite[0].setState(1),v=fTurboDriftCpt2&&L.driftSprite[0].setState(2)),!L.turnSound&&L.tourne&&(L.turnSound=playDistSound(L,"musics/events/spin.mp3","BB"==course?80:50),L.frminv||(L.frminv=10)),L.turnSound&&!L.tourne&&(L.turnSound=void 0);for(P=r[0][1];P'+a[1]+'
'+timeStr(a[5])+"":u[t][0].innerHTML=a[1],u[t][0].id="j"+t,u[t][1]=document.createElement("td"),u[t][1].innerHTML=a[2];var o=document.createElement("small");if(o.innerHTML=(a[3]<0?"":"+")+a[3],n.appendChild(r),n.appendChild(u[t][0]),u[t][1].appendChild(o),n.appendChild(u[t][1]),iTeamPlay){n.style.textShadow="-1px 0 #603, 0 1px #603, 1px 0 #603, 0 -1px #603";for(var i=0;i=n&&(n=h[3][i][2],o=i);var r=h[3][e];h[3][e]=h[3][o],h[3][o]=r}for(e=0;ei&&(a.speed=i),a.speed<-i/4&&(a.speed=-i/4);var r=kartInstantSpeed(a),l=r[0],s=r[1],c=a.x+l,p=a.y+s,d=a.x,u=a.y;a.z||a.heightinc?handleHeightInc(a)&&(delete a.jumped,a.driftinc&&carDrift&&!a.driftSound&&kartIsPlayer(a)&&(carDrift.currentTime=0,carDrift.play(),a.driftSound=carDrift)):(clLocalVars.autoAccelerate&&!a.cpu&&a.accelerate(),a.speed+=a.speedinc,(isCup&&22!=oMap.skin&&30!=oMap.skin||!isCup&&oMap.smartjump)&&a.cpu&&(tombe(c,p)&&!sauts(d,u,l,s)||(K=ralenti(c,p))&&(q=getOffroadProps(a,K))&&a.speed-1.01*a.speedinc>q.speed&&!a.protect&&!a.champi)&&(a.z=1,a.heightinc=.5,a.jumped=!0));var m=!(isOnline&&e&&a.controller!=identifiant||onlineSpectatorId);if(m&&!a.loose){var h=a.using;if(a.tourne){h=[];for(n=0;na.speedinc&&(a.speed=Math.min(.75*a.speed,a.speed+.5-a.speedinc)),collisionDecor||(3=fTurboDriftCpt+5)&&(a.driftcpt-=5),a.cpu||(clLocalVars.touchedWalls=!0));for(n=5;0Y&&(loseBall(e),stopDrifting(e),a.spin(Z),a.frminv=24,a.speed=2.5*Math.sign(a.speed),loseUsingItems(a)))),collisionFloor&&(F=collisionFloor.z),a.speedinc||(a.speed*=a.sliding?.95:.9),a.cannon||handleCannon(a,inCannon(d,u,a.x,a.y))&&(stopDrifting(e),a.protect=!0,a.jumped=!0,a.tourne&&(a.tourne=2),delete a.shift,a.cpu||(clLocalVars.cannons++,clSelected&&clRuleVars[clSelected.id]&&(ee=clRuleVars[clSelected.id].max_cannons)&&updateChallengeHud("cannons",clLocalVars.cannons+ee.cannons)),a.boostSound||(a.boostSound=playIfShould(a,"musics/events/boost.mp3"),a.boostSound&&(a.boostSound.onended=function(){a.boostSound=void 0,document.body.removeChild(this)}))),!a.teleport&&m){var Z=inTeleport(a.x,a.y);if(Z){a.aX=a.x,a.aY=a.y,a.aRotation=a.rotation,a.x=Z[0],a.y=Z[1],a.rotation=90*Z[2],a.teleport=5,playIfShould(a,"musics/events/teleport.mp3"),a.speed<0&&(a.speed=0);for(n=0;n=a.aipoints.length&&(a.aipoint=0)))}}if(a.sliding=void 0,!a.z){if(a.heightinc||(a.ctrled=!1,a.fell=!1,F?a.z0=F:a.z0&&delete a.z0),a.figuring&&(a.turbodrift=15,a.turbodrift0=a.turbodrift,a.driftcpt=0),handleJump(a,sauts(d,u,l,s)))a.speed=11*cappedRelSpeed(a),a.figuring=!1,a.figstate=0,a.cpu||(clLocalVars.jumps++,clSelected&&clRuleVars[clSelected.id]&&(ee=clRuleVars[clSelected.id].max_jumps)&&updateChallengeHud("jumps",clLocalVars.jumps+ee.jumps)),a.bounceSound||(a.bounceSound=playIfShould(a,"musics/events/jump.mp3"),a.bounceSound&&(a.bounceSound.onended=function(){a.bounceSound=void 0,document.body.removeChild(this)}));else{if(m&&(W=tombe(a.x,a.y,oMap.checkpoint&&a.demitours?oMap.checkpoint[a.demitours+1!=oMap.checkpoint.length?a.demitours+1:0][3]:0)),W){1==W?isBattle&&simplified?(W=[a.x,a.y,a.rotation],a.x>oMap.w-1?(W[0]=oMap.w-50,a.y>oMap.h-1?(W[1]=oMap.h-50,W[2]=225):a.y<0?(W[1]=50,W[2]=315):(W[1]=a.y-a.y%100+50,W[2]=270)):a.y>oMap.h-1?(W[1]=oMap.h-50,a.x<0?(W[0]=50,W[2]=135):(W[0]=a.x-a.x%100+50,W[2]=180)):a.x<0?(W[0]=50,a.y<0?(W[1]=50,W[2]=45):(W[1]=a.y-a.y%100+50,W[2]=90)):(W[1]=50,W[0]=a.x-a.x%100+50,W[2]=0)):W=oMap.startposition[0]:isNaN(W[0])&&(W=oMap.startposition[(a.initialPlace-1)%oMap.startposition.length]),a.aX=a.x,a.aY=a.y,a.aRotation=a.rotation,a.x=W[0],a.y=W[1],a.rotation=90*W[2],a.speed=0,a.protect=!1,a.figuring=!1,a.figstate=0,a.fell=!0,a.champi=0,delete a.champiType,delete a.champior,delete a.champior0,a.cpu&&(a.aipoint=void 0),a.tombe=20,a.frminv=10,a.ctrled=!0,a.z=10,a.tourne=0,stopDrifting(e),supprArme(e),deleteUsingItems(a);for(var ee,te=getScreenPlayerIndex(n),n=0;n.8*a.turbodrift0||!(K=ralenti(c,p))||((q=getOffroadProps(a,K)).speed*=cappedRelSpeed(),q.sliding&&(a.sliding=q.sliding),a.speed>q.speed&&(a.speed=q.speed),stopDrifting(e)),a.tourne||(j=flowShift(c,p,a.protect)),j&&a.cpu&&100<=j[0]*j[0]+j[1]*j[1]&&(l+j[0])*l+(s+j[1])*s<0&&(a.collided=!0,a.horizontality=[j[1],-j[0]]);a.figuring=!1,a.figstate=0}if(j){a.shift||(a.shift=[0,0,0]);for(n=0;n<3;n++)a.shift[n]=.7*a.shift[n]+.3*j[n];a.shift[0]*a.shift[0]+a.shift[1]*a.shift[1]+300*a.shift[2]*a.shift[2]<.01&&delete a.shift}else delete a.shift}if(moveUsingItems(a,t),"BB"!=course){if(checkpoint(a,l,s)){var ne=aKarts.length;a.demitours=getNextCp(a),a.tours++;c=oMap.checkpointCoords[0];oMap.sections&&(c=oMap.checkpointCoords[oMap.checkpointCoords.length-1]);p=1,t=intersectionLineLine(d,u,d+l,u+s,c.A[0],c.A[1],c.B[0],c.B[1]);0<=t[0]&&t[0]oMap.tours&&a.place++;if(isOnline&&!a.finaltime&&(a.finaltime=timeTrialMode()?c:(new Date).getTime()-tnCourse),kartIsPlayer(a)&&!finishing){for(showTimer(timerMS=c),"CM"!=course&&(document.getElementById("infoPlace"+e).innerHTML=a.place);a.using.length;){var ie=bMusic,re=iSfx;iSfx=bMusic=!1,arme(e),bMusic=ie,iSfx=re}if(a.arme=!1,stopDrifting(e),supprArme(e),resetWrongWay(a),a.billball&&(a.billball=1),a.cpu=!0,a.aipoint=0,a.lastAItime=0,a.maxspeed=5.7,a.maxspeed0=a.maxspeed,!oPlayers[1-e]||oPlayers[1-e].cpu){if(isOnline){var le=document.getElementById("infos0");le.style.left=15*iScreenScale+"px",le.innerHTML="";t=document.createElement("tr"),p=document.createElement("td");p.style.fontSize=8*iScreenScale+"px",p.style.color="#F80",p.innerHTML=toLanguage("    FINISH !","TERMINÉ !"),t.appendChild(p);c=document.createElement("tr"),p=document.createElement("td");p.style.fontSize=Math.round(4.5*iScreenScale+10)+"px",p.style.color="#FF0",p.innerHTML=toLanguage("      Please wait...","Veuillez patienter..."),c.appendChild(p),le.appendChild(t),le.appendChild(c),le.style.display="",document.getElementById("infoPlace0").style.visibility="hidden",finishing=!0}else{if("CM"!=course){for(var se=getRankScores(),n=0;nPlaces'+toLanguage("Player","Joueur")+"Pts",de=(Math.round(1.25*aKarts.length),""),ue="";iTeamPlay&&(de="; text-shadow: -1px 0 #603, 0 1px #603, 1px 0 #603, 0 -1px #603",ue=' style="padding: 0 '+Math.round(iScreenScale/2)+'px"');for(var me=getPointDistribution(),n=0;n'+toPlace(n+1)+' "+toPerso(he)+'"+aScores[o]+"+"+Le+"",aScores[o]+=Le,o=ne)}pe+='',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="";var ge=document.body.scrollTop;Re.focus(),document.body.scrollTop=ge}else{document.getElementById("infos0").style.fontSize=5*iScreenScale+"px",document.getElementById("infos0").style.fontWeight="bold",document.getElementById("infos0").style.color="white";var ye=Math.ceil(iScreenScale/4)+"px";sShadow="-"+ye+" 0 "+(Me="black")+", 0 "+ye+" "+Me+", "+ye+" 0 "+Me+", 0 -"+ye+" "+Me;for(var fe="",Se=lapTimers[0],n=1;n'+(n+1)+". "+timeStr(lapTimers[n])+""}document.getElementById("infos0").style.top=7*iScreenScale+10+"px",document.getElementById("infos0").innerHTML=''+document.getElementById("temps0").innerHTML+''+fe+"",document.getElementById("infos0").style.display="",(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=function(){document.getElementById("infos0").style.display="none";var e=document.createElement("div");e.style.color="black",e.style.position="absolute",e.style.left=5*iScreenScale+10+"px",e.style.top=5*iScreenScale+10+"px",e.style.fontSize=4*iScreenScale+"pt",e.style.backgroundColor="#FF6",e.style.opacity=.8,e.style.border="double 4px black",e.style.textAlign="center",e.style.width=70*iScreenScale-10+"px",e.style.height=25*iScreenScale-10+"px",e.style.zIndex=2e4;var t=document.createElement("p");t.innerHTML=toLanguage('Save the time to the record list ?','Enregistrer le temps dans la liste des records ?'),t.style.margin=iScreenScale+"px";var a=t.cloneNode(!1),n=document.createElement("input");n.type="button",n.value=" "+toLanguage("Yes","Oui")+" ",n.style.marginRight=iScreenScale+"px",n.style.fontSize=4*iScreenScale+"px",n.onmouseover=function(){this.style.fontSize=5*iScreenScale+"px",o.style.fontSize=4*iScreenScale+"px"},n.onclick=function(){$mkScreen.removeChild(e),continuer(),document.getElementById("enregistrer").getElementsByTagName("input")[0].onclick()},a.appendChild(n);var o=document.createElement("input");o.type="button",o.value=" "+toLanguage("No","Non")+" ",o.style.fontSize=4*iScreenScale+"px",o.style.marginLeft=iScreenScale+"px",o.onmouseover=function(){this.style.fontSize=5*iScreenScale+"px",n.style.fontSize=4*iScreenScale+"px"},o.onclick=function(){$mkScreen.removeChild(e),document.getElementById("infos0").style.display="",continuer()},a.appendChild(o),e.appendChild(t),e.appendChild(a),$mkScreen.appendChild(e),(gRecord<=timerMS?o:n).focus()},document.getElementById("continuer").appendChild(Re),document.getElementById("infos0").style.display="",Re.focus()}handleEndRace()}resetEvents(),window.onbeforeunload=logGameTime}}else onlineSpectatorId&&!finishing&&te "+a.tours,a.time=40,bMusic||iSfx)if(a.tours==oMap.tours){for(var be,Ce=!0,n=0;nPlaces'+toLanguage("Player","Joueur")+"Pts",Ie="",Te=1,de="",ue="";iTeamPlay&&(de="; text-shadow: -1px 0 #603, 0 1px #603, 1px 0 #603, 0 -1px #603",ue=' style="padding: 0 '+Math.round(iScreenScale/2)+'px"');for(var we,n=0;n'+toPlace(Ee+1)+' "+toPerso(he)+'"+aScores[n]+(Le?"+1":"")+"";Le?Ie=Ee+Ie:(Ie+=Ee,Te++),aScores[n]+=Le}pe+=Ie,pe+='',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.")+'
",n.querySelector(".private-link-form").onsubmit=function(e){e.preventDefault(),o(e.target.elements["private-link"].value)};var i=n.querySelector(".saved-links"),r=loadOptionLinks();function t(){for(var e=0;e',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

'+o.name+'

'+o.description+"
",i.style.display="flex",i.style.direction="column",i.style.alignItems="center",i.style.width="100%",i.style.fontSize=Math.round(1.9*iScreenScale)+"px",i.style.margin=Math.round(1.5*iScreenScale)+"px 0",i.className="fakebtn",i.onclick=function(){t.innerHTML="",oContainers[0].removeChild(t),selectTrackCreate(e)},n.appendChild(i)}t.appendChild(n);e=document.createElement("a");e.style.color="#CCF",e.style.fontSize=Math.round(2.5*iScreenScale)+"px",e.style.position="absolute",e.style.left=toLanguage(30,29)*iScreenScale+"px",e.style.top=35*iScreenScale+"px",e.href="creations.php",e.onclick=function(){},e.innerHTML=toLanguage("List of creations","Liste des créations"),t.appendChild(e),oContainers[0].appendChild(t);e=document.createElement("input");e.type="button",e.value=toLanguage("Back","Retour"),e.style.fontSize=2*iScreenScale+"px",e.style.position="absolute",e.style.left=2*iScreenScale+"px",e.style.top=35*iScreenScale+"px",e.onclick=function(){t.innerHTML="",oContainers[0].removeChild(t),selectTypeScreen()},t.appendChild(e),updateMenuMusic(0)}function selectTrackCreate(e){var t=document.createElement("div"),a=t.style;a.width=iWidth*iScreenScale+"px",a.height=iHeight*iScreenScale+"px",a.border="solid 1px black",a.backgroundColor="black";a=toTitle(e?toLanguage("Complete track builder","Éditeur complet"):toLanguage("Quick track builder","Éditeur simplifié"),0);a.style.fontSize=Math.round(7*iScreenScale)+"px",t.appendChild(a);var n=[{name:toLanguage("Circuit","Circuit"),url:e?"draw.php":"create.php",thumbnail:"help/build-circuit.png"},{name:toLanguage("Cup - Circuits","Coupe - Circuits"),url:e?"completecup.php":"simplecup.php",thumbnail:"help/build-cup-circuit.png"},{name:toLanguage("Multicup - Circuits","Multicoupe - Circuits"),url:e?"completecups.php":"simplecups.php",thumbnail:"help/build-multicup-circuit.png"},{name:toLanguage("Arena","Arène"),url:e?"course.php":"arene.php",thumbnail:"help/build-arena.png"},{name:toLanguage("Cup - Arenas","Coupe - Arènes"),url:e?"completecup.php?battle":"simplecup.php?battle",thumbnail:"help/build-cup-arena.png"},{name:toLanguage("Multicup - Arenas","Multicoupe - Arènes"),url:e?"completecups.php?battle":"simplecups.php?battle",thumbnail:"help/build-multicup-arena.png"}],o=document.createElement("div");o.style.display="grid",o.style.position="absolute",o.style.left=14*iScreenScale+"px",o.style.top=9*iScreenScale+"px",o.style.width=60*iScreenScale+"px",o.style.display="grid",o.style.gridTemplateColumns=14*iScreenScale+"px "+18*iScreenScale+"px "+20*iScreenScale+"px",o.style.columnGap=2*iScreenScale+"px",o.style.fontSize=2*iScreenScale+"px",o.style.textAlign="center",o.style.backgroundColor="#000C",o.style.paddingBottom="1px",o.style.zIndex=1;for(e=0;e
'+i.name+"
",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("Concurrent items","Objets simultanés")+'

'+toLanguage("Cooldown","Cooldown")+'

'+toLanguage("Double items","Double objets")+'

'+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")+'
'+toLanguage("Export: Copy this text to share this distribution with other players.","Exporter : Copiez ce texte pour partager cette distribution avec d'autres joueurs.")+'
'+toLanguage("Import: Paste a new text to import distribution shared by another player.","Importer : Collez un texte pour importer la distribution d'un autre joueur.")+'
';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+"
")+'Edit',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")+"
",r.appendChild(t),clearInterval(pollingGamepadsHandler),pollingGamepadsHandler=setInterval(function(){for(var e=navigator.getGamepads(),t=0;t"+toLanguage("Selected:","Séléctionné :")+" "+I["_name"+P],K.appendChild(F),(j=document.createElement("a")).href="#null",j.innerHTML=toLanguage("[Reset]","[Réinitiliser]"),j.onclick=function(){if(confirm(toLanguage("Reset controller selection?","Réinitialiser la sélection de la manette ?"))){delete I["_id"+P],delete I["_name"+P];for(var e=0;e div")[a].click()}else document.querySelector("#commandes strong")&&updateCommandSheet()}function getKeyName(e,t){if("gamepad"!==t)return this.keyMatching||(this.keyMatching=["","","","Break","","","","","Backspace","Tab","","","Clear","Enter","","","Shift","Ctrl","Alt","Pause","CapsLock","Hangul","","","","Hanja","",toLanguage("Escape","Échap"),"Conversion","Non-conversion","","",toLanguage("Spacebar","Espace"),"PageUp","PageDown","End","Home","←","↑","→","↓","Select","Print","Execute",toLanguage("Print Screen","ImpEcr"),"Inser",toLanguage("Delete","Suppr"),"Help","0","1","2","3","4","5","6","7","8","9",":","=","<","=","","SS","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Meta","Meta","Meta","","Sleep","0","1","2","3","4","5","6","7","8","9","×","+",".","-",".","/","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","","","","","","","","","NumLock","ScrollLock","","","","","","","","","","","","","","","^","!","؛","#","$","Ù","PageDown","PageUp","Refresh",")","*","~","Home","-","Vol. down","Vol. up","Next","Previous","Stop","Play/pause","@","Mute","Vol. down","Vol. up","","","Ñ","=",",","#",".","/","%","°",",","","","","","","","","","","","","","","","","","","","","","","","","","{","\\","}","'","`","Meta","AltGr","<","","","","Compose","Ç","","Forward","Back","Non-conversion","","","","","Alphanumeric","","Hiragana","Half-width","Kanji","","","","","","","Unlock Trackpad","","","","Toggle Touchpad"]),this.keyMatching[e]||"#"+e;for(var a=[],n=0;n"+t+""}function toTitle(e,t){var a=document.createElement("div");return a.style.width=iWidth*iScreenScale+"px",a.style.fontSize=Math.round(8*iScreenScale)+"px",a.style.fontWeight="normal",a.style.position="absolute",a.style.left="0px",a.style.top=Math.round(t*iScreenScale)+"px",a.style.textAlign="center",a.style.color=primaryColor,a.innerHTML=e,a.style.fontFamily="Tahoma",a}function ucwords(e){return e.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(e){return e.toUpperCase()})}function toPerso(e){if(isCustomPerso(e))return customPersos[e].name;var t=e;return language?"maskass"==e?t="shy guy":"skelerex"==e?t="dry bones":"harmonie"==e?t="rosalina":"roi_boo"==e?t="king boo":"frere_marto"==e?t="hammer bro":"bowser_skelet"==e?t="dry bowser":"flora_piranha"==e&&(t="petey piranha"):"frere_marto"==e&&(t="frère marto"),t=ucwords(t=t.replace(/_/g," "))}var isMobileCache=!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)),$commandes;function isMobile(){return isMobileCache}function isChatting(){return isOnline&&(document.forms[1]&&(document.forms[1].elements.rMessage&&document.activeElement==document.forms[1].elements.rMessage))}function onButtonTouch(e){e&&e.preventDefault(),this.style.backgroundColor="#603",this.dataset.pressed="1",navigator.vibrate(30);for(var t=this.dataset.key.split(","),a=0;a"+toLanguage("Message not sent (reason: "+t+")","Message non envoyé (raison : "+t+")")+"",oMessages.appendChild(e)),!0}),rMessage.value=""),!1},oChat.appendChild(oConnectes),oChat.appendChild(oMessages),oChat.appendChild(oRepondre);var iChatLastMsg=0;rtcService=rtcService||RTCService({spectatorId:onlineSpectatorId}),refreshChat(),vConnectes.disabled=!0,rtcService.getVocChat({callback:function(e){e&&(vConnectes.style.display="none",vChatActions.style.display="inline-block"),vConnectes.disabled=!1}}),document.body.insertBefore(oChat,$mkScreen)}function removeBlockDialog(){return oBlockDialog&&(oChat.removeChild(oBlockDialog),oBlockDialog=null,1)}function showMemberList(title,blockedFn,onSelect){var oBlockTitle,oBlockClose,oBlockMembers;removeBlockDialog()||(oBlockDialog=document.createElement("div"),oBlockDialog.className="online-chat-blockdialog",oBlockDialog.style.position="absolute",oBlockDialog.style.left="85px",oBlockDialog.style.top="8%",oBlockDialog.style.width="200px",oBlockDialog.style.border="double 4px silver",oBlockDialog.style.backgroundColor="#222",oBlockTitle=document.createElement("h1"),oBlockTitle.innerHTML=title,oBlockDialog.appendChild(oBlockTitle),oBlockClose=document.createElement("input"),oBlockClose.type="button",oBlockClose.onclick=function(){removeBlockDialog()},oBlockClose.value="×",oBlockDialog.appendChild(oBlockClose),oBlockMembers=document.createElement("div"),oBlockMembers.className="online-chat-blockdialog-members",xhr("listCoursePlayers.php",onlineSpectatorId?"spectator="+onlineSpectatorId:"",function(reponse){if(reponse){try{var rCode=eval(reponse)}catch(e){return!1}for(var i=0;i
Spectator
Voc
',jConnectes.appendChild(sNom)),isIcon=!1,sNom.querySelector(".online-chat-playerlistname").innerText=cPlayer.name,cPlayer.spectator?(sNom.querySelector(".online-chat-spectator").style.display="",isIcon=!0):sNom.querySelector(".online-chat-spectator").style.display="none",cPlayer.peer?(isIcon=!0,sNom.querySelector(".online-chat-playerlisticonwrapper").style.display="",sNom.querySelector(".online-chat-playerlisticonwrapper img").src="images/"+(cPlayer.muted?"ic_muted":"ic_voc")+".png",cPeer=rtcService.getPeer(cPlayer.peer),cPeer&&cPeer.audio&&(cPeer.recorderHandler||function(o,i){var e,r,l;i&&(e=new AudioContext,r=e.createAnalyser(),e.createMediaStreamSource(o.audio.srcObject).connect(r),l=new Uint8Array(r.fftSize),o.recorderHandler=setInterval(function(){if(!o.audio.parentNode||!document.body.contains(i)||!cPlayerPeers[identifiant])return clearInterval(o.recorderHandler),delete o.recorderHandler,r.disconnect(),i.style.width="",i.style.height="",i.style.left="",void(i.style.top="");r.getByteTimeDomainData(l);for(var e=0,t=0;t