Skip to content

Instantly share code, notes, and snippets.

@nomolosvulgaris
Created April 18, 2014 04:44
Show Gist options
  • Save nomolosvulgaris/11025183 to your computer and use it in GitHub Desktop.
Save nomolosvulgaris/11025183 to your computer and use it in GitHub Desktop.
document.onkeyup = function(e) {
var btn = { 37: 'Назад', 39: 'Вперёд' };
var el = function(title) {
return document.querySelector(['a[title="', title, '"]'].join(''));
};
Object.keys(btn).forEach(function(code) {
if (e.ctrlKey && e.keyCode == code) {
var link = el(btn[code]);
if (link) link.click();
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment