61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
|
|
||
|
// jus fot testing :)
|
||
|
console.log("Ok");
|
||
|
|
||
|
//Materialize js component initialization
|
||
|
$(document).ready(function(){
|
||
|
$('select').formSelect();
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
var socket = io();
|
||
|
$('#send').click(function(e){
|
||
|
e.preventDefault();
|
||
|
var data = {zone:$("#zone").val(),
|
||
|
ListeCom : new Array()};
|
||
|
data.ListeCom.push({
|
||
|
IDPub:-1,
|
||
|
html: $('#summernote').summernote('code'),
|
||
|
level:$("#level").val()
|
||
|
});
|
||
|
|
||
|
socket.emit('Communication', JSON.stringify(data));
|
||
|
//$('#m').val('');
|
||
|
return false;
|
||
|
});
|
||
|
|
||
|
$("#SendAll").click(function(){
|
||
|
var data = {zone:$("#zone").val(),
|
||
|
ListeCom : new Array()};
|
||
|
|
||
|
for(var i=0;i<3;i++)
|
||
|
{
|
||
|
var f = $($("form").get(i));
|
||
|
console.log(f)
|
||
|
data.ListeCom.push({
|
||
|
IDPub:-1,
|
||
|
html:f.children(".com")[0].value,
|
||
|
level:f.children(".lvl")[0].value
|
||
|
});
|
||
|
}
|
||
|
socket.emit('Communication', JSON.stringify(data));
|
||
|
})
|
||
|
|
||
|
|
||
|
socket.on('chat message', function(msg){
|
||
|
//$('#messages').append($('<li>').text(msg));
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
//Summer note initialization
|
||
|
$('#summernote').summernote({
|
||
|
placeholder: 'nothing',
|
||
|
tabsize: 2,
|
||
|
height: 100
|
||
|
});
|