From f8b029b2f4e9801aa20b80c77b452537ff463de5 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Fri, 25 Sep 2015 13:39:08 +0800 Subject: Fixed checkCursorTag and checkCursorMenu not calculate doc height properly, fixed jquery-textcomplete support upSideDown --- .../jquery-textcomplete/jquery.textcomplete.js | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'public/vendor') diff --git a/public/vendor/jquery-textcomplete/jquery.textcomplete.js b/public/vendor/jquery-textcomplete/jquery.textcomplete.js index 145e2413..49881ce1 100755 --- a/public/vendor/jquery-textcomplete/jquery.textcomplete.js +++ b/public/vendor/jquery-textcomplete/jquery.textcomplete.js @@ -554,10 +554,16 @@ if (typeof jQuery === 'undefined') { if (!this.shown) { return; } if (this.isUp(e)) { e.preventDefault(); - this._up(); + if(typeof upSideDown != 'undefined' && upSideDown) + this._down(); + else + this._up(); } else if (this.isDown(e)) { e.preventDefault(); - this._down(); + if(typeof upSideDown != 'undefined' && upSideDown) + this._up(); + else + this._down(); } else if (this.isEnter(e)) { e.preventDefault(); this._enter(); @@ -633,7 +639,7 @@ if (typeof jQuery === 'undefined') { }, _getActiveElement: function () { - return this.$el.children('.textcomplete-item:nth(' + this._index + ')'); + return this.$el.children('.textcomplete-item[data-index=' + this._index + ']'); }, _setScroll: function () { @@ -661,20 +667,11 @@ if (typeof jQuery === 'undefined') { this.data.push(datum); item.push(datum.strategy.template(datum.value)); } - if(typeof upSideDown != 'undefined' && upSideDown) { - for (i = item.length - 1; i >= 0; i--) { - html += '
  • '; - html += item[i]; - html += '
  • '; - } - this._index = this.data.length - 1; - } else { - for (i = 0; i < item.length; i++) { + for (i = 0; i < item.length; i++) { html += '
  • '; html += item[i]; html += '
  • '; - } - } + } return html; }, -- cgit v1.2.3