-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
61 lines (55 loc) · 2.19 KB
/
script.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
51
52
53
54
55
56
57
58
59
60
61
const buttons = document.querySelectorAll(".btn");
const times = document.querySelector(".times");
const glosbe_dict = document.querySelector(".glosbe_dict");
buttons.forEach((item) => {
item.addEventListener("click", function () {
const input = document.getElementById("input");
let inputValue = input.value;
const array = inputValue
.trim()
.split(/[^a-zA-z\u0401\u0451\u0410-\u044f]/g);
let temp = "";
let link = "";
temp = item.id;
if (input.value == "") {
return;
}
if (temp == "cambridge") {
link =
"https://dictionary.cambridge.org/dictionary/english-turkish/";
} else if (temp == "oxford") {
link =
"https://www.oxfordlearnersdictionaries.com/definition/english/";
} else if (temp == "glosbe") {
link = "https://tr.glosbe.com/ru/tr/";
} else if (temp == "trex") {
link = "https://tr-ex.me/translation/russian-english/";
} else if (temp == "wordreference") {
link = "https://www.wordreference.com/ruen/";
} else if (temp == "dictionary") {
link = "https://dictionary.reverso.net/russian-english/";
} else if (temp == "dict") {
link = "https://www.dict.com/rusca-turkce/";
} else if (temp == "glosbe_dict") {
const [temp1, temp2] = temp;
console.log(temp1, temp2);
} else if (temp == "scholar") {
link = "https://scholar.google.com/scholar?hl=tr&as_sdt=0%2C5&q=";
} else if (temp == "playphraseme") {
link = `https://www.playphrase.me/#/search?q=`;
}
for (let i = 0; i < array.length; i++) {
if (temp !== "glosbe_dict") {
window.open(link + array[i]);
} else if (temp == "scholar") {
window.open(link + array[i]);
} else {
window.open(`https://tr.glosbe.com/ru/tr/${array[i]}`);
window.open(`https://www.dict.com/rusca-turkce/${array[i]}`);
}
}
});
});
times.addEventListener("click", () => {
document.getElementById("input").value = "";
});