lib/sdoc/generator/template/direct/resources/js/searchdoc.js in voloko-sdoc-0.2.11.1 vs lib/sdoc/generator/template/direct/resources/js/searchdoc.js in voloko-sdoc-0.2.12
- old
+ new
@@ -35,32 +35,37 @@
this.onkeydown = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
- if (this.moveLeft())
- e.preventDefault();
+ if (this.moveLeft()) e.preventDefault();
break;
case 38: //Event.KEY_UP:
- if (this.moveUp())
- e.preventDefault();
- this.startMoveTimeout(false);
+ case 73: // i
+ case 67: // c (dvorak)
+ if (e.keyCode == 38 || e.ctrlKey) {
+ if (this.moveUp()) e.preventDefault();
+ this.startMoveTimeout(false);
+ }
break;
case 39: //Event.KEY_RIGHT:
- if (this.moveRight())
- e.preventDefault();
+ if (this.moveRight()) e.preventDefault();
break;
case 40: //Event.KEY_DOWN:
- if (this.moveDown())
- e.preventDefault();
- this.startMoveTimeout(true);
+ case 75: // k
+ case 84: // t (dvorak)
+ if (e.keyCode == 40 || e.ctrlKey) {
+ 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);
break;
}
+ if (e.ctrlKey && e.shiftKey) this.select(this.$current);
}
this.clearMoveTimeout = function() {
clearTimeout(this.moveTimeout);
this.moveTimeout = null;
@@ -462,14 +467,18 @@
this.initNavigation();
if (jQuery.browser.msie) document.body.className += '';
}
this.select = function($li) {
+ this.highlight($li);
var path = $li[0].searchdoc_tree_data.path;
+ if (path) this.panel.open(path);
+ }
+
+ this.highlight = function($li) {
if (this.$current) this.$current.removeClass('current');
this.$current = $li.addClass('current');
- if (path) this.panel.open(path);
}
this.toggle = function($li) {
var closed = !$li.hasClass('closed'),
children = $li[0].searchdoc_tree_data.children;
@@ -479,21 +488,21 @@
};
}
this.moveRight = function() {
if (!this.$current) {
- this.select(this.$list.find('li:first'));
+ this.highlight(this.$list.find('li:first'));
return;
}
if (this.$current.hasClass('closed')) {
this.toggle(this.$current);
}
}
this.moveLeft = function() {
if (!this.$current) {
- this.select(this.$list.find('li:first'));
+ this.highlight(this.$list.find('li:first'));
return;
}
if (!this.$current.hasClass('closed')) {
this.toggle(this.$current);
} else {
@@ -507,10 +516,10 @@
}
}
this.move = function(isDown) {
if (!this.$current) {
- this.select(this.$list.find('li:first'));
+ this.highlight(this.$list.find('li:first'));
return true;
}
var next = this.$current[0];
if (isDown) {
do {