From e556eb6f7ca5c6e0db16c51f16a7519624ae80bf Mon Sep 17 00:00:00 2001 From: rituparno Date: Thu, 25 Oct 2018 12:49:36 +0530 Subject: [PATCH 1/2] Search directly on Wikipedia --- background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index f2fc661..b1a1b09 100644 --- a/background.js +++ b/background.js @@ -439,8 +439,10 @@ $(document).ready(function(){ if((idx = (txt.toLowerCase()).lastIndexOf("Wikipedia".toLowerCase())) !==-1) { Speech("I am searching this on wikipedia."); - //Code to search content directly on wikipedia. - // MEDIUM: 2 + txt.replace('Wikipedia',''); + if( ((txt.toLowerCase()).lastIndexOf("search".toLowerCase())) !==-1) + txt.replace('Search',''); + chrome.tabs.create({'url':'https://en.wikipedia.org/w/index.php?search='+txt}); } else if((idx = (txt.toLowerCase()).lastIndexOf("change background".toLowerCase())) !==-1) From ee5d944f14dd124b4a3e30221c851b286ffcfe71 Mon Sep 17 00:00:00 2001 From: rituparno Date: Thu, 1 Nov 2018 14:30:46 +0530 Subject: [PATCH 2/2] Corrected errors --- background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index b1a1b09..cf1c76c 100644 --- a/background.js +++ b/background.js @@ -439,9 +439,11 @@ $(document).ready(function(){ if((idx = (txt.toLowerCase()).lastIndexOf("Wikipedia".toLowerCase())) !==-1) { Speech("I am searching this on wikipedia."); - txt.replace('Wikipedia',''); + txt=txt.replace('Wikipedia',''); if( ((txt.toLowerCase()).lastIndexOf("search".toLowerCase())) !==-1) - txt.replace('Search',''); + txt=txt.replace('Search',''); + if( ((txt.toLowerCase()).lastIndexOf("on".toLowerCase())) !==-1) + txt=txt.replace('on',''); chrome.tabs.create({'url':'https://en.wikipedia.org/w/index.php?search='+txt}); }