word-games-theme 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/js/repeat-letters.js +4 -3
- data/assets/js/wordScrabble-test.js +432 -407
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311deae76947cafdf44ffa19ababd891b997cec42ee7bdb7bcd0a033a6cb081a
|
4
|
+
data.tar.gz: '080b33c982a3ffd87b66d3481a6f5d67b098d9a5317f96bc69b885b8458381f0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c7e7c68534841f2b6961e3c748a36821261e53394153628fe463681d04c3b900811748cfb19f5011ed0db5ba9918303023638f64a31d111cb23aef62f3a942
|
7
|
+
data.tar.gz: 218d035bb072da0476fe3d1c91553c8107cf3b0dfec1989987426002f73a5991eef664dd6fcde56e7417990e5baac19afeb128352d9f55771398e6d2e8e217ec
|
data/assets/js/repeat-letters.js
CHANGED
@@ -26,7 +26,7 @@ let dictionary = document.querySelector(".select_dropDown2");
|
|
26
26
|
var sortValue;
|
27
27
|
var sortBool = false;
|
28
28
|
let sortSelect = document.querySelector("#sort-select");
|
29
|
-
let serachValue = txtBox.value;
|
29
|
+
let serachValue = txtBox.value.toLowerCase();
|
30
30
|
let prefixValue = startsWith.value;
|
31
31
|
let containsValue = mustInclude.value;
|
32
32
|
let suffixValue = endsWith.value;
|
@@ -185,8 +185,8 @@ function getWords(data) {
|
|
185
185
|
main.innerHTML = "";
|
186
186
|
tab_container.innerHTML = "";
|
187
187
|
|
188
|
-
data = filterRepeatedWords(txtBox.value, data);
|
189
|
-
data = sortWords(data);
|
188
|
+
data = filterRepeatedWords(txtBox.value.toLowerCase(), data);
|
189
|
+
// data = sortWords(data);
|
190
190
|
if (data.length === 0) {
|
191
191
|
hideResultPageComponents();
|
192
192
|
errorMsg.innerHTML = "no words found";
|
@@ -292,6 +292,7 @@ function getWords(data) {
|
|
292
292
|
main.innerHTML += "";
|
293
293
|
} else {
|
294
294
|
newWordsLength += newdata.length;
|
295
|
+
newdata = sortWords(newdata);
|
295
296
|
const result = newdata.map((item) => {
|
296
297
|
// var text1 = serachValue.replace("?", "");
|
297
298
|
// var text2 = item;
|
@@ -1,371 +1,397 @@
|
|
1
1
|
/***************
|
2
2
|
SCRABBLER_JS
|
3
3
|
***************/
|
4
|
-
const getScript = document.currentScript
|
5
|
-
let form = document.querySelector(
|
6
|
-
let wordCount = document.querySelector(
|
7
|
-
let main = document.querySelector(
|
4
|
+
const getScript = document.currentScript;
|
5
|
+
let form = document.querySelector("#form");
|
6
|
+
let wordCount = document.querySelector(".wordCount");
|
7
|
+
let main = document.querySelector(".main");
|
8
8
|
// let loader = document.querySelector(".main-loader")
|
9
|
-
let errorMsg = document.querySelector(
|
10
|
-
let script = document.currentScript
|
9
|
+
let errorMsg = document.querySelector(".errorMsg");
|
10
|
+
let script = document.currentScript;
|
11
11
|
|
12
12
|
// getqueryUrl from form
|
13
|
-
const params = new URLSearchParams(window.location.search)
|
14
|
-
let serachValue = params.get(
|
15
|
-
let prefixValue = params.get(
|
16
|
-
let containsValue = params.get(
|
17
|
-
let suffixValue = params.get(
|
18
|
-
let exculdeValue = params.get(
|
19
|
-
let includeValue = params.get(
|
20
|
-
let lengthValue = params.get(
|
21
|
-
let dictonary = params.get(
|
13
|
+
const params = new URLSearchParams(window.location.search);
|
14
|
+
let serachValue = params.get("search").toLowerCase();
|
15
|
+
let prefixValue = params.get("prefix");
|
16
|
+
let containsValue = params.get("contains");
|
17
|
+
let suffixValue = params.get("suffix");
|
18
|
+
let exculdeValue = params.get("exculde");
|
19
|
+
let includeValue = params.get("include");
|
20
|
+
let lengthValue = params.get("length");
|
21
|
+
let dictonary = params.get("dictionary");
|
22
22
|
|
23
23
|
// advanced filter element grabs
|
24
|
-
let tick
|
25
|
-
let startsWith = document.getElementById(
|
26
|
-
let mustInclude = document.getElementById(
|
27
|
-
let endsWith = document.getElementById(
|
28
|
-
let exculdeWith = document.getElementById(
|
29
|
-
let inculdeWith = document.getElementById(
|
30
|
-
let wordLength = document.getElementById(
|
31
|
-
|
32
|
-
let ok = true
|
33
|
-
|
34
|
-
let tab_container = document.querySelector(
|
35
|
-
const siteUrl = getScript.dataset.url
|
36
|
-
var sortValue
|
37
|
-
var sortBool = false
|
38
|
-
|
39
|
-
|
40
|
-
|
24
|
+
let tick;
|
25
|
+
let startsWith = document.getElementById("startsWith");
|
26
|
+
let mustInclude = document.getElementById("mustInclude");
|
27
|
+
let endsWith = document.getElementById("endsWith");
|
28
|
+
let exculdeWith = document.getElementById("exculdeWith");
|
29
|
+
let inculdeWith = document.getElementById("inculdeWith");
|
30
|
+
let wordLength = document.getElementById("wordLength");
|
31
|
+
|
32
|
+
let ok = true;
|
33
|
+
|
34
|
+
let tab_container = document.querySelector(".tab_container");
|
35
|
+
const siteUrl = getScript.dataset.url;
|
36
|
+
var sortValue;
|
37
|
+
var sortBool = false;
|
38
|
+
|
39
|
+
let letterCloseButton = document.querySelector(
|
40
|
+
".letter-close-button-commonPage"
|
41
|
+
);
|
41
42
|
if (serachValue) {
|
42
|
-
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
43
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage");
|
43
44
|
}
|
44
45
|
letterCloseButton.addEventListener("click", () => {
|
45
|
-
txtBox.value = ""
|
46
|
-
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
47
|
-
})
|
46
|
+
txtBox.value = "";
|
47
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage");
|
48
|
+
});
|
48
49
|
|
50
|
+
let txtBox = document.querySelector(".txtBox");
|
51
|
+
txtBox.focus();
|
52
|
+
txtBox.value = serachValue;
|
49
53
|
|
50
|
-
|
51
|
-
txtBox.focus()
|
52
|
-
txtBox.value = serachValue
|
53
|
-
|
54
|
-
|
55
|
-
txtBox.addEventListener('input', (e) => {
|
54
|
+
txtBox.addEventListener("input", (e) => {
|
56
55
|
if (e.target.value === "") {
|
57
|
-
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
56
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage");
|
58
57
|
} else {
|
59
|
-
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
58
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage");
|
60
59
|
}
|
61
|
-
let rangeOfBlankTile = script.dataset.range
|
62
|
-
e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g,
|
63
|
-
if (rangeOfBlankTile ===
|
64
|
-
rangeOfBlankTile = 3
|
60
|
+
let rangeOfBlankTile = script.dataset.range;
|
61
|
+
e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "");
|
62
|
+
if (rangeOfBlankTile === "") {
|
63
|
+
rangeOfBlankTile = 3;
|
65
64
|
}
|
66
|
-
e.target.value = e.target.value.replace(/ /g,
|
67
|
-
let data = []
|
68
|
-
data = e.target.value.split(
|
65
|
+
e.target.value = e.target.value.replace(/ /g, "?");
|
66
|
+
let data = [];
|
67
|
+
data = e.target.value.split("").filter((i) => i === "?");
|
69
68
|
if (data.length > rangeOfBlankTile) {
|
70
|
-
e.target.value = e.target.value.replace(/\?$/,
|
69
|
+
e.target.value = e.target.value.replace(/\?$/, "");
|
71
70
|
}
|
72
|
-
})
|
73
|
-
|
71
|
+
});
|
74
72
|
|
75
73
|
function mobileScrollTop(x) {
|
76
74
|
if (x.matches) {
|
77
75
|
console.log(x.matches);
|
78
76
|
txtBox.addEventListener("click", () => {
|
79
|
-
document.documentElement.scrollTop = 350
|
77
|
+
document.documentElement.scrollTop = 350;
|
80
78
|
setTimeout(() => {
|
81
|
-
document.documentElement.scrollTop = 350
|
79
|
+
document.documentElement.scrollTop = 350;
|
82
80
|
}, 300);
|
83
|
-
})
|
81
|
+
});
|
84
82
|
} else {
|
85
83
|
console.log("false");
|
86
84
|
}
|
87
85
|
}
|
88
|
-
var x = window.matchMedia("(max-width: 768px)")
|
89
|
-
mobileScrollTop(x)
|
90
|
-
x.addListener(mobileScrollTop)
|
86
|
+
var x = window.matchMedia("(max-width: 768px)");
|
87
|
+
mobileScrollTop(x);
|
88
|
+
x.addListener(mobileScrollTop);
|
91
89
|
|
92
|
-
|
93
|
-
let
|
94
|
-
let quesMark = "?"
|
90
|
+
let rangeOfBlankTile = script.dataset.range;
|
91
|
+
let quesMark = "?";
|
95
92
|
|
96
93
|
if (rangeOfBlankTile) {
|
97
94
|
if (!serachValue.includes("?")) {
|
98
95
|
serachValue = serachValue + quesMark.repeat(rangeOfBlankTile); //
|
99
|
-
txtBox.value = serachValue
|
96
|
+
txtBox.value = serachValue;
|
100
97
|
}
|
101
98
|
}
|
102
99
|
|
103
|
-
let theSelect = document.getElementById(
|
100
|
+
let theSelect = document.getElementById("select_dropDown");
|
104
101
|
|
105
|
-
const sortup = document.querySelector(".sortup-icon")
|
106
|
-
let bool = false
|
102
|
+
const sortup = document.querySelector(".sortup-icon");
|
103
|
+
let bool = false;
|
107
104
|
sortup.addEventListener("click", () => {
|
108
105
|
if (bool) {
|
109
|
-
theSelect.size = 0
|
110
|
-
bool = false
|
111
|
-
theSelect.style.display = "none"
|
112
|
-
}
|
113
|
-
|
114
|
-
|
115
|
-
theSelect.
|
116
|
-
theSelect.style.display = "block"
|
106
|
+
theSelect.size = 0;
|
107
|
+
bool = false;
|
108
|
+
theSelect.style.display = "none";
|
109
|
+
} else {
|
110
|
+
bool = true;
|
111
|
+
theSelect.size = 3;
|
112
|
+
theSelect.style.display = "block";
|
117
113
|
}
|
118
|
-
})
|
119
|
-
document.querySelector(
|
114
|
+
});
|
115
|
+
document.querySelector(".select_dropDown2").value = dictonary;
|
120
116
|
const getDiff = (text1, text2) => {
|
121
|
-
var diffRange = []
|
122
|
-
var currentRange = undefined
|
117
|
+
var diffRange = [];
|
118
|
+
var currentRange = undefined;
|
123
119
|
for (var i = 0; i < text1.length; i++) {
|
124
120
|
if (text1[i] != text2[i]) {
|
125
121
|
if (currentRange == undefined) {
|
126
|
-
currentRange = [i]
|
122
|
+
currentRange = [i];
|
127
123
|
}
|
128
124
|
}
|
129
125
|
if (currentRange != undefined && text1[i] == text2[i]) {
|
130
|
-
currentRange.push(i)
|
131
|
-
diffRange.push(currentRange)
|
132
|
-
currentRange = undefined
|
126
|
+
currentRange.push(i);
|
127
|
+
diffRange.push(currentRange);
|
128
|
+
currentRange = undefined;
|
133
129
|
}
|
134
130
|
}
|
135
131
|
if (currentRange != undefined) {
|
136
|
-
currentRange.push(i)
|
137
|
-
diffRange.push(currentRange)
|
132
|
+
currentRange.push(i);
|
133
|
+
diffRange.push(currentRange);
|
138
134
|
}
|
139
|
-
return diffRange
|
140
|
-
}
|
141
|
-
|
142
|
-
|
135
|
+
return diffRange;
|
136
|
+
};
|
143
137
|
|
144
138
|
// getWords define...
|
145
139
|
const getData = async (serachValue) => {
|
146
140
|
try {
|
147
|
-
errorMsg.innerHTML = ""
|
148
|
-
wordCount.innerHTML = ""
|
149
|
-
let selectedDictionary = document.querySelector(
|
141
|
+
errorMsg.innerHTML = "";
|
142
|
+
wordCount.innerHTML = "";
|
143
|
+
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
150
144
|
main.innerHTML = `<div class="loader">
|
151
145
|
<img src='/assets/images/loading.gif'>
|
152
|
-
<div style="font-weight:900;font-size:14px" >Finding words - Powered by ${siteUrl.replace(
|
153
|
-
|
146
|
+
<div style="font-weight:900;font-size:14px" >Finding words - Powered by ${siteUrl.replace(
|
147
|
+
/^https?:\/\//,
|
148
|
+
""
|
149
|
+
)}</div>
|
150
|
+
</div>`;
|
154
151
|
/// loader
|
155
152
|
const response = await fetch(
|
156
153
|
`/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
|
157
|
-
)
|
158
|
-
const data = await response.json()
|
159
|
-
main.innerHTML =
|
160
|
-
getWords(data)
|
154
|
+
);
|
155
|
+
const data = await response.json();
|
156
|
+
main.innerHTML = "";
|
157
|
+
getWords(data);
|
161
158
|
//getWords calling...
|
162
159
|
} catch (error) {
|
163
|
-
console.log(error)
|
160
|
+
console.log(error);
|
164
161
|
}
|
165
|
-
}
|
162
|
+
};
|
166
163
|
//getData calling...
|
167
|
-
if (lengthValue ===
|
168
|
-
errorMsg.innerHTML =
|
164
|
+
if (lengthValue === "1") {
|
165
|
+
errorMsg.innerHTML = "words length should be more than 1";
|
169
166
|
} else {
|
170
|
-
getData(serachValue.toLowerCase())
|
167
|
+
getData(serachValue.toLowerCase());
|
171
168
|
function logSubmit(event) {
|
172
|
-
const scrollingElement =
|
173
|
-
scrollingElement.scroll({ top: 0, behavior:
|
169
|
+
const scrollingElement = document.scrollingElement || document.body;
|
170
|
+
scrollingElement.scroll({ top: 0, behavior: "smooth" });
|
174
171
|
if (rangeOfBlankTile) {
|
175
172
|
if (!txtBox.value.includes("?")) {
|
176
173
|
txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
|
177
174
|
}
|
178
175
|
}
|
179
176
|
|
180
|
-
let selectedDictionary = document.querySelector(
|
177
|
+
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
181
178
|
event.preventDefault();
|
182
179
|
if (history.pushState) {
|
183
|
-
var newurl =
|
184
|
-
window.location.
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
180
|
+
var newurl =
|
181
|
+
window.location.protocol +
|
182
|
+
"//" +
|
183
|
+
window.location.host +
|
184
|
+
window.location.pathname +
|
185
|
+
"?" +
|
186
|
+
"search" +
|
187
|
+
"=" +
|
188
|
+
txtBox.value.toLowerCase() +
|
189
|
+
"&" +
|
190
|
+
"dictionary" +
|
191
|
+
"=" +
|
192
|
+
selectedDictionary +
|
193
|
+
"&" +
|
194
|
+
"prefix" +
|
195
|
+
"=" +
|
196
|
+
startsWith.value +
|
197
|
+
"&" +
|
198
|
+
"contains" +
|
199
|
+
"=" +
|
200
|
+
mustInclude.value +
|
201
|
+
"&" +
|
202
|
+
"suffix" +
|
203
|
+
"=" +
|
204
|
+
endsWith.value +
|
205
|
+
"&" +
|
206
|
+
"exculde" +
|
207
|
+
"=" +
|
208
|
+
exculdeWith.value +
|
209
|
+
"&" +
|
210
|
+
"include" +
|
211
|
+
"=" +
|
212
|
+
inculdeWith.value +
|
213
|
+
"&" +
|
214
|
+
"length" +
|
215
|
+
"=" +
|
216
|
+
wordLength.value;
|
217
|
+
window.history.pushState({ path: newurl }, "", newurl);
|
218
|
+
|
219
|
+
const params = new URLSearchParams(window.location.search);
|
220
|
+
serachValue = params.get("search");
|
221
|
+
prefixValue = params.get("prefix");
|
222
|
+
containsValue = params.get("contains");
|
223
|
+
suffixValue = params.get("suffix");
|
224
|
+
exculdeValue = params.get("exculde");
|
225
|
+
includeValue = params.get("include");
|
226
|
+
lengthValue = params.get("length");
|
227
|
+
dictonary = params.get("dictionary");
|
228
|
+
|
229
|
+
gtag("event", "page_view", {
|
202
230
|
page_location: window.location.pathname + location.search,
|
203
|
-
})
|
231
|
+
});
|
204
232
|
}
|
205
|
-
getData(txtBox.value.toLowerCase())
|
206
|
-
addFilterCount()
|
207
|
-
|
233
|
+
getData(txtBox.value.toLowerCase());
|
234
|
+
addFilterCount();
|
208
235
|
}
|
209
236
|
|
210
|
-
let selectedDictionary = document.querySelector(
|
211
|
-
selectedDictionary.addEventListener("change", (
|
212
|
-
logSubmit(e)
|
213
|
-
})
|
214
|
-
applyBtn.addEventListener(
|
215
|
-
form.addEventListener(
|
237
|
+
let selectedDictionary = document.querySelector(".select_dropDown2");
|
238
|
+
selectedDictionary.addEventListener("change", (e) => {
|
239
|
+
logSubmit(e);
|
240
|
+
});
|
241
|
+
applyBtn.addEventListener("submit", logSubmit);
|
242
|
+
form.addEventListener("submit", logSubmit);
|
216
243
|
}
|
217
244
|
|
218
245
|
// getWords function define...
|
219
246
|
function getWords(data) {
|
220
|
-
main.innerHTML = ""
|
221
|
-
tab_container.innerHTML = ""
|
222
|
-
if (typeof data ===
|
223
|
-
errorMsg.innerHTML =
|
247
|
+
main.innerHTML = "";
|
248
|
+
tab_container.innerHTML = "";
|
249
|
+
if (typeof data === "string") {
|
250
|
+
errorMsg.innerHTML = "no words found";
|
224
251
|
wordCount.innerHTML = `<strong>Found 0 words with letters ${serachValue.split(
|
225
|
-
|
226
|
-
)}</strong
|
252
|
+
""
|
253
|
+
)}</strong>`;
|
227
254
|
} else {
|
228
|
-
let newWordsLength = 0
|
229
|
-
let dataArr = []
|
255
|
+
let newWordsLength = 0;
|
256
|
+
let dataArr = [];
|
230
257
|
for (let i = serachValue.length; i >= 1; i--) {
|
231
|
-
let newdata = data.filter((item) => item.length === i)
|
258
|
+
let newdata = data.filter((item) => item.length === i);
|
232
259
|
if (prefixValue) {
|
233
260
|
newdata = newdata.filter((item2) =>
|
234
261
|
item2.startsWith(prefixValue.toLowerCase())
|
235
|
-
)
|
236
|
-
startsWith.classList.add(
|
237
|
-
startsWith.value = prefixValue
|
262
|
+
);
|
263
|
+
startsWith.classList.add("tick");
|
264
|
+
startsWith.value = prefixValue;
|
238
265
|
} else {
|
239
|
-
startsWith.classList.remove(
|
266
|
+
startsWith.classList.remove("tick");
|
240
267
|
}
|
241
268
|
if (containsValue) {
|
242
269
|
newdata = newdata.filter((item) =>
|
243
270
|
item.includes(containsValue.toLowerCase())
|
244
|
-
)
|
245
|
-
mustInclude.classList.add(
|
246
|
-
mustInclude.value = containsValue
|
247
|
-
}
|
248
|
-
|
249
|
-
mustInclude.classList.remove('tick')
|
271
|
+
);
|
272
|
+
mustInclude.classList.add("tick");
|
273
|
+
mustInclude.value = containsValue;
|
274
|
+
} else {
|
275
|
+
mustInclude.classList.remove("tick");
|
250
276
|
}
|
251
277
|
if (suffixValue) {
|
252
278
|
newdata = newdata.filter((item) =>
|
253
279
|
item.endsWith(suffixValue.toLowerCase())
|
254
|
-
)
|
255
|
-
endsWith.classList.add(
|
256
|
-
endsWith.value = suffixValue
|
280
|
+
);
|
281
|
+
endsWith.classList.add("tick");
|
282
|
+
endsWith.value = suffixValue;
|
257
283
|
} else {
|
258
|
-
endsWith.classList.remove(
|
284
|
+
endsWith.classList.remove("tick");
|
259
285
|
}
|
260
286
|
if (exculdeValue) {
|
261
|
-
let data = []
|
287
|
+
let data = [];
|
262
288
|
newdata.map((item) => {
|
263
|
-
let check = false
|
289
|
+
let check = false;
|
264
290
|
for (let e = 0; e < exculdeValue.length; e++) {
|
265
|
-
const element = exculdeValue[e].toLowerCase()
|
291
|
+
const element = exculdeValue[e].toLowerCase();
|
266
292
|
if (item.includes(element)) {
|
267
|
-
check = true
|
268
|
-
break
|
293
|
+
check = true;
|
294
|
+
break;
|
269
295
|
} else {
|
270
|
-
check = false
|
296
|
+
check = false;
|
271
297
|
}
|
272
298
|
}
|
273
299
|
if (check === false) {
|
274
|
-
data.push(item)
|
300
|
+
data.push(item);
|
275
301
|
}
|
276
|
-
})
|
277
|
-
exculdeWith.classList.add(
|
278
|
-
exculdeWith.value = exculdeValue
|
279
|
-
newdata = data
|
302
|
+
});
|
303
|
+
exculdeWith.classList.add("tick");
|
304
|
+
exculdeWith.value = exculdeValue;
|
305
|
+
newdata = data;
|
280
306
|
} else {
|
281
|
-
exculdeWith.classList.remove(
|
307
|
+
exculdeWith.classList.remove("tick");
|
282
308
|
}
|
283
309
|
if (includeValue) {
|
284
|
-
let data = []
|
310
|
+
let data = [];
|
285
311
|
newdata.map((item) => {
|
286
|
-
let check = false
|
312
|
+
let check = false;
|
287
313
|
for (let e = 0; e < includeValue.length; e++) {
|
288
|
-
const element = includeValue[e].toLowerCase()
|
314
|
+
const element = includeValue[e].toLowerCase();
|
289
315
|
if (!item.includes(element)) {
|
290
|
-
check = true
|
291
|
-
break
|
316
|
+
check = true;
|
317
|
+
break;
|
292
318
|
} else {
|
293
|
-
check = false
|
319
|
+
check = false;
|
294
320
|
}
|
295
321
|
}
|
296
322
|
if (check === false) {
|
297
|
-
data.push(item)
|
323
|
+
data.push(item);
|
298
324
|
}
|
299
|
-
})
|
300
|
-
inculdeWith.classList.add(
|
301
|
-
inculdeWith.value = includeValue
|
302
|
-
newdata = data
|
325
|
+
});
|
326
|
+
inculdeWith.classList.add("tick");
|
327
|
+
inculdeWith.value = includeValue;
|
328
|
+
newdata = data;
|
303
329
|
} else {
|
304
|
-
inculdeWith.classList.remove(
|
330
|
+
inculdeWith.classList.remove("tick");
|
305
331
|
}
|
306
332
|
if (lengthValue) {
|
307
|
-
newdata = newdata.filter((item) => item.length == lengthValue)
|
308
|
-
wordLength.classList.add(
|
309
|
-
wordLength.value = lengthValue
|
333
|
+
newdata = newdata.filter((item) => item.length == lengthValue);
|
334
|
+
wordLength.classList.add("tick");
|
335
|
+
wordLength.value = lengthValue;
|
310
336
|
} else {
|
311
|
-
wordLength.classList.remove(
|
337
|
+
wordLength.classList.remove("tick");
|
312
338
|
}
|
313
339
|
if (newdata.length === 0) {
|
314
|
-
main.innerHTML +=
|
340
|
+
main.innerHTML += "";
|
315
341
|
} else {
|
316
|
-
newWordsLength += newdata.length
|
342
|
+
newWordsLength += newdata.length;
|
317
343
|
const result = newdata.map((item) => {
|
318
|
-
var text1 = serachValue.replace(
|
319
|
-
var text2 = item
|
320
|
-
var text3 = item
|
321
|
-
let chars = text1.split(
|
344
|
+
var text1 = serachValue.replace("?", "");
|
345
|
+
var text2 = item;
|
346
|
+
var text3 = item;
|
347
|
+
let chars = text1.split("");
|
322
348
|
|
323
|
-
let indexs = []
|
349
|
+
let indexs = [];
|
324
350
|
chars.map((i) => {
|
325
|
-
let findIndexes = findIndex(text3, i)
|
351
|
+
let findIndexes = findIndex(text3, i);
|
326
352
|
if (findIndexes.length > 0) {
|
327
|
-
text3 = text3.split(
|
328
|
-
text3[findIndexes] =
|
329
|
-
text3 = text3.join(
|
353
|
+
text3 = text3.split("");
|
354
|
+
text3[findIndexes] = "$";
|
355
|
+
text3 = text3.join("");
|
330
356
|
|
331
|
-
indexs = [...indexs, ...findIndexes]
|
357
|
+
indexs = [...indexs, ...findIndexes];
|
332
358
|
}
|
333
|
-
})
|
334
|
-
let itemHtml =
|
335
|
-
text2.split(
|
336
|
-
let check = indexs.find((i) => i === index)
|
359
|
+
});
|
360
|
+
let itemHtml = "";
|
361
|
+
text2.split("").map((itemValue, index) => {
|
362
|
+
let check = indexs.find((i) => i === index);
|
337
363
|
|
338
364
|
if (check !== undefined) {
|
339
|
-
itemHtml += `${itemValue}
|
365
|
+
itemHtml += `${itemValue}`;
|
340
366
|
} else {
|
341
|
-
itemHtml += `<span class='highlight'>${itemValue}</span
|
367
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`;
|
342
368
|
}
|
343
|
-
})
|
369
|
+
});
|
344
370
|
|
345
371
|
if (item.length === 1) {
|
346
|
-
ok = false
|
347
|
-
newWordsLength = newWordsLength - 1
|
372
|
+
ok = false;
|
373
|
+
newWordsLength = newWordsLength - 1;
|
348
374
|
} else {
|
349
|
-
let ScrabbleLetterScore = ScrabbleScore()
|
350
|
-
sum = 0
|
351
|
-
item = item.toLowerCase()
|
375
|
+
let ScrabbleLetterScore = ScrabbleScore();
|
376
|
+
sum = 0;
|
377
|
+
item = item.toLowerCase();
|
352
378
|
for (let i = 0; i < item.length; i++) {
|
353
|
-
sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
|
379
|
+
sum += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
|
354
380
|
}
|
355
|
-
dataArr.push(item)
|
381
|
+
dataArr.push(item);
|
356
382
|
return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.toLowerCase()}">
|
357
383
|
<li>${itemHtml}
|
358
384
|
<span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
|
359
|
-
</li></a
|
385
|
+
</li></a>`;
|
360
386
|
}
|
361
|
-
})
|
387
|
+
});
|
362
388
|
if (result[0] !== undefined) {
|
363
389
|
tab_container.innerHTML += `
|
364
390
|
<input type="button" id="Tab_${i}" onclick="Filtering(${i})" value="${i} Letter"
|
365
391
|
class="tab_link cursorPointer" />
|
366
|
-
|
367
|
-
let tabs = document.getElementsByClassName(
|
368
|
-
tabs[0] ? tabs[0].classList.add(
|
392
|
+
`;
|
393
|
+
let tabs = document.getElementsByClassName("tab_link");
|
394
|
+
tabs[0] ? tabs[0].classList.add("active-tab") : "";
|
369
395
|
main.innerHTML += `
|
370
396
|
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
371
397
|
<div class="wordListHeading">
|
@@ -373,119 +399,119 @@ function getWords(data) {
|
|
373
399
|
</div>
|
374
400
|
<div class="wordList">
|
375
401
|
<ul class="ul list-unstyled">
|
376
|
-
${result.join(
|
402
|
+
${result.join("")}
|
377
403
|
</ul>
|
378
404
|
</div>
|
379
405
|
</div>
|
380
|
-
|
406
|
+
`;
|
381
407
|
}
|
382
408
|
}
|
383
409
|
}
|
384
|
-
theSelect.addEventListener(
|
385
|
-
sortValue = theSelect[theSelect.selectedIndex].text
|
386
|
-
if (sortValue ==
|
387
|
-
sortBool = true
|
388
|
-
sortby(sortBool, dataArr)
|
410
|
+
theSelect.addEventListener("change", () => {
|
411
|
+
sortValue = theSelect[theSelect.selectedIndex].text;
|
412
|
+
if (sortValue == "Z-A") {
|
413
|
+
sortBool = true;
|
414
|
+
sortby(sortBool, dataArr);
|
389
415
|
} else {
|
390
|
-
sortBool = false
|
391
|
-
sortby(sortBool, dataArr)
|
416
|
+
sortBool = false;
|
417
|
+
sortby(sortBool, dataArr);
|
392
418
|
}
|
393
|
-
if (sortValue ==
|
394
|
-
sortBool = true
|
395
|
-
sortPointsby(sortBool, dataArr)
|
419
|
+
if (sortValue == "Points") {
|
420
|
+
sortBool = true;
|
421
|
+
sortPointsby(sortBool, dataArr);
|
396
422
|
}
|
397
|
-
})
|
398
|
-
sortValue = theSelect[theSelect.selectedIndex].text
|
399
|
-
if (sortValue ==
|
400
|
-
sortby(sortBool, dataArr)
|
423
|
+
});
|
424
|
+
sortValue = theSelect[theSelect.selectedIndex].text;
|
425
|
+
if (sortValue == "Z-A") {
|
426
|
+
sortby(sortBool, dataArr);
|
401
427
|
}
|
402
|
-
if (sortValue ==
|
403
|
-
sortPointsby(sortBool, dataArr)
|
428
|
+
if (sortValue == "Points") {
|
429
|
+
sortPointsby(sortBool, dataArr);
|
404
430
|
}
|
405
431
|
if (newWordsLength === 0) {
|
406
|
-
errorMsg.innerHTML =
|
432
|
+
errorMsg.innerHTML = "no words found";
|
407
433
|
} else {
|
408
434
|
wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split(
|
409
|
-
|
410
|
-
)}</strong
|
435
|
+
""
|
436
|
+
)}</strong>`;
|
411
437
|
}
|
412
438
|
}
|
413
439
|
}
|
414
440
|
|
415
441
|
// sorting by points
|
416
442
|
function sortPointsby(sortValue, data) {
|
417
|
-
main.innerHTML =
|
443
|
+
main.innerHTML = "";
|
418
444
|
if (sortValue) {
|
419
|
-
let newWordsLength = 0
|
445
|
+
let newWordsLength = 0;
|
420
446
|
for (let i = serachValue.length; i >= 1; i--) {
|
421
|
-
var newdata = data.filter((item) => item.length === i)
|
447
|
+
var newdata = data.filter((item) => item.length === i);
|
422
448
|
if (newdata.length === 0) {
|
423
|
-
main.innerHTML +=
|
449
|
+
main.innerHTML += "";
|
424
450
|
} else {
|
425
|
-
newWordsLength += newdata.length
|
426
|
-
var newArray = []
|
451
|
+
newWordsLength += newdata.length;
|
452
|
+
var newArray = [];
|
427
453
|
newdata.map((item) => {
|
428
454
|
if (item.length === 1) {
|
429
|
-
ok = false
|
430
|
-
newWordsLength = newWordsLength - 1
|
455
|
+
ok = false;
|
456
|
+
newWordsLength = newWordsLength - 1;
|
431
457
|
} else {
|
432
|
-
let ScrabbleLetterScore = ScrabbleScore()
|
433
|
-
let points = 0
|
434
|
-
item = item.toLowerCase()
|
458
|
+
let ScrabbleLetterScore = ScrabbleScore();
|
459
|
+
let points = 0;
|
460
|
+
item = item.toLowerCase();
|
435
461
|
for (let i = 0; i < item.length; i++) {
|
436
|
-
points += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
|
462
|
+
points += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
|
437
463
|
}
|
438
464
|
const value = {
|
439
465
|
words: item,
|
440
466
|
points: points,
|
441
|
-
}
|
442
|
-
newArray.push(value)
|
467
|
+
};
|
468
|
+
newArray.push(value);
|
443
469
|
}
|
444
|
-
})
|
470
|
+
});
|
445
471
|
|
446
472
|
newArray.sort(function (a, b) {
|
447
|
-
return b.points - a.points
|
448
|
-
})
|
473
|
+
return b.points - a.points;
|
474
|
+
});
|
449
475
|
const result = newArray.map((item) => {
|
450
|
-
var text1 = serachValue.replace(
|
451
|
-
var text2 = item.words
|
452
|
-
var text3 = item.words
|
476
|
+
var text1 = serachValue.replace("?", "");
|
477
|
+
var text2 = item.words;
|
478
|
+
var text3 = item.words;
|
453
479
|
function findIndex(str, char) {
|
454
|
-
const strLength = str.length
|
455
|
-
const indexes = []
|
456
|
-
let newStr = str
|
480
|
+
const strLength = str.length;
|
481
|
+
const indexes = [];
|
482
|
+
let newStr = str;
|
457
483
|
while (newStr && newStr.indexOf(char) > -1) {
|
458
|
-
indexes.push(newStr.indexOf(char) + strLength - newStr.length)
|
459
|
-
newStr = newStr.substring(newStr.indexOf(char) + 1)
|
460
|
-
newStr = newStr.substring(newStr.indexOf(char) + 1)
|
484
|
+
indexes.push(newStr.indexOf(char) + strLength - newStr.length);
|
485
|
+
newStr = newStr.substring(newStr.indexOf(char) + 1);
|
486
|
+
newStr = newStr.substring(newStr.indexOf(char) + 1);
|
461
487
|
}
|
462
|
-
return indexes
|
488
|
+
return indexes;
|
463
489
|
}
|
464
|
-
let chars = text1.split(
|
465
|
-
let indexs = []
|
490
|
+
let chars = text1.split("");
|
491
|
+
let indexs = [];
|
466
492
|
chars.map((i) => {
|
467
|
-
let findIndexes = findIndex(text3, i)
|
493
|
+
let findIndexes = findIndex(text3, i);
|
468
494
|
if (findIndexes.length > 0) {
|
469
|
-
text3 = text3.split(
|
470
|
-
text3[findIndexes] =
|
471
|
-
text3 = text3.join(
|
472
|
-
indexs = [...indexs, ...findIndexes]
|
495
|
+
text3 = text3.split("");
|
496
|
+
text3[findIndexes] = "$";
|
497
|
+
text3 = text3.join("");
|
498
|
+
indexs = [...indexs, ...findIndexes];
|
473
499
|
}
|
474
|
-
})
|
475
|
-
let itemHtml =
|
476
|
-
text2.split(
|
477
|
-
let check = indexs.find((i) => i === index)
|
500
|
+
});
|
501
|
+
let itemHtml = "";
|
502
|
+
text2.split("").map((itemValue, index) => {
|
503
|
+
let check = indexs.find((i) => i === index);
|
478
504
|
if (check !== undefined) {
|
479
|
-
itemHtml += `${itemValue}
|
505
|
+
itemHtml += `${itemValue}`;
|
480
506
|
} else {
|
481
|
-
itemHtml += `<span class='highlight'>${itemValue}</span
|
507
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`;
|
482
508
|
}
|
483
|
-
})
|
509
|
+
});
|
484
510
|
return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.words}">
|
485
511
|
<li>${itemHtml}
|
486
512
|
<span class="points" value="${item.points}" style="position:relative; top:4px; font-size:12px"> ${item.points}</span>
|
487
|
-
</li></a
|
488
|
-
})
|
513
|
+
</li></a>`;
|
514
|
+
});
|
489
515
|
|
490
516
|
main.innerHTML += `
|
491
517
|
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
@@ -494,11 +520,11 @@ function sortPointsby(sortValue, data) {
|
|
494
520
|
</div>
|
495
521
|
<div class="wordList">
|
496
522
|
<ul class="ul list-unstyled">
|
497
|
-
${result.join(
|
523
|
+
${result.join("")}
|
498
524
|
</ul>
|
499
525
|
</div>
|
500
526
|
</div>
|
501
|
-
|
527
|
+
`;
|
502
528
|
}
|
503
529
|
}
|
504
530
|
}
|
@@ -506,58 +532,58 @@ function sortPointsby(sortValue, data) {
|
|
506
532
|
// sort by aplhabets
|
507
533
|
function sortby(sortBool, data) {
|
508
534
|
if (sortBool) {
|
509
|
-
main.innerHTML =
|
510
|
-
data.reverse()
|
511
|
-
let newWordsLength = 0
|
535
|
+
main.innerHTML = "";
|
536
|
+
data.reverse();
|
537
|
+
let newWordsLength = 0;
|
512
538
|
for (let i = serachValue.length; i >= 1; i--) {
|
513
|
-
var newdata = data.filter((item) => item.length === i)
|
539
|
+
var newdata = data.filter((item) => item.length === i);
|
514
540
|
|
515
541
|
if (newdata.length === 0) {
|
516
|
-
main.innerHTML +=
|
542
|
+
main.innerHTML += "";
|
517
543
|
} else {
|
518
|
-
newWordsLength += newdata.length
|
544
|
+
newWordsLength += newdata.length;
|
519
545
|
|
520
546
|
const result = newdata.map((item) => {
|
521
|
-
var text1 = serachValue.replace(
|
522
|
-
var text2 = item
|
523
|
-
var text3 = item
|
524
|
-
let chars = text1.split(
|
525
|
-
let indexs = []
|
547
|
+
var text1 = serachValue.replace("?", "");
|
548
|
+
var text2 = item;
|
549
|
+
var text3 = item;
|
550
|
+
let chars = text1.split("");
|
551
|
+
let indexs = [];
|
526
552
|
chars.map((i) => {
|
527
|
-
let findIndexes = findIndex(text3, i)
|
553
|
+
let findIndexes = findIndex(text3, i);
|
528
554
|
if (findIndexes.length > 0) {
|
529
|
-
text3 = text3.split(
|
530
|
-
text3[findIndexes] =
|
531
|
-
text3 = text3.join(
|
532
|
-
indexs = [...indexs, ...findIndexes]
|
555
|
+
text3 = text3.split("");
|
556
|
+
text3[findIndexes] = "$";
|
557
|
+
text3 = text3.join("");
|
558
|
+
indexs = [...indexs, ...findIndexes];
|
533
559
|
}
|
534
|
-
})
|
535
|
-
let itemHtml =
|
536
|
-
text2.split(
|
537
|
-
let check = indexs.find((i) => i === index)
|
560
|
+
});
|
561
|
+
let itemHtml = "";
|
562
|
+
text2.split("").map((itemValue, index) => {
|
563
|
+
let check = indexs.find((i) => i === index);
|
538
564
|
if (check !== undefined) {
|
539
|
-
itemHtml += `${itemValue}
|
565
|
+
itemHtml += `${itemValue}`;
|
540
566
|
} else {
|
541
|
-
itemHtml += `<span class='highlight'>${itemValue}</span
|
567
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`;
|
542
568
|
}
|
543
|
-
})
|
569
|
+
});
|
544
570
|
if (item.length === 1) {
|
545
|
-
ok = false
|
546
|
-
newWordsLength = newWordsLength - 1
|
571
|
+
ok = false;
|
572
|
+
newWordsLength = newWordsLength - 1;
|
547
573
|
} else {
|
548
|
-
let ScrabbleLetterScore = ScrabbleScore()
|
549
|
-
let sum = 0
|
550
|
-
item = item.toLowerCase()
|
574
|
+
let ScrabbleLetterScore = ScrabbleScore();
|
575
|
+
let sum = 0;
|
576
|
+
item = item.toLowerCase();
|
551
577
|
for (let i = 0; i < item.length; i++) {
|
552
|
-
sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
|
578
|
+
sum += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
|
553
579
|
}
|
554
580
|
|
555
581
|
return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.toLowerCase()}">
|
556
582
|
<li>${itemHtml}
|
557
583
|
<span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
|
558
|
-
</li></a
|
584
|
+
</li></a>`;
|
559
585
|
}
|
560
|
-
})
|
586
|
+
});
|
561
587
|
|
562
588
|
main.innerHTML += `
|
563
589
|
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
@@ -566,61 +592,61 @@ function sortby(sortBool, data) {
|
|
566
592
|
</div>
|
567
593
|
<div class="wordList">
|
568
594
|
<ul class="ul list-unstyled">
|
569
|
-
${result.join(
|
595
|
+
${result.join("")}
|
570
596
|
</ul>
|
571
597
|
</div>
|
572
598
|
</div>
|
573
|
-
|
599
|
+
`;
|
574
600
|
}
|
575
601
|
}
|
576
602
|
} else {
|
577
|
-
main.innerHTML =
|
578
|
-
data.sort()
|
603
|
+
main.innerHTML = "";
|
604
|
+
data.sort();
|
579
605
|
for (let i = serachValue.length; i >= 1; i--) {
|
580
|
-
var newdata = data.filter((item) => item.length === i)
|
606
|
+
var newdata = data.filter((item) => item.length === i);
|
581
607
|
if (newdata.length === 0) {
|
582
|
-
main.innerHTML +=
|
608
|
+
main.innerHTML += "";
|
583
609
|
} else {
|
584
610
|
const result = newdata.map((item) => {
|
585
|
-
var text1 = serachValue.replace(
|
586
|
-
var text2 = item
|
587
|
-
var text3 = item
|
588
|
-
let chars = text1.split(
|
589
|
-
let indexs = []
|
611
|
+
var text1 = serachValue.replace("?", "");
|
612
|
+
var text2 = item;
|
613
|
+
var text3 = item;
|
614
|
+
let chars = text1.split("");
|
615
|
+
let indexs = [];
|
590
616
|
chars.map((i) => {
|
591
|
-
let findIndexes = findIndex(text3, i)
|
617
|
+
let findIndexes = findIndex(text3, i);
|
592
618
|
if (findIndexes.length > 0) {
|
593
|
-
text3 = text3.split(
|
594
|
-
text3[findIndexes] =
|
595
|
-
text3 = text3.join(
|
596
|
-
indexs = [...indexs, ...findIndexes]
|
619
|
+
text3 = text3.split("");
|
620
|
+
text3[findIndexes] = "$";
|
621
|
+
text3 = text3.join("");
|
622
|
+
indexs = [...indexs, ...findIndexes];
|
597
623
|
}
|
598
|
-
})
|
599
|
-
let itemHtml =
|
600
|
-
text2.split(
|
601
|
-
let check = indexs.find((i) => i === index)
|
624
|
+
});
|
625
|
+
let itemHtml = "";
|
626
|
+
text2.split("").map((itemValue, index) => {
|
627
|
+
let check = indexs.find((i) => i === index);
|
602
628
|
if (check !== undefined) {
|
603
|
-
itemHtml += `${itemValue}
|
629
|
+
itemHtml += `${itemValue}`;
|
604
630
|
} else {
|
605
|
-
itemHtml += `<span class='highlight'>${itemValue}</span
|
631
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`;
|
606
632
|
}
|
607
|
-
})
|
633
|
+
});
|
608
634
|
if (item.length === 1) {
|
609
|
-
ok = false
|
635
|
+
ok = false;
|
610
636
|
} else {
|
611
|
-
let ScrabbleLetterScore = ScrabbleScore()
|
612
|
-
let sum = 0
|
613
|
-
item = item.toLowerCase()
|
637
|
+
let ScrabbleLetterScore = ScrabbleScore();
|
638
|
+
let sum = 0;
|
639
|
+
item = item.toLowerCase();
|
614
640
|
for (let i = 0; i < item.length; i++) {
|
615
|
-
sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
|
641
|
+
sum += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
|
616
642
|
}
|
617
643
|
|
618
644
|
return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.toLowerCase()}">
|
619
645
|
<li>${itemHtml}
|
620
646
|
<span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
|
621
|
-
</li></a
|
647
|
+
</li></a>`;
|
622
648
|
}
|
623
|
-
})
|
649
|
+
});
|
624
650
|
main.innerHTML += `
|
625
651
|
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
626
652
|
<div class="wordListHeading">
|
@@ -628,11 +654,11 @@ function sortby(sortBool, data) {
|
|
628
654
|
</div>
|
629
655
|
<div class="wordList">
|
630
656
|
<ul class="ul list-unstyled">
|
631
|
-
${result.join(
|
657
|
+
${result.join("")}
|
632
658
|
</ul>
|
633
659
|
</div>
|
634
660
|
</div>
|
635
|
-
|
661
|
+
`;
|
636
662
|
}
|
637
663
|
}
|
638
664
|
}
|
@@ -667,7 +693,7 @@ const ScrabbleScore = () => {
|
|
667
693
|
x: 8,
|
668
694
|
q: 10,
|
669
695
|
z: 10,
|
670
|
-
}
|
696
|
+
};
|
671
697
|
|
672
698
|
let wwfScore = {
|
673
699
|
a: 1,
|
@@ -696,70 +722,69 @@ const ScrabbleScore = () => {
|
|
696
722
|
x: 8,
|
697
723
|
y: 3,
|
698
724
|
z: 10,
|
699
|
-
}
|
725
|
+
};
|
700
726
|
|
701
|
-
if (dictonary ===
|
702
|
-
return wwfScore
|
727
|
+
if (dictonary === "wwf") {
|
728
|
+
return wwfScore;
|
703
729
|
} else {
|
704
|
-
return twl06_sowpods
|
730
|
+
return twl06_sowpods;
|
705
731
|
}
|
706
|
-
}
|
732
|
+
};
|
707
733
|
//Handling of filter counter in advanced filter
|
708
734
|
function addFilterCount() {
|
709
|
-
let filter_val = document.getElementsByClassName(
|
710
|
-
let filter = document.querySelector(
|
711
|
-
let filter_count = 0
|
735
|
+
let filter_val = document.getElementsByClassName("filter_val");
|
736
|
+
let filter = document.querySelector(".filter_count");
|
737
|
+
let filter_count = 0;
|
712
738
|
|
713
|
-
filter_val[0].value = prefixValue
|
714
|
-
filter_val[1].value = containsValue
|
715
|
-
filter_val[2].value = suffixValue
|
716
|
-
filter_val[3].value = exculdeValue
|
717
|
-
filter_val[4].value = includeValue
|
718
|
-
filter_val[5].value = lengthValue
|
739
|
+
filter_val[0].value = prefixValue;
|
740
|
+
filter_val[1].value = containsValue;
|
741
|
+
filter_val[2].value = suffixValue;
|
742
|
+
filter_val[3].value = exculdeValue;
|
743
|
+
filter_val[4].value = includeValue;
|
744
|
+
filter_val[5].value = lengthValue;
|
719
745
|
|
720
746
|
for (var i = 0; i <= 5; i++) {
|
721
|
-
if (filter_val[i].value !=
|
722
|
-
filter_count += 1
|
747
|
+
if (filter_val[i].value != "") {
|
748
|
+
filter_count += 1;
|
723
749
|
}
|
724
750
|
if (filter_count === 0) {
|
725
|
-
filter.style.display =
|
751
|
+
filter.style.display = "none";
|
726
752
|
} else {
|
727
|
-
filter.style.display =
|
753
|
+
filter.style.display = "inline-block";
|
728
754
|
}
|
729
755
|
|
730
|
-
filter.innerHTML = filter_count
|
756
|
+
filter.innerHTML = filter_count;
|
731
757
|
}
|
732
758
|
}
|
733
|
-
addFilterCount()
|
759
|
+
addFilterCount();
|
734
760
|
|
735
761
|
// handling of filter on scroll
|
736
762
|
window.onscroll = function () {
|
737
|
-
var section = document.querySelectorAll(
|
738
|
-
let new_sections = {}
|
763
|
+
var section = document.querySelectorAll(".wordlistContainer");
|
764
|
+
let new_sections = {};
|
739
765
|
Array.prototype.forEach.call(section, function (e) {
|
740
766
|
if (document.body.clientWidth > 991) {
|
741
|
-
new_sections[e.id] = e.offsetTop - 10
|
767
|
+
new_sections[e.id] = e.offsetTop - 10;
|
742
768
|
} else {
|
743
|
-
new_sections[e.id] = e.offsetTop - 10
|
769
|
+
new_sections[e.id] = e.offsetTop - 10;
|
744
770
|
}
|
745
|
-
})
|
771
|
+
});
|
746
772
|
var scrollPosition =
|
747
|
-
document.documentElement.scrollTop || document.body.scrollTop
|
773
|
+
document.documentElement.scrollTop || document.body.scrollTop;
|
748
774
|
for (i in new_sections) {
|
749
|
-
let sort_val = document.querySelector(
|
775
|
+
let sort_val = document.querySelector(".sort-select").value;
|
750
776
|
if (
|
751
|
-
i.split(
|
777
|
+
i.split("_")[0] == sort_val &&
|
752
778
|
new_sections[i] &&
|
753
779
|
new_sections[i] <= scrollPosition
|
754
780
|
) {
|
755
|
-
document.querySelector(
|
756
|
-
var active_now = document.querySelector(
|
757
|
-
active_now.classList.add(
|
758
|
-
active_now.scrollIntoView({ block:
|
781
|
+
document.querySelector(".active-tab").classList.remove("active-tab");
|
782
|
+
var active_now = document.querySelector("#Tab_" + i.split("_")[1]);
|
783
|
+
active_now.classList.add("active-tab");
|
784
|
+
active_now.scrollIntoView({ block: "nearest" });
|
759
785
|
}
|
760
786
|
}
|
761
|
-
}
|
762
|
-
|
787
|
+
};
|
763
788
|
|
764
789
|
// Add Filtering
|
765
790
|
let sections = {};
|
@@ -791,51 +816,51 @@ function Filtering(id) {
|
|
791
816
|
}
|
792
817
|
|
793
818
|
// next && previous functionality
|
794
|
-
let prev = document.getElementById(
|
795
|
-
let next = document.getElementById(
|
819
|
+
let prev = document.getElementById("prev");
|
820
|
+
let next = document.getElementById("next");
|
796
821
|
|
797
822
|
if (prev) {
|
798
|
-
prev.onclick = scroll_Right
|
823
|
+
prev.onclick = scroll_Right;
|
799
824
|
}
|
800
825
|
if (next) {
|
801
|
-
next.onclick = scroll_Left
|
826
|
+
next.onclick = scroll_Left;
|
802
827
|
}
|
803
|
-
window.addEventListener(
|
804
|
-
scroll_visible()
|
805
|
-
})
|
806
|
-
window.addEventListener(
|
807
|
-
scroll_visible()
|
808
|
-
})
|
828
|
+
window.addEventListener("resize", function () {
|
829
|
+
scroll_visible();
|
830
|
+
});
|
831
|
+
window.addEventListener("scroll", function () {
|
832
|
+
scroll_visible();
|
833
|
+
});
|
809
834
|
function scroll_visible() {
|
810
|
-
let tab_container = document.querySelector(
|
835
|
+
let tab_container = document.querySelector("#tab-container");
|
811
836
|
if (tab_container) {
|
812
837
|
if (tab_container.clientWidth === tab_container.scrollWidth) {
|
813
|
-
prev.style.display =
|
814
|
-
next.style.display =
|
838
|
+
prev.style.display = "none";
|
839
|
+
next.style.display = "none";
|
815
840
|
} else {
|
816
|
-
prev.style.display =
|
817
|
-
next.style.display =
|
841
|
+
prev.style.display = "block";
|
842
|
+
next.style.display = "block";
|
818
843
|
}
|
819
844
|
}
|
820
845
|
}
|
821
|
-
scroll_visible()
|
846
|
+
scroll_visible();
|
822
847
|
|
823
848
|
function scroll_Left() {
|
824
|
-
tab_container.scrollLeft += 130
|
849
|
+
tab_container.scrollLeft += 130;
|
825
850
|
}
|
826
851
|
function scroll_Right() {
|
827
|
-
tab_container.scrollLeft -= 130
|
852
|
+
tab_container.scrollLeft -= 130;
|
828
853
|
}
|
829
854
|
function findIndex(str, char) {
|
830
|
-
const strLength = str.length
|
831
|
-
const indexes = []
|
832
|
-
let newStr = str
|
855
|
+
const strLength = str.length;
|
856
|
+
const indexes = [];
|
857
|
+
let newStr = str;
|
833
858
|
|
834
859
|
while (newStr && newStr.indexOf(char) > -1) {
|
835
|
-
indexes.push(newStr.indexOf(char) + strLength - newStr.length)
|
836
|
-
newStr = newStr.substring(newStr.indexOf(char) + 5)
|
837
|
-
newStr = newStr.substring(newStr.indexOf(char) + 5)
|
860
|
+
indexes.push(newStr.indexOf(char) + strLength - newStr.length);
|
861
|
+
newStr = newStr.substring(newStr.indexOf(char) + 5);
|
862
|
+
newStr = newStr.substring(newStr.indexOf(char) + 5);
|
838
863
|
}
|
839
864
|
|
840
|
-
return indexes
|
841
|
-
}
|
865
|
+
return indexes;
|
866
|
+
}
|