Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Commit

Permalink
show id in history; esc closes history
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sap committed Jan 27, 2017
1 parent cc6517e commit 48a32eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/addressbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ function onBlur () {
el[0].value = getUnfocusedText();
}

function onKeyPress (e) {
if (e.key === 'Enter') return gotoUrl();
}

function onKeyDown (e) {
if (e.key === 'ArrowDown') return $.trigger('focus-address-results');
if (e.key === 'Escape') {
Expand All @@ -97,10 +101,6 @@ function onKeyDown (e) {
}
}

function onKeyPress (e) {
if (e.key === 'Enter') return gotoUrl();
}

function onInput (e) {
$.trigger('address-input', e);
}
Expand Down
1 change: 1 addition & 0 deletions app/frame/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function init () {
webview = frame.find('#webview');


webview.on('focus', () => $.trigger('frame-focused'));
webview.on('will-navigate', gotoUrl);
webview.on('did-navigate-in-page', onNavigationStart);
webview.on('dom-ready', onNavigationEnd);
Expand Down
10 changes: 8 additions & 2 deletions app/history/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let el, listEl, isVisible = false, isReady = false;
function hide () {
if (!isVisible) return;
isVisible = false;
el.show().animate({ opacity: 1 }, { opacity: 0 }).then(el.hide);
el.show().animate({ opacity: 1 }, { opacity: 0 }).then(el.hide.bind(el));
}


Expand All @@ -28,9 +28,10 @@ function onUrlChanged (webview, issue) {


function getItemHtml (item, i) {
const mod = item.repo.split('/').pop() + '#' + item.id;
let selected = '';
if (i === 0) selected = 'selected="selected"';
return `<option ${selected} value="${item._id}">${item.name}</option>`;
return `<option ${selected} value="${item._id}">${item.name} (${mod})</option>`;
}


Expand Down Expand Up @@ -58,6 +59,10 @@ function onKeyDown (e) {
if (e.key === 'ArrowUp' && listEl[0].selectedIndex === 0) {
$.trigger('focus-addressbar');
}
else if (e.key === 'Escape') {
hide();
$.trigger('focus-addressbar');
}
}


Expand Down Expand Up @@ -89,6 +94,7 @@ function init () {
$.on('address-input-end', hide);
$.on('focus-address-results', focusResults);
$.on('document-clicked', onDocumentClick);
$.on('frame-focused', hide);

isReady = true;
}
Expand Down

0 comments on commit 48a32eb

Please sign in to comment.