diff --git a/README.md b/README.md index 2c2db17..09e670a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ MDLinks is a static HTML page with JS markdown parser. It creates a link portal * At the top there is a search bar. Enter values to filter out links not matching to keyword. * Pressing key 's' focuses the search bar. + * Pressing key 'c' clears the search bar. * Top right has a toggle button. Click it to convert all links to open in a new window/tab. * Pressing key 'n' toggles diff --git a/index.html b/index.html index 79bb3e3..5150ce7 100644 --- a/index.html +++ b/index.html @@ -285,15 +285,9 @@ function keyboard_entry(ev) { if (/N/.test(k)) { toggle_blank(); } -} -function keyboard_control(ev) { - var kC=ev.keyCode; - var k=String.fromCharCode(ev.keyCode); - if (ev.ctrlKey) { - if (k=='C') { - document.getElementById("filter").value=''; - filter(ev); - } + if (/C/.test(k)) { + document.getElementById("filter").value=''; + filter(ev); } } @@ -433,7 +427,6 @@ function set_cookie(name,value) { ";path=" + window.location.pathname + ";max-age="+ (60*60*2).toString() + ";"; } document.onkeyup=keyboard_entry; -document.onkeydown=keyboard_control; document.onscroll=scroll_save; var linkReg=/([^\[]*)\[([^\]]+)\]\(([^\)]+)\)(.*)/; var linkPlain=/(.*)(http[^\s]+)(.*)/;