From 7b19fea9163e514f5c32201938a0279d8bbba149 Mon Sep 17 00:00:00 2001 From: Shakeel Mohamed Date: Wed, 2 Mar 2016 01:29:38 -0800 Subject: [PATCH] Start work on #16 --- search-extension.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/search-extension.js b/search-extension.js index 2e9647a..fab17c3 100644 --- a/search-extension.js +++ b/search-extension.js @@ -7,11 +7,13 @@ chrome.omnibox.onInputChanged.addListener(function(text, suggest) { }); function navigate(url) { - chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { - chrome.tabs.update(tabs[0].id, {url: url}); - }); + chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { + chrome.tabs.update(tabs[0].id, {url: url}); + }); } chrome.omnibox.onInputEntered.addListener(function(text) { - navigate("https://zenplayer.audio?v=" + encodeURIComponent(text) ) + // TODO: lame hack, assume we're doing real search if we find a space + var param = text.indexOf(" ") ? "q=" : "v="; + navigate("https://zenplayer.audio?" + param + encodeURIComponent(text)); }); \ No newline at end of file