word-games-theme 2.7.9 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/wordgames/search-box/search-box.html +1 -1
- data/_layouts/wordgames-home.html +1 -0
- data/assets/js/wordfinder.js +135 -358
- data/assets/js/wordgames-result.js +298 -452
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5df4720a7fc2541995554657951e55b1ba0de00e047f07048b89acbe1953a8e4
|
|
4
|
+
data.tar.gz: a2f908b9a172e07275569bbd709a75e38f9b5f2b28221e167fd6a0027a843be1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5450914e354f403c90239d934f315b2d1082c41dbda586942af093e233c475315b5564228c4311b58a76b13d8b4f73b82a036d1eb215a34fe14bfde76421683
|
|
7
|
+
data.tar.gz: cb5a93d653727f0feff0ff0be046b11f9ccef12eadd3d0d2fa2a9f5c345c946db796966343b9b7704cfb1690cfc903be04f05aebbca833d1201f5780a705777d
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
<div class="search-btn-container">
|
|
18
|
-
<
|
|
18
|
+
<button value="Search" type="submit" class="btn serachBtn" id="serach"></button>
|
|
19
19
|
</div>
|
|
20
20
|
<div class="dictonaryDropdown">
|
|
21
21
|
<select class="form-select select_dropDown2" name="dictionary" aria-label="Default select example">
|
data/assets/js/wordfinder.js
CHANGED
|
@@ -49,6 +49,7 @@ sortup.addEventListener("click", () => {
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
document.querySelector(".select_dropDown2").value = dictonary;
|
|
52
|
+
|
|
52
53
|
const getDiff = (text1, text2) => {
|
|
53
54
|
var diffRange = [];
|
|
54
55
|
var currentRange = undefined;
|
|
@@ -70,28 +71,18 @@ const getDiff = (text1, text2) => {
|
|
|
70
71
|
}
|
|
71
72
|
return diffRange;
|
|
72
73
|
};
|
|
73
|
-
|
|
74
74
|
let authorsLists = document.querySelector(".authors-list")
|
|
75
75
|
let serachBtn = document.querySelector(".serachBtn")
|
|
76
76
|
let searchBtnContainer = document.querySelector(".search-btn-container")
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
fetch('/.netlify/functions/helloWorld')
|
|
80
|
-
.then(response => response.json())
|
|
81
|
-
.then(data => {
|
|
82
|
-
console.log(data);
|
|
83
|
-
})
|
|
84
|
-
.catch(error => {
|
|
85
|
-
console.error(error);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
|
|
89
78
|
// getWords define...
|
|
79
|
+
const worker = new Worker('wordfinder-worker.js');
|
|
90
80
|
const getData = async (serachValue) => {
|
|
91
81
|
try {
|
|
92
82
|
document.querySelector(".main-header").style.background = "#fff"
|
|
93
83
|
document.querySelector(".heading-h2").style.display = "none"
|
|
94
84
|
document.querySelector(".sortingFilters").style.display = "none"
|
|
85
|
+
|
|
95
86
|
if (featureContainer) {
|
|
96
87
|
featureContainer.remove()
|
|
97
88
|
}
|
|
@@ -107,10 +98,11 @@ const getData = async (serachValue) => {
|
|
|
107
98
|
if (authorsLists) {
|
|
108
99
|
authorsLists.remove()
|
|
109
100
|
}
|
|
101
|
+
|
|
110
102
|
errorMsg.innerHTML = "";
|
|
111
103
|
wordCount.innerHTML = "";
|
|
112
|
-
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
|
113
104
|
|
|
105
|
+
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
|
114
106
|
serachBtn.style.background = 'url(/assets/images/spinner.gif) no-repeat center center';
|
|
115
107
|
|
|
116
108
|
main.innerHTML = `<main class="placeholder-loader">
|
|
@@ -142,27 +134,18 @@ const getData = async (serachValue) => {
|
|
|
142
134
|
</ul>
|
|
143
135
|
</main>`;
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
worker.postMessage({
|
|
138
|
+
type: "api",
|
|
139
|
+
serachValue: serachValue,
|
|
140
|
+
selectedDictionary: selectedDictionary,
|
|
141
|
+
endpoint: `/.netlify/functions`
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
worker.onmessage = (event) => {
|
|
145
|
+
main.innerHTML = "";
|
|
146
|
+
serachBtn.style.background = 'url(/assets/images/search.svg) no-repeat center center';
|
|
147
|
+
getWords(event.data.data);
|
|
154
148
|
}
|
|
155
|
-
const endTime = performance.now();
|
|
156
|
-
const duration = endTime - startTime;
|
|
157
|
-
console.log(`API response time: ${duration} milliseconds`);
|
|
158
|
-
console.log('this is hashing apporch!');
|
|
159
|
-
|
|
160
|
-
const data = await response.json();
|
|
161
|
-
console.log(data);
|
|
162
|
-
main.innerHTML = "";
|
|
163
|
-
serachBtn.style.background = 'url(/assets/images/search.svg) no-repeat center center';
|
|
164
|
-
getWords(data);
|
|
165
|
-
//getWords calling...
|
|
166
149
|
} catch (error) {
|
|
167
150
|
console.log(error);
|
|
168
151
|
}
|
|
@@ -175,12 +158,6 @@ if (lengthValue === "1") {
|
|
|
175
158
|
document.querySelector(".fillterWrapper").classList.add("hide")
|
|
176
159
|
const scrollingElement = document.scrollingElement || document.body;
|
|
177
160
|
scrollingElement.scroll({ top: 0, behavior: "smooth" });
|
|
178
|
-
// if (rangeOfBlankTile) {
|
|
179
|
-
// if (!txtBox.value.includes("?")) {
|
|
180
|
-
// txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
|
|
181
|
-
// }
|
|
182
|
-
// }
|
|
183
|
-
|
|
184
161
|
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
|
185
162
|
event.preventDefault();
|
|
186
163
|
if (history.pushState) {
|
|
@@ -238,18 +215,15 @@ if (lengthValue === "1") {
|
|
|
238
215
|
});
|
|
239
216
|
}
|
|
240
217
|
getData(txtBox.value.toLowerCase());
|
|
241
|
-
// addFilterCount();
|
|
242
218
|
}
|
|
243
219
|
let selectedDictionary = document.querySelector(".select_dropDown2");
|
|
244
220
|
selectedDictionary.addEventListener("change", (e) => {
|
|
245
221
|
logSubmit(e);
|
|
246
222
|
});
|
|
247
|
-
// applyBtn.addEventListener("submit", logSubmit);
|
|
248
223
|
form.addEventListener("submit", logSubmit);
|
|
249
224
|
sortingFilter.addEventListener("change", logSubmit);
|
|
250
225
|
}
|
|
251
226
|
|
|
252
|
-
|
|
253
227
|
let previousDataIndex = null
|
|
254
228
|
let previousID = null;
|
|
255
229
|
let storepreviousIndex = []
|
|
@@ -261,194 +235,78 @@ function getWords(data) {
|
|
|
261
235
|
storepreviousIndex = []
|
|
262
236
|
main.innerHTML = "";
|
|
263
237
|
lengthSelect.innerHTML = ""
|
|
264
|
-
document.querySelector(".sortingFilters").style.display = "flex"
|
|
265
238
|
if (typeof data === "string") {
|
|
266
239
|
errorMsg.innerHTML = "no words found";
|
|
267
|
-
wordCount.innerHTML = `<strong>Found 0 words with letters ${serachValue.split(
|
|
268
|
-
""
|
|
269
|
-
)}</strong>`;
|
|
270
240
|
} else {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
newdata = newdata.filter((item) =>
|
|
290
|
-
item.includes(containsValue.toLowerCase())
|
|
291
|
-
);
|
|
292
|
-
mustInclude.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
293
|
-
mustInclude.nextElementSibling.removeAttribute("data-tip")
|
|
294
|
-
mustInclude.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
|
295
|
-
mustInclude.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
|
296
|
-
mustInclude.classList.add("tick");
|
|
297
|
-
mustInclude.value = containsValue;
|
|
298
|
-
} else {
|
|
299
|
-
mustInclude.classList.remove("tick");
|
|
300
|
-
}
|
|
301
|
-
if (suffixValue) {
|
|
302
|
-
newdata = newdata.filter((item) =>
|
|
303
|
-
item.endsWith(suffixValue.toLowerCase())
|
|
304
|
-
);
|
|
305
|
-
endsWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
306
|
-
endsWith.nextElementSibling.removeAttribute("data-tip")
|
|
307
|
-
endsWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
|
308
|
-
endsWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
|
309
|
-
endsWith.classList.add("tick");
|
|
310
|
-
endsWith.value = suffixValue;
|
|
311
|
-
} else {
|
|
312
|
-
endsWith.classList.remove("tick");
|
|
313
|
-
}
|
|
314
|
-
if (exculdeValue) {
|
|
315
|
-
let data = [];
|
|
316
|
-
newdata.map((item) => {
|
|
317
|
-
let check = false;
|
|
318
|
-
for (let e = 0; e < exculdeValue.length; e++) {
|
|
319
|
-
const element = exculdeValue[e].toLowerCase();
|
|
320
|
-
if (item.includes(element)) {
|
|
321
|
-
check = true;
|
|
322
|
-
break;
|
|
323
|
-
} else {
|
|
324
|
-
check = false;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (check === false) {
|
|
328
|
-
data.push(item);
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
exculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
332
|
-
exculdeWith.nextElementSibling.removeAttribute("data-tip")
|
|
333
|
-
exculdeWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
|
334
|
-
exculdeWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
|
335
|
-
exculdeWith.classList.add("tick");
|
|
336
|
-
exculdeWith.value = exculdeValue;
|
|
337
|
-
newdata = data;
|
|
338
|
-
} else {
|
|
339
|
-
exculdeWith.classList.remove("tick");
|
|
340
|
-
}
|
|
341
|
-
if (includeValue) {
|
|
342
|
-
let data = [];
|
|
343
|
-
newdata.map((item) => {
|
|
344
|
-
let check = false;
|
|
345
|
-
for (let e = 0; e < includeValue.length; e++) {
|
|
346
|
-
const element = includeValue[e].toLowerCase();
|
|
347
|
-
if (!item.includes(element)) {
|
|
348
|
-
check = true;
|
|
349
|
-
break;
|
|
350
|
-
} else {
|
|
351
|
-
check = false;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (check === false) {
|
|
355
|
-
data.push(item);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
inculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
359
|
-
inculdeWith.nextElementSibling.removeAttribute("data-tip")
|
|
360
|
-
inculdeWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
|
361
|
-
inculdeWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
|
362
|
-
inculdeWith.classList.add("tick");
|
|
363
|
-
inculdeWith.value = includeValue;
|
|
364
|
-
newdata = data;
|
|
365
|
-
} else {
|
|
366
|
-
inculdeWith.classList.remove("tick");
|
|
367
|
-
}
|
|
368
|
-
if (lengthValue) {
|
|
369
|
-
newdata = newdata.filter((item) => item.length == lengthValue);
|
|
370
|
-
wordLength.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
371
|
-
wordLength.nextElementSibling.removeAttribute("data-tip")
|
|
372
|
-
wordLength.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
|
373
|
-
wordLength.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
|
374
|
-
wordLength.classList.add("tick");
|
|
375
|
-
wordLength.value = lengthValue;
|
|
376
|
-
} else {
|
|
377
|
-
wordLength.classList.remove("tick");
|
|
378
|
-
}
|
|
379
|
-
if (newdata.length === 0) {
|
|
380
|
-
main.innerHTML += "";
|
|
381
|
-
} else {
|
|
382
|
-
newWordsLength += newdata.length;
|
|
383
|
-
newdata = sortWords(newdata);
|
|
241
|
+
worker.postMessage({
|
|
242
|
+
type: 'filterwords',
|
|
243
|
+
data: data,
|
|
244
|
+
serachValue: serachValue,
|
|
245
|
+
prefixValue: prefixValue,
|
|
246
|
+
containsValue: containsValue,
|
|
247
|
+
suffixValue: suffixValue,
|
|
248
|
+
exculdeValue: exculdeValue,
|
|
249
|
+
includeValue: includeValue,
|
|
250
|
+
lengthValue: lengthValue,
|
|
251
|
+
sortingFilter: sortingFilter.selectedIndex,
|
|
252
|
+
dictonary: dictonary
|
|
253
|
+
});
|
|
254
|
+
worker.onmessage = (event) => {
|
|
255
|
+
if (event.data.type === "filterwords") {
|
|
256
|
+
errorMsg.innerHTML = ""
|
|
257
|
+
document.querySelector(".sortingFilters").style.display = "flex"
|
|
258
|
+
let { prefixValue, containsValue, suffixValue, exculdeValue, includeValue, lengthValue, newdata, i, newWordsLength, result } = event.data
|
|
384
259
|
moreData.push(newdata)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
260
|
+
if (prefixValue) {
|
|
261
|
+
startsWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
262
|
+
startsWith.classList.add("tick");
|
|
263
|
+
startsWith.value = prefixValue;
|
|
264
|
+
}
|
|
265
|
+
if (suffixValue) {
|
|
266
|
+
endsWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
267
|
+
endsWith.classList.add("tick");
|
|
268
|
+
endsWith.value = suffixValue;
|
|
269
|
+
}
|
|
270
|
+
if (containsValue) {
|
|
271
|
+
mustInclude.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
272
|
+
mustInclude.classList.add("tick");
|
|
273
|
+
mustInclude.value = containsValue;
|
|
274
|
+
}
|
|
275
|
+
if (lengthValue) {
|
|
276
|
+
wordLength.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
277
|
+
wordLength.classList.add("tick");
|
|
278
|
+
wordLength.value = lengthValue;
|
|
279
|
+
}
|
|
280
|
+
if (exculdeValue) {
|
|
281
|
+
exculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
282
|
+
exculdeWith.classList.add("tick");
|
|
283
|
+
exculdeWith.value = exculdeValue;
|
|
284
|
+
}
|
|
285
|
+
if (includeValue) {
|
|
286
|
+
inculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
|
287
|
+
inculdeWith.classList.add("tick");
|
|
288
|
+
inculdeWith.value = includeValue;
|
|
289
|
+
}
|
|
290
|
+
if (newdata.length === 0) {
|
|
291
|
+
main.innerHTML += "";
|
|
292
|
+
} else {
|
|
293
|
+
if (result[0] !== undefined) {
|
|
294
|
+
if (wordLength.value) {
|
|
295
|
+
lengthSelect.style.display = "none"
|
|
296
|
+
} else {
|
|
297
|
+
var option = document.createElement("option");
|
|
298
|
+
option.text = `${i} Letter`;
|
|
299
|
+
option.value = i;
|
|
300
|
+
lengthSelect.setAttribute("onchange", `Filtering(${i})`)
|
|
301
|
+
lengthSelect.add(option);
|
|
302
|
+
lengthSelect.style.display = "block"
|
|
422
303
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
<
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
`;
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
if (result[0] !== undefined) {
|
|
433
|
-
if (wordLength.value) {
|
|
434
|
-
lengthSelect.style.display = "none"
|
|
435
|
-
} else {
|
|
436
|
-
var option = document.createElement("option");
|
|
437
|
-
option.text = `${i} Letter`;
|
|
438
|
-
option.value = i;
|
|
439
|
-
lengthSelect.setAttribute("onchange", `Filtering(${i})`)
|
|
440
|
-
lengthSelect.add(option);
|
|
441
|
-
lengthSelect.style.display = "block"
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
result = result.slice(0, 25)
|
|
445
|
-
|
|
446
|
-
main.innerHTML += `
|
|
447
|
-
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
|
448
|
-
<h3 class="wordListHeading lead">${i} Letter Words</h3>
|
|
449
|
-
<div class="wordList">${result.join("")}</div>
|
|
450
|
-
<div class="w-100 text-center btn-container">
|
|
451
|
-
<button
|
|
304
|
+
main.innerHTML += `
|
|
305
|
+
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
|
306
|
+
<h3 class="wordListHeading lead">${i} Letter Words</h3>
|
|
307
|
+
<div class="wordList">${result.join("")}</div>
|
|
308
|
+
<div class="w-100 text-center btn-container">
|
|
309
|
+
<button
|
|
452
310
|
style="background: black;
|
|
453
311
|
padding: 1rem 2rem;
|
|
454
312
|
border-radius: 50px;
|
|
@@ -456,57 +314,57 @@ function getWords(data) {
|
|
|
456
314
|
font-size: 15px;
|
|
457
315
|
border: none;"
|
|
458
316
|
onclick="showMoreWords(this)" type="button" class="my-4 showmore_btn" id="${i}">More Words</button>
|
|
459
|
-
|
|
460
|
-
|
|
317
|
+
</div>
|
|
318
|
+
</div>`
|
|
319
|
+
showMoreLimit()
|
|
461
320
|
|
|
462
|
-
|
|
321
|
+
}
|
|
463
322
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
323
|
+
if (newWordsLength === 0) {
|
|
324
|
+
errorMsg.innerHTML = "No Words Found";
|
|
325
|
+
document.querySelector(".sortingFilters").style.display = "none"
|
|
326
|
+
} else {
|
|
327
|
+
if (serachValue) {
|
|
328
|
+
wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split("")}</strong>`;
|
|
329
|
+
} else {
|
|
330
|
+
let startwithMsg = ""
|
|
331
|
+
let endwithMsg = ""
|
|
332
|
+
let containsMsg = ""
|
|
333
|
+
let lengthMsg = ""
|
|
334
|
+
let inputVal = ""
|
|
335
|
+
if (serachValue) {
|
|
336
|
+
inputVal = `${input.value.split("")} `
|
|
337
|
+
}
|
|
338
|
+
if (prefixValue) {
|
|
339
|
+
startwithMsg = `starting with ${prefixValue.split("")}`
|
|
340
|
+
}
|
|
341
|
+
if (suffixValue) {
|
|
342
|
+
endwithMsg = `ending with ${suffixValue.split("")} `
|
|
343
|
+
}
|
|
344
|
+
if (containsValue) {
|
|
345
|
+
containsMsg = `containing with ${containsValue.split("")} `
|
|
346
|
+
}
|
|
347
|
+
if (lengthValue) {
|
|
348
|
+
lengthMsg = `with ${lengthValue} letter words`
|
|
349
|
+
}
|
|
350
|
+
let msg = `<strong> Found ${newWordsLength} words with letters
|
|
351
|
+
${lengthMsg} ${inputVal} ${startwithMsg} ${endwithMsg} ${containsMsg} </strong>`
|
|
469
352
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split("")}</strong>`;
|
|
473
|
-
} else {
|
|
474
|
-
|
|
475
|
-
let startwithMsg = ""
|
|
476
|
-
let endwithMsg = ""
|
|
477
|
-
let containsMsg = ""
|
|
478
|
-
let lengthMsg = ""
|
|
479
|
-
let inputVal = ""
|
|
480
|
-
if (serachValue) {
|
|
481
|
-
inputVal = `${input.value.split("")} `
|
|
482
|
-
}
|
|
483
|
-
if (prefixValue) {
|
|
484
|
-
startwithMsg = `starting with ${prefixValue.split("")}`
|
|
485
|
-
}
|
|
486
|
-
if (suffixValue) {
|
|
487
|
-
endwithMsg = `ending with ${suffixValue.split("")} `
|
|
488
|
-
}
|
|
489
|
-
if (containsValue) {
|
|
490
|
-
containsMsg = `containing with ${containsValue.split("")} `
|
|
491
|
-
}
|
|
492
|
-
if (lengthValue) {
|
|
493
|
-
lengthMsg = `with ${lengthValue} letter words`
|
|
353
|
+
wordCount.innerHTML = `${msg} `
|
|
354
|
+
}
|
|
494
355
|
}
|
|
495
|
-
let msg = `<strong> Found ${newWordsLength} words with letters
|
|
496
|
-
${lengthMsg} ${inputVal} ${startwithMsg} ${endwithMsg} ${containsMsg} </strong>`
|
|
497
356
|
|
|
498
|
-
|
|
357
|
+
|
|
499
358
|
}
|
|
500
359
|
}
|
|
501
360
|
}
|
|
502
361
|
}
|
|
362
|
+
|
|
503
363
|
async function getMoreWords() {
|
|
504
364
|
let flattenedArray = moreData.flat();
|
|
505
|
-
let uniqueArray = [...new Set(flattenedArray)]
|
|
506
|
-
// console.log(uniqueArray);
|
|
365
|
+
let uniqueArray = [...new Set(flattenedArray)];;
|
|
507
366
|
return uniqueArray
|
|
508
367
|
}
|
|
509
|
-
|
|
510
368
|
async function showMoreWords(e) {
|
|
511
369
|
try {
|
|
512
370
|
let showmore = e.parentElement.children[0];
|
|
@@ -514,15 +372,12 @@ async function showMoreWords(e) {
|
|
|
514
372
|
|
|
515
373
|
if (previousID !== null && parseInt(previousID) !== parseInt(id)) {
|
|
516
374
|
data_index = 25
|
|
517
|
-
console.log(storepreviousIndex);
|
|
518
375
|
const filteredIndexes = storepreviousIndex.filter(item => item.id === id);
|
|
519
376
|
if (filteredIndexes.length > 0) {
|
|
520
377
|
const lastItem = filteredIndexes[filteredIndexes.length - 1];
|
|
521
378
|
data_index = lastItem.data_index + 25;
|
|
522
379
|
lastItem.data_index = data_index;
|
|
523
380
|
}
|
|
524
|
-
console.log(filteredIndexes);
|
|
525
|
-
|
|
526
381
|
}
|
|
527
382
|
previousID = id;
|
|
528
383
|
storepreviousIndex.push({
|
|
@@ -598,60 +453,9 @@ async function showMoreWords(e) {
|
|
|
598
453
|
}
|
|
599
454
|
}
|
|
600
455
|
|
|
601
|
-
function showMoreLimit() {
|
|
602
|
-
let tableFooter = document.querySelectorAll(".btn-container")
|
|
603
|
-
let showmore = document.querySelectorAll(".showmore_btn");
|
|
604
|
-
for (let i = 0; i < showmore.length; i++) {
|
|
605
|
-
let data_of_button = document.getElementById("alpha_" + showmore[i].getAttribute("id"));
|
|
606
|
-
let final_data = data_of_button.getElementsByClassName("anchor__style");
|
|
607
|
-
if (final_data.length < 25) {
|
|
608
|
-
tableFooter[i].style.display = "none";
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function sortWords(data) {
|
|
613
|
-
if (sortingFilter.selectedIndex == 0) {
|
|
614
|
-
return data;
|
|
615
|
-
} else if (sortingFilter.selectedIndex == 1) {
|
|
616
|
-
return data.sort();
|
|
617
|
-
} else if (sortingFilter.selectedIndex == 2) {
|
|
618
|
-
return data.reverse();
|
|
619
|
-
} else if (sortingFilter.selectedIndex == 3) {
|
|
620
|
-
var tempArr = [];
|
|
621
|
-
var newArray = [];
|
|
622
|
-
data.map((item) => {
|
|
623
|
-
let newWordsLength = 0;
|
|
624
|
-
if (item.length === 1) {
|
|
625
|
-
ok = false;
|
|
626
|
-
newWordsLength = newWordsLength - 1;
|
|
627
|
-
} else {
|
|
628
|
-
let ScrabbleLetterScore = ScrabbleScore();
|
|
629
|
-
let points = 0;
|
|
630
|
-
item = item.toLowerCase();
|
|
631
|
-
for (let i = 0; i < item.length; i++) {
|
|
632
|
-
points += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
|
|
633
|
-
}
|
|
634
|
-
const value = {
|
|
635
|
-
words: item,
|
|
636
|
-
points: points,
|
|
637
|
-
};
|
|
638
|
-
newArray.push(value);
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
newArray.sort(function (a, b) {
|
|
643
|
-
return b.points - a.points;
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
newArray.map((ele) => {
|
|
647
|
-
tempArr.push(ele.words);
|
|
648
|
-
});
|
|
649
456
|
|
|
650
|
-
return tempArr;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
457
|
// Scrabble Point Array
|
|
654
|
-
const ScrabbleScore = () => {
|
|
458
|
+
const ScrabbleScore = (dictonary) => {
|
|
655
459
|
let twl06_sowpods = {
|
|
656
460
|
a: 1,
|
|
657
461
|
e: 1,
|
|
@@ -680,7 +484,6 @@ const ScrabbleScore = () => {
|
|
|
680
484
|
q: 10,
|
|
681
485
|
z: 10,
|
|
682
486
|
};
|
|
683
|
-
|
|
684
487
|
let wwfScore = {
|
|
685
488
|
a: 1,
|
|
686
489
|
b: 4,
|
|
@@ -717,6 +520,19 @@ const ScrabbleScore = () => {
|
|
|
717
520
|
}
|
|
718
521
|
};
|
|
719
522
|
|
|
523
|
+
function showMoreLimit() {
|
|
524
|
+
let tableFooter = document.querySelectorAll(".btn-container")
|
|
525
|
+
let showmore = document.querySelectorAll(".showmore_btn");
|
|
526
|
+
for (let i = 0; i < showmore.length; i++) {
|
|
527
|
+
let data_of_button = document.getElementById("alpha_" + showmore[i].getAttribute("id"));
|
|
528
|
+
let final_data = data_of_button.getElementsByClassName("anchor__style");
|
|
529
|
+
if (final_data.length < 25) {
|
|
530
|
+
tableFooter[i].style.display = "none";
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
|
|
720
536
|
// handling of filter on scroll
|
|
721
537
|
window.onscroll = function () {
|
|
722
538
|
var section = document.querySelectorAll(".wordlistContainer");
|
|
@@ -744,8 +560,6 @@ window.onscroll = function () {
|
|
|
744
560
|
}
|
|
745
561
|
}
|
|
746
562
|
};
|
|
747
|
-
|
|
748
|
-
// Add Filtering
|
|
749
563
|
let sections = {};
|
|
750
564
|
function Filtering(id) {
|
|
751
565
|
id = lengthSelect.value
|
|
@@ -775,43 +589,6 @@ function Filtering(id) {
|
|
|
775
589
|
document.documentElement.scrollTop = sections[sort_val + "_" + id] + 5;
|
|
776
590
|
}, 150);
|
|
777
591
|
}
|
|
778
|
-
|
|
779
|
-
// next && previous functionality
|
|
780
|
-
let prev = document.getElementById("prev");
|
|
781
|
-
let next = document.getElementById("next");
|
|
782
|
-
|
|
783
|
-
if (prev) {
|
|
784
|
-
prev.onclick = scroll_Right;
|
|
785
|
-
}
|
|
786
|
-
if (next) {
|
|
787
|
-
next.onclick = scroll_Left;
|
|
788
|
-
}
|
|
789
|
-
window.addEventListener("resize", function () {
|
|
790
|
-
scroll_visible();
|
|
791
|
-
});
|
|
792
|
-
window.addEventListener("scroll", function () {
|
|
793
|
-
scroll_visible();
|
|
794
|
-
});
|
|
795
|
-
function scroll_visible() {
|
|
796
|
-
let tab_container = document.querySelector("#tab-container");
|
|
797
|
-
if (tab_container) {
|
|
798
|
-
if (tab_container.clientWidth === tab_container.scrollWidth) {
|
|
799
|
-
prev.style.display = "none";
|
|
800
|
-
next.style.display = "none";
|
|
801
|
-
} else {
|
|
802
|
-
prev.style.display = "block";
|
|
803
|
-
next.style.display = "block";
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
scroll_visible();
|
|
808
|
-
|
|
809
|
-
function scroll_Left() {
|
|
810
|
-
tab_container.scrollLeft += 130;
|
|
811
|
-
}
|
|
812
|
-
function scroll_Right() {
|
|
813
|
-
tab_container.scrollLeft -= 130;
|
|
814
|
-
}
|
|
815
592
|
function findIndex(str, char) {
|
|
816
593
|
const strLength = str.length;
|
|
817
594
|
const indexes = [];
|