Skip to content

Commit

Permalink
Add lucky search to omnibox
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsbfft committed Jan 16, 2017
1 parent e40db2d commit 83ad636
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/js/main/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Window(parameters) {
this.browser.loadURL('file://' + __dirname + '/src/html/index.html' + '#' + this.id);

// @if NODE_ENV='development'
this.browser.webContents.openDevTools();
// this.browser.webContents.openDevTools();
// @endif
}

Expand Down
19 changes: 16 additions & 3 deletions src/js/renderer/Omnibox.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,30 @@ Omnibox.prototype.onInputKeyDown = function(e) {

Omnibox.prototype.onInputKeyUp = function(e) {

if(e.keyCode == 9) {
// Tab
if(e.ctrlKey && e.keyCode == 13 && this.searchDictionary.direct) {

// Ctrl + Enter
var raw = this.input.value;
var url = this.searchDictionary.direct.replace('{query}', raw);
this.submitCallback(url);
e.preventDefault();
return;

}

if(e.keyCode == 13) {

// Enter
removeClass(this.input, 'highlight');
this.submit();
e.preventDefault();

}

if(e.key == "Escape") {
if(!Browser.isFirstLoad) this.hide()

if(!Browser.isFirstLoad) this.hide();

}

var customSearch = this.getCustomSearch();
Expand Down

0 comments on commit 83ad636

Please sign in to comment.