Client side support for setting and retrieving ask_for_name status

master
Daniel Berteaud 11 years ago
parent b1780003a3
commit 42b9dc8a1c
  1. 33
      public/js/vroom.js

@ -269,6 +269,10 @@ function initVroom(room) {
$('#lockLabel').addClass('btn-danger active'); $('#lockLabel').addClass('btn-danger active');
$('#lockButton').prop('checked', true); $('#lockButton').prop('checked', true);
} }
if (data.ask_for_name == 'yes'){
$('#askForNameLabel').addClass('btn-danger active');
$('#askForNameButton').prop('checked', true);
}
} }
}); });
} }
@ -916,6 +920,35 @@ function initVroom(room) {
}); });
}); });
// Force participants to set a name
$('#askForNameButton').change(function() {
var type = ($(this).is(":checked")) ? 'set':'unset';
$.ajax({
data: {
action: 'askForName',
type: type,
room: roomName
},
error: function(data) {
$.notify(locale.ERROR_OCCURED, 'error');
},
success: function(data) {
if (data.status == 'success'){
$.notify(data.msg, 'info');
if (type === 'set'){
$('#askForNameLabel').addClass('btn-danger active');
}
else{
$('#askForNameLabel').removeClass('btn-danger active');
}
}
else{
$.notify(data.msg, 'error');
}
}
});
});
// ScreenSharing // ScreenSharing
$('#shareScreenButton').change(function() { $('#shareScreenButton').change(function() {
var action = ($(this).is(":checked")) ? 'share':'unshare'; var action = ($(this).is(":checked")) ? 'share':'unshare';

Loading…
Cancel
Save