lib/sdoc/generator/template/shtml/resources/js/searchdoc.js in voloko-sdoc-0.1.4 vs lib/sdoc/generator/template/shtml/resources/js/searchdoc.js in voloko-sdoc-0.1.5
- old
+ new
@@ -35,25 +35,25 @@
this.onkeydown = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
- this.moveLeft();
- e.preventDefault();
+ if (this.moveLeft())
+ e.preventDefault();
break;
case 38: //Event.KEY_UP:
- this.moveUp();
- e.preventDefault();
+ if (this.moveUp())
+ e.preventDefault();
this.startMoveTimeout(false);
break;
case 39: //Event.KEY_RIGHT:
- this.moveRight();
- e.preventDefault();
+ if (this.moveRight())
+ e.preventDefault();
break;
case 40: //Event.KEY_DOWN:
- this.moveDown();
- e.preventDefault();
+ if (this.moveDown())
+ e.preventDefault();
this.startMoveTimeout(true);
break;
case 9: //Event.KEY_TAB:
case 13: //Event.KEY_RETURN:
if (this.$current) this.select(this.$current);
@@ -87,15 +87,15 @@
this.move = function(isDown) {
}
this.moveUp = function() {
- this.move(false);
+ return this.move(false);
}
this.moveDown = function() {
- this.move(true);
+ return this.move(true);
}
}
// scrollIntoView.js --------------------------------------
@@ -203,13 +203,12 @@
};
return true;
}
function matchPassRegexp(index, longIndex, queries, regexps) {
- if (!index.match(regexps[0])) return false;
- for (var i=1, l = regexps.length; i < l; i++) {
- if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
+ for (var i=0, l = regexps.length; i < l; i++) {
+ if (!index.match(regexps[i]) && (i == 0 || !longIndex.indexOf(regexps[i]))) return false;
};
return true;
}
@@ -266,11 +265,11 @@
while (state.pass < 3 && state.limit > 0 && togo > 0) {
if (state.pass == 0) {
matchFunc = matchPass1;
hltFunc = highlightQuery;
} else if (state.pass == 1) {
- matchFunc = matchPass2;
+ matchFunc = matchPass1;
hltFunc = highlightQuery;
} else if (state.pass == 2) {
matchFunc = matchPassRegexp;
hltFunc = highlightRegexp;
}
@@ -393,9 +392,10 @@
this.$current.removeClass('current');
$next.addClass('current');
scrollIntoView($next[0], this.$view[0]);
this.$current = $next;
}
+ return true;
}
function renderItem(result) {
var li = document.createElement('li'),
html = '', badge = result.badge;