//Webinar $(document).ready(function($) { Widgets.run(); Site.run(); var pusher = new Pusher('94236c7a115a8dfd3b49',{cluster: "eu"}); var Channel = pusher.subscribe("WealthyWebinar"); $.ajax({ type: "GET", url: "messages.php", data: { SbjId: $("#SbjId").val() }, cache: false, success: function(result){ $("#messaggiAssemblea").html(result); }, error: function(xhr, status, error){ //alert(error); } }); $("#checkViewer1").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteI' }, cache: false, success: function(result){ alert("Da questo momento tutti gli utenti attivi possono effettuare la prima votazione") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#checkViewer2").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteII' }, cache: false, success: function(result){ alert("Da questo momento tutti gli utenti attivi possono effettuare la seconda votazione") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote1_1").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteI', presence: 1 }, cache: false, success: function(result){ $("#vote1").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote1_2").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteI', presence: 0 }, cache: false, success: function(result){ $("#vote1").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote1_3").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteI', presence: 3 }, cache: false, success: function(result){ $("#vote1").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote2_1").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteII', presence: 1 }, cache: false, success: function(result){ $("#vote2").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote2_2").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteII', presence: 0 }, cache: false, success: function(result){ $("#vote2").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#vote2_3").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'VoteII', presence: 3 }, cache: false, success: function(result){ $("#vote2").hide(); alert("Hai confermato il tuo voto") }, error: function(xhr, status, error){ //alert(error); } }); } }); $("#message").on("click", function(){ if($(this).hasClass('disabled')){ return false; }else{ $.ajax({ type: "POST", url: "pusher_listener.php", data: { SbjId: $("#SbjId").val(), part: 'Message', displayName: $("#displayName").val(), message: $("#messaggioAssemblea").val() }, cache: false, success: function(result){ $("#messaggioAssemblea").val(''); alert("Hai inviato il tuo messaggio"); }, error: function(xhr, status, error){ //alert(error); } }); } }); Channel.bind('Webinar-event', function(data) { switch(data.part){ case 'VoteI': $("#vote1").show(); break; case 'VoteII': $("#vote2").show(); break; case 'Message': $.ajax({ type: "GET", url: "messages.php", data: { SbjId: $("#SbjId").val() }, cache: false, success: function(result){ $("#messaggiAssemblea").html(result); }, error: function(xhr, status, error){ //alert(error); } }); break; default: break; } $("#OnlineUser").html(data.useronline); }); });