You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
$(document).ready(()=>{
|
|
|
|
const socket = io();
|
|
|
|
|
|
// socket.emit('cloudIndex', getURLParameter('cloud'));
|
|
if(getURLParameter('cloud')){
|
|
socket.emit('cloudIndex', getURLParameter('cloud'));
|
|
}
|
|
|
|
if(getURLParameter('message')){
|
|
socket.emit('message', getURLParameter('message'));
|
|
}
|
|
|
|
if(getURLParameter('response')){
|
|
socket.emit('response', getURLParameter('response'));
|
|
}
|
|
|
|
if(getURLParameter('actions')){
|
|
socket.emit('actions', getURLParameter('actions'));
|
|
}
|
|
|
|
if(getURLParameter('display')){
|
|
socket.emit('display', getURLParameter('display'));
|
|
}
|
|
|
|
if(getURLParameter('reset')){
|
|
socket.emit('reset', 1);
|
|
}
|
|
|
|
$('#gotoCloud').on('change', function(){
|
|
current = $(this).val();
|
|
socket.emit('cloudIndex', current);
|
|
});
|
|
|
|
$('#reset').on('click', function(){
|
|
socket.emit('reset', 1);
|
|
console.log('RESET');
|
|
});
|
|
|
|
$('#message').on('keypress', function(event){
|
|
if(event.which == 13){
|
|
socket.emit('message', $(this).val());
|
|
console.log('message', $(this).val());
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function getURLParameter(sParam){
|
|
const sPageURL = window.location.search.substring(1);
|
|
const sURLVariables = sPageURL.split('&');
|
|
|
|
for (let i = 0; i < sURLVariables.length; i++){
|
|
const sParameterName = sURLVariables[i].split('=');
|
|
if (sParameterName[0] == sParam){
|
|
return sParameterName[1];
|
|
}
|
|
}
|
|
}
|