-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdropdown.js
51 lines (46 loc) · 1.71 KB
/
dropdown.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function gen_dropdown_list(search){
let dropdown_list = ['Google', 'DuckDuckGo', 'Bing', 'Qwant', 'Baidu', 'Google Scholar', 'Google Images', 'DuckDuckGo Images'];
dropdown_list = dropdown_list.filter(item => item !== search);
return dropdown_list;
};
function add_values_dropdown(search){
const dropdown = document.getElementById('BMdropdown');
const options = gen_dropdown_list(search);
dropdown.innerHTML = '';
options.forEach(optionValue => {
const option = document.createElement('option');
option.value = optionValue;
option.textContent = optionValue;
dropdown.appendChild(option);
});
};
function redirect_engine(engine, query){
switch(engine){
case "Google":
window.location.href = "https://www.google.com/search?q=" + query + "&num=100&start=0";
break;
case "DuckDuckGo":
window.location.href = "https://duckduckgo.com/?t=h_&q=" + query + "&ia=web";
break;
case "Bing":
window.location.href = "https://www.bing.com/search?q=" + query + "&first=0&count=30&FORM=PERE";
break;
case "Qwant":
window.location.href = "https://www.qwant.com/?l=fr&q=" + query + "&t=web";
break;
case "Baidu":
window.location.href = "https://www.baidu.com/s?wd=" + query + "&pn=0&rn=50";
break;
case "Google Scholar":
window.location.href = "https://scholar.google.com/scholar?q=" + query + "&hl=fr&num=20&start=0";
break;
case "Google Images":
window.location.href = "https://www.google.com/search?num=100&q=" + query + "&udm=2";
break;
case "DuckDuckGo Images":
window.location.href = "https://duckduckgo.com/?t=h_&q=" + query + "&iax=images&ia=images";
break;
default:
break;
}
};