word-games-theme 1.1.1 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,692 @@
1
+ const getScript = document.currentScript
2
+ const letterLen = getScript.dataset.letter
3
+ const ablank = getScript.dataset.ablank
4
+
5
+ const siteUrl = getScript.dataset.url
6
+
7
+ let errorMsg = document.querySelector('.errorMsg')
8
+ let script = document.currentScript
9
+ let wordCount = document.querySelector('.wordCount')
10
+ let main = document.querySelector('.main')
11
+
12
+ const params = new URLSearchParams(window.location.search)
13
+ let serachValue = params.get('search').toLowerCase()
14
+ let prefixValue = params.get('prefix')
15
+ let containsValue = params.get('contains')
16
+ let suffixValue = params.get('suffix')
17
+ let exculdeValue = params.get('exculde')
18
+ let includeValue = params.get('include')
19
+ let lengthValue = params.get('length')
20
+ let dictonary = params.get('dictionary')
21
+
22
+
23
+ let tab_link_wrapper = document.querySelector('.tab_link_wrapper')
24
+ tab_link_wrapper.style.display = "none"
25
+
26
+ let home_page_search_result = document.querySelector("#home_page_search_result")
27
+ let homePageSearchResult = `/result?search=${serachValue}&dictionary=Dictionary&prefix=&contains=&suffix=&exculde=&inculde=&length=`;
28
+
29
+ let txtBox = document.querySelector('.txtBox')
30
+ txtBox.focus()
31
+ txtBox.value = serachValue
32
+
33
+
34
+ if (ablank) {
35
+ if (!serachValue.includes("?")) {
36
+ if (serachValue.length <= letterLen || serachValue.length >= letterLen) {
37
+ serachValue = serachValue + '?'
38
+ txtBox.value = serachValue
39
+ }
40
+ }
41
+ }
42
+
43
+
44
+
45
+
46
+
47
+
48
+ let letterCloseButton = document.querySelector('.letter-close-button-commonPage')
49
+ if (serachValue) {
50
+ letterCloseButton.classList.add("ltr-cls-btn-commonPage")
51
+ }
52
+ letterCloseButton.addEventListener("click", () => {
53
+ txtBox.value = ""
54
+ letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
55
+ })
56
+
57
+ txtBox.addEventListener('input', (e) => {
58
+ if (e.target.value === "") {
59
+ letterCloseButton.classList.remove("ltr-cls-btn-commonPage")
60
+ } else {
61
+ letterCloseButton.classList.add("ltr-cls-btn-commonPage")
62
+ }
63
+ let rangeOfBlankTile = script.dataset.range
64
+ e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, '')
65
+ if (rangeOfBlankTile === '') {
66
+ rangeOfBlankTile = 3
67
+ }
68
+ e.target.value = e.target.value.replace(/ /g, '?')
69
+ let data = []
70
+ data = e.target.value.split('').filter((i) => i === '?')
71
+ // console.log(data)
72
+ if (data.length > rangeOfBlankTile) {
73
+ e.target.value = e.target.value.replace(/\?$/, '')
74
+ }
75
+ })
76
+
77
+ var 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
+ const getData = async (serachValue) => {
115
+ try {
116
+ errorMsg.innerHTML = ""
117
+ wordCount.innerHTML = ""
118
+ home_page_search_result.innerHTML = ""
119
+ let selectedDictionary = document.querySelector('.select_dropDown2').value
120
+ main.innerHTML = `<div class="loader">
121
+ <img src='/assets/images/loading.gif'>
122
+ <div style="font-weight:900;font-size:14px" >Finding words - Powered by ${siteUrl.replace(/^https?:\/\//, '')}</div>
123
+ </div>`
124
+ const response = await fetch(
125
+ `/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
126
+ )
127
+ const data = await response.json()
128
+ main.innerHTML = ''
129
+ x_with_letters(data)
130
+ } catch (error) {
131
+ console.log(error)
132
+ }
133
+ }
134
+ // calling function
135
+ getData(serachValue.toLowerCase())
136
+
137
+ let quesMark = ''
138
+ quesMark = "?"
139
+ function logSubmit(event) {
140
+
141
+ if (ablank) {
142
+ if (!txtBox.value.includes("?")) {
143
+ txtBox.value = txtBox.value + quesMark
144
+ }
145
+ }
146
+
147
+ let selectedDictionary = document.querySelector('.select_dropDown2').value
148
+ event.preventDefault();
149
+ if (history.pushState) {
150
+ var newurl = window.location.protocol + "//" + window.location.host +
151
+ window.location.pathname + '?' + "search" + "=" + txtBox.value.toLowerCase() + '&' +
152
+ 'dictionary' + '=' + selectedDictionary +
153
+ '&' + 'prefix' + '=' + startsWith.value + '&' + 'contains' + '=' + mustInclude.value +
154
+ '&' + 'suffix' + '=' + endsWith.value + '&' + 'exculde' + '=' + exculdeWith.value +
155
+ '&' + 'include' + '=' + inculdeWith.value + '&' + 'length' + '=' + wordLength.value;
156
+ window.history.pushState({ path: newurl }, '', newurl);
157
+
158
+ const params = new URLSearchParams(window.location.search)
159
+ serachValue = params.get('search')
160
+ prefixValue = params.get('prefix')
161
+ containsValue = params.get('contains')
162
+ suffixValue = params.get('suffix')
163
+ exculdeValue = params.get('exculde')
164
+ includeValue = params.get('include')
165
+ lengthValue = params.get('length')
166
+ dictonary = params.get('dictionary')
167
+ }
168
+ getData(txtBox.value.toLowerCase())
169
+ addFilterCount()
170
+
171
+ }
172
+ applyBtn.addEventListener('submit', logSubmit)
173
+ form.addEventListener('submit', logSubmit);
174
+
175
+
176
+ function x_with_letters(data) {
177
+ main.innerHTML = ""
178
+ if (typeof data === 'string') {
179
+ errorMsg.innerHTML = 'No words found'
180
+ wordCount.innerHTML = `<strong>Found 0 words with letters ${serachValue.split(
181
+ ''
182
+ )}</strong>`
183
+ } else {
184
+ let newWordsLength = 0
185
+ let filterData = ''
186
+
187
+
188
+ if (letterLen) {
189
+ filterData = data.filter((item) => item.length == letterLen)
190
+ }
191
+
192
+ if (prefixValue) {
193
+ filterData = filterData.filter((item2) =>
194
+ item2.startsWith(prefixValue.toLowerCase())
195
+ )
196
+ startsWith.classList.add('tick')
197
+ startsWith.value = prefixValue
198
+ } else {
199
+ startsWith.classList.remove('tick')
200
+ }
201
+ if (containsValue) {
202
+ filterData = filterData.filter((item) =>
203
+ item.includes(containsValue.toLowerCase())
204
+ )
205
+ mustInclude.classList.add('tick')
206
+ mustInclude.value = containsValue
207
+ } else {
208
+ mustInclude.classList.remove('tick')
209
+ }
210
+ if (suffixValue) {
211
+ filterData = filterData.filter((item) =>
212
+ item.endsWith(suffixValue.toLowerCase())
213
+ )
214
+ endsWith.classList.add('tick')
215
+ endsWith.value = suffixValue
216
+ } else {
217
+ endsWith.classList.remove('tick')
218
+ }
219
+ if (exculdeValue) {
220
+ let data = []
221
+ filterData.map((item) => {
222
+ let check = false
223
+ for (let e = 0; e < exculdeValue.length; e++) {
224
+ const element = exculdeValue[e].toLowerCase()
225
+ if (item.includes(element)) {
226
+ check = true
227
+ break
228
+ } else {
229
+ check = false
230
+ }
231
+ }
232
+ if (check === false) {
233
+ data.push(item)
234
+ }
235
+ })
236
+ exculdeWith.classList.add('tick')
237
+ exculdeWith.value = exculdeValue
238
+ filterData = data
239
+ } else {
240
+ exculdeWith.classList.remove('tick')
241
+ }
242
+
243
+ if (includeValue) {
244
+ let data = []
245
+ filterData.map((item) => {
246
+ let check = false
247
+ for (let e = 0; e < includeValue.length; e++) {
248
+ const element = includeValue[e].toLowerCase()
249
+ if (!item.includes(element)) {
250
+ check = true
251
+ break
252
+ } else {
253
+ check = false
254
+ }
255
+ }
256
+ if (check === false) {
257
+ data.push(item)
258
+ }
259
+ })
260
+ inculdeWith.classList.add('tick')
261
+ inculdeWith.value = includeValue
262
+ filterData = data
263
+ } else {
264
+ inculdeWith.classList.remove('tick')
265
+ }
266
+
267
+ if (filterData.length === 0) {
268
+ main.innerHTML += ''
269
+ errorMsg.innerHTML = 'No words Found with this length'
270
+ } else {
271
+ // sort eventlistener
272
+ theSelect.addEventListener('change', () => {
273
+ sortValue = theSelect[theSelect.selectedIndex].text
274
+ if (sortValue == 'Z-A') {
275
+ sortBool = true
276
+ sortby(sortBool, filterData, itemLength)
277
+ } else {
278
+ sortBool = false
279
+ sortby(sortBool, filterData, itemLength)
280
+ }
281
+ if (sortValue == 'Points') {
282
+ sortBool = true
283
+ sortPointsby(sortBool, filterData, itemLength)
284
+ }
285
+ })
286
+
287
+ newWordsLength += filterData.length
288
+ let itemLength = ''
289
+ const result = filterData.map((item) => {
290
+ itemLength = item.length
291
+ let ScrabbleLetterScore = ScrabbleScore()
292
+ sum = 0
293
+ item = item.toLowerCase()
294
+ for (let i = 0; i < item.length; i++) {
295
+ sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
296
+ }
297
+ wordLength.value = itemLength
298
+
299
+ var text1 = serachValue.replace('?', '')
300
+ var text2 = item
301
+ var text3 = item
302
+ function findIndex(str, char) {
303
+ const strLength = str.length
304
+ const indexes = []
305
+ let newStr = str
306
+ while (newStr && newStr.indexOf(char) > -1) {
307
+ indexes.push(newStr.indexOf(char) + strLength - newStr.length)
308
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
309
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
310
+ }
311
+ return indexes
312
+ }
313
+ let chars = text1.split('')
314
+ let indexs = []
315
+ chars.map((i) => {
316
+ let findIndexes = findIndex(text3, i)
317
+ if (findIndexes.length > 0) {
318
+ text3 = text3.split('')
319
+ text3[findIndexes] = '$'
320
+ text3 = text3.join('')
321
+ indexs = [...indexs, ...findIndexes]
322
+ }
323
+ })
324
+ let itemHtml = ''
325
+ text2.split('').map((itemValue, index) => {
326
+ let check = indexs.find((i) => i === index)
327
+ if (check !== undefined) {
328
+ itemHtml += `${itemValue}`
329
+ } else {
330
+ itemHtml += `<span class='highlight'>${itemValue}</span>`
331
+ }
332
+ })
333
+
334
+
335
+ return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item}">
336
+ <li>${itemHtml}
337
+ <span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
338
+ </li></a>`
339
+ })
340
+
341
+ // tab_container.innerHTML += `
342
+ // <a href="#${itemLength}">
343
+ // <input type="button" value="${itemLength} Letter" id="Tab${itemLength}" onclick="addFilter(${itemLength})"
344
+ // class="tab_link">
345
+ // </a>
346
+ // `
347
+
348
+ // let tabs = document.getElementsByClassName('tab_link')
349
+ // tabs[0] ? tabs[0].classList.add('active-tab') : ''
350
+
351
+ home_page_search_result.href = homePageSearchResult
352
+ home_page_search_result.innerHTML = `See words of any length with letters ${serachValue.split("")}`
353
+
354
+
355
+ main.innerHTML += `
356
+ <div class="allGroupWords">
357
+ <div class="wordListHeading">
358
+ <h3 class="lead">${itemLength} Letter Words</h3>
359
+ </div>
360
+ <div class="wordList">
361
+ <ul class="ul list-unstyled">
362
+ ${result.join('')}
363
+ </ul>
364
+ </div>
365
+ </div>
366
+ `
367
+ }
368
+ wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split(
369
+ ''
370
+ )}</strong>`
371
+ }
372
+ }
373
+
374
+ //Handling of filter counter in advanced filter
375
+ function addFilterCount() {
376
+ let filter_val = document.getElementsByClassName('filter_val')
377
+ let filter = document.querySelector('.filter_count')
378
+ let filter_count = 0
379
+
380
+ filter_val[0].value = prefixValue
381
+ filter_val[1].value = containsValue
382
+ filter_val[2].value = suffixValue
383
+ filter_val[3].value = exculdeValue
384
+ filter_val[4].value = includeValue
385
+ filter_val[5].value = lengthValue
386
+
387
+ for (var i = 0; i <= 4; i++) {
388
+ if (filter_val[i].value != '') {
389
+ filter_count += 1
390
+ }
391
+ if (filter_count === 0) {
392
+ filter.style.display = 'none'
393
+ } else {
394
+ filter.style.display = 'inline-block'
395
+ }
396
+
397
+ filter.innerHTML = filter_count
398
+ }
399
+ }
400
+ addFilterCount()
401
+
402
+ // sorting by points
403
+ function sortPointsby(sortValue, data, i) {
404
+ if (sortValue) {
405
+ main.innerHTML = ''
406
+ let newArray = []
407
+ data.map((item) => {
408
+ let ScrabbleLetterScore = ScrabbleScore()
409
+ let points = 0
410
+ item = item.toLowerCase()
411
+ for (let i = 0; i < item.length; i++) {
412
+ points += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
413
+ }
414
+ const value = {
415
+ words: item,
416
+ points: points,
417
+ }
418
+ newArray.push(value)
419
+ newArray.sort(function (a, b) {
420
+ return b.points - a.points
421
+ })
422
+ })
423
+ const result = newArray.map((item) => {
424
+ var text1 = serachValue.replace('?', '')
425
+ var text2 = item.words
426
+ var text3 = item.words
427
+ function findIndex(str, char) {
428
+ const strLength = str.length
429
+ const indexes = []
430
+ let newStr = str
431
+ while (newStr && newStr.indexOf(char) > -1) {
432
+ indexes.push(newStr.indexOf(char) + strLength - newStr.length)
433
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
434
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
435
+ }
436
+ return indexes
437
+ }
438
+ let chars = text1.split('')
439
+ let indexs = []
440
+ chars.map((i) => {
441
+ let findIndexes = findIndex(text3, i)
442
+ if (findIndexes.length > 0) {
443
+ text3 = text3.split('')
444
+ text3[findIndexes] = '$'
445
+ text3 = text3.join('')
446
+ indexs = [...indexs, ...findIndexes]
447
+ }
448
+ })
449
+ let itemHtml = ''
450
+ text2.split('').map((itemValue, index) => {
451
+ let check = indexs.find((i) => i === index)
452
+ if (check !== undefined) {
453
+ itemHtml += `${itemValue}`
454
+ } else {
455
+ itemHtml += `<span class='highlight'>${itemValue}</span>`
456
+ }
457
+ })
458
+ return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.words}">
459
+ <li>${itemHtml}
460
+ <span class="points" value="${item.points}" style="position:relative; top:4px; font-size:12px"> ${item.points}</span>
461
+ </li></a>`
462
+ })
463
+
464
+ main.innerHTML += `
465
+ <div class="allGroupWords wordlistContainer" id="alpha_${i}">
466
+ <div class="wordListHeading">
467
+ <h3 class="lead">${i} Letter Words</h3>
468
+ </div>
469
+ <div class="wordList">
470
+ <ul class="ul list-unstyled">
471
+ ${result.join('')}
472
+ </ul>
473
+ </div>
474
+ </div>
475
+ `
476
+ }
477
+ }
478
+ // sort by aplhabets
479
+ function sortby(sortBool, data, i) {
480
+ if (sortBool) {
481
+ main.innerHTML = ''
482
+ data.reverse()
483
+ const result = data.map((item) => {
484
+ let ScrabbleLetterScore = ScrabbleScore()
485
+ let sum = 0
486
+ item = item.toLowerCase()
487
+ for (let i = 0; i < item.length; i++) {
488
+ sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
489
+ }
490
+
491
+ var text1 = serachValue.replace('?', '')
492
+ var text2 = item
493
+ var text3 = item
494
+ function findIndex(str, char) {
495
+ const strLength = str.length
496
+ const indexes = []
497
+ let newStr = str
498
+ while (newStr && newStr.indexOf(char) > -1) {
499
+ indexes.push(newStr.indexOf(char) + strLength - newStr.length)
500
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
501
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
502
+ }
503
+ return indexes
504
+ }
505
+ let chars = text1.split('')
506
+ let indexs = []
507
+ chars.map((i) => {
508
+ let findIndexes = findIndex(text3, i)
509
+ if (findIndexes.length > 0) {
510
+ text3 = text3.split('')
511
+ text3[findIndexes] = '$'
512
+ text3 = text3.join('')
513
+ indexs = [...indexs, ...findIndexes]
514
+ }
515
+ })
516
+ let itemHtml = ''
517
+ text2.split('').map((itemValue, index) => {
518
+ let check = indexs.find((i) => i === index)
519
+ if (check !== undefined) {
520
+ itemHtml += `${itemValue}`
521
+ } else {
522
+ itemHtml += `<span class='highlight'>${itemValue}</span>`
523
+ }
524
+ })
525
+
526
+ return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item}">
527
+ <li>${itemHtml}
528
+ <span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
529
+ </li></a>`
530
+ })
531
+
532
+ main.innerHTML += `
533
+ <div class="allGroupWords wordlistContainer" id="alpha_${i}">
534
+ <div class="wordListHeading">
535
+ <h3 class="lead">${i} Letter Words</h3>
536
+ </div>
537
+ <div class="wordList">
538
+ <ul class="ul list-unstyled">
539
+ ${result.join('')}
540
+ </ul>
541
+ </div>
542
+ </div>
543
+
544
+ `
545
+ } else {
546
+ main.innerHTML = ''
547
+ data.sort()
548
+ const result = data.map((item) => {
549
+ let ScrabbleLetterScore = ScrabbleScore()
550
+ let sum = 0
551
+ item = item.toLowerCase()
552
+ for (let i = 0; i < item.length; i++) {
553
+ sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
554
+ }
555
+
556
+ var text1 = serachValue.replace('?', '')
557
+ var text2 = item
558
+ var text3 = item
559
+ function findIndex(str, char) {
560
+ const strLength = str.length
561
+ const indexes = []
562
+ let newStr = str
563
+ while (newStr && newStr.indexOf(char) > -1) {
564
+ indexes.push(newStr.indexOf(char) + strLength - newStr.length)
565
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
566
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
567
+ }
568
+ return indexes
569
+ }
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
+
591
+ return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item}">
592
+ <li>${itemHtml}
593
+ <span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
594
+ </li></a>`
595
+ })
596
+
597
+ main.innerHTML += `
598
+ <div class="allGroupWords wordlistContainer" id="alpha_${i}">
599
+ <div class="wordListHeading">
600
+ <h3 class="lead">${i} Letter Words</h3>
601
+ </div>
602
+ <div class="wordList">
603
+ <ul class="ul list-unstyled">
604
+ ${result.join('')}
605
+ </ul>
606
+ </div>
607
+ </div>
608
+
609
+ `
610
+ }
611
+ }
612
+
613
+ // Implement Active class
614
+ // const addFilter = () => {
615
+ // let tabs = document.getElementsByClassName('tab_link')
616
+ // tabs[0] ? tabs[0].classList.add('active-tab') : ''
617
+
618
+ // Array.from(tabs).map((item) => {
619
+ // item.classList.remove('active-tab')
620
+ // })
621
+ // main.innerHTML += ``
622
+ // let activeLetter = event.target
623
+ // // console.log(activeLetter)
624
+ // activeLetter.classList.add('active-tab')
625
+ // }
626
+
627
+ // Scrabble Point Counts
628
+ const ScrabbleScore = () => {
629
+ let twl06_sowpods = {
630
+ a: 1,
631
+ e: 1,
632
+ i: 1,
633
+ o: 1,
634
+ u: 1,
635
+ l: 1,
636
+ n: 1,
637
+ r: 1,
638
+ s: 1,
639
+ t: 1,
640
+ d: 2,
641
+ g: 2,
642
+ b: 3,
643
+ c: 3,
644
+ m: 3,
645
+ p: 3,
646
+ f: 4,
647
+ h: 4,
648
+ v: 4,
649
+ w: 4,
650
+ y: 4,
651
+ k: 5,
652
+ j: 8,
653
+ x: 8,
654
+ q: 10,
655
+ z: 10,
656
+ }
657
+
658
+ let wwfScore = {
659
+ a: 1,
660
+ b: 4,
661
+ c: 4,
662
+ d: 2,
663
+ e: 1,
664
+ f: 4,
665
+ g: 3,
666
+ h: 3,
667
+ i: 1,
668
+ j: 10,
669
+ k: 5,
670
+ l: 2,
671
+ m: 4,
672
+ n: 2,
673
+ o: 1,
674
+ p: 4,
675
+ q: 10,
676
+ r: 1,
677
+ s: 1,
678
+ t: 1,
679
+ u: 2,
680
+ v: 5,
681
+ w: 4,
682
+ x: 8,
683
+ y: 3,
684
+ z: 10,
685
+ }
686
+
687
+ if (dictonary === 'wwf') {
688
+ return wwfScore
689
+ } else {
690
+ return twl06_sowpods
691
+ }
692
+ }
@@ -110,12 +110,13 @@ const getDiff = (text1, text2) => {
110
110
  }
111
111
  const getData = async (serachValue) => {
112
112
  try {
113
+ let selectedDictionary = document.querySelector('.select_dropDown2').value
113
114
  main.innerHTML = `<div class="loader">
114
115
  <img src='/assets/images/loading.gif'>
115
116
  <div style="font-weight:900;font-size:14px" >Finding words - Powered by ${siteUrl.replace(/^https?:\/\//, '')}</div>
116
117
  </div>`
117
118
  const response = await fetch(
118
- `/.netlify/functions/getWords?name=${serachValue}`
119
+ `/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
119
120
  )
120
121
  const data = await response.json()
121
122
  main.innerHTML = ''