word-games-theme 1.2.7 → 1.2.8

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