diff --git a/js/min.js b/js/min.js
index 62d6fd5..f86d1fb 100644
--- a/js/min.js
+++ b/js/min.js
@@ -1,5 +1,5 @@
/*
-minified version of the scripts in /js/ from commit 1aecf9d94e511d316686f32aa82035fbd59b0c2e
+minified version of the scripts in /js/ from commit b5743dcf8b69f080aca8aeb5f2ab7ea41f834b1e
@author robalb / http://halb.it / https://github.com/robalb/morsechat
*/
-var context,audioSupport=!0,isAuth=!1,oX1101o=!0;function openMlSidebar(){document.getElementById("morseListSideBar").style.display="block"}function closeMlSidebar(){document.getElementById("morseListSideBar").style.display="none"}function stretchMlSidebar(){document.getElementById("morseListSideBar").style.width="100%",document.getElementById("morseList").style.columnCount=4}function unstretchMlSidebar(){document.getElementById("morseListSideBar").style.width="180px",document.getElementById("morseList").style.columnCount=2}function openMenu(){document.getElementById("menu").style.display="block"}function openSettings(){document.getElementById("settings").style.display="block"}function popup(e,t){document.getElementById("popup").style.display="table",document.getElementById("popupTitle").innerText=e,document.getElementById("popupContent").innerHTML=t}function displaySenderInfo(e){var t=channel.members.get(e);popup("user info",t?"
username: "+t.info.username+"
continent: "+t.info.continent+"
country: "+t.info.countryName+"
id: "+e+"
":"this user doesn't exist anymore
")}function scrollDown(){document.getElementById("radiobt").style.display="none",chatId.scrollTop=chatId.scrollHeight,viewTagDisplaied&&(viewedMessages=!0)}function ch(){alert("there is only one channel at the moment")}window.addEventListener("load",function(){Pusher.logToConsole=!0,keyId=document.getElementById("key"),barId=document.getElementById("timebar_bar"),letterDisplayId=document.getElementById("letterDisp"),phraseDisplayId=document.getElementById("phraseDisp"),chatId=document.getElementById("chatContainer"),settings.applyMultipliers(settings.defaultMultipliers),"undefined"!=typeof AudioContext?context=new AudioContext:"undefined"!=typeof webkitAudioContext?context=new webkitAudioContext:void 0!==window.webkitAudioContext?context=new window.webkitAudioContext:void 0!==window.AudioContext?context=new window.AudioContext:"undefined"!=typeof mozAudioContext?context=new mozAudioContext:audioSupport=!1,chatId.addEventListener("scroll",function(e){chat.viewTagDisplaied&&(chatId.scrollTopusername: "+channel.members.me.info.username+"
"+e+" morser"+(e>1?"s":"")+" online",document.getElementById("sidebar_username_disp").innerText=channel.members.me.info.username,console.log(channel.members)}),channel.bind("pusher:subscription_error",function(e){document.getElementById("connecting-msg").innerHTML="connection error. status: "+e+"
"}),channel.bind("morsebroadcast",function(t){e=0;var s=channel.members.get(t.sender),n=t.sender==channel.members.me.id?"you":s.info.username;chat.insertMorsingMsg(t.sender,n,t.message)}),channel.bind("pusher:member_added",function(s){var n=channel.members.count;0!=e&&t==s.id?(console.log("still him"),document.querySelectorAll(".msg-normal:last-child .editable")[0].innerHTML=" reconnected.
"+n+" morser"+(n>1?"s":"")+" online"):(e=1,t=s.id,chat.insertMsg(""+s.info.username+" joined the chat.
"+n+" morsers online
",!0),console.log("new member"),console.log(s))}),channel.bind("pusher:member_removed",function(s){var n=channel.members.count;0!=e&&t==s.id?(console.log("still him"),document.querySelectorAll(".msg-normal:last-child .editable")[0].innerHTML=" joined and left the chat
"+n+" morser"+(n>1?"s":"")+" online"):(e=2,t=s.id,chat.insertMsg(""+s.info.username+" left the chat.
"+n+" morser"+(n>1?"s":"")+" online
",!0),console.log("removed member"),console.log(s))}),window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)})},!1);var morseKey={isDown:!1,startHold:0,letter:"",phrase:"",down:function(){if(!this.isDown){this.isDown=!0,clearTimeout(this.spaceTimer),sender.stopCountDown(),this.startHold=Date.now();var e=this;this.dashTimer=setTimeout(function(){e.up(),console.log(morseKey),console.log("holded dash for too long. released it")},3*settings.dashLength),keyId.style.backgroundColor="#404040",audioSupport&&settings.keySound&&(this.o=context.createOscillator(),this.o.frequency.value=1175,this.g=context.createGain(),this.o.connect(this.g),this.g.connect(context.destination),this.o.start(0))}},up:function(){if(this.isDown){this.isDown=!1,clearTimeout(this.dashTimer),keyId.style.backgroundColor="#212121";var e=Date.now()-this.startHold;this.letter+=e>settings.dashLength?"1":"0",console.log("letter is now "+this.letter),letterDisplayId.insertAdjacentText("beforeend",e>settings.dashLength?"_":".");var t=this;this.spaceTimer=setTimeout(function(){t.pushWord()},settings.charactersPause),audioSupport&&settings.keySound&&this.o.stop(context.currentTime)}},pushWord:function(){if("000000"==this.letter)if(this.phrase=this.phrase.slice(0,-1),phraseDisplayId.innerText=this.phrase,console.log("undo"),console.log("phrase is now "+this.phrase),this.phrase.length>0){var e=this;this.spaceTimer=setTimeout(function(){e.pushSpace()},settings.wordsPause)}else chat.insertMsg("message removed
",!1);else{this.phrase+=""+(morse.tree[this.letter]?morse.tree[this.letter]:"");var t=morse.tree[this.letter]?morse.tree[this.letter]:"|";phraseDisplayId.insertAdjacentHTML("beforeend",t),console.log("decoded "+this.letter+" into "+t),this.letter="",letterDisplayId.innerText="",console.log("letter added to phrase"),console.log("phrase is now "+this.phrase);e=this;this.spaceTimer=setTimeout(function(){console.log(e),e.pushSpace()},settings.wordsPause)}this.letter="",letterDisplayId.innerText=""},pushSpace:function(){this.phrase+=" ",phraseDisplayId.insertAdjacentHTML("beforeend"," "),console.log("added space"),sender.startCountDown(this.phrase),barId.style.height="2px",console.log("started a "+settings.phraseInactivityTime+"ms countdown")}};sender={countDownCtrl:0,msg:"",startCountDown:function(e){this.msg=e,this.countDownCtrl=Date.now(),this.update()},stopCountDown:function(){this.countDownCtrl=0},update:function(){if(0==this.countDownCtrl)console.log("send countdown interrupted. progress bar removed"),barId.style.height="0px",barId.style.width="0px";else{var e=Date.now()-this.countDownCtrl;eerror "+t.status+" "+t.statusText+"",!0)},t.send()}else chat.insertMsg("failed to broadcast the message.
you are not connected to a channell
",!0);morseKey.phrase="",phraseDisplayId.innerHTML=""}};var settings={defaultMultipliers:[80,3,1,3,5,2e3],newMultipliers:[80,3,1,3,5,2e3],morserDotSpeed:80,updateMorserSpeed:function(e){this.morserDotSpeed=e,document.getElementById("morserSpeedDisp").text=e,document.getElementById("morserWpmDisp").text=Math.floor(1200/e)},updateMultiplier:function(e,t){0==e&&(document.getElementById("dotSpeedDisp").text=t),t>0&&(t<=500||5==e&&t<=4e3)&&(this.newMultipliers[e]=t,console.log("applying multipliers"),this.applyMultipliers(this.newMultipliers))},restoreDefaultMultipliers:function(){console.log("applying default multipliers"),this.applyMultipliers(this.defaultMultipliers),this.newMultipliers=this.defaultMultipliers.slice(0)},applyMultipliers:function(e){var t=e[0];this.dashLength=t*e[1],this.elementsPause=t*e[2],this.charactersPause=t*e[3],this.wordsPause=t*e[4],this.phraseInactivityTime=e[5],document.getElementById("dotSpeedDisp").text=e[0],document.getElementById("dotWpmDisp").text=Math.floor(1200/e[0]),document.getElementById("speedRange").value=e[0];for(var s=document.getElementsByClassName("tElement"),n=0;nthis is your configuration code. Keep it somewhere safe."+e+"
")},importFromString:function(){var e=document.getElementById("stringInput").value.split("x");if(7==e.length){for(var t=1;t<7;t++)console.log(e[t]),parseFloat(e[t])>0&&parseFloat(e[t])<=4e3?this.newMultipliers[t-1]=parseFloat(e[t]):(console.log("invalid value"),this.newMultipliers[t-1]=this.defaultMultipliers[t-1]);this.applyMultipliers(this.newMultipliers)}else popup("import error","Invalid code!
")},keySound:!0,receivedMorseSound:!0,toggleKeySound:function(){this.keySound?(this.keySound=!1,document.getElementById("ksbutton").innerText="enable key sound"):(this.keySound=!0,document.getElementById("ksbutton").innerText="disable key sound")},toggleReceivedSound:function(){this.receivedMorseSound?(this.receivedMorseSound=!1,document.getElementById("rmbutton").innerText="unmute received morse"):(this.receivedMorseSound=!0,document.getElementById("rmbutton").innerText="mute received morse")}},chat={viewTagDisplaied:!1,viewedMessages:!1,insertMsg:function(e,t){if(chatId.scrollTopunread messages")),chatId.insertAdjacentHTML("beforeend",e)}else chatId.insertAdjacentHTML("beforeend",e),chatId.scrollTop=chatId.scrollHeight;if(!0===t&&audioSupport&&settings.keySound){var n=context.createOscillator();n.frequency.value=440;var i=context.createGain();n.connect(i),i.connect(context.destination),n.start(0),i.gain.exponentialRampToValueAtTime(.001,context.currentTime+.1),n.stop(context.currentTime+.2)}},activeMorsers:[],updatingMorsers:!1,frequencies:[1046,987,880,784,698],lastFrequencyUsed:0,insertMorsingMsg:function(e,t,s){var n=""+t+":
";this.insertMsg(n,!1);var i=document.getElementsByClassName("msg-phrase").length-1,o=this.activeMorsers.length,r=this.frequencies[this.lastFrequencyUsed];this.lastFrequencyUsed=this.lastFrequencyUsed0){for(var t=0;t0)this.steps--;else if(this.phrase.length>0)if(this.currentLetterMorse.length>0){var e=this.currentLetterMorse.shift();if(this.steps=0==e?1:3,this.msgL.insertAdjacentHTML("beforeend",0==e?".":"_"),audioSupport&&settings.receivedMorseSound){var t=context.createOscillator();t.frequency.value=this.noteFreq;var s=context.createGain();t.connect(s),s.connect(context.destination),t.start(0);var n=settings.morserDotSpeed/(100*(0==e?6:2.8));t.stop(context.currentTime+n)}}else this.msgL.innerText="",this.msgP.insertAdjacentHTML("beforeend",this.currentLetter),this.currentLetter=this.phrase.shift()," "==this.currentLetter?this.steps=4:(this.steps=3,this.currentLetterMorse=morse.translateLetterToMorse(this.currentLetter));else this.finishedMorsing=!0;return this.finishedMorsing}}var morse={tree:{"01":"a",1000:"b",1010:"c",100:"d",0:"e","0010":"f",110:"g","0000":"h","00":"i","0111":"j",101:"k","0100":"l",11:"m",10:"n",111:"o","0110":"p",1101:"q","010":"r","000":"s",1:"t","001":"u","0001":"v","011":"w",1001:"x",1011:"y",1100:"z","010101":".",110011:",","001100":"?","011110":"'",101011:"!",10010:"/",111000:":",101010:";",10001:"=",100001:"-","01010":"+","011010":"@","01111":"1","00111":"2","00011":"3","00001":"4","00000":"5",10000:"6",11000:"7",11100:"8",11110:"9",11111:"0","00000010":" "},specialChars:{A:".",B:",",C:"?",D:"'",E:"!",F:"/",G:":",H:";",I:"=",L:"-",M:"+",N:"@",J:" ",K:"|"},escapeRegExp:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},webEncode:function(e){var t=e;for(var s in this.specialChars){var n=new RegExp(this.escapeRegExp(this.specialChars[s]),"g");t=t.replace(n,s)}return console.log("encoded phrase to "+t),t},webDecode:function(e){var t=e;for(var s in this.specialChars)t=t.replace(new RegExp(s,"g"),this.specialChars[s]);return t.toLowerCase()},translateLetterToMorse:function(e){for(var t in this.tree)if(this.tree[t]==e)return t.split("");return null}};
+var context,lastMessageType,lastPersonId,audioSupport=!0,isAuth=!1,connectedChannel="",oX1101o=!0;function chConnect(e){document.getElementById("ch-menu").style.display="none";var t="presence-ch"+e;if(t==connectedChannel)chat.insertMsg("already connected to this channel",!1);else{history.replaceState({foo:""},"morse chat","?ch="+e),document.getElementById("ch-display").innerText=e,chatId.innerHTML='connecting...
',isAuth=!1,pusher.unsubscribe(connectedChannel),channel=pusher.subscribe(t),connectedChannel=t,channel.bind("pusher:subscription_succeeded",function(){isAuth=!0;var e=channel.members.count,t=channel.name.substr(11);document.getElementById("connecting-msg").innerHTML="connected to channel "+t+"
username: "+channel.members.me.info.username+"
"+e+" morser"+(e>1?"s":"")+" online",document.getElementById("sidebar_username_disp").innerText=channel.members.me.info.username,console.log(channel.members)}),channel.bind("pusher:subscription_error",function(e){document.getElementById("connecting-msg").innerHTML="connection error. status: "+e+"
"}),channel.bind("morsebroadcast",function(e){lastMessageType=0;var t=channel.members.get(e.sender),n=e.sender==channel.members.me.id?"you":t.info.username;chat.insertMorsingMsg(e.sender,n,e.message)}),channel.bind("pusher:member_added",function(e){var t=channel.members.count;0!=lastMessageType&&lastPersonId==e.id?(console.log("still him"),document.querySelectorAll(".msg-normal:last-child .editable")[0].innerHTML=" reconnected.
"+t+" morser"+(t>1?"s":"")+" online"):(lastMessageType=1,lastPersonId=e.id,chat.insertMsg(""+e.info.username+" joined the chat.
"+t+" morsers online
",!0),console.log("new member"),console.log(e))}),channel.bind("pusher:member_removed",function(e){var t=channel.members.count;0!=lastMessageType&&lastPersonId==e.id?(console.log("still him"),document.querySelectorAll(".msg-normal:last-child .editable")[0].innerHTML=" joined and left the chat
"+t+" morser"+(t>1?"s":"")+" online"):(lastMessageType=2,lastPersonId=e.id,chat.insertMsg(""+e.info.username+" left the chat.
"+t+" morser"+(t>1?"s":"")+" online
",!0),console.log("removed member"),console.log(e))})}console.log(e)}function openMlSidebar(){document.getElementById("morseListSideBar").style.display="block"}function closeMlSidebar(){document.getElementById("morseListSideBar").style.display="none"}function stretchMlSidebar(){document.getElementById("morseListSideBar").style.width="100%",document.getElementById("morseList").style.columnCount=4}function unstretchMlSidebar(){document.getElementById("morseListSideBar").style.width="180px",document.getElementById("morseList").style.columnCount=2}function openMenu(){document.getElementById("menu").style.display="block"}function openSettings(){document.getElementById("settings").style.display="block"}function popup(e,t){document.getElementById("popup").style.display="table",document.getElementById("popupTitle").innerText=e,document.getElementById("popupContent").innerHTML=t}function displaySenderInfo(e){var t=channel.members.get(e);popup("user info",t?"username: "+t.info.username+"
continent: "+t.info.continent+"
country: "+t.info.countryName+"
id: "+e+"
":"this user doesn't exist anymore
")}function scrollDown(){document.getElementById("radiobt").style.display="none",chatId.scrollTop=chatId.scrollHeight,viewTagDisplaied&&(viewedMessages=!0)}window.addEventListener("load",function(){Pusher.logToConsole=!0,keyId=document.getElementById("key"),barId=document.getElementById("timebar_bar"),letterDisplayId=document.getElementById("letterDisp"),phraseDisplayId=document.getElementById("phraseDisp"),chatId=document.getElementById("chatContainer"),chMenuId=document.getElementById("ch-menu"),settings.applyMultipliers(settings.defaultMultipliers),"undefined"!=typeof AudioContext?context=new AudioContext:"undefined"!=typeof webkitAudioContext?context=new webkitAudioContext:void 0!==window.webkitAudioContext?context=new window.webkitAudioContext:void 0!==window.AudioContext?context=new window.AudioContext:"undefined"!=typeof mozAudioContext?context=new mozAudioContext:audioSupport=!1,chatId.addEventListener("scroll",function(e){chat.viewTagDisplaied&&(chatId.scrollTopchannel '+t+"";chMenuId.innerHTML=e,document.getElementById("ch-open").addEventListener("click",function(e){chMenuId.style.display="block",e.stopPropagation()}),window.addEventListener("click",function(e){chMenuId.contains(e.target)||(chMenuId.style.display="none")}),keyId.addEventListener("touchstart",function(e){e.stopPropagation(),e.preventDefault(),morseKey.down()},!1),keyId.addEventListener("touchend",function(e){e.stopPropagation(),e.preventDefault(),morseKey.up()},!1),keyId.addEventListener("mousedown",function(){console.log(morseKey),morseKey.down()},!1),keyId.addEventListener("mouseup",function(){morseKey.up()},!1);var s=!1;document.addEventListener("keydown",function(e){s||32!=e.keyCode&&32!=e.which&&" "!=e.key&&"Space"!=e.code||(e.preventDefault(),s=!0,morseKey.down())},!1),document.addEventListener("keyup",function(e){32!=e.keyCode&&32!=e.which&&" "!=e.key&&"Space"!=e.code||(e.preventDefault(),s=!1,morseKey.up())},!1),pusher=new Pusher(config.PUSHER_KEY,{authEndpoint:"app/auth.php",cluster:config.PUSHER_CLUSTER,encrypted:!0});var o="ch";o=o.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+o+"=([^]*)").exec(location.search);chConnect(null===i?1:decodeURIComponent(i[1].replace(/\+/g," "))),window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)})},!1);var morseKey={isDown:!1,startHold:0,letter:"",phrase:"",down:function(){if(!this.isDown){this.isDown=!0,clearTimeout(this.spaceTimer),sender.stopCountDown(),this.startHold=Date.now();var e=this;this.dashTimer=setTimeout(function(){e.up(),console.log(morseKey),console.log("holded dash for too long. released it")},3*settings.dashLength),keyId.style.backgroundColor="#404040",audioSupport&&settings.keySound&&(this.o=context.createOscillator(),this.o.frequency.value=1175,this.g=context.createGain(),this.o.connect(this.g),this.g.connect(context.destination),this.o.start(0))}},up:function(){if(this.isDown){this.isDown=!1,clearTimeout(this.dashTimer),keyId.style.backgroundColor="#212121";var e=Date.now()-this.startHold;this.letter+=e>settings.dashLength?"1":"0",console.log("letter is now "+this.letter),letterDisplayId.insertAdjacentText("beforeend",e>settings.dashLength?"_":".");var t=this;this.spaceTimer=setTimeout(function(){t.pushWord()},settings.charactersPause),audioSupport&&settings.keySound&&this.o.stop(context.currentTime)}},pushWord:function(){if("000000"==this.letter)if(this.phrase=this.phrase.slice(0,-1),phraseDisplayId.innerText=this.phrase,console.log("undo"),console.log("phrase is now "+this.phrase),this.phrase.length>0){var e=this;this.spaceTimer=setTimeout(function(){e.pushSpace()},settings.wordsPause)}else chat.insertMsg("message removed
",!1);else{this.phrase+=""+(morse.tree[this.letter]?morse.tree[this.letter]:"");var t=morse.tree[this.letter]?morse.tree[this.letter]:"|";phraseDisplayId.insertAdjacentHTML("beforeend",t),console.log("decoded "+this.letter+" into "+t),this.letter="",letterDisplayId.innerText="",console.log("letter added to phrase"),console.log("phrase is now "+this.phrase);e=this;this.spaceTimer=setTimeout(function(){console.log(e),e.pushSpace()},settings.wordsPause)}this.letter="",letterDisplayId.innerText=""},pushSpace:function(){this.phrase+=" ",phraseDisplayId.insertAdjacentHTML("beforeend"," "),console.log("added space"),sender.startCountDown(this.phrase)}};sender={countDownCtrl:0,msg:"",startCountDown:function(e){this.msg=e,this.countDownCtrl=Date.now(),this.update(),barId.style.height="2px",console.log("started a "+settings.phraseInactivityTime+"ms countdown")},stopCountDown:function(){this.countDownCtrl=0},update:function(){if(0==this.countDownCtrl)console.log("send countdown interrupted. progress bar removed"),barId.style.height="0px",barId.style.width="0px";else{var e=Date.now()-this.countDownCtrl;eerror "+t.status+" "+t.statusText+"",!0)},t.send()}else chat.insertMsg("failed to broadcast the message.
you are not connected to a channell
",!0);morseKey.phrase="",phraseDisplayId.innerHTML=""}};var settings={defaultMultipliers:[80,3,1,3,5,2e3],newMultipliers:[80,3,1,3,5,2e3],morserDotSpeed:80,updateMorserSpeed:function(e){this.morserDotSpeed=e,document.getElementById("morserSpeedDisp").text=e,document.getElementById("morserWpmDisp").text=Math.floor(1200/e)},updateMultiplier:function(e,t){0==e&&(document.getElementById("dotSpeedDisp").text=t),t>0&&(t<=500||5==e&&t<=4e3)&&(this.newMultipliers[e]=t,console.log("applying multipliers"),this.applyMultipliers(this.newMultipliers))},restoreDefaultMultipliers:function(){console.log("applying default multipliers"),this.applyMultipliers(this.defaultMultipliers),this.newMultipliers=this.defaultMultipliers.slice(0)},applyMultipliers:function(e){var t=e[0];this.dashLength=t*e[1],this.elementsPause=t*e[2],this.charactersPause=t*e[3],this.wordsPause=t*e[4],this.phraseInactivityTime=e[5],document.getElementById("dotSpeedDisp").text=e[0],document.getElementById("dotWpmDisp").text=Math.floor(1200/e[0]),document.getElementById("speedRange").value=e[0];for(var n=document.getElementsByClassName("tElement"),s=0;sthis is your configuration code. Keep it somewhere safe."+e+"
")},importFromString:function(){var e=document.getElementById("stringInput").value.split("x");if(7==e.length){for(var t=1;t<7;t++)console.log(e[t]),parseFloat(e[t])>0&&parseFloat(e[t])<=4e3?this.newMultipliers[t-1]=parseFloat(e[t]):(console.log("invalid value"),this.newMultipliers[t-1]=this.defaultMultipliers[t-1]);this.applyMultipliers(this.newMultipliers)}else popup("import error","Invalid code!
")},keySound:!0,receivedMorseSound:!0,toggleKeySound:function(){this.keySound?(this.keySound=!1,document.getElementById("ksbutton").innerText="enable key sound"):(this.keySound=!0,document.getElementById("ksbutton").innerText="disable key sound")},toggleReceivedSound:function(){this.receivedMorseSound?(this.receivedMorseSound=!1,document.getElementById("rmbutton").innerText="unmute received morse"):(this.receivedMorseSound=!0,document.getElementById("rmbutton").innerText="mute received morse")}},chat={viewTagDisplaied:!1,viewedMessages:!1,insertMsg:function(e,t){if(chatId.scrollTopunread messages")),chatId.insertAdjacentHTML("beforeend",e)}else chatId.insertAdjacentHTML("beforeend",e),chatId.scrollTop=chatId.scrollHeight;if(!0===t&&audioSupport&&settings.keySound){var s=context.createOscillator();s.frequency.value=440;var o=context.createGain();s.connect(o),o.connect(context.destination),s.start(0),o.gain.exponentialRampToValueAtTime(.001,context.currentTime+.1),s.stop(context.currentTime+.2)}},activeMorsers:[],updatingMorsers:!1,frequencies:[1046,987,880,784,698],lastFrequencyUsed:0,insertMorsingMsg:function(e,t,n){var s=""+t+":
";this.insertMsg(s,!1);var o=document.getElementsByClassName("msg-phrase").length-1,i=this.activeMorsers.length,r=this.frequencies[this.lastFrequencyUsed];this.lastFrequencyUsed=this.lastFrequencyUsed0){for(var t=0;t0)this.steps--;else if(this.phrase.length>0)if(this.currentLetterMorse.length>0){var e=this.currentLetterMorse.shift();if(this.steps=0==e?1:3,this.msgL.insertAdjacentHTML("beforeend",0==e?".":"_"),audioSupport&&settings.receivedMorseSound){var t=context.createOscillator();t.frequency.value=this.noteFreq;var n=context.createGain();t.connect(n),n.connect(context.destination),t.start(0);var s=settings.morserDotSpeed/(100*(0==e?6:2.8));t.stop(context.currentTime+s)}}else this.msgL.innerText="",this.msgP.insertAdjacentHTML("beforeend",this.currentLetter),this.currentLetter=this.phrase.shift()," "==this.currentLetter?this.steps=4:(this.steps=3,this.currentLetterMorse=morse.translateLetterToMorse(this.currentLetter));else this.finishedMorsing=!0;return this.finishedMorsing}}var morse={tree:{"01":"a",1000:"b",1010:"c",100:"d",0:"e","0010":"f",110:"g","0000":"h","00":"i","0111":"j",101:"k","0100":"l",11:"m",10:"n",111:"o","0110":"p",1101:"q","010":"r","000":"s",1:"t","001":"u","0001":"v","011":"w",1001:"x",1011:"y",1100:"z","010101":".",110011:",","001100":"?","011110":"'",101011:"!",10010:"/",111000:":",101010:";",10001:"=",100001:"-","01010":"+","011010":"@","01111":"1","00111":"2","00011":"3","00001":"4","00000":"5",10000:"6",11000:"7",11100:"8",11110:"9",11111:"0","00000010":" "},specialChars:{A:".",B:",",C:"?",D:"'",E:"!",F:"/",G:":",H:";",I:"=",L:"-",M:"+",N:"@",J:" ",K:"|"},escapeRegExp:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},webEncode:function(e){var t=e;for(var n in this.specialChars){var s=new RegExp(this.escapeRegExp(this.specialChars[n]),"g");t=t.replace(s,n)}return console.log("encoded phrase to "+t),t},webDecode:function(e){var t=e;for(var n in this.specialChars)t=t.replace(new RegExp(n,"g"),this.specialChars[n]);return t.toLowerCase()},translateLetterToMorse:function(e){for(var t in this.tree)if(this.tree[t]==e)return t.split("");return null}};
\ No newline at end of file