diff --git a/js/timer.js b/js/timer.js index 6c66cd3..42a6489 100644 --- a/js/timer.js +++ b/js/timer.js @@ -58,8 +58,6 @@ let clappingTime = 30, red = 0, timeLeft = 0; -let elements = new Map(); - let isPaused = false, isStarted = false, isStopped = true, diff --git a/js/timer.min.js b/js/timer.min.js index 12bcb46..7c00bd0 100644 --- a/js/timer.min.js +++ b/js/timer.min.js @@ -1 +1 @@ -const displayOutput=document.querySelector(".display-remain-time"),btnPause=document.getElementById("pause"),btnRestart=document.getElementById("btnRestart"),btnStop=document.getElementById("btnStop"),btnTimeTable=document.getElementById("btnTimetable"),btnChampion=document.getElementById("btnChampion"),btnBeep=document.getElementById("btnBeep"),btnVibrate=document.getElementById("btnVibrate"),btnClap=document.getElementById("btnClap"),btnDelete=document.getElementById("btnDelete"),btnInvert=document.getElementById("btnInvert"),btnMultiple=document.getElementById("btnMultiple"),btnEmail=document.getElementById("btnEmail"),btnShare=document.getElementById("btnShare"),btnDownload=document.getElementById("btnDownload"),btnYesChallenge=document.getElementById("btnYesChallenge"),btnYesConfirm=document.getElementById("btnYesConfirm"),btnYesChanges=document.getElementById("btnYesChanges"),btnSave=document.getElementById("btnSave"),btnSaveClap=document.getElementById("btnSaveClap"),btnAbout=document.getElementById("btnAbout"),imgClap=document.getElementById("imgClap"),dialogTimeTable=document.getElementById("timeTable"),dialogWelcome=document.getElementById("welcomeDialog"),dialogConfirm=document.getElementById("confirmDialog"),dialogChanges=document.getElementById("changesDialog"),dialogCustomTimes=document.getElementById("customTimes"),dialogAbout=document.getElementById("aboutDialog"),dialogClapping=document.getElementById("clappingDialog"),txtSpeaker=document.getElementById("txtSpeaker"),txtCustom=document.getElementById("txtCustom"),txtMin=document.getElementById("txtMin"),txtAvg=document.getElementById("txtAvg"),txtMax=document.getElementById("txtMax"),clapM=document.getElementById("clapM"),clapS=document.getElementById("clapS"),cmbSpeechType=document.getElementById("cmbSpeechType"),remainTime=document.getElementById("remainTime"),divSpeaker=document.getElementById("divSpeaker"),snackbarMsg=document.getElementById("snackbarMsg"),tickAll=document.getElementById("tickAll"),length=100*(2*Math.PI);let intervalTimer,titleMeeting=document.getElementById("titleMeeting"),externalContainer=null,clappingTime=30,wholeTime=30,selected=-1,minimum=0,average=0,maximum=0,selectedColor=0,green=0,yellow=0,red=0,timeLeft=0,elements=new Map,isPaused=!1,isStarted=!1,isStopped=!0,isBeepEnabled=!1,isVibrateEnabled=!1,isClappingEnabled=!1,isContestMode=!1,isCustom=!1,isFirstRun=!0,clappingStarted=!1,multipleEnabled=!1,isNinjaMode=!1,isFirstTime=!1,dateFormat="DD/MM/YYYY",latestDB="1.0",currentDB="1.0",lastColor="white",countries=["US","FM","MH","PH"],bgColors=["white","black"],times=[[10,20,30],[240,300,360],[300,360,420],[30,45,60],[60,75,90],[120,150,180],[300,330,360],[60,90,120],[480,540,600],[600,660,720],[780,840,900],[1080,1170,1200]],progressBar=document.querySelector(".e-c-progress"),indicator=document.getElementById("e-indicator"),pointer=document.getElementById("e-pointer");var results=[];progressBar.style.strokeDasharray=length;function update(a,b){0<=a&&(progressBar.style.strokeDashoffset=-(-length-length*a/b),pointer.style.transform=`rotate(${360*a/-b}deg)`)}update(wholeTime,wholeTime),displayTimeLeft(wholeTime),checkMode();function setDateFormat(){countries.includes(navigator.language.split("-")[1])&&(dateFormat="MM/DD/YYYY")}function getTimeStamp(a){return moment.utc(1e3*a).format("HH:mm:ss")}function getTime(){return remainTime.innerHTML}function checkMode(){isContestMode?(document.getElementById("remainTime").classList.remove("showTime"),document.getElementById("controls").classList.remove("contestModeOff"),document.getElementById("remainTime").classList.add("hideTime"),document.getElementById("controls").classList.add("contestMode")):(document.getElementById("remainTime").classList.remove("contestMode"),document.getElementById("controls").classList.remove("hideTime"),document.getElementById("remainTime").classList.add("showTime"),document.getElementById("controls").classList.add("contestModeOff"))}function changeWholeTime(a){0",timeLeft=0,currentState=1}function timer(a){let b=Date.now()+1e3*a;displayTimeLeft(a),intervalTimer=setInterval(function(){timeLeft=Math.round((b-Date.now())/1e3);let a=maximum-timeLeft;a>=minimum&&a=average&&a=maximum&&(red++,document.body.style.background="#e53935",startBeep(),startVibrate(),lastColor="red"),a>=maximum+clappingTime&&(!clappingStarted&&startClapping(),clappingStarted=!0),displayTimeLeft(timeLeft)},1e3)}window.onresize=function(){resizeScreen()};function resizeScreen(){let a=window.innerHeight/600;if(514>window.innerHeight){if(null===externalContainer){let a=document.body,b=document.createElement("div");b.id="externalContainer",a.insertBefore(b,a.firstChild)}externalContainer=document.getElementById("externalContainer");let b=document.getElementById("superContainer");externalContainer.append(b),externalContainer.style.height=`${window.innerHeight}px`,b.style.transformOrigin="50% 0% 0px",setTimeout(function(){b.style.transform=`scale(${a})`,setTimeout(function(){let c=(1+a)*window.innerHeight;514>c&&(c=514),b.style.height=`${c}px`},100)},100)}else{let b=document.getElementById("superContainer");b.style.height=`${window.innerHeight}px`,b.style.transformOrigin="50% 0% 0px",setTimeout(function(){b.style.transform=`scale(${a})`},100),setTimeout(function(){cmbSpeechType.getBoundingClientRect().width>window.outerWidth&&(b.style.transform=`scale(${a-(a-cmbSpeechType.getBoundingClientRect().width/window.outerWidth)})`)},100)}}function resizeSelect(){setTimeout(function(){document.getElementsByClassName("mdl-menu__outline")[0].style.width="300px",document.getElementsByClassName("mdl-menu__container")[0].style.width="300px",document.getElementsByClassName("mdl-menu__outline")[0].style.height="310px",document.getElementsByClassName("mdl-menu__container")[0].style.height="310px";let a=document.getElementsByClassName("mdl-menu")[0],b=a.style.clip.split(", ");b[1]=b[1].replace("px",""),b[2]=b[2].replace("px",""),a.style.clip=`${b[0]}, 300px, 300px, ${b[3]}`},50)}function pauseTimer(){return 0===minimum&&0===maximum&&0===average||-1===selected?void(isCustom?showSnackbar(lngObject.notSaved):showSnackbar(lngObject.chooseTime)):void(validateProperIntervals(),browserStopClapping(),isStopped=!1,btnInvert.disabled=!0,cmbSpeechType.disabled=!0,isStarted&&timeLeft!==void 0?isPaused?(btnPause.classList.remove("play"),btnPause.classList.add("pause"),timer(timeLeft),isPaused=!isPaused):(btnPause.classList.remove("pause"),btnPause.classList.add("play"),clearInterval(intervalTimer),isPaused=!isPaused):(timer(wholeTime),isStarted=!0,btnPause.classList.remove("play"),btnPause.classList.add("pause")),btnRestart.disabled=!isPaused,btnRestart.disabled?(btnRestart.innerHTML="",fade.to(document.getElementById("divSpeechType"),fastTransition,.1),fade.to(document.getElementById("divSpeaker"),fastTransition,.1),fade.to(document.getElementById("options"),fastTransition,.1),fade.to(document.getElementsByTagName("footer")[0],fastTransition,.1),isNinjaMode&&(fade.to(document.getElementById("controls"),fastTransition,.5),fade.to(document.getElementsByClassName("circle")[0],fastTransition,0))):(btnRestart.innerHTML="",unfadeElements()))}function unfadeElements(){fade.to(document.getElementById("divSpeechType"),fastTransition,1),fade.to(document.getElementById("divSpeaker"),fastTransition,1),fade.to(document.getElementById("options"),fastTransition,1),fade.to(document.getElementsByTagName("footer")[0],fastTransition,1),fade.to(document.getElementById("controls"),fastTransition,1),fade.to(document.getElementsByClassName("circle")[0],fastTransition,1)}function displayTimeLeft(a){let b=maximum-a,c=Math.floor(b/3600),d=Math.floor(b/60),e=b%60,f=`${10>c?"0":""}${c}:${10>d?"0":""}${d}:${10>e?"0":""}${e}`;displayOutput.textContent=f,update(a,wholeTime)}function setDropDownValue(a,b){try{document.getElementById(a).dataset.selected="true",getmdlSelect.init(b)}catch(a){}}function validateProperIntervals(){isCustom?(minimum=getMinCustom(),average=getAvgCustom(),maximum=getMaxCustom()):setBasicIntervals(),0===timeLeft&&(wholeTime=maximum)}function setBasicIntervals(){let a=selected;11":""}function setVibrateImg(){btnVibrate.innerHTML=isVibrateEnabled?"":""}function setBeepImg(){btnBeep.innerHTML=isBeepEnabled?"":""}function setClappingImg(){imgClap.src=isClappingEnabled?"img/clapping-hands.svg":"img/clapping-off.svg"}function invertColors(){document.body.style.filter=1===selectedColor?"invert(100%)":"invert(0%)",document.body.style.background=lastColor}function storeTime(a){if(0!==minimum||0!==maximum||0!==average){if(stopClapping(),a){let a=maximum-timeLeft,b=cmbSpeechType.value;11===selected&&(b=txtCustom.value),addNewTime(txtSpeaker.value,b,getTimeStamp(minimum),getTimeStamp(average),getTimeStamp(maximum),getTimeStamp(a),lastColor,a>maximum+clappingTime||a=b?showSnackbar(lngObject.errorMin):a>=c?showSnackbar(lngObject.errorHalf):b>=c?showSnackbar(lngObject.errorMax):(minimum=a,average=b,maximum=c,wholeTime=maximum,updateDisplay(),dialogCustomTimes.close())}btnPause.addEventListener("click",function(a){1===a.detail&&pauseTimer()}),btnRestart.addEventListener("click",()=>{storeTime(!1)}),btnStop.addEventListener("click",()=>{storeTime(!0)}),btnChampion.addEventListener("click",function(a){3===a.detail?(isNinjaMode=!isNinjaMode,isNinjaMode?showSnackbar(lngObject.ninjaEnabled,!1):showSnackbar(lngObject.ninjaDisabled,!1),setLocalStorage("isNinjaMode",isNinjaMode)):(isContestMode=!isContestMode,setContestImg(),checkMode(),setContestMode())}),btnVibrate.addEventListener("click",()=>{isVibrateEnabled=!isVibrateEnabled,setVibrateImg(),setVibrate()}),btnBeep.addEventListener("click",()=>{isBeepEnabled=!isBeepEnabled,setBeepImg(),setBeep()}),btnClap.addEventListener("click",function(a){3===a.detail?(dialogClapping.showModal(),30===clappingTime&&(setDropDownValue("clapM0","#divClapM"),setDropDownValue("clapS30","#divClapS"))):(isClappingEnabled=!isClappingEnabled,setClappingImg(),setClapping())}),btnSave.addEventListener("click",saveChanges),btnSaveClap.addEventListener("click",()=>{clappingTime=getSeconds(`00:${clapM.value}:${clapS.value}`),dialogClapping.close()}),dialogTimeTable.showModal||dialogPolyfill.registerDialog(dialogTimeTable),dialogChanges.showModal||dialogPolyfill.registerDialog(dialogChanges),dialogAbout.showModal||dialogPolyfill.registerDialog(dialogAbout),dialogClapping.showModal||dialogPolyfill.registerDialog(dialogClapping),dialogCustomTimes.showModal||dialogPolyfill.registerDialog(dialogCustomTimes),dialogWelcome.showModal||dialogPolyfill.registerDialog(dialogWelcome),dialogConfirm.showModal||dialogPolyfill.registerDialog(dialogConfirm),btnTimeTable.addEventListener("click",countTimetable),btnDelete.addEventListener("click",deleteTimetable),btnYesChallenge.addEventListener("click",function(){isContestMode=!0,setContestImg(),checkMode(),setContestMode(),dialogWelcome.close(),isFirstRun=!1,setFirstRun()}),btnYesConfirm.addEventListener("click",deleteByIDs),btnInvert.addEventListener("click",function(){selectedColor=0===selectedColor?1:0,lastColor=bgColors[selectedColor],setSelectedColor(),invertColors()}),btnYesChanges.addEventListener("click",function(){saveChanges(),dialogChanges.close()}),btnShare.addEventListener("click",function(){}),btnEmail.addEventListener("click",function(){}),btnAbout.addEventListener("click",function(){dialogAbout.showModal(),"phone"===deviceDetector.device&&setTimeout(function(){dialogAbout.style.height=`${100*dialogAbout.innerHeight/window.outerHeight}%`},100)}),txtMin.addEventListener("click",function(){setNewTime("txtMin",txtMin.value)}),txtMax.addEventListener("click",function(){setNewTime("txtMax",txtMax.value)}),txtAvg.addEventListener("click",function(){setNewTime("txtAvg",txtAvg.value)}),btnDownload.addEventListener("click",browserExport),btnMultiple.addEventListener("click",function(){Array.from(document.getElementsByClassName("mdl-js-checkbox")).forEach(function(a){setTimeout(function(){a.MaterialCheckbox.check()},10)}),multipleEnabled?(btnMultiple.innerHTML="",hideCheckBoxes()):(btnMultiple.innerHTML="",showCheckBoxes()),multipleEnabled=!multipleEnabled,refreshControls()}),dialogTimeTable.querySelector(".close").addEventListener("click",function(){dialogTimeTable.close()}),dialogCustomTimes.querySelector(".close").addEventListener("click",closeCustomDialog),dialogConfirm.querySelector(".close").addEventListener("click",function(){dialogConfirm.close()}),dialogAbout.querySelector(".close").addEventListener("click",function(){dialogAbout.close()}),dialogChanges.querySelector(".close").addEventListener("click",function(){dialogChanges.close(),dialogCustomTimes.close()}),dialogWelcome.querySelector(".close").addEventListener("click",function(){dialogWelcome.close(),isFirstRun=!1,setFirstRun(),showSnackbar(lngObject.noHints)}),txtCustom.addEventListener("keyup",function(a){13===a.keyCode&&hideKeyboard(txtCustom)}),txtSpeaker.addEventListener("keyup",function(a){13===a.keyCode&&hideKeyboard(txtSpeaker)}),document.addEventListener("DOMContentLoaded",function(){cmbSpeechType.onchange=changeEventHandler},!1),cmbSpeechType.addEventListener("click",resizeSelect),maximum=0,wholeTime=0,getBeep(),getVibrate(),getClapping(),getContestMode(),getSelectedColor(),getNinjaMode(),getFirstRun(),setContestImg(),setVibrateImg(),setBeepImg(),setClappingImg(),setSelectedColor(),setDateFormat(),initializeDB(currentDB,latestDB),lastColor=bgColors[selectedColor],invertColors(),setTimeout(function(){if("phone"==deviceDetector.device){let a=document.getElementById("timeTable"),b=document.createElement("div");b.className="titleContainer";let c=document.createElement("div");c.className="titleInnerContainer";let d=document.createElement("span");d.className="closeMobile",d.id="btnCloseMobile";let e=document.createElement("span");e.className="mdi mdi-close";let f=document.createElement("span");f.id="spanTitle",d.appendChild(e),c.appendChild(d),c.appendChild(f),b.appendChild(c),a.insertBefore(b,a.firstChild),titleMeeting=document.getElementById("titleMeeting"),titleMeeting.classList.remove("mdl-dialog__title"),titleMeeting.style.margin="0",titleMeeting.style.marginTop="16px",titleMeeting.style.fontWeight=1e3,titleMeeting.style.fontSize="1.25em",titleMeeting.style.display="inline",document.getElementById("spanTitle").append(titleMeeting),document.getElementById("btnCloseMeeting").style.display="none",document.getElementById("btnCloseMobile").addEventListener("click",function(){dialogTimeTable.close()});let g=document.getElementById("customTimes"),h=document.createElement("div");h.className="titleContainer";let i=document.createElement("div");i.className="titleInnerContainer";let j=document.createElement("span");j.className="closeMobile",j.id="btnCloseMobileCustom";let k=document.createElement("span");k.className="mdi mdi-close";let l=document.createElement("span");l.id="spanTitleCustom";let m=document.createElement("h4");m.innerHTML=" ",m.id="customTitle";let n=document.createElement("span");n.id="spanSave",j.appendChild(k),l.appendChild(m),i.appendChild(j),i.appendChild(l),i.appendChild(n),h.appendChild(i),g.insertBefore(h,g.firstChild);let o=document.getElementById("customTitle");o.classList.remove("mdl-dialog__title"),o.style.margin="0",o.style.marginTop="16px",o.style.fontWeight=1e3,o.style.fontSize="1.25em",o.style.display="inline",document.getElementById("btnCloseMobileCustom").addEventListener("click",function(){closeCustomDialog()}),document.getElementById("spanSave").appendChild(document.getElementById("btnSave")),document.getElementById("footerCustom").style.display="none",document.getElementById("btnCloseCustom").style.display="none";let p=document.getElementById("aboutDialog"),q=document.createElement("div");q.className="titleContainer";let r=document.createElement("div");r.className="titleInnerContainer";let s=document.createElement("span");s.className="closeMobile",s.id="btnCloseMobileAbout";let t=document.createElement("span");t.className="mdi mdi-close";let u=document.createElement("span");u.id="spanTitleAbout",s.appendChild(t),r.appendChild(s),r.appendChild(u),q.appendChild(r),p.insertBefore(q,p.firstChild),document.getElementById("btnCloseMobileAbout").addEventListener("click",function(){dialogAbout.close()});let v=document.getElementById("titleAbout");v.classList.remove("mdl-dialog__title"),v.style.margin="0",v.style.marginTop="16px",v.style.fontWeight=1e3,v.style.fontSize="1.25em",v.style.display="inline",document.getElementById("spanTitleAbout").append(v),document.getElementById("divCloseAbout").style.display="none"}let a=0;do setTimeout(function(){try{titleMeeting.innerHTML=`${lngObject.meetingAt} ${moment().format(dateFormat)}`}catch(a){}},1e3),a++;while(lngObject===void 0&&5>a)},100),isFirstRun&&dialogWelcome.showModal(),checkMode(),tickAll.addEventListener("change",()=>{Array.from(document.querySelectorAll(".mdl-js-checkbox:not(#lblTickAll)")).forEach(function(a){let b=a;setTimeout(function(){lblTickAll.matches(".is-checked")?b.MaterialCheckbox.check():b.MaterialCheckbox.uncheck()},10)}),refreshControls()}),function(){btnShare.style.display="none",btnEmail.style.display="none",isFirstTime=!0,"desktop"===deviceDetector.device?(dialogTimeTable.classList.add("centeredDialog"),dialogTimeTable.classList.add("fullscreen-dialog-tablet"),dialogAbout.classList.add("centeredDialog"),document.getElementById("divSpeakers").style.height=`${.53*document.body.clientHeight}px`):"tablet"===deviceDetector.device?(dialogTimeTable.classList.add("centeredDialog-tablet"),dialogTimeTable.classList.add("fullscreen-dialog-tablet"),dialogAbout.classList.add("centeredDialog"),document.getElementById("divSpeakers").style.height=`${.53*document.body.clientHeight}px`):(dialogCustomTimes.classList.add("customBodyMobile"),document.getElementById("divSpeakers").style.height=514>window.innerHeight&&window.innerWidth>window.innerHeight?`${.6*document.body.clientHeight}px`:`${.75*document.body.clientHeight}px`,dialogTimeTable.classList.add("fullscreen-dialog"),dialogCustomTimes.classList.add("fullscreen-dialog"),dialogAbout.classList.add("fullscreen-dialog")),"function"!=typeof HTMLDialogElement&&(dialogWelcome.classList.remove("centeredDialog"),dialogWelcome.classList.add("centeredDialogNoSupport"),dialogSetTime.classList.remove("centeredDialog"),dialogSetTime.classList.add("centeredDialogNoSupport")),document.body.addEventListener("focus",function(){"-1"!==document.querySelector(".mdl-menu__outline")[0].style.zIndex&&resizeSelect()})}(),resizeScreen();function hideKeyboard(a){a.readOnly=!0,setTimeout(function(){a.blur(),a.readOnly=!1},100)}window.addEventListener("orientationchange",doOnOrientationChange);function doOnOrientationChange(){location.reload()} \ No newline at end of file +const displayOutput=document.querySelector(".display-remain-time"),btnPause=document.getElementById("pause"),btnRestart=document.getElementById("btnRestart"),btnStop=document.getElementById("btnStop"),btnTimeTable=document.getElementById("btnTimetable"),btnChampion=document.getElementById("btnChampion"),btnBeep=document.getElementById("btnBeep"),btnVibrate=document.getElementById("btnVibrate"),btnClap=document.getElementById("btnClap"),btnDelete=document.getElementById("btnDelete"),btnInvert=document.getElementById("btnInvert"),btnMultiple=document.getElementById("btnMultiple"),btnEmail=document.getElementById("btnEmail"),btnShare=document.getElementById("btnShare"),btnDownload=document.getElementById("btnDownload"),btnYesChallenge=document.getElementById("btnYesChallenge"),btnYesConfirm=document.getElementById("btnYesConfirm"),btnYesChanges=document.getElementById("btnYesChanges"),btnSave=document.getElementById("btnSave"),btnSaveClap=document.getElementById("btnSaveClap"),btnAbout=document.getElementById("btnAbout"),imgClap=document.getElementById("imgClap"),dialogTimeTable=document.getElementById("timeTable"),dialogWelcome=document.getElementById("welcomeDialog"),dialogConfirm=document.getElementById("confirmDialog"),dialogChanges=document.getElementById("changesDialog"),dialogCustomTimes=document.getElementById("customTimes"),dialogAbout=document.getElementById("aboutDialog"),dialogClapping=document.getElementById("clappingDialog"),txtSpeaker=document.getElementById("txtSpeaker"),txtCustom=document.getElementById("txtCustom"),txtMin=document.getElementById("txtMin"),txtAvg=document.getElementById("txtAvg"),txtMax=document.getElementById("txtMax"),clapM=document.getElementById("clapM"),clapS=document.getElementById("clapS"),cmbSpeechType=document.getElementById("cmbSpeechType"),remainTime=document.getElementById("remainTime"),divSpeaker=document.getElementById("divSpeaker"),snackbarMsg=document.getElementById("snackbarMsg"),tickAll=document.getElementById("tickAll"),length=100*(2*Math.PI);let intervalTimer,titleMeeting=document.getElementById("titleMeeting"),externalContainer=null,clappingTime=30,wholeTime=30,selected=-1,minimum=0,average=0,maximum=0,selectedColor=0,green=0,yellow=0,red=0,timeLeft=0,isPaused=!1,isStarted=!1,isStopped=!0,isBeepEnabled=!1,isVibrateEnabled=!1,isClappingEnabled=!1,isContestMode=!1,isCustom=!1,isFirstRun=!0,clappingStarted=!1,multipleEnabled=!1,isNinjaMode=!1,isFirstTime=!1,dateFormat="DD/MM/YYYY",latestDB="1.0",currentDB="1.0",lastColor="white",countries=["US","FM","MH","PH"],bgColors=["white","black"],times=[[10,20,30],[240,300,360],[300,360,420],[30,45,60],[60,75,90],[120,150,180],[300,330,360],[60,90,120],[480,540,600],[600,660,720],[780,840,900],[1080,1170,1200]],progressBar=document.querySelector(".e-c-progress"),indicator=document.getElementById("e-indicator"),pointer=document.getElementById("e-pointer");var results=[];progressBar.style.strokeDasharray=length;function update(a,b){0<=a&&(progressBar.style.strokeDashoffset=-(-length-length*a/b),pointer.style.transform=`rotate(${360*a/-b}deg)`)}update(wholeTime,wholeTime),displayTimeLeft(wholeTime),checkMode();function setDateFormat(){countries.includes(navigator.language.split("-")[1])&&(dateFormat="MM/DD/YYYY")}function getTimeStamp(a){return moment.utc(1e3*a).format("HH:mm:ss")}function getTime(){return remainTime.innerHTML}function checkMode(){isContestMode?(document.getElementById("remainTime").classList.remove("showTime"),document.getElementById("controls").classList.remove("contestModeOff"),document.getElementById("remainTime").classList.add("hideTime"),document.getElementById("controls").classList.add("contestMode")):(document.getElementById("remainTime").classList.remove("contestMode"),document.getElementById("controls").classList.remove("hideTime"),document.getElementById("remainTime").classList.add("showTime"),document.getElementById("controls").classList.add("contestModeOff"))}function changeWholeTime(a){0",timeLeft=0,currentState=1}function timer(a){let b=Date.now()+1e3*a;displayTimeLeft(a),intervalTimer=setInterval(function(){timeLeft=Math.round((b-Date.now())/1e3);let a=maximum-timeLeft;a>=minimum&&a=average&&a=maximum&&(red++,document.body.style.background="#e53935",startBeep(),startVibrate(),lastColor="red"),a>=maximum+clappingTime&&(!clappingStarted&&startClapping(),clappingStarted=!0),displayTimeLeft(timeLeft)},1e3)}window.onresize=function(){resizeScreen()};function resizeScreen(){let a=window.innerHeight/600;if(514>window.innerHeight){if(null===externalContainer){let a=document.body,b=document.createElement("div");b.id="externalContainer",a.insertBefore(b,a.firstChild)}externalContainer=document.getElementById("externalContainer");let b=document.getElementById("superContainer");externalContainer.append(b),externalContainer.style.height=`${window.innerHeight}px`,b.style.transformOrigin="50% 0% 0px",setTimeout(function(){b.style.transform=`scale(${a})`,setTimeout(function(){let c=(1+a)*window.innerHeight;514>c&&(c=514),b.style.height=`${c}px`},100)},100)}else{let b=document.getElementById("superContainer");b.style.height=`${window.innerHeight}px`,b.style.transformOrigin="50% 0% 0px",setTimeout(function(){b.style.transform=`scale(${a})`},100),setTimeout(function(){cmbSpeechType.getBoundingClientRect().width>window.outerWidth&&(b.style.transform=`scale(${a-(a-cmbSpeechType.getBoundingClientRect().width/window.outerWidth)})`)},100)}}function resizeSelect(){setTimeout(function(){document.getElementsByClassName("mdl-menu__outline")[0].style.width="300px",document.getElementsByClassName("mdl-menu__container")[0].style.width="300px",document.getElementsByClassName("mdl-menu__outline")[0].style.height="310px",document.getElementsByClassName("mdl-menu__container")[0].style.height="310px";let a=document.getElementsByClassName("mdl-menu")[0],b=a.style.clip.split(", ");b[1]=b[1].replace("px",""),b[2]=b[2].replace("px",""),a.style.clip=`${b[0]}, 300px, 300px, ${b[3]}`},50)}function pauseTimer(){return 0===minimum&&0===maximum&&0===average||-1===selected?void(isCustom?showSnackbar(lngObject.notSaved):showSnackbar(lngObject.chooseTime)):void(validateProperIntervals(),browserStopClapping(),isStopped=!1,btnInvert.disabled=!0,cmbSpeechType.disabled=!0,isStarted&&timeLeft!==void 0?isPaused?(btnPause.classList.remove("play"),btnPause.classList.add("pause"),timer(timeLeft),isPaused=!isPaused):(btnPause.classList.remove("pause"),btnPause.classList.add("play"),clearInterval(intervalTimer),isPaused=!isPaused):(timer(wholeTime),isStarted=!0,btnPause.classList.remove("play"),btnPause.classList.add("pause")),btnRestart.disabled=!isPaused,btnRestart.disabled?(btnRestart.innerHTML="",fade.to(document.getElementById("divSpeechType"),fastTransition,.1),fade.to(document.getElementById("divSpeaker"),fastTransition,.1),fade.to(document.getElementById("options"),fastTransition,.1),fade.to(document.getElementsByTagName("footer")[0],fastTransition,.1),isNinjaMode&&(fade.to(document.getElementById("controls"),fastTransition,.5),fade.to(document.getElementsByClassName("circle")[0],fastTransition,0))):(btnRestart.innerHTML="",unfadeElements()))}function unfadeElements(){fade.to(document.getElementById("divSpeechType"),fastTransition,1),fade.to(document.getElementById("divSpeaker"),fastTransition,1),fade.to(document.getElementById("options"),fastTransition,1),fade.to(document.getElementsByTagName("footer")[0],fastTransition,1),fade.to(document.getElementById("controls"),fastTransition,1),fade.to(document.getElementsByClassName("circle")[0],fastTransition,1)}function displayTimeLeft(a){let b=maximum-a,c=Math.floor(b/3600),d=Math.floor(b/60),e=b%60,f=`${10>c?"0":""}${c}:${10>d?"0":""}${d}:${10>e?"0":""}${e}`;displayOutput.textContent=f,update(a,wholeTime)}function setDropDownValue(a,b){try{document.getElementById(a).dataset.selected="true",getmdlSelect.init(b)}catch(a){}}function validateProperIntervals(){isCustom?(minimum=getMinCustom(),average=getAvgCustom(),maximum=getMaxCustom()):setBasicIntervals(),0===timeLeft&&(wholeTime=maximum)}function setBasicIntervals(){let a=selected;11":""}function setVibrateImg(){btnVibrate.innerHTML=isVibrateEnabled?"":""}function setBeepImg(){btnBeep.innerHTML=isBeepEnabled?"":""}function setClappingImg(){imgClap.src=isClappingEnabled?"img/clapping-hands.svg":"img/clapping-off.svg"}function invertColors(){document.body.style.filter=1===selectedColor?"invert(100%)":"invert(0%)",document.body.style.background=lastColor}function storeTime(a){if(0!==minimum||0!==maximum||0!==average){if(stopClapping(),a){let a=maximum-timeLeft,b=cmbSpeechType.value;11===selected&&(b=txtCustom.value),addNewTime(txtSpeaker.value,b,getTimeStamp(minimum),getTimeStamp(average),getTimeStamp(maximum),getTimeStamp(a),lastColor,a>maximum+clappingTime||a=b?showSnackbar(lngObject.errorMin):a>=c?showSnackbar(lngObject.errorHalf):b>=c?showSnackbar(lngObject.errorMax):(minimum=a,average=b,maximum=c,wholeTime=maximum,updateDisplay(),dialogCustomTimes.close())}btnPause.addEventListener("click",function(a){1===a.detail&&pauseTimer()}),btnRestart.addEventListener("click",()=>{storeTime(!1)}),btnStop.addEventListener("click",()=>{storeTime(!0)}),btnChampion.addEventListener("click",function(a){3===a.detail?(isNinjaMode=!isNinjaMode,isNinjaMode?showSnackbar(lngObject.ninjaEnabled,!1):showSnackbar(lngObject.ninjaDisabled,!1),setLocalStorage("isNinjaMode",isNinjaMode)):(isContestMode=!isContestMode,setContestImg(),checkMode(),setContestMode())}),btnVibrate.addEventListener("click",()=>{isVibrateEnabled=!isVibrateEnabled,setVibrateImg(),setVibrate()}),btnBeep.addEventListener("click",()=>{isBeepEnabled=!isBeepEnabled,setBeepImg(),setBeep()}),btnClap.addEventListener("click",function(a){3===a.detail?(dialogClapping.showModal(),30===clappingTime&&(setDropDownValue("clapM0","#divClapM"),setDropDownValue("clapS30","#divClapS"))):(isClappingEnabled=!isClappingEnabled,setClappingImg(),setClapping())}),btnSave.addEventListener("click",saveChanges),btnSaveClap.addEventListener("click",()=>{clappingTime=getSeconds(`00:${clapM.value}:${clapS.value}`),dialogClapping.close()}),dialogTimeTable.showModal||dialogPolyfill.registerDialog(dialogTimeTable),dialogChanges.showModal||dialogPolyfill.registerDialog(dialogChanges),dialogAbout.showModal||dialogPolyfill.registerDialog(dialogAbout),dialogClapping.showModal||dialogPolyfill.registerDialog(dialogClapping),dialogCustomTimes.showModal||dialogPolyfill.registerDialog(dialogCustomTimes),dialogWelcome.showModal||dialogPolyfill.registerDialog(dialogWelcome),dialogConfirm.showModal||dialogPolyfill.registerDialog(dialogConfirm),btnTimeTable.addEventListener("click",countTimetable),btnDelete.addEventListener("click",deleteTimetable),btnYesChallenge.addEventListener("click",function(){isContestMode=!0,setContestImg(),checkMode(),setContestMode(),dialogWelcome.close(),isFirstRun=!1,setFirstRun()}),btnYesConfirm.addEventListener("click",deleteByIDs),btnInvert.addEventListener("click",function(){selectedColor=0===selectedColor?1:0,lastColor=bgColors[selectedColor],setSelectedColor(),invertColors()}),btnYesChanges.addEventListener("click",function(){saveChanges(),dialogChanges.close()}),btnShare.addEventListener("click",function(){}),btnEmail.addEventListener("click",function(){}),btnAbout.addEventListener("click",function(){dialogAbout.showModal(),"phone"===deviceDetector.device&&setTimeout(function(){dialogAbout.style.height=`${100*dialogAbout.innerHeight/window.outerHeight}%`},100)}),txtMin.addEventListener("click",function(){setNewTime("txtMin",txtMin.value)}),txtMax.addEventListener("click",function(){setNewTime("txtMax",txtMax.value)}),txtAvg.addEventListener("click",function(){setNewTime("txtAvg",txtAvg.value)}),btnDownload.addEventListener("click",browserExport),btnMultiple.addEventListener("click",function(){Array.from(document.getElementsByClassName("mdl-js-checkbox")).forEach(function(a){setTimeout(function(){a.MaterialCheckbox.check()},10)}),multipleEnabled?(btnMultiple.innerHTML="",hideCheckBoxes()):(btnMultiple.innerHTML="",showCheckBoxes()),multipleEnabled=!multipleEnabled,refreshControls()}),dialogTimeTable.querySelector(".close").addEventListener("click",function(){dialogTimeTable.close()}),dialogCustomTimes.querySelector(".close").addEventListener("click",closeCustomDialog),dialogConfirm.querySelector(".close").addEventListener("click",function(){dialogConfirm.close()}),dialogAbout.querySelector(".close").addEventListener("click",function(){dialogAbout.close()}),dialogChanges.querySelector(".close").addEventListener("click",function(){dialogChanges.close(),dialogCustomTimes.close()}),dialogWelcome.querySelector(".close").addEventListener("click",function(){dialogWelcome.close(),isFirstRun=!1,setFirstRun(),showSnackbar(lngObject.noHints)}),txtCustom.addEventListener("keyup",function(a){13===a.keyCode&&hideKeyboard(txtCustom)}),txtSpeaker.addEventListener("keyup",function(a){13===a.keyCode&&hideKeyboard(txtSpeaker)}),document.addEventListener("DOMContentLoaded",function(){cmbSpeechType.onchange=changeEventHandler},!1),cmbSpeechType.addEventListener("click",resizeSelect),maximum=0,wholeTime=0,getBeep(),getVibrate(),getClapping(),getContestMode(),getSelectedColor(),getNinjaMode(),getFirstRun(),setContestImg(),setVibrateImg(),setBeepImg(),setClappingImg(),setSelectedColor(),setDateFormat(),initializeDB(currentDB,latestDB),lastColor=bgColors[selectedColor],invertColors(),setTimeout(function(){if("phone"==deviceDetector.device){let a=document.getElementById("timeTable"),b=document.createElement("div");b.className="titleContainer";let c=document.createElement("div");c.className="titleInnerContainer";let d=document.createElement("span");d.className="closeMobile",d.id="btnCloseMobile";let e=document.createElement("span");e.className="mdi mdi-close";let f=document.createElement("span");f.id="spanTitle",d.appendChild(e),c.appendChild(d),c.appendChild(f),b.appendChild(c),a.insertBefore(b,a.firstChild),titleMeeting=document.getElementById("titleMeeting"),titleMeeting.classList.remove("mdl-dialog__title"),titleMeeting.style.margin="0",titleMeeting.style.marginTop="16px",titleMeeting.style.fontWeight=1e3,titleMeeting.style.fontSize="1.25em",titleMeeting.style.display="inline",document.getElementById("spanTitle").append(titleMeeting),document.getElementById("btnCloseMeeting").style.display="none",document.getElementById("btnCloseMobile").addEventListener("click",function(){dialogTimeTable.close()});let g=document.getElementById("customTimes"),h=document.createElement("div");h.className="titleContainer";let i=document.createElement("div");i.className="titleInnerContainer";let j=document.createElement("span");j.className="closeMobile",j.id="btnCloseMobileCustom";let k=document.createElement("span");k.className="mdi mdi-close";let l=document.createElement("span");l.id="spanTitleCustom";let m=document.createElement("h4");m.innerHTML=" ",m.id="customTitle";let n=document.createElement("span");n.id="spanSave",j.appendChild(k),l.appendChild(m),i.appendChild(j),i.appendChild(l),i.appendChild(n),h.appendChild(i),g.insertBefore(h,g.firstChild);let o=document.getElementById("customTitle");o.classList.remove("mdl-dialog__title"),o.style.margin="0",o.style.marginTop="16px",o.style.fontWeight=1e3,o.style.fontSize="1.25em",o.style.display="inline",document.getElementById("btnCloseMobileCustom").addEventListener("click",function(){closeCustomDialog()}),document.getElementById("spanSave").appendChild(document.getElementById("btnSave")),document.getElementById("footerCustom").style.display="none",document.getElementById("btnCloseCustom").style.display="none";let p=document.getElementById("aboutDialog"),q=document.createElement("div");q.className="titleContainer";let r=document.createElement("div");r.className="titleInnerContainer";let s=document.createElement("span");s.className="closeMobile",s.id="btnCloseMobileAbout";let t=document.createElement("span");t.className="mdi mdi-close";let u=document.createElement("span");u.id="spanTitleAbout",s.appendChild(t),r.appendChild(s),r.appendChild(u),q.appendChild(r),p.insertBefore(q,p.firstChild),document.getElementById("btnCloseMobileAbout").addEventListener("click",function(){dialogAbout.close()});let v=document.getElementById("titleAbout");v.classList.remove("mdl-dialog__title"),v.style.margin="0",v.style.marginTop="16px",v.style.fontWeight=1e3,v.style.fontSize="1.25em",v.style.display="inline",document.getElementById("spanTitleAbout").append(v),document.getElementById("divCloseAbout").style.display="none"}let a=0;do setTimeout(function(){try{titleMeeting.innerHTML=`${lngObject.meetingAt} ${moment().format(dateFormat)}`}catch(a){}},1e3),a++;while(lngObject===void 0&&5>a)},100),isFirstRun&&dialogWelcome.showModal(),checkMode(),tickAll.addEventListener("change",()=>{Array.from(document.querySelectorAll(".mdl-js-checkbox:not(#lblTickAll)")).forEach(function(a){let b=a;setTimeout(function(){lblTickAll.matches(".is-checked")?b.MaterialCheckbox.check():b.MaterialCheckbox.uncheck()},10)}),refreshControls()}),function(){btnShare.style.display="none",btnEmail.style.display="none",isFirstTime=!0,"desktop"===deviceDetector.device?(dialogTimeTable.classList.add("centeredDialog"),dialogTimeTable.classList.add("fullscreen-dialog-tablet"),dialogAbout.classList.add("centeredDialog"),document.getElementById("divSpeakers").style.height=`${.53*document.body.clientHeight}px`):"tablet"===deviceDetector.device?(dialogTimeTable.classList.add("centeredDialog-tablet"),dialogTimeTable.classList.add("fullscreen-dialog-tablet"),dialogAbout.classList.add("centeredDialog"),document.getElementById("divSpeakers").style.height=`${.53*document.body.clientHeight}px`):(dialogCustomTimes.classList.add("customBodyMobile"),document.getElementById("divSpeakers").style.height=514>window.innerHeight&&window.innerWidth>window.innerHeight?`${.6*document.body.clientHeight}px`:`${.75*document.body.clientHeight}px`,dialogTimeTable.classList.add("fullscreen-dialog"),dialogCustomTimes.classList.add("fullscreen-dialog"),dialogAbout.classList.add("fullscreen-dialog")),"function"!=typeof HTMLDialogElement&&(dialogWelcome.classList.remove("centeredDialog"),dialogWelcome.classList.add("centeredDialogNoSupport"),dialogSetTime.classList.remove("centeredDialog"),dialogSetTime.classList.add("centeredDialogNoSupport")),document.body.addEventListener("focus",function(){"-1"!==document.querySelector(".mdl-menu__outline")[0].style.zIndex&&resizeSelect()})}(),resizeScreen();function hideKeyboard(a){a.readOnly=!0,setTimeout(function(){a.blur(),a.readOnly=!1},100)}window.addEventListener("orientationchange",doOnOrientationChange);function doOnOrientationChange(){location.reload()} \ No newline at end of file