‘;}).join(”);messages.scrollTop=messages.scrollHeight;}
function bootChat(){api(‘chat/identity?guest=’+encodeURIComponent(guest)).then(function(d){guest=d.guest||guest;if(guest)localStorage.setItem(‘nkRadioGuest’,guest);identity.textContent=d.name;identity.className=’nk-chat-name nk-chat-name–‘+(d.kind||’guest’);chatAdmin=!!d.admin;clear.hidden=!chatAdmin;return api(‘chat’);}).then(function(d){showMessages(d.messages||[]);}).catch(function(){});}
form.addEventListener(‘submit’,function(e){e.preventDefault();var message=input.value.trim();if(!message)return;api(‘chat’,{message:message,guest:guest}).then(function(){input.value=”;bootChat();}).catch(function(e){alert(e.message);});});
messages.addEventListener(‘click’,function(e){var b=e.target.closest(‘.nk-chat-delete’);if(!b)return;api(‘chat/delete’,{id:b.dataset.id}).then(bootChat).catch(function(e){alert(e.message);});});clear.addEventListener(‘click’,function(){if(confirm(‘Clear every chat message?’))api(‘chat/clear’,{}).then(bootChat).catch(function(e){alert(e.message);});});accountToggle.addEventListener(‘click’,function(){accountForm.hidden=!accountForm.hidden;});
function account(action){api(‘chat/’+action,{username:document.getElementById(‘nk-chat-username’).value,email:document.getElementById(‘nk-chat-email’).value,password:document.getElementById(‘nk-chat-password’).value}).then(function(d){note.textContent=d.message+’ Refreshing your chat identity…’;window.setTimeout(function(){window.location.reload();},250);}).catch(function(e){note.textContent=e.message;});}
document.getElementById(‘nk-chat-register’).addEventListener(‘click’,function(){account(‘register’);});document.getElementById(‘nk-chat-login’).addEventListener(‘click’,function(){account(‘login’);});refreshRadio();bootChat();window.setInterval(refreshRadio,5000);window.setInterval(bootChat,10000);
}());
NERVENKLINIK team doesn’t give a fuck about your cookies but according to the idiotic EU regulations we must have this banner. So just click.