Correct behavior on firefox
This commit is contained in:
parent
ba16a7aa60
commit
1f5f00f82a
@ -1,22 +1,26 @@
|
||||
function switchSearch(tab) {
|
||||
const bingSearch = "https://www.bing.com/search?q=";
|
||||
const googleSearch = "https://www.google.com/search?q=";
|
||||
const bingSearch = "https://www.bing.com/search?";
|
||||
const googleSearch = "https://www.google.com/search?";
|
||||
|
||||
const bingImageSearch = "https://www.bing.com/images/search?q="
|
||||
const bingImageSearch = "https://www.bing.com/images/search?"
|
||||
const googleImageSearchSubstring = "&tbm=isch";
|
||||
const url = tab.url;
|
||||
|
||||
let newURL;
|
||||
let removeEngine;
|
||||
let searchStart;
|
||||
let searchEnd;
|
||||
let justSearch;
|
||||
//Handle bing searches
|
||||
//This is the way it should be done, TODO: Refactor rest of methods to be like this
|
||||
if (url.substring(0, bingSearch.length) === bingSearch) {
|
||||
removeEngine = url.slice(bingSearch.length);
|
||||
searchEnd = removeEngine.indexOf('&');
|
||||
justSearch = removeEngine.substring(0, searchEnd);
|
||||
searchStart = removeEngine.indexOf('&q=') + 3;
|
||||
justSearch = removeEngine.substring(searchStart);
|
||||
searchEnd = justSearch.indexOf('&');
|
||||
justSearch = justSearch.substring(0, searchEnd);
|
||||
|
||||
newURL = googleSearch + justSearch + '&';
|
||||
newURL = googleSearch + 'q=' +justSearch + '&';
|
||||
|
||||
}
|
||||
//Handle Google image searches
|
||||
|
Loading…
Reference in New Issue
Block a user