-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxach.html
127 lines (117 loc) · 4.66 KB
/
xach.html
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="dict.js"></script>
<link rel="stylesheet" href="style.css">
<title>ԽԱՉԲԱՌ</title>
<link rel="shortcut icon" type="x-icon" href="icon.png">
</head>
<body>
<div class="title">
<h1 >ԽԱՉԲԱՌ | v4 (08.2024)</h1>
<!-- <h4>© MillKeny 2023</h4> -->
<h2 id="hed"></h2>
<a href="dict.js" download target="_blank">Ներբեռնել Բառերի Ցանկը</a>
<br>
<input type="text" id="rifmi" placeholder="Ձեր Բառը" style="width: 500px;" class="search">
<!-- <input type="number" id="cnt" placeholder="Տողերի Քանակը" class="count"> -->
<br>
<div>
<button onclick="xach(document.getElementById('rifmi').value)" class="srchd" class="dropbtn">Գտնել</button>
<!-- <input type="checkbox" id="ankapv"> -->
<!-- <h3 class="srchd">Անկապ Հորինում</h3> -->
</div>
</div>
<h2 id="info" class="ftitle">Գրեք ձեր բառը</h2>
<h2 id="finded" class="ftitle">-</h2>
<script>
function setid(id, txt){
document.getElementById(id).innerHTML = txt;
}
function getid(id){
return document.getElementById(id).value
}
function knowid(id){
return document.getElementById(id)
}
bars = window.bars;
verbs = window.verbs;
nouns = window.nouns;
adjs = window.adjs;
bars.push(...verbs);
bars.push(...nouns);
bars.push(...adjs);
texts = window.texts;
setid("hed", "Պարունակում է " + bars.length + " Բառ");
var rnda = [];
var rndw = "";
function randome(arr){
return arr[Math.floor(Math.random()*arr.length)]
}
function replaceCharacter(string, index, replacement) {
return (
string.slice(0, index) +
replacement +
string.slice(index + replacement.length)
);
}
function xach(wrd){
wrd = wrd.toLowerCase();
for(var i = 0; i < wrd.length; i++){
if (wrd[i] === "ւ") wrd = wrd.substring(0, i - 1) + wrd.substring(i, wrd.length);
}
wrd = wrd.split('');
var clwrd = [];
var out = [];
var barsu = "";
for(var i = 0; i < wrd.length; i++){
if(wrd[i] != "-") clwrd.push(wrd[i]);
}
for(var i = 0; i < bars.length; i++){
barsu = bars[i];
for(var j = 0; j < barsu.length; j++){
if (barsu[j] === "ւ") barsu = barsu.substring(0, j - 1) + barsu.substring(j, barsu.length);
}
if(barsu.length == wrd.length){
var score = 0;
for(var j = 0; j < wrd.length; j++){
if(wrd[j] != "-") {
if(barsu[j] == wrd[j]) score++;
}
}
if(score == clwrd.length) out.push(bars[i]);
}
}
var outt = "";
for(i in out){
outt += '<a class="wiki" target="_blank" href="https://hy.wiktionary.org/wiki/' + out[i].toLowerCase() + '">' + out[i].toLowerCase() + '</a><br>';
}
setid("finded", outt)
setid("info", "Գտնվեց " + out.length + " բառ")
if(outt == "") {
setid("info", "Բառեր չգտնվեցին")
setid("finded", "-")
}
if(getid("rifmi") == "") {
setid("info", "Գրեք ձեր բառը")
setid("finded", "-")
}
$('.wiki').map(function() {
var id = this
getwiki(this.text, function(data) {
var out = '';
for(var y = 0; y < data.length; y++){
if(y != data.length-1) out += data[y] + " | ";
else out += data[y]
}
if(out != '') id.title = out;
else id.title = "Կտցրեք բառին, որպեսզի նայեք նրա էջը Wiktionary-ում";
});
});
}
</script>
</body>
</html>