viewing of others code working
This commit is contained in:
@ -44,34 +44,32 @@
|
||||
|
||||
isLiveMode();
|
||||
setHeight();
|
||||
window.location.hash = '#live'; // set live mode on by default
|
||||
|
||||
let isTeacher = window.location.hash === '#4ELQcUq7UnFGghAZCVr4Chr9JmtncigfkGu5WSf9';
|
||||
|
||||
if (isTeacher) {
|
||||
$liveModeLink.hide();
|
||||
$liveModeStatus.hide();
|
||||
} else {
|
||||
window.location.hash = '#live'; // set live mode on by default
|
||||
}
|
||||
|
||||
let $editors = $('.ace_editor');
|
||||
|
||||
if (isTeacher) {
|
||||
$editors.each(function (i, e) {
|
||||
|
||||
$editors.each(function (i, e) {
|
||||
let editor = ace.edit(e);
|
||||
|
||||
let editor = ace.edit(e);
|
||||
editor.session.on('change', function () {
|
||||
|
||||
editor.session.on('change', function () {
|
||||
let user = $yourNameText.val();
|
||||
let code = editor.getValue();
|
||||
|
||||
let user = 'ryan';
|
||||
let code = editor.getValue();
|
||||
|
||||
connection.invoke('UpdateCode', user, i, code).catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
connection.invoke('UpdateCode', user, i, code, isTeacher).catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
connection.on('ReceiveCode', function (user, index, code) {
|
||||
|
||||
@ -87,7 +85,7 @@
|
||||
|
||||
let usersList = Object.values(users)
|
||||
.filter(u => u.name !== '')
|
||||
.map(u => `<span style="color: ${u.color};" title="${u.color}">${u.name}</span>`);
|
||||
.map(u => `<a href="/view/${u.id}" style="color: ${u.color};" title="${u.color}">${u.name}</a>`);
|
||||
|
||||
$usersList.html(`<strong>${usersList.length} users online:</strong> ${usersList.join(', ')}`);
|
||||
|
||||
|
Reference in New Issue
Block a user