word-games-theme 2.7.0 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/wordgames/footer/footer.html +5 -5
- data/_includes/wordgames/words-data/words-data.html +1 -1
- data/_layouts/default.html +4 -4
- data/_layouts/page.html +12 -0
- data/_layouts/wordgames-home.html +5 -2
- data/assets/css/wordgames-result.css +491 -464
- data/assets/css/wordgames-theme.css +1 -1
- data/assets/js/other-lang-wordScrabble-home.js +251 -0
- data/assets/js/scrabble-words.js +1 -1
- data/assets/js/wordfinder-home.js +14 -10
- data/assets/js/wordfinder.js +149 -9
- data/assets/js/xletter-result.js +121 -6
- metadata +3 -2
@@ -0,0 +1,251 @@
|
|
1
|
+
let txtBox = document.querySelector('.txtBox')
|
2
|
+
txtBox.focus()
|
3
|
+
let letterCloseButton = document.querySelector('.letter-close-button')
|
4
|
+
let startsWith = document.getElementById("startsWith");
|
5
|
+
let mustInclude = document.getElementById("mustInclude");
|
6
|
+
let endsWith = document.getElementById("endsWith");
|
7
|
+
let exculdeWith = document.getElementById("exculdeWith");
|
8
|
+
let inculdeWith = document.getElementById("inculdeWith");
|
9
|
+
let wordLength = document.getElementById("wordLength");
|
10
|
+
|
11
|
+
const serachSection = document.querySelector(".serachSection");
|
12
|
+
let rangeOfBlankTile = serachSection.dataset.range;
|
13
|
+
|
14
|
+
// // when typing on input
|
15
|
+
txtBox.addEventListener('input', (e) => {
|
16
|
+
if (e.target.value === "") {
|
17
|
+
letterCloseButton.style.display = "none"
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
letterCloseButton.style.display = "block"
|
21
|
+
}
|
22
|
+
e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "")
|
23
|
+
let rangeOfBlankTile = 3
|
24
|
+
if (rangeOfBlankTile === "") {
|
25
|
+
rangeOfBlankTile = 3
|
26
|
+
}
|
27
|
+
e.target.value = e.target.value.replace(/ /g, '?')
|
28
|
+
let data = []
|
29
|
+
data = e.target.value.split('').filter((i) => i === '?')
|
30
|
+
if (data.length > rangeOfBlankTile) {
|
31
|
+
e.target.value = e.target.value.replace(/\?$/, '')
|
32
|
+
}
|
33
|
+
})
|
34
|
+
letterCloseButton.addEventListener("click", () => {
|
35
|
+
txtBox.value = ""
|
36
|
+
letterCloseButton.style.display = "none"
|
37
|
+
})
|
38
|
+
//tooltips for advanced filter
|
39
|
+
const filterInputs = document.querySelectorAll('.filter_val');
|
40
|
+
Array.from(filterInputs).forEach((item) => {
|
41
|
+
item.addEventListener("input", (e) => {
|
42
|
+
const inputValue = e.target.value;
|
43
|
+
const parentElement = e.target.parentElement;
|
44
|
+
const imgElement = parentElement.querySelector('img');
|
45
|
+
const tooltipElement = parentElement.querySelector('.filter-tooltip');
|
46
|
+
|
47
|
+
if (inputValue == "") {
|
48
|
+
imgElement.src = "/assets/images/questionmark.svg"
|
49
|
+
setTimeout(() => {
|
50
|
+
item.nextElementSibling.setAttribute("data-tip", item.nextElementSibling.id)
|
51
|
+
}, 100);
|
52
|
+
tooltipElement.style.setProperty('--tooltip-padding', '0.5rem');
|
53
|
+
tooltipElement.style.setProperty('--tooltip-border-style', 'soild');
|
54
|
+
|
55
|
+
} else {
|
56
|
+
item.nextElementSibling.removeAttribute("data-tip")
|
57
|
+
imgElement.src = "/assets/images/close-btn.svg"
|
58
|
+
tooltipElement.style.setProperty('--tooltip-padding', '0');
|
59
|
+
tooltipElement.style.setProperty('--tooltip-border-style', 'none');
|
60
|
+
}
|
61
|
+
item.nextElementSibling.addEventListener("click", () => {
|
62
|
+
e.target.value = ""
|
63
|
+
imgElement.src = "/assets/images/questionmark.svg"
|
64
|
+
setTimeout(() => {
|
65
|
+
item.nextElementSibling.setAttribute("data-tip", item.nextElementSibling.id)
|
66
|
+
}, 100);
|
67
|
+
tooltipElement.style.setProperty('--tooltip-padding', '0.5rem');
|
68
|
+
tooltipElement.style.setProperty('--tooltip-border-style', 'soild');
|
69
|
+
})
|
70
|
+
})
|
71
|
+
})
|
72
|
+
|
73
|
+
|
74
|
+
const loadResource = (FILE_URL, data = {}, async = true, type = "text/javascript") => {
|
75
|
+
return new Promise((resolve, reject) => {
|
76
|
+
let resourceEle;
|
77
|
+
|
78
|
+
if (type === "text/javascript") {
|
79
|
+
resourceEle = document.createElement("script");
|
80
|
+
resourceEle.src = FILE_URL;
|
81
|
+
resourceEle.classList.add("loaded-js");
|
82
|
+
} else if (type === "text/css") {
|
83
|
+
resourceEle = document.createElement("link");
|
84
|
+
resourceEle.rel = "stylesheet";
|
85
|
+
resourceEle.href = FILE_URL;
|
86
|
+
} else {
|
87
|
+
reject({
|
88
|
+
status: false,
|
89
|
+
message: `Unsupported resource type: ${type}`,
|
90
|
+
});
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
|
94
|
+
resourceEle.type = type;
|
95
|
+
resourceEle.async = async;
|
96
|
+
|
97
|
+
Object.keys(data).forEach((key) => {
|
98
|
+
resourceEle.setAttribute(`data-${key}`, data[key]);
|
99
|
+
});
|
100
|
+
|
101
|
+
resourceEle.addEventListener("load", () => {
|
102
|
+
resolve({ status: true });
|
103
|
+
});
|
104
|
+
|
105
|
+
resourceEle.addEventListener("error", () => {
|
106
|
+
reject({
|
107
|
+
status: false,
|
108
|
+
message: `Failed to load the resource ${FILE_URL}`,
|
109
|
+
});
|
110
|
+
});
|
111
|
+
|
112
|
+
if (type === "text/javascript") {
|
113
|
+
// console.log(resourceEle);
|
114
|
+
// console.log(FILE_URL);
|
115
|
+
document.body.appendChild(resourceEle);
|
116
|
+
} else if (type === "text/css") {
|
117
|
+
document.head.appendChild(resourceEle);
|
118
|
+
}
|
119
|
+
});
|
120
|
+
};
|
121
|
+
const formElement = document.querySelector("#form");
|
122
|
+
formElement.addEventListener("submit", function (e) {
|
123
|
+
e.preventDefault();
|
124
|
+
if (txtBox.value != "" || startsWith.value != "" || endsWith.value != "" || mustInclude.value != "" || exculdeWith.value != "" || inculdeWith.value != "" || wordLength.value != "") {
|
125
|
+
let quesMark = "?";
|
126
|
+
if (rangeOfBlankTile) {
|
127
|
+
if (!txtBox.value.includes("?")) {
|
128
|
+
txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
|
129
|
+
txtBox.value = txtBox.value;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
document.querySelector(".fillterWrapper").classList.add("hide")
|
133
|
+
let selectedDictionary = document.querySelector(".select_dropDown2").value;
|
134
|
+
if (history.pushState) {
|
135
|
+
var newurl =
|
136
|
+
window.location.protocol +
|
137
|
+
"//" +
|
138
|
+
window.location.host +
|
139
|
+
window.location.pathname +
|
140
|
+
"?" +
|
141
|
+
"search" +
|
142
|
+
"=" +
|
143
|
+
txtBox.value.toLowerCase() +
|
144
|
+
"&" +
|
145
|
+
"dictionary" +
|
146
|
+
"=" +
|
147
|
+
selectedDictionary +
|
148
|
+
"&" +
|
149
|
+
"prefix" +
|
150
|
+
"=" +
|
151
|
+
startsWith.value +
|
152
|
+
"&" +
|
153
|
+
"contains" +
|
154
|
+
"=" +
|
155
|
+
mustInclude.value +
|
156
|
+
"&" +
|
157
|
+
"suffix" +
|
158
|
+
"=" +
|
159
|
+
endsWith.value +
|
160
|
+
"&" +
|
161
|
+
"exclude" +
|
162
|
+
"=" +
|
163
|
+
exculdeWith.value +
|
164
|
+
"&" +
|
165
|
+
"include" +
|
166
|
+
"=" +
|
167
|
+
inculdeWith.value +
|
168
|
+
"&" +
|
169
|
+
"length" +
|
170
|
+
"=" +
|
171
|
+
wordLength.value;
|
172
|
+
window.history.pushState({ path: newurl }, "", newurl);
|
173
|
+
|
174
|
+
const params = new URLSearchParams(window.location.search);
|
175
|
+
serachValue = params.get("search");
|
176
|
+
prefixValue = params.get("prefix");
|
177
|
+
containsValue = params.get("contains");
|
178
|
+
suffixValue = params.get("suffix");
|
179
|
+
exculdeValue = params.get("exclude");
|
180
|
+
includeValue = params.get("include");
|
181
|
+
lengthValue = params.get("length");
|
182
|
+
dictonary = params.get("dictionary");
|
183
|
+
|
184
|
+
gtag("event", "page_view", {
|
185
|
+
page_location: window.location.pathname + location.search,
|
186
|
+
});
|
187
|
+
}
|
188
|
+
const paramName = 'search';
|
189
|
+
if (new URLSearchParams(window.location.search).has(paramName)) {
|
190
|
+
const additionalData = {
|
191
|
+
url: "{{site.url}}",
|
192
|
+
range: "{{page.blanktilerange}}"
|
193
|
+
}
|
194
|
+
var loadJs = document.querySelector(".loaded-js");
|
195
|
+
if (loadJs == null) {
|
196
|
+
loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
|
197
|
+
.then((data) => {
|
198
|
+
console.log("CSS loaded:", data);
|
199
|
+
})
|
200
|
+
.then(() => {
|
201
|
+
// Load the JavaScript file after the CSS file has loaded
|
202
|
+
loadResource("/assets/js/other-lang-wordScrabble.js", additionalData, true, "text/javascript")
|
203
|
+
.then((data) => {
|
204
|
+
console.log("JavaScript loaded:", data);
|
205
|
+
getData(txtBox.value.toLowerCase());
|
206
|
+
})
|
207
|
+
.catch((error) => {
|
208
|
+
console.error("Error loading JavaScript:", error);
|
209
|
+
});
|
210
|
+
})
|
211
|
+
.catch((error) => {
|
212
|
+
console.error("Error loading CSS:", error);
|
213
|
+
});
|
214
|
+
}
|
215
|
+
}
|
216
|
+
} else {
|
217
|
+
console.log("Please Enter Valid Letters.");
|
218
|
+
}
|
219
|
+
});
|
220
|
+
// Now you can use the loadScript function with additional data
|
221
|
+
function checkQueryParam() {
|
222
|
+
const urlParams = new URLSearchParams(window.location.search);
|
223
|
+
const paramName = 'search';
|
224
|
+
if (urlParams.has(paramName)) {
|
225
|
+
const additionalData = {
|
226
|
+
url: "{{site.url}}",
|
227
|
+
range: "{{page.blanktilerange}}"
|
228
|
+
};
|
229
|
+
loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
|
230
|
+
.then((data) => {
|
231
|
+
console.log("CSS loaded:", data);
|
232
|
+
})
|
233
|
+
.then(() => {
|
234
|
+
// Load the JavaScript file after the CSS file has loaded
|
235
|
+
loadResource("/assets/js/other-lang-wordScrabble.js", additionalData, true, "text/javascript")
|
236
|
+
.then((data) => {
|
237
|
+
console.log("JavaScript loaded:", data);
|
238
|
+
getData(txtBox.value.toLowerCase());
|
239
|
+
})
|
240
|
+
.catch((error) => {
|
241
|
+
console.error("Error loading JavaScript:", error);
|
242
|
+
});
|
243
|
+
})
|
244
|
+
.catch((error) => {
|
245
|
+
console.error("Error loading CSS:", error);
|
246
|
+
});
|
247
|
+
}
|
248
|
+
}
|
249
|
+
checkQueryParam();
|
250
|
+
|
251
|
+
|
data/assets/js/scrabble-words.js
CHANGED
@@ -183,7 +183,7 @@ const getData = async (serachValue) => {
|
|
183
183
|
</div>`;
|
184
184
|
/// loader
|
185
185
|
const response = await fetch(
|
186
|
-
|
186
|
+
`/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
|
187
187
|
);
|
188
188
|
const data = await response.json();
|
189
189
|
main.innerHTML = "";
|
@@ -57,16 +57,20 @@ Array.from(filterInputs).forEach((item) => {
|
|
57
57
|
imgElement.src = "/assets/images/close-btn.svg"
|
58
58
|
tooltipElement.style.setProperty('--tooltip-padding', '0');
|
59
59
|
tooltipElement.style.setProperty('--tooltip-border-style', 'none');
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
}
|
61
|
+
})
|
62
|
+
|
63
|
+
item.nextElementSibling.addEventListener("click", () => {
|
64
|
+
const parentElement = item.parentElement;
|
65
|
+
const imgElement = parentElement.querySelector('img');
|
66
|
+
const tooltipElement = parentElement.querySelector('.filter-tooltip');
|
67
|
+
item.value = ""
|
68
|
+
imgElement.src = "/assets/images/questionmark.svg"
|
69
|
+
setTimeout(() => {
|
70
|
+
item.nextElementSibling.setAttribute("data-tip", item.nextElementSibling.id)
|
71
|
+
}, 100);
|
72
|
+
tooltipElement.style.setProperty('--tooltip-padding', '0.5rem');
|
73
|
+
tooltipElement.style.setProperty('--tooltip-border-style', 'soild');
|
70
74
|
})
|
71
75
|
})
|
72
76
|
|
data/assets/js/wordfinder.js
CHANGED
@@ -78,6 +78,7 @@ const getData = async (serachValue) => {
|
|
78
78
|
try {
|
79
79
|
document.querySelector(".main-header").style.background = "#fff"
|
80
80
|
document.querySelector(".heading-h2").style.display = "none"
|
81
|
+
document.querySelector(".sortingFilters").style.display = "none"
|
81
82
|
if (featureContainer) {
|
82
83
|
featureContainer.remove()
|
83
84
|
}
|
@@ -225,7 +226,11 @@ if (lengthValue === "1") {
|
|
225
226
|
sortingFilter.addEventListener("change", logSubmit);
|
226
227
|
}
|
227
228
|
|
229
|
+
let moreData = []
|
230
|
+
let data_index = 25;
|
228
231
|
function getWords(data) {
|
232
|
+
data_index = 25
|
233
|
+
moreData = []
|
229
234
|
main.innerHTML = "";
|
230
235
|
lengthSelect.innerHTML = ""
|
231
236
|
document.querySelector(".sortingFilters").style.display = "flex"
|
@@ -237,7 +242,6 @@ function getWords(data) {
|
|
237
242
|
} else {
|
238
243
|
let newWordsLength = 0;
|
239
244
|
let dataArr = [];
|
240
|
-
// for (let i = serachValue.length; i >= 1; i--) {
|
241
245
|
for (let i = 15; i > 0; i--) {
|
242
246
|
let newdata = data.filter((item) => item.length === i);
|
243
247
|
if (prefixValue) {
|
@@ -245,6 +249,9 @@ function getWords(data) {
|
|
245
249
|
item2.startsWith(prefixValue.toLowerCase())
|
246
250
|
);
|
247
251
|
startsWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
252
|
+
startsWith.nextElementSibling.removeAttribute("data-tip")
|
253
|
+
startsWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
254
|
+
startsWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
248
255
|
startsWith.classList.add("tick");
|
249
256
|
startsWith.value = prefixValue;
|
250
257
|
} else {
|
@@ -255,6 +262,9 @@ function getWords(data) {
|
|
255
262
|
item.includes(containsValue.toLowerCase())
|
256
263
|
);
|
257
264
|
mustInclude.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
265
|
+
mustInclude.nextElementSibling.removeAttribute("data-tip")
|
266
|
+
mustInclude.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
267
|
+
mustInclude.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
258
268
|
mustInclude.classList.add("tick");
|
259
269
|
mustInclude.value = containsValue;
|
260
270
|
} else {
|
@@ -265,6 +275,9 @@ function getWords(data) {
|
|
265
275
|
item.endsWith(suffixValue.toLowerCase())
|
266
276
|
);
|
267
277
|
endsWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
278
|
+
endsWith.nextElementSibling.removeAttribute("data-tip")
|
279
|
+
endsWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
280
|
+
endsWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
268
281
|
endsWith.classList.add("tick");
|
269
282
|
endsWith.value = suffixValue;
|
270
283
|
} else {
|
@@ -288,6 +301,9 @@ function getWords(data) {
|
|
288
301
|
}
|
289
302
|
});
|
290
303
|
exculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
304
|
+
exculdeWith.nextElementSibling.removeAttribute("data-tip")
|
305
|
+
exculdeWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
306
|
+
exculdeWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
291
307
|
exculdeWith.classList.add("tick");
|
292
308
|
exculdeWith.value = exculdeValue;
|
293
309
|
newdata = data;
|
@@ -312,6 +328,9 @@ function getWords(data) {
|
|
312
328
|
}
|
313
329
|
});
|
314
330
|
inculdeWith.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
331
|
+
inculdeWith.nextElementSibling.removeAttribute("data-tip")
|
332
|
+
inculdeWith.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
333
|
+
inculdeWith.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
315
334
|
inculdeWith.classList.add("tick");
|
316
335
|
inculdeWith.value = includeValue;
|
317
336
|
newdata = data;
|
@@ -321,6 +340,9 @@ function getWords(data) {
|
|
321
340
|
if (lengthValue) {
|
322
341
|
newdata = newdata.filter((item) => item.length == lengthValue);
|
323
342
|
wordLength.nextElementSibling.querySelector("img").src = "/assets/images/close-btn.svg"
|
343
|
+
wordLength.nextElementSibling.removeAttribute("data-tip")
|
344
|
+
wordLength.nextElementSibling.style.setProperty('--tooltip-padding', '0');
|
345
|
+
wordLength.nextElementSibling.style.setProperty('--tooltip-border-style', 'none');
|
324
346
|
wordLength.classList.add("tick");
|
325
347
|
wordLength.value = lengthValue;
|
326
348
|
} else {
|
@@ -331,7 +353,8 @@ function getWords(data) {
|
|
331
353
|
} else {
|
332
354
|
newWordsLength += newdata.length;
|
333
355
|
newdata = sortWords(newdata);
|
334
|
-
|
356
|
+
moreData.push(newdata)
|
357
|
+
let result = newdata.map((item) => {
|
335
358
|
let itemHtml = "";
|
336
359
|
if (serachValue) {
|
337
360
|
var text1 = serachValue.replace("?", "");
|
@@ -389,14 +412,19 @@ function getWords(data) {
|
|
389
412
|
lengthSelect.add(option);
|
390
413
|
lengthSelect.style.display = "block"
|
391
414
|
}
|
415
|
+
|
416
|
+
result = result.slice(0, 25)
|
417
|
+
|
392
418
|
main.innerHTML += `
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
419
|
+
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
420
|
+
<h3 class="wordListHeading lead">${i} Letter Words</h3>
|
421
|
+
<div class="wordList">${result.join("")}</div>
|
422
|
+
<div class="w-100 text-center btn-container">
|
423
|
+
<button onclick="showMoreWords(this)" type="button" class="my-4 showmore_btn" id="${i}">More Words</button>
|
424
|
+
</div>
|
425
|
+
</div>`
|
426
|
+
|
427
|
+
showMoreLimit()
|
400
428
|
}
|
401
429
|
}
|
402
430
|
}
|
@@ -437,6 +465,118 @@ function getWords(data) {
|
|
437
465
|
}
|
438
466
|
}
|
439
467
|
}
|
468
|
+
async function getMoreWords() {
|
469
|
+
let flattenedArray = moreData.flat();
|
470
|
+
let uniqueArray = [...new Set(flattenedArray)];
|
471
|
+
// console.log(uniqueArray);
|
472
|
+
return uniqueArray
|
473
|
+
}
|
474
|
+
|
475
|
+
let previousDataIndex = null
|
476
|
+
let previousID = null;
|
477
|
+
let storepreviousIndex = []
|
478
|
+
async function showMoreWords(e) {
|
479
|
+
try {
|
480
|
+
let showmore = e.parentElement.children[0];
|
481
|
+
let id = showmore.id;
|
482
|
+
|
483
|
+
if (previousID !== null && parseInt(previousID) !== parseInt(id)) {
|
484
|
+
data_index = 25
|
485
|
+
console.log(storepreviousIndex);
|
486
|
+
const filteredIndexes = storepreviousIndex.filter(item => item.id === id);
|
487
|
+
if (filteredIndexes.length > 0) {
|
488
|
+
const lastItem = filteredIndexes[filteredIndexes.length - 1];
|
489
|
+
data_index = lastItem.data_index + 25;
|
490
|
+
lastItem.data_index = data_index;
|
491
|
+
}
|
492
|
+
console.log(filteredIndexes);
|
493
|
+
|
494
|
+
}
|
495
|
+
previousID = id;
|
496
|
+
storepreviousIndex.push({
|
497
|
+
data_index,
|
498
|
+
id
|
499
|
+
})
|
500
|
+
console.log("Current data_index:", data_index);
|
501
|
+
|
502
|
+
document.getElementById(id).innerHTML = `Loading...`;
|
503
|
+
let content_area = document.getElementById("alpha_" + id).getElementsByClassName("wordList")[0];
|
504
|
+
const result = await getMoreWords();
|
505
|
+
let full_words = result.filter((item) => item.length === Number(id));
|
506
|
+
|
507
|
+
if (data_index < full_words.length) {
|
508
|
+
for (let d = data_index; d < data_index + 25; d++) {
|
509
|
+
if (full_words[d] != undefined) {
|
510
|
+
let itemHtml = "";
|
511
|
+
if (serachValue) {
|
512
|
+
var text1 = serachValue.replace("?", "");
|
513
|
+
var text2 = full_words[d];
|
514
|
+
var text3 = full_words[d];
|
515
|
+
let chars = text1.split("");
|
516
|
+
let indexs = [];
|
517
|
+
chars.map((i) => {
|
518
|
+
let findIndexes = findIndex(text3, i);
|
519
|
+
if (findIndexes.length > 0) {
|
520
|
+
text3 = text3.split("");
|
521
|
+
text3[findIndexes] = "$";
|
522
|
+
text3 = text3.join("");
|
523
|
+
indexs = [...indexs, ...findIndexes];
|
524
|
+
}
|
525
|
+
});
|
526
|
+
text2.split("").map((itemValue, index) => {
|
527
|
+
let check = indexs.find((i) => i === index);
|
528
|
+
if (check !== undefined) {
|
529
|
+
itemHtml += `${itemValue}`;
|
530
|
+
} else {
|
531
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`;
|
532
|
+
}
|
533
|
+
});
|
534
|
+
} else {
|
535
|
+
itemHtml = full_words[d]
|
536
|
+
}
|
537
|
+
let ScrabbleLetterScore = ScrabbleScore();
|
538
|
+
let points = 0;
|
539
|
+
full_words[d] = full_words[d].toLowerCase();
|
540
|
+
for (let i = 0; i < full_words[d].length; i++) {
|
541
|
+
points += ScrabbleLetterScore[full_words[d][i]] || 0; // for unknown characters
|
542
|
+
}
|
543
|
+
|
544
|
+
let span = document.createElement("span");
|
545
|
+
span.setAttribute("class", "points");
|
546
|
+
span.setAttribute("value", `${points}`);
|
547
|
+
span.innerHTML = `${points}`;
|
548
|
+
|
549
|
+
let a = document.createElement("a");
|
550
|
+
a.setAttribute("class", "anchor__style");
|
551
|
+
a.setAttribute("target", "_blank");
|
552
|
+
a.setAttribute("href", "/word-meaning?search=" + full_words[d].replace(/<\/?[^>]+>/gi, ''));
|
553
|
+
a.setAttribute("data-original-title", `Lookup ${full_words[d].replace(/<\/?[^>]+>/gi, '')} in Dictionary`)
|
554
|
+
a.innerHTML = ` ${itemHtml} `;
|
555
|
+
a.appendChild(span)
|
556
|
+
content_area.appendChild(a);
|
557
|
+
}
|
558
|
+
}
|
559
|
+
document.getElementById(id).innerHTML = `More Words`;
|
560
|
+
data_index += 25;
|
561
|
+
} else {
|
562
|
+
document.getElementById(id).style.display = "none";
|
563
|
+
}
|
564
|
+
} catch (error) {
|
565
|
+
console.error("Error fetching or processing data:", error);
|
566
|
+
}
|
567
|
+
}
|
568
|
+
|
569
|
+
function showMoreLimit() {
|
570
|
+
let tableFooter = document.querySelectorAll(".btn-container")
|
571
|
+
let showmore = document.querySelectorAll(".showmore_btn");
|
572
|
+
for (let i = 0; i < showmore.length; i++) {
|
573
|
+
let data_of_button = document.getElementById("alpha_" + showmore[i].getAttribute("id"));
|
574
|
+
let final_data = data_of_button.getElementsByClassName("anchor__style");
|
575
|
+
if (final_data.length < 25) {
|
576
|
+
tableFooter[i].style.display = "none";
|
577
|
+
}
|
578
|
+
}
|
579
|
+
}
|
440
580
|
function sortWords(data) {
|
441
581
|
if (sortingFilter.selectedIndex == 0) {
|
442
582
|
return data;
|