word-games-theme 1.1.0 → 1.1.3

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