word-games-theme 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_data/footer/en/data.json +16 -0
- data/_data/header/en/data.json +16 -0
- data/_data/wordgames/en/french-word-unscrambler.json +61 -0
- data/_data/wordgames/en/german-word-unscrambler.json +61 -0
- data/_data/wordgames/en/italian-word-unscrambler.json +61 -0
- data/_data/wordgames/en/spanish-word-unscrambler.json +61 -0
- data/_data/wordleSolver/en/data.json +10 -0
- data/_includes/adBlocker/adBlocker.html +136 -0
- data/_includes/find-words-in-certain-positions/words-in-certain-positions.html +1 -1
- data/_includes/head/index.html +5 -0
- data/_includes/howto.html +63 -0
- data/_includes/script.html +3 -0
- data/_includes/section/commonPage.html +5 -2
- data/_includes/section/feature.html +16 -1
- data/_includes/section/home.html +6 -3
- data/_includes/section/home2.html +5 -2
- data/_includes/section/news.html +9 -0
- data/_includes/section/recent_posts.html +43 -0
- data/_includes/wordle-solver/wordle-solver.html +1 -1
- data/_layouts/autogencontent.html +1 -0
- data/_layouts/blog.html +1 -0
- data/_layouts/default.html +30 -0
- data/_layouts/other-lang-scrabble.html +170 -0
- data/_layouts/page.html +5 -2
- data/_layouts/post.html +1 -0
- data/_layouts/tools.html +1 -0
- data/_layouts/wordMeaning.html +4 -1
- data/_layouts/xyzpages.html +2 -0
- data/assets/css/adBlocker.css +232 -0
- data/assets/css/advancedFilter.css +1 -0
- data/assets/css/config.css +17 -0
- data/assets/css/home.css +3 -3
- data/assets/css/news.css +2 -2
- data/assets/css/style.css +28 -4
- data/assets/css/wordGroup.css +15 -0
- data/assets/css/wordScrabble.css +4 -0
- data/assets/images/abp.svg +41 -0
- data/assets/images/adblock.svg +266 -0
- data/assets/images/uo.svg +41 -0
- data/assets/js/X-letter.js +60 -47
- data/assets/js/adBlocker.js +36 -0
- data/assets/js/other-lang-wordScrabble.js +534 -0
- data/assets/js/wordScrabble.js +19 -4
- data/assets/js/wordleSolver.js +6 -6
- data/assets/js/words-starting-with.js +24 -4
- metadata +17 -2
@@ -0,0 +1,534 @@
|
|
1
|
+
// grab some html elements
|
2
|
+
|
3
|
+
const getScript = document.currentScript
|
4
|
+
let form = document.querySelector('#form')
|
5
|
+
let wordCount = document.querySelector('.wordCount')
|
6
|
+
let main = document.querySelector('.main')
|
7
|
+
let errorMsg = document.querySelector('.errorMsg')
|
8
|
+
let script = document.currentScript
|
9
|
+
|
10
|
+
// getqueryUrl from form
|
11
|
+
const params = new URLSearchParams(window.location.search)
|
12
|
+
let serachValue = params.get('search').toLowerCase()
|
13
|
+
let prefixValue = params.get('prefix')
|
14
|
+
let containsValue = params.get('contains')
|
15
|
+
let suffixValue = params.get('suffix')
|
16
|
+
let exculdeValue = params.get('exculde')
|
17
|
+
let includeValue = params.get('include')
|
18
|
+
let lengthValue = params.get('length')
|
19
|
+
|
20
|
+
// advanced filter element grabs
|
21
|
+
let tick
|
22
|
+
let startsWith = document.getElementById('startsWith')
|
23
|
+
let mustInclude = document.getElementById('mustInclude')
|
24
|
+
let endsWith = document.getElementById('endsWith')
|
25
|
+
let exculdeWith = document.getElementById('exculdeWith')
|
26
|
+
let inculdeWith = document.getElementById('inculdeWith')
|
27
|
+
let wordLength = document.getElementById('wordLength')
|
28
|
+
|
29
|
+
let ok = true
|
30
|
+
|
31
|
+
let tab_container = document.querySelector('.tab_container')
|
32
|
+
const siteUrl = window.location.href;
|
33
|
+
const lang = script.dataset.language
|
34
|
+
var sortValue
|
35
|
+
var sortBool = false
|
36
|
+
|
37
|
+
let txtBox = document.querySelector('.txtBox')
|
38
|
+
txtBox.focus()
|
39
|
+
txtBox.value = serachValue
|
40
|
+
|
41
|
+
let letterCloseButton = document.querySelector('.letter-close-button-commonPage')
|
42
|
+
if (serachValue) {
|
43
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
44
|
+
// letterCloseButton.style.right = "70px"
|
45
|
+
}
|
46
|
+
letterCloseButton.addEventListener("click", () => {
|
47
|
+
txtBox.value = ""
|
48
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
49
|
+
})
|
50
|
+
|
51
|
+
|
52
|
+
txtBox.addEventListener('input', (e) => {
|
53
|
+
if (e.target.value === "") {
|
54
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
55
|
+
} else {
|
56
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
57
|
+
}
|
58
|
+
})
|
59
|
+
var theSelect = document.getElementById('select_dropDown')
|
60
|
+
const select_dropDown2 = document.querySelector(".select_dropDown2")
|
61
|
+
select_dropDown2[0].style.display = "none"
|
62
|
+
select_dropDown2[1].style.display = "none"
|
63
|
+
select_dropDown2[2].style.display = "none"
|
64
|
+
select_dropDown2[3].style.display = "none"
|
65
|
+
const getDiff = (text1, text2) => {
|
66
|
+
var diffRange = []
|
67
|
+
var currentRange = undefined
|
68
|
+
for (var i = 0; i < text1.length; i++) {
|
69
|
+
if (text1[i] != text2[i]) {
|
70
|
+
if (currentRange == undefined) {
|
71
|
+
currentRange = [i]
|
72
|
+
}
|
73
|
+
}
|
74
|
+
if (currentRange != undefined && text1[i] == text2[i]) {
|
75
|
+
currentRange.push(i)
|
76
|
+
diffRange.push(currentRange)
|
77
|
+
currentRange = undefined
|
78
|
+
}
|
79
|
+
}
|
80
|
+
if (currentRange != undefined) {
|
81
|
+
currentRange.push(i)
|
82
|
+
diffRange.push(currentRange)
|
83
|
+
}
|
84
|
+
return diffRange
|
85
|
+
}
|
86
|
+
|
87
|
+
// getWords define...
|
88
|
+
const getData = async (serachValue) => {
|
89
|
+
try {
|
90
|
+
main.innerHTML = `<div class="loader">
|
91
|
+
<img src='/assets/images/loading.gif'>
|
92
|
+
<div style="font-weight:900;font-size:14px" >Finding words - Powered by ${siteUrl.replace(/^https?:\/\//, '').split("/")[0]}</div>
|
93
|
+
</div>`
|
94
|
+
/// loader
|
95
|
+
let response = null;
|
96
|
+
if (lang == "french")
|
97
|
+
response = await fetch(`/.netlify/functions/get-fr-words?name=${serachValue}`)
|
98
|
+
if (lang == "german")
|
99
|
+
response = await fetch(`/.netlify/functions/get-de-words?name=${serachValue}`)
|
100
|
+
if (lang == "italian")
|
101
|
+
response = await fetch(`/.netlify/functions/get-it-words?name=${serachValue}`)
|
102
|
+
if (lang == "spanish")
|
103
|
+
response = await fetch(`/.netlify/functions/get-es-words?name=${serachValue}`)
|
104
|
+
const data = await response.json()
|
105
|
+
main.innerHTML = ''
|
106
|
+
getWords(data)
|
107
|
+
//getWords calling...
|
108
|
+
} catch (error) {
|
109
|
+
console.log(error)
|
110
|
+
}
|
111
|
+
}
|
112
|
+
//getData calling...
|
113
|
+
if (lengthValue === '1') {
|
114
|
+
errorMsg.innerHTML = 'words length should be more than 1'
|
115
|
+
} else {
|
116
|
+
getData(serachValue.toLowerCase())
|
117
|
+
}
|
118
|
+
|
119
|
+
// getWords function define...
|
120
|
+
function getWords(data) {
|
121
|
+
if (typeof data === 'string') {
|
122
|
+
errorMsg.innerHTML = 'no words found'
|
123
|
+
wordCount.innerHTML = `<strong>Found 0 words with letters ${serachValue.split(
|
124
|
+
''
|
125
|
+
)}</strong>`
|
126
|
+
} else {
|
127
|
+
let newWordsLength = 0
|
128
|
+
|
129
|
+
// sort eventlistener
|
130
|
+
theSelect[3].style.display = "none"
|
131
|
+
theSelect.addEventListener('change', () => {
|
132
|
+
sortValue = theSelect[theSelect.selectedIndex].text
|
133
|
+
if (sortValue == 'Z-A') {
|
134
|
+
sortBool = true
|
135
|
+
sortby(sortBool, data)
|
136
|
+
} else {
|
137
|
+
sortBool = false
|
138
|
+
sortby(sortBool, data)
|
139
|
+
}
|
140
|
+
})
|
141
|
+
|
142
|
+
for (let i = serachValue.length; i >= 1; i--) {
|
143
|
+
let newdata = data.filter((item) => item.length === i)
|
144
|
+
|
145
|
+
if (prefixValue) {
|
146
|
+
newdata = newdata.filter((item2) =>
|
147
|
+
item2.startsWith(prefixValue.toLowerCase())
|
148
|
+
)
|
149
|
+
startsWith.classList.add('tick')
|
150
|
+
startsWith.value = prefixValue
|
151
|
+
}
|
152
|
+
if (containsValue) {
|
153
|
+
newdata = newdata.filter((item) =>
|
154
|
+
item.includes(containsValue.toLowerCase())
|
155
|
+
)
|
156
|
+
mustInclude.classList.add('tick')
|
157
|
+
mustInclude.value = containsValue
|
158
|
+
}
|
159
|
+
if (suffixValue) {
|
160
|
+
newdata = newdata.filter((item) =>
|
161
|
+
item.endsWith(suffixValue.toLowerCase())
|
162
|
+
)
|
163
|
+
endsWith.classList.add('tick')
|
164
|
+
endsWith.value = suffixValue
|
165
|
+
}
|
166
|
+
|
167
|
+
if (exculdeValue) {
|
168
|
+
let data = []
|
169
|
+
newdata.map((item) => {
|
170
|
+
let check = false
|
171
|
+
for (let e = 0; e < exculdeValue.length; e++) {
|
172
|
+
const element = exculdeValue[e]
|
173
|
+
if (item.includes(element)) {
|
174
|
+
check = true
|
175
|
+
break
|
176
|
+
} else {
|
177
|
+
check = false
|
178
|
+
}
|
179
|
+
}
|
180
|
+
if (check === false) {
|
181
|
+
data.push(item)
|
182
|
+
}
|
183
|
+
})
|
184
|
+
exculdeWith.classList.add('tick')
|
185
|
+
exculdeWith.value = exculdeValue
|
186
|
+
newdata = data
|
187
|
+
}
|
188
|
+
if (includeValue) {
|
189
|
+
let data = []
|
190
|
+
newdata.map((item) => {
|
191
|
+
let check = false
|
192
|
+
for (let e = 0; e < includeValue.length; e++) {
|
193
|
+
const element = includeValue[e]
|
194
|
+
if (!item.includes(element)) {
|
195
|
+
check = true
|
196
|
+
break
|
197
|
+
} else {
|
198
|
+
check = false
|
199
|
+
}
|
200
|
+
}
|
201
|
+
if (check === false) {
|
202
|
+
data.push(item)
|
203
|
+
}
|
204
|
+
})
|
205
|
+
inculdeWith.classList.add('tick')
|
206
|
+
inculdeWith.value = includeValue
|
207
|
+
newdata = data
|
208
|
+
}
|
209
|
+
|
210
|
+
if (lengthValue) {
|
211
|
+
newdata = newdata.filter((item) => item.length == lengthValue)
|
212
|
+
wordLength.classList.add('tick')
|
213
|
+
wordLength.value = lengthValue
|
214
|
+
}
|
215
|
+
|
216
|
+
if (newdata.length === 0) {
|
217
|
+
main.innerHTML += ''
|
218
|
+
} else {
|
219
|
+
newWordsLength += newdata.length
|
220
|
+
const result = newdata.map((item) => {
|
221
|
+
var text1 = serachValue.replace('?', '')
|
222
|
+
var text2 = item
|
223
|
+
var text3 = item
|
224
|
+
let chars = text1.split('')
|
225
|
+
let indexs = []
|
226
|
+
chars.map((i) => {
|
227
|
+
let findIndexes = findIndex(text3, i)
|
228
|
+
if (findIndexes.length > 0) {
|
229
|
+
text3 = text3.split('')
|
230
|
+
text3[findIndexes] = '$'
|
231
|
+
text3 = text3.join('')
|
232
|
+
indexs = [...indexs, ...findIndexes]
|
233
|
+
}
|
234
|
+
})
|
235
|
+
let itemHtml = ''
|
236
|
+
text2.split('').map((itemValue, index) => {
|
237
|
+
let check = indexs.find((i) => i === index)
|
238
|
+
if (check !== undefined) {
|
239
|
+
itemHtml += `${itemValue}`
|
240
|
+
} else {
|
241
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`
|
242
|
+
}
|
243
|
+
})
|
244
|
+
|
245
|
+
if (item.length === 1) {
|
246
|
+
ok = false
|
247
|
+
newWordsLength = newWordsLength - 1
|
248
|
+
} else {
|
249
|
+
return `<li><h4 style="font-weight:600">${item}</h4></li>`
|
250
|
+
}
|
251
|
+
})
|
252
|
+
|
253
|
+
if (ok) {
|
254
|
+
tab_container.innerHTML += `
|
255
|
+
<input type="button" id="Tab_${i}" onclick="Filtering(${i})" value="${i} Letter"
|
256
|
+
class="tab_link cursorPointer" />
|
257
|
+
`
|
258
|
+
let tabs = document.getElementsByClassName('tab_link')
|
259
|
+
tabs[0] ? tabs[0].classList.add('active-tab') : ''
|
260
|
+
main.innerHTML += `
|
261
|
+
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
262
|
+
<div class="wordListHeading">
|
263
|
+
<h3 class="lead">${i} Letter Words</h3>
|
264
|
+
</div>
|
265
|
+
<div class="wordList">
|
266
|
+
<ul class="ul list-unstyled">
|
267
|
+
${result.join('')}
|
268
|
+
</ul>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
`
|
272
|
+
}
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
if (newWordsLength === 0) {
|
277
|
+
errorMsg.innerHTML = 'no words found'
|
278
|
+
} else {
|
279
|
+
wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split(
|
280
|
+
''
|
281
|
+
)}</strong>`
|
282
|
+
}
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
// sort by aplhabets
|
287
|
+
function sortby(sortBool, data) {
|
288
|
+
if (sortBool) {
|
289
|
+
main.innerHTML = ''
|
290
|
+
data.reverse()
|
291
|
+
let newWordsLength = 0
|
292
|
+
for (let i = serachValue.length; i >= 1; i--) {
|
293
|
+
var newdata = data.filter((item) => item.length === i)
|
294
|
+
|
295
|
+
if (newdata.length === 0) {
|
296
|
+
main.innerHTML += ''
|
297
|
+
} else {
|
298
|
+
newWordsLength += newdata.length
|
299
|
+
|
300
|
+
const result = newdata.map((item) => {
|
301
|
+
var text1 = serachValue.replace('?', '')
|
302
|
+
var text2 = item
|
303
|
+
var text3 = item
|
304
|
+
let chars = text1.split('')
|
305
|
+
let indexs = []
|
306
|
+
chars.map((i) => {
|
307
|
+
let findIndexes = findIndex(text3, i)
|
308
|
+
if (findIndexes.length > 0) {
|
309
|
+
text3 = text3.split('')
|
310
|
+
text3[findIndexes] = '$'
|
311
|
+
text3 = text3.join('')
|
312
|
+
indexs = [...indexs, ...findIndexes]
|
313
|
+
}
|
314
|
+
})
|
315
|
+
let itemHtml = ''
|
316
|
+
text2.split('').map((itemValue, index) => {
|
317
|
+
let check = indexs.find((i) => i === index)
|
318
|
+
if (check !== undefined) {
|
319
|
+
itemHtml += `${itemValue}`
|
320
|
+
} else {
|
321
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`
|
322
|
+
}
|
323
|
+
})
|
324
|
+
if (item.length === 1) {
|
325
|
+
ok = false
|
326
|
+
newWordsLength = newWordsLength - 1
|
327
|
+
} else {
|
328
|
+
return `<li><h4 style="font-weight:600">${item}</h4></li>`
|
329
|
+
}
|
330
|
+
})
|
331
|
+
|
332
|
+
main.innerHTML += `
|
333
|
+
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
334
|
+
<div class="wordListHeading">
|
335
|
+
<h3 class="lead">${i} Letter Words</h3>
|
336
|
+
</div>
|
337
|
+
<div class="wordList">
|
338
|
+
<ul class="ul list-unstyled">
|
339
|
+
${result.join('')}
|
340
|
+
</ul>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
`
|
344
|
+
}
|
345
|
+
}
|
346
|
+
} else {
|
347
|
+
main.innerHTML = ''
|
348
|
+
data.sort()
|
349
|
+
for (let i = serachValue.length; i >= 1; i--) {
|
350
|
+
var newdata = data.filter((item) => item.length === i)
|
351
|
+
if (newdata.length === 0) {
|
352
|
+
main.innerHTML += ''
|
353
|
+
} else {
|
354
|
+
const result = newdata.map((item) => {
|
355
|
+
var text1 = serachValue.replace('?', '')
|
356
|
+
var text2 = item
|
357
|
+
var text3 = item
|
358
|
+
let chars = text1.split('')
|
359
|
+
let indexs = []
|
360
|
+
chars.map((i) => {
|
361
|
+
let findIndexes = findIndex(text3, i)
|
362
|
+
if (findIndexes.length > 0) {
|
363
|
+
text3 = text3.split('')
|
364
|
+
text3[findIndexes] = '$'
|
365
|
+
text3 = text3.join('')
|
366
|
+
indexs = [...indexs, ...findIndexes]
|
367
|
+
}
|
368
|
+
})
|
369
|
+
let itemHtml = ''
|
370
|
+
text2.split('').map((itemValue, index) => {
|
371
|
+
let check = indexs.find((i) => i === index)
|
372
|
+
if (check !== undefined) {
|
373
|
+
itemHtml += `${itemValue}`
|
374
|
+
} else {
|
375
|
+
itemHtml += `<span class='highlight'>${itemValue}</span>`
|
376
|
+
}
|
377
|
+
})
|
378
|
+
if (item.length === 1) {
|
379
|
+
ok = false
|
380
|
+
newWordsLength = newWordsLength - 1
|
381
|
+
} else {
|
382
|
+
return `<li><h4 style="font-weight:600">${item}</h4></li>`
|
383
|
+
}
|
384
|
+
})
|
385
|
+
main.innerHTML += `
|
386
|
+
<div class="allGroupWords wordlistContainer" id="alpha_${i}">
|
387
|
+
<div class="wordListHeading">
|
388
|
+
<h3 class="lead">${i} Letter Words</h3>
|
389
|
+
</div>
|
390
|
+
<div class="wordList">
|
391
|
+
<ul class="ul list-unstyled">
|
392
|
+
${result.join('')}
|
393
|
+
</ul>
|
394
|
+
</div>
|
395
|
+
</div>
|
396
|
+
`
|
397
|
+
}
|
398
|
+
}
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
//Handling of filter counter in advanced filter
|
403
|
+
function addFilterCount() {
|
404
|
+
let filter_val = document.getElementsByClassName('filter_val')
|
405
|
+
let filter = document.querySelector('.filter_count')
|
406
|
+
let filter_count = 0
|
407
|
+
|
408
|
+
filter_val[0].value = prefixValue
|
409
|
+
filter_val[1].value = containsValue
|
410
|
+
filter_val[2].value = suffixValue
|
411
|
+
filter_val[3].value = exculdeValue
|
412
|
+
filter_val[4].value = includeValue
|
413
|
+
filter_val[5].value = lengthValue
|
414
|
+
|
415
|
+
for (var i = 0; i <= 4; i++) {
|
416
|
+
if (filter_val[i].value != '') {
|
417
|
+
filter_count += 1
|
418
|
+
}
|
419
|
+
if (filter_count === 0) {
|
420
|
+
filter.style.display = 'none'
|
421
|
+
} else {
|
422
|
+
filter.style.display = 'inline-block'
|
423
|
+
}
|
424
|
+
|
425
|
+
filter.innerHTML = filter_count
|
426
|
+
}
|
427
|
+
}
|
428
|
+
addFilterCount()
|
429
|
+
|
430
|
+
|
431
|
+
// handling of filter on scroll
|
432
|
+
window.onscroll = function () {
|
433
|
+
var section = document.querySelectorAll('.wordlistContainer')
|
434
|
+
let new_sections = {}
|
435
|
+
Array.prototype.forEach.call(section, function (e) {
|
436
|
+
if (document.body.clientWidth > 991) {
|
437
|
+
new_sections[e.id] = e.offsetTop - 10
|
438
|
+
} else {
|
439
|
+
new_sections[e.id] = e.offsetTop - 10
|
440
|
+
}
|
441
|
+
})
|
442
|
+
var scrollPosition =
|
443
|
+
document.documentElement.scrollTop || document.body.scrollTop
|
444
|
+
for (i in new_sections) {
|
445
|
+
let sort_val = document.querySelector('.sort-select').value
|
446
|
+
if (
|
447
|
+
i.split('_')[0] == sort_val &&
|
448
|
+
new_sections[i] &&
|
449
|
+
new_sections[i] <= scrollPosition
|
450
|
+
) {
|
451
|
+
document.querySelector('.active-tab').classList.remove('active-tab')
|
452
|
+
var active_now = document.querySelector('#Tab_' + i.split('_')[1])
|
453
|
+
active_now.classList.add('active-tab')
|
454
|
+
// active_now.scrollIntoView()
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
// Add Filtering
|
460
|
+
let sections = {}
|
461
|
+
function Filtering(id) {
|
462
|
+
let tabs = document.getElementsByClassName('tab_link')
|
463
|
+
tabs[0] ? tabs[0].classList.add('active-tab') : ''
|
464
|
+
|
465
|
+
Array.from(tabs).map((item) => {
|
466
|
+
item.classList.remove('active-tab')
|
467
|
+
})
|
468
|
+
main.innerHTML += ``
|
469
|
+
let activeLetter = event.target
|
470
|
+
activeLetter.classList.add('active-tab')
|
471
|
+
|
472
|
+
var section = document.querySelectorAll('.wordlistContainer')
|
473
|
+
var sort_val = document.querySelector('.sort-select').value
|
474
|
+
Array.prototype.forEach.call(section, function (e) {
|
475
|
+
if (document.body.clientWidth > 991) {
|
476
|
+
sections[e.id] = e.offsetTop - 10
|
477
|
+
} else {
|
478
|
+
sections[e.id] = e.offsetTop - 10
|
479
|
+
}
|
480
|
+
})
|
481
|
+
|
482
|
+
document.body.scrollTop = sections[sort_val + '_' + id] + 5
|
483
|
+
}
|
484
|
+
|
485
|
+
// next && previous functionality
|
486
|
+
let prev = document.getElementById('prev')
|
487
|
+
let next = document.getElementById('next')
|
488
|
+
|
489
|
+
if (prev) {
|
490
|
+
prev.onclick = scroll_Right
|
491
|
+
}
|
492
|
+
if (next) {
|
493
|
+
next.onclick = scroll_Left
|
494
|
+
}
|
495
|
+
window.addEventListener('resize', function () {
|
496
|
+
scroll_visible()
|
497
|
+
})
|
498
|
+
window.addEventListener('scroll', function () {
|
499
|
+
scroll_visible()
|
500
|
+
})
|
501
|
+
function scroll_visible() {
|
502
|
+
let tab_container = document.querySelector('#tab-container')
|
503
|
+
|
504
|
+
if (tab_container) {
|
505
|
+
if (tab_container.clientWidth === tab_container.scrollWidth) {
|
506
|
+
prev.style.display = 'none'
|
507
|
+
next.style.display = 'none'
|
508
|
+
} else {
|
509
|
+
prev.style.display = 'block'
|
510
|
+
next.style.display = 'block'
|
511
|
+
}
|
512
|
+
}
|
513
|
+
}
|
514
|
+
scroll_visible()
|
515
|
+
|
516
|
+
function scroll_Left() {
|
517
|
+
tab_container.scrollLeft += 130
|
518
|
+
}
|
519
|
+
function scroll_Right() {
|
520
|
+
tab_container.scrollLeft -= 130
|
521
|
+
}
|
522
|
+
function findIndex(str, char) {
|
523
|
+
const strLength = str.length
|
524
|
+
const indexes = []
|
525
|
+
let newStr = str
|
526
|
+
|
527
|
+
while (newStr && newStr.indexOf(char) > -1) {
|
528
|
+
indexes.push(newStr.indexOf(char) + strLength - newStr.length)
|
529
|
+
newStr = newStr.substring(newStr.indexOf(char) + 1)
|
530
|
+
newStr = newStr.substring(newStr.indexOf(char) + 1)
|
531
|
+
}
|
532
|
+
|
533
|
+
return indexes
|
534
|
+
}
|
data/assets/js/wordScrabble.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
// grab some html elements
|
6
6
|
|
7
|
-
const getScript=document.currentScript
|
7
|
+
const getScript = document.currentScript
|
8
8
|
let form = document.querySelector('#form')
|
9
9
|
let wordCount = document.querySelector('.wordCount')
|
10
10
|
let main = document.querySelector('.main')
|
@@ -38,14 +38,29 @@ const siteUrl = getScript.dataset.url
|
|
38
38
|
var sortValue
|
39
39
|
var sortBool = false
|
40
40
|
|
41
|
+
let letterCloseButton = document.querySelector('.letter-close-button-commonPage')
|
42
|
+
if (serachValue) {
|
43
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
44
|
+
}
|
45
|
+
letterCloseButton.addEventListener("click", () => {
|
46
|
+
txtBox.value = ""
|
47
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
48
|
+
})
|
49
|
+
|
50
|
+
|
41
51
|
let txtBox = document.querySelector('.txtBox')
|
42
52
|
txtBox.focus()
|
43
53
|
txtBox.value = serachValue
|
44
54
|
txtBox.addEventListener('input', (e) => {
|
55
|
+
if (e.target.value === "") {
|
56
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
57
|
+
} else {
|
58
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
59
|
+
}
|
45
60
|
let rangeOfBlankTile = script.dataset.range
|
46
61
|
e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, '')
|
47
62
|
if (rangeOfBlankTile === '') {
|
48
|
-
rangeOfBlankTile =
|
63
|
+
rangeOfBlankTile = 3
|
49
64
|
}
|
50
65
|
e.target.value = e.target.value.replace(/ /g, '?')
|
51
66
|
let data = []
|
@@ -324,8 +339,8 @@ function sortPointsby(sortValue, data) {
|
|
324
339
|
var text1 = serachValue.replace('?', '')
|
325
340
|
var text2 = item.words
|
326
341
|
var text3 = item.words
|
327
|
-
|
328
|
-
|
342
|
+
|
343
|
+
|
329
344
|
function findIndex(str, char) {
|
330
345
|
const strLength = str.length
|
331
346
|
const indexes = []
|
data/assets/js/wordleSolver.js
CHANGED
@@ -13,7 +13,7 @@ let wordlesolver_submit = document.getElementById('wordlesolver_submit')
|
|
13
13
|
let newWordsLength = 0
|
14
14
|
|
15
15
|
let errMessage = document.querySelector('.errMessage')
|
16
|
-
let
|
16
|
+
let wrapper_div = document.querySelector('.wrapper_div')
|
17
17
|
let addMore = document.querySelector('#addMore')
|
18
18
|
|
19
19
|
addMore.addEventListener('click', (e) => {
|
@@ -34,7 +34,7 @@ addMore.addEventListener('click', (e) => {
|
|
34
34
|
input.classList.add(...classes)
|
35
35
|
input.id = 'greyLetters'
|
36
36
|
div.append(input)
|
37
|
-
|
37
|
+
wrapper_div.append(div)
|
38
38
|
}
|
39
39
|
})
|
40
40
|
|
@@ -54,8 +54,8 @@ const wordleSolver = async (value, value2, value3, greenWithIndex) => {
|
|
54
54
|
greenWithIndex: greenWithIndex,
|
55
55
|
}),
|
56
56
|
})
|
57
|
-
let
|
58
|
-
data = data.slice(0,1000)
|
57
|
+
let data = await response.json()
|
58
|
+
data = data.slice(0, 1000)
|
59
59
|
document.querySelector('#updateTxt').innerHTML = 'Solve'
|
60
60
|
spinner.classList.remove('spinner-border')
|
61
61
|
|
@@ -193,7 +193,7 @@ function handleSubmit(e) {
|
|
193
193
|
let yellowLetters = getLetters('.yellowLetters')
|
194
194
|
let greyLetters = getLetters('.greyLetters')
|
195
195
|
let greenWithIndex = getIndexs('.greenWithIndex')
|
196
|
-
|
196
|
+
|
197
197
|
// if (
|
198
198
|
// greenLetters[0].value !== '' ||
|
199
199
|
// greenLetters[1].value !== '' ||
|
@@ -204,7 +204,7 @@ function handleSubmit(e) {
|
|
204
204
|
// errMessage.innerHTML = ''
|
205
205
|
// errMessage.classList.remove('alert-danger')
|
206
206
|
// errMessage.style.display = 'none'
|
207
|
-
|
207
|
+
wordleSolver(greenLetter, yellowLetters, greyLetters, greenWithIndex)
|
208
208
|
// } else {
|
209
209
|
// errMessage.innerHTML = 'You must enter at least 1 green letter'
|
210
210
|
// errMessage.classList.add('alert-danger')
|
@@ -30,10 +30,30 @@ let tab_container = document.querySelector('.tab_container')
|
|
30
30
|
var sortValue
|
31
31
|
var sortBool = false
|
32
32
|
|
33
|
+
|
33
34
|
let txtBox = document.querySelector('.txtBox')
|
34
35
|
txtBox.focus()
|
35
36
|
txtBox.value = serachValue
|
36
37
|
|
38
|
+
|
39
|
+
let letterCloseButton = document.querySelector('.letter-close-button-commonPage')
|
40
|
+
if (serachValue) {
|
41
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
42
|
+
}
|
43
|
+
letterCloseButton.addEventListener("click", () => {
|
44
|
+
txtBox.value = ""
|
45
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
46
|
+
})
|
47
|
+
|
48
|
+
|
49
|
+
txtBox.addEventListener('input', (e) => {
|
50
|
+
if (e.target.value === "") {
|
51
|
+
letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
|
52
|
+
} else {
|
53
|
+
letterCloseButton.classList.add("ltr-cls-btn-commonPage")
|
54
|
+
}
|
55
|
+
})
|
56
|
+
|
37
57
|
var theSelect = document.getElementById('select_dropDown')
|
38
58
|
document.querySelector('.select_dropDown2').value = dictonary
|
39
59
|
// getWords define...
|
@@ -49,7 +69,7 @@ const getData = async (serachValue) => {
|
|
49
69
|
`/.netlify/functions/wordsStartingWith?name=${serachValue}&selecteddictionary=${selectedDictionary}`
|
50
70
|
)
|
51
71
|
let data = await response.json()
|
52
|
-
data = data.slice(0,1500)
|
72
|
+
data = data.slice(0, 1500)
|
53
73
|
main.innerHTML = ''
|
54
74
|
wordsStartingWith(data)
|
55
75
|
//wordsStartingWith calling...
|
@@ -224,7 +244,7 @@ function sortPointsby(sortValue, data) {
|
|
224
244
|
main.innerHTML = ''
|
225
245
|
if (sortValue) {
|
226
246
|
let newWordsLength = 0
|
227
|
-
|
247
|
+
for (let i = 15; i >= 0; i--) {
|
228
248
|
var newdata = data.filter((item) => item.length === i)
|
229
249
|
console.log(newdata)
|
230
250
|
if (newdata.length === 0) {
|
@@ -284,7 +304,7 @@ function sortby(sortBool, data) {
|
|
284
304
|
main.innerHTML = ''
|
285
305
|
data.reverse()
|
286
306
|
let newWordsLength = 0
|
287
|
-
|
307
|
+
for (let i = 15; i >= 0; i--) {
|
288
308
|
var newdata = data.filter((item) => item.length === i)
|
289
309
|
|
290
310
|
if (newdata.length === 0) {
|
@@ -328,7 +348,7 @@ function sortby(sortBool, data) {
|
|
328
348
|
} else {
|
329
349
|
main.innerHTML = ''
|
330
350
|
data.sort()
|
331
|
-
|
351
|
+
for (let i = 15; i >= 0; i--) {
|
332
352
|
var newdata = data.filter((item) => item.length === i)
|
333
353
|
if (newdata.length === 0) {
|
334
354
|
main.innerHTML += ''
|