mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
HTML doc: navigate with left/right arrow keys
Adjusted basic theme's JS accordingly
This commit is contained in:
parent
470bac3d1c
commit
1b80100dff
2
AUTHORS
2
AUTHORS
@ -28,7 +28,7 @@ Other contributors, listed alphabetically, are:
|
|||||||
* Horst Gutmann -- internationalization support
|
* Horst Gutmann -- internationalization support
|
||||||
* Martin Hans -- autodoc improvements
|
* Martin Hans -- autodoc improvements
|
||||||
* Doug Hellmann -- graphviz improvements
|
* Doug Hellmann -- graphviz improvements
|
||||||
* Timotheus Kampik - stop words language fix
|
* Timotheus Kampik - JS enhancements, stop words language fix
|
||||||
* Takeshi Komiya -- numref feature
|
* Takeshi Komiya -- numref feature
|
||||||
* Dave Kuhlman -- original LaTeX writer
|
* Dave Kuhlman -- original LaTeX writer
|
||||||
* Blaise Laflamme -- pyramid theme
|
* Blaise Laflamme -- pyramid theme
|
||||||
|
1
CHANGES
1
CHANGES
@ -14,6 +14,7 @@ Features added
|
|||||||
* C++ type alias support (e.g., ``.. type:: T = int``)
|
* C++ type alias support (e.g., ``.. type:: T = int``)
|
||||||
* C++ template support for classes, functions, type aliases, and variables (#1729, #1314).
|
* C++ template support for classes, functions, type aliases, and variables (#1729, #1314).
|
||||||
* C++, added new scope management directives ``namespace-push`` and ``namespace-pop``.
|
* C++, added new scope management directives ``namespace-push`` and ``namespace-pop``.
|
||||||
|
* #1970: Keyboard shortcuts to navigate Next and Previous topics
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -124,6 +124,7 @@ var Documentation = {
|
|||||||
this.fixFirefoxAnchorBug();
|
this.fixFirefoxAnchorBug();
|
||||||
this.highlightSearchWords();
|
this.highlightSearchWords();
|
||||||
this.initIndexTable();
|
this.initIndexTable();
|
||||||
|
this.initOnKeyListeners();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,6 +253,30 @@ var Documentation = {
|
|||||||
});
|
});
|
||||||
var url = parts.join('/');
|
var url = parts.join('/');
|
||||||
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
|
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* init onKeyListernes (for navigation)
|
||||||
|
*/
|
||||||
|
initOnKeyListeners: function() {
|
||||||
|
$(document).keyup(function(event) {
|
||||||
|
if (!$(document.activeElement).is('input')) { //don't navigate when in search box
|
||||||
|
switch (event.keyCode) {
|
||||||
|
case 37: //left
|
||||||
|
var prevElement = $('link[rel="prev"]')[0];
|
||||||
|
if (prevElement) {
|
||||||
|
window.location.href = prevElement.href;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 39: //right
|
||||||
|
var nextElement = $('link[rel="next"]')[0];
|
||||||
|
if (nextElement) {
|
||||||
|
window.location.href = nextElement.href;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user