summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorYukai Huang2016-10-12 18:19:08 +0800
committerYukai Huang2016-10-12 18:19:08 +0800
commit2f11706dd256502d3ad5912fce777bc19b92b609 (patch)
treee974cc6912603889da66d34b28f995b12d6a94fb /public
parentae3d142d9c36095b17f3468a44d28ad6f15ccbdd (diff)
parentc98d2639286344188f50045ab2e28a157df7ddf7 (diff)
Merge branch 'master' into webpack-frontend
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js8
-rwxr-xr-xpublic/vendor/jquery-textcomplete/jquery.textcomplete.js35
2 files changed, 29 insertions, 14 deletions
diff --git a/public/js/index.js b/public/js/index.js
index f3bdf115..f8f997d8 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2870,14 +2870,14 @@ function sortOnlineUserList(list) {
else if (usera.idle && !userb.idle)
return 1;
else {
- if (usera.name.toLowerCase() < userb.name.toLowerCase()) {
+ if (usera.name && usera.name.toLowerCase() < userb.name.toLowerCase()) {
return -1;
- } else if (usera.name.toLowerCase() > userb.name.toLowerCase()) {
+ } else if (usera.name && usera.name.toLowerCase() > userb.name.toLowerCase()) {
return 1;
} else {
- if (usera.color.toLowerCase() < userb.color.toLowerCase())
+ if (usera.color && usera.color.toLowerCase() < userb.color.toLowerCase())
return -1;
- else if (usera.color.toLowerCase() > userb.color.toLowerCase())
+ else if (usera.color && usera.color.toLowerCase() > userb.color.toLowerCase())
return 1;
else
return 0;
diff --git a/public/vendor/jquery-textcomplete/jquery.textcomplete.js b/public/vendor/jquery-textcomplete/jquery.textcomplete.js
index e1d90d0a..cd2f863d 100755
--- a/public/vendor/jquery-textcomplete/jquery.textcomplete.js
+++ b/public/vendor/jquery-textcomplete/jquery.textcomplete.js
@@ -863,16 +863,31 @@ if (typeof jQuery === 'undefined') {
//
// FIXME: Calculate the left top corner of `this.option.appendTo` element.
getCaretPosition: function () {
- //var position = this._getCaretRelativePosition();
- //var offset = this.$el.offset();
- //var offset = $('.CodeMirror-cursor').offset();
- var position = $('.CodeMirror-cursor').position();
- var menu = $('.cursor-menu .dropdown-menu');
- var offsetLeft = parseFloat(menu.attr('data-offset-left'));
- var offsetTop = parseFloat(menu.attr('data-offset-top'));
- position.left += offsetLeft;
- position.top += offsetTop;
- return position;
+ if ($('.CodeMirror-cursor').length > 0) {
+ var position = $('.CodeMirror-cursor').position();
+ var menu = $('.cursor-menu .dropdown-menu');
+ var offsetLeft = parseFloat(menu.attr('data-offset-left'));
+ var offsetTop = parseFloat(menu.attr('data-offset-top'));
+ position.left += offsetLeft;
+ position.top += offsetTop;
+ return position;
+ } else {
+ var position = this._getCaretRelativePosition();
+ var offset = this.$el.offset();
+
+ // Calculate the left top corner of `this.option.appendTo` element.
+ var $parent = this.option.appendTo;
+ if ($parent) {
+ if (!($parent instanceof $)) { $parent = $($parent); }
+ var parentOffset = $parent.offsetParent().offset();
+ offset.top -= parentOffset.top;
+ offset.left -= parentOffset.left;
+ }
+
+ position.top += offset.top;
+ position.left += offset.left;
+ return position;
+ }
},
// Focus on the element.