summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-01-22 19:48:07 -0600
committerCheng-Han, Wu2016-01-22 19:48:07 -0600
commite473a4e61b447c359501a5ea2b1aa17291e1357c (patch)
treeb785954ef35d3b24e77e41d8daff0115a7ddccb8 /public
parent90710bc78ba21a95e9affc272fbe4c97bfed04c3 (diff)
Fixed cursor id not valid to selector
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 3d2efc07..e49985e6 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1373,7 +1373,7 @@ socket.on('cursor focus', function (data) {
if (data.id != socket.id)
buildCursor(data);
//force show
- var cursor = $('#' + data.id);
+ var cursor = $('div[data-clientid="' + data.id + '"]');
if (cursor.length > 0) {
cursor.stop(true).fadeIn();
}
@@ -1400,7 +1400,7 @@ socket.on('cursor blur', function (data) {
if (data.id != socket.id)
buildCursor(data);
//force hide
- var cursor = $('#' + data.id);
+ var cursor = $('div[data-clientid="' + data.id + '"]');
if (cursor.length > 0) {
cursor.stop(true).fadeOut();
}
@@ -1648,8 +1648,8 @@ function buildCursor(user) {
if ($('.other-cursors').length <= 0) {
$("<div class='other-cursors'>").insertAfter('.CodeMirror-cursors');
}
- if ($('#' + user.id).length <= 0) {
- var cursor = $('<div id="' + user.id + '" class="other-cursor" style="display:none;"></div>');
+ if ($('div[data-clientid="' + user.id + '"]').length <= 0) {
+ var cursor = $('<div data-clientid="' + user.id + '" class="other-cursor" style="display:none;"></div>');
cursor.attr('data-line', user.cursor.line);
cursor.attr('data-ch', user.cursor.ch);
cursor.attr('data-offset-left', 0);
@@ -1726,7 +1726,7 @@ function buildCursor(user) {
checkCursorTag(coord, cursortag);
} else {
- var cursor = $('#' + user.id);
+ var cursor = $('div[data-clientid="' + user.id + '"]');
var lineDiff = Math.abs(cursor.attr('data-line') - user.cursor.line);
cursor.attr('data-line', user.cursor.line);
cursor.attr('data-ch', user.cursor.ch);