new tab with keyboard shortcut

This commit is contained in:
ville rantanen
2017-07-13 09:05:43 +03:00
parent fadafbf9ff
commit 408827c5c3

View File

@@ -261,17 +261,18 @@ function parse_links(s) {
linkList=links.slice(0);
init();
}
function move_cursor(ev) {
function keyboard_entry(ev) {
var kC=ev.keyCode;
var k=String.fromCharCode(ev.keyCode);
/*if (/[0-9]/.test(k) ) {
var ki=parseInt(k); if (ki==0) { ki=10; }
open_link(hitList[ki-1]);
if ( document.activeElement === document.getElementById("filter")) {
return
}*/
}
if (/S/.test(k)) {
document.getElementById("filter").focus();
}
if (/N/.test(k)) {
toggle_blank();
}
}
function toggle_blank() {
var span=document.getElementById('open_blank_span');
@@ -318,7 +319,7 @@ function get_cookie(name) {
}
return null
}
document.onkeyup=move_cursor;
document.onkeyup=keyboard_entry;
document.onscroll=scroll_save;
var linkReg=/([^\[]*)\[([^\]]+)\]\(([^\)]+)\)(.*)/;
var linkPlain=/(.*)(http[^\s]+)(.*)/;
@@ -340,9 +341,9 @@ var config = {
</head>
<body onload="read_links()">
<div id="search">
<span class="search_span"><input type="text" oninput="filter(event)" onkeypress="filter(event)" onblur="no_filter()" id="filter" title="Filter links by name, filter headers by #name"></span>
<span class="search_span"><input type="text" oninput="filter(event)" onkeypress="filter(event)" onblur="no_filter()" id="filter" title="[s] Filter links by name, filter headers by #name"></span>
<span class="search_span" id="menu_span"></span>
<span class="search_span tickbox" id=open_blank_span onclick="toggle_blank()" title="Toggle open links in new/this window"><span id=open_blank_box></span><span id=open_blank_arrow></span></span>
<span class="search_span tickbox" id=open_blank_span onclick="toggle_blank()" title="[n] Toggle open links in new/this window"><span id=open_blank_box></span><span id=open_blank_arrow></span></span>
</div>
<div id="main"></div>
<span class="search_span" id="reload_span"><a href="#" onclick="reload_source()" title="Reload links source">&#8635;</a></span>