summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-09-21 14:16:03 +0300
committerAlon Levy <alon@pobox.com>2014-09-21 14:17:36 +0300
commit99ab703971fc013e3241dc3d8c462f7000a19ee9 (patch)
treefb068d6c380c0a75c59fef630d084e5c2c8e5f11 /scripts
parent44b4f031ba24f47c2baf3f7677c13f5afe9cac44 (diff)
scripts/autocomplete.js cleanup: remove empty lines at wrong places
Diffstat (limited to 'scripts')
-rw-r--r--scripts/autocomplete.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/scripts/autocomplete.js b/scripts/autocomplete.js
index e70f8a10..c5306ae9 100644
--- a/scripts/autocomplete.js
+++ b/scripts/autocomplete.js
@@ -89,14 +89,12 @@
$(this).val(firstTextPart + text.substring(cursorPosition, text.length));
acTrigger.setCursorPosition(firstTextPart.length);
} else {
-
var text = $(this).text();
var html = $(this).html();
-
var searchTerm = text.substring(0, cursorPosition);
-
var i = 0;
var index = 0;
+
while (i < searchTerm.length) {
index = html.lastIndexOf(searchTerm.substring(i));
if (index != -1) {
@@ -147,7 +145,6 @@
var delay = typeof acTrigger.options.delay === 'undefined' ? 0 : acTrigger.options.delay;
if (event.keyCode != $.ui.keyCode.UP && event.keyCode != $.ui.keyCode.DOWN) {
-
if ($(this).is('input,textarea')) {
var text = $(this).val();
} else {
@@ -174,7 +171,6 @@
* @description Destroy an instantiated plugin and clean up modifications the widget has made to the DOM
*/
destroy: function () {
-
// this.element.removeStuff();
// For UI 1.8, destroy must be invoked from the
// base widget
@@ -216,7 +212,8 @@
lastTriggerEndPosition = text.substring(0, cursorPosition).lastIndexOf(triggerEnd);
// console.log('autocomplete: '+text+", lastTriggerPosition: "+lastTriggerPosition+", lastTriggerEndPosition: "+lastTriggerEndPosition + ", cursorPosition: "+cursorPosition);
- if ((lastTriggerEndPosition < lastTriggerPosition || textLength >= trigger.length) && lastTriggerPosition != -1) {
+ if ((lastTriggerEndPosition < lastTriggerPosition || textLength >= trigger.length)
+ && lastTriggerPosition != -1) {
query = text.substring(lastTriggerPosition + trigger.length, cursorPosition);
// console.log('query '+query);
acTrigger.triggered = true;
@@ -225,9 +222,6 @@
acTrigger.triggered = false;
widget.autocomplete("close");
}
-
}
-
-
});
-})(jQuery, window, document); \ No newline at end of file
+})(jQuery, window, document);