TVJR/static/Js/index.js

61 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2018-12-12 16:25:12 +01:00
// 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
});