word-games-theme 2.6.7 → 2.6.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: 17e32113e5fded96d16258968b572c13ee60119ae0e6bbe5add6d74a6457f688
4
- data.tar.gz: 6b9ad1a465b551a95c3de7b622c45eff9e3ee7d3163675395fbedeb340542e86
3
+ metadata.gz: 137fe43b5869a4d3dbbd7b1a67da8b8cd3dbf58e76db6eb2c425f57b114edfb8
4
+ data.tar.gz: 85cfa82687767c010b3286fef9afc21bdbb969d036291b73a15c4fdd602c0c97
5
5
  SHA512:
6
- metadata.gz: f597fcbd9491f79dab91626b6af46b08d4ce8a6dae0043fec3100beca731e04f3d69f13446755bd02859bc4e3d7850860bf416b3acefc962ceaeeee68c11bb60
7
- data.tar.gz: 3caee3e6da1f867fb048498bce1beb60250c4162986234473cdf895325871d1a353e2ed0e993611263515ce54aaca5089481ea22a1c8e5ba6409459c0780c199
6
+ metadata.gz: 8f05e34319a8114f9e5e66e4275b9944226e648929d55c3b3e8ab4faabade67587d551af5e89b7188393e4746ab3a8c793c9d84619fe78947e2980ae5b1af23c
7
+ data.tar.gz: 2c21976c0eb1e9f0f28dc62dea0df68d0fcc3902c80338752f9e1474926043b88284568c5ef7e70a9a26df1539bc48760f375beea915bffaea669bfa1ec3beff
@@ -7,7 +7,7 @@
7
7
  <input type="text"
8
8
  placeholder="{% if page.size > 15 %}Enter up to {{page.size}} letters?{% else %}Enter up to 15 letters?{% endif %}"
9
9
  class="txtBox" value='' name="search"
10
- maxlength="{% if page.size > 15 %}{{page.size}}{% else %}15?{% endif %}" required
10
+ maxlength="{% if page.size > 15 %}{{page.size}}{% else %}15?{% endif %}"
11
11
  autocomplete="off">
12
12
  <div class="letter-close-button">
13
13
  <img width="40px" height="40px" src="/assets/images/close-button.svg" alt="close-btn">
@@ -433,12 +433,12 @@
433
433
  text-decoration: none !important;
434
434
  font-weight: 600;
435
435
  list-style: none;
436
- padding: 8px 0;
436
+ padding: 8px;
437
437
  background: #f8f9fa;
438
438
  border-radius: 5px;
439
439
  margin: 6px 6px;
440
440
  width: auto;
441
- min-width: 100px;
441
+ /* min-width: 100px; */
442
442
  text-align: center;
443
443
  border: solid 1px var(--black-color);
444
444
  box-shadow: 2px 2px 1px 0px var(--black-color);
@@ -455,7 +455,8 @@
455
455
 
456
456
  .errorMsg {
457
457
  text-align: center;
458
- font-size: 20px;
458
+ font-size: 25px;
459
+ margin-top: 1rem;
459
460
  color: red;
460
461
  font-weight: 800;
461
462
  }
@@ -125,9 +125,13 @@ const getData = async (serachValue) => {
125
125
  </ul>
126
126
  </main>`;
127
127
  /// loader
128
- const response = await fetch(
129
- `/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
130
- );
128
+ let response
129
+ if (serachValue) {
130
+ response = await fetch(`/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`);
131
+ } else {
132
+ response = await fetch(`/.netlify/functions/getData?&selecteddictionary=${selectedDictionary}`)
133
+ }
134
+
131
135
  const data = await response.json();
132
136
  main.innerHTML = "";
133
137
  getWords(data);
@@ -233,7 +237,8 @@ function getWords(data) {
233
237
  } else {
234
238
  let newWordsLength = 0;
235
239
  let dataArr = [];
236
- for (let i = serachValue.length; i >= 1; i--) {
240
+ // for (let i = serachValue.length; i >= 1; i--) {
241
+ for (let i = 15; i > 0; i--) {
237
242
  let newdata = data.filter((item) => item.length === i);
238
243
  if (prefixValue) {
239
244
  newdata = newdata.filter((item2) =>
@@ -327,33 +332,33 @@ function getWords(data) {
327
332
  newWordsLength += newdata.length;
328
333
  newdata = sortWords(newdata);
329
334
  const result = newdata.map((item) => {
330
- var text1 = serachValue.replace("?", "");
331
- var text2 = item;
332
- var text3 = item;
333
- let chars = text1.split("");
334
-
335
- let indexs = [];
336
- chars.map((i) => {
337
- let findIndexes = findIndex(text3, i);
338
- if (findIndexes.length > 0) {
339
- text3 = text3.split("");
340
- text3[findIndexes] = "$";
341
- text3 = text3.join("");
342
-
343
- indexs = [...indexs, ...findIndexes];
344
- }
345
- });
346
335
  let itemHtml = "";
347
- text2.split("").map((itemValue, index) => {
348
- let check = indexs.find((i) => i === index);
349
-
350
- if (check !== undefined) {
351
- itemHtml += `${itemValue}`;
352
- } else {
353
- itemHtml += `<span class='highlight'>${itemValue}</span>`;
354
- }
355
- });
356
-
336
+ if (serachValue) {
337
+ var text1 = serachValue.replace("?", "");
338
+ var text2 = item;
339
+ var text3 = item;
340
+ let chars = text1.split("");
341
+ let indexs = [];
342
+ chars.map((i) => {
343
+ let findIndexes = findIndex(text3, i);
344
+ if (findIndexes.length > 0) {
345
+ text3 = text3.split("");
346
+ text3[findIndexes] = "$";
347
+ text3 = text3.join("");
348
+ indexs = [...indexs, ...findIndexes];
349
+ }
350
+ });
351
+ text2.split("").map((itemValue, index) => {
352
+ let check = indexs.find((i) => i === index);
353
+ if (check !== undefined) {
354
+ itemHtml += `${itemValue}`;
355
+ } else {
356
+ itemHtml += `<span class='highlight'>${itemValue}</span>`;
357
+ }
358
+ });
359
+ } else {
360
+ itemHtml = item
361
+ }
357
362
  if (item.length === 1) {
358
363
  ok = false;
359
364
  newWordsLength = newWordsLength - 1;
@@ -373,13 +378,17 @@ function getWords(data) {
373
378
  `;
374
379
  }
375
380
  });
376
-
377
381
  if (result[0] !== undefined) {
378
- var option = document.createElement("option");
379
- option.text = `${i} Letter`;
380
- option.value = i;
381
- lengthSelect.setAttribute("onchange", `Filtering(${i})`)
382
- lengthSelect.add(option);
382
+ if (wordLength.value) {
383
+ lengthSelect.style.display = "none"
384
+ } else {
385
+ var option = document.createElement("option");
386
+ option.text = `${i} Letter`;
387
+ option.value = i;
388
+ lengthSelect.setAttribute("onchange", `Filtering(${i})`)
389
+ lengthSelect.add(option);
390
+ lengthSelect.style.display = "block"
391
+ }
383
392
  main.innerHTML += `
384
393
  <div class="allGroupWords wordlistContainer" id="alpha_${i}">
385
394
  <h3 class="wordListHeading lead">${i} Letter Words</h3>
@@ -392,11 +401,39 @@ function getWords(data) {
392
401
  }
393
402
  }
394
403
  if (newWordsLength === 0) {
395
- errorMsg.innerHTML = "no words found";
404
+ errorMsg.innerHTML = "No Words Found";
405
+ document.querySelector(".sortingFilters").style.display = "none"
406
+
396
407
  } else {
397
- wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split(
398
- ""
399
- )}</strong>`;
408
+ if (serachValue) {
409
+ wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split("")}</strong>`;
410
+ } else {
411
+
412
+ let startwithMsg = ""
413
+ let endwithMsg = ""
414
+ let containsMsg = ""
415
+ let lengthMsg = ""
416
+ let inputVal = ""
417
+ if (serachValue) {
418
+ inputVal = `${input.value.split("")} `
419
+ }
420
+ if (prefixValue) {
421
+ startwithMsg = `starting with ${prefixValue.split("")}`
422
+ }
423
+ if (suffixValue) {
424
+ endwithMsg = `ending with ${suffixValue.split("")} `
425
+ }
426
+ if (containsValue) {
427
+ containsMsg = `containing with ${containsValue.split("")} `
428
+ }
429
+ if (lengthValue) {
430
+ lengthMsg = `with ${lengthValue} letter words`
431
+ }
432
+ let msg = `<strong> Found ${newWordsLength} words with letters
433
+ ${lengthMsg} ${inputVal} ${startwithMsg} ${endwithMsg} ${containsMsg} </strong>`
434
+
435
+ wordCount.innerHTML = `${msg} `
436
+ }
400
437
  }
401
438
  }
402
439
  }
@@ -152,19 +152,19 @@ const getData = async (serachValue) => {
152
152
  document.querySelector(".heading-h2").style.display = "none"
153
153
  errorMsg.innerHTML = ""
154
154
  wordCount.innerHTML = ""
155
- if(featureContainer){
155
+ if (featureContainer) {
156
156
  featureContainer.remove()
157
157
  }
158
- if(howContainer){
158
+ if (howContainer) {
159
159
  howContainer.remove()
160
160
  }
161
- if(faqsContainer){
161
+ if (faqsContainer) {
162
162
  faqsContainer.remove()
163
163
  }
164
- if(infographicsContainer){
164
+ if (infographicsContainer) {
165
165
  infographicsContainer.remove()
166
166
  }
167
- if(authorsLists){
167
+ if (authorsLists) {
168
168
  authorsLists.remove()
169
169
  }
170
170
  home_page_search_result.innerHTML = ""
@@ -197,9 +197,11 @@ const getData = async (serachValue) => {
197
197
  </li>
198
198
  </ul>
199
199
  </main>`;
200
- const response = await fetch(
201
- `/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`
202
- )
200
+ if (serachValue) {
201
+ response = await fetch(`/.netlify/functions/getWords?name=${serachValue}&selecteddictionary=${selectedDictionary}`);
202
+ } else {
203
+ response = await fetch(`/.netlify/functions/getData?&selecteddictionary=${selectedDictionary}`)
204
+ }
203
205
  const data = await response.json()
204
206
  main.innerHTML = ''
205
207
  x_with_letters(data)
@@ -264,10 +266,10 @@ form.addEventListener('submit', logSubmit);
264
266
  sortingFilter.addEventListener("change", logSubmit);
265
267
 
266
268
  function x_with_letters(data) {
267
- document.querySelector(".sortingFilters").style.display="flex"
269
+ document.querySelector(".sortingFilters").style.display = "flex"
268
270
  main.innerHTML = ""
269
271
  if (typeof data === 'string') {
270
- document.querySelector(".sortingFilters").style.display="none"
272
+ document.querySelector(".sortingFilters").style.display = "none"
271
273
  errorMsg.innerHTML = 'No words found'
272
274
  wordCount.innerHTML = `<strong>Found 0 words with letters ${serachValue.split(
273
275
  ''
@@ -374,6 +376,7 @@ function x_with_letters(data) {
374
376
  filterData = sortWords(filterData);
375
377
  let itemLength = ''
376
378
  const result = filterData.map((item) => {
379
+ let itemHtml = "";
377
380
  itemLength = item.length
378
381
  let ScrabbleLetterScore = ScrabbleScore()
379
382
  sum = 0
@@ -382,41 +385,45 @@ function x_with_letters(data) {
382
385
  sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
383
386
  }
384
387
  wordLength.value = itemLength
385
-
386
- var text1 = serachValue.replace('?', '')
387
- var text2 = item
388
- var text3 = item
389
- function findIndex(str, char) {
390
- const strLength = str.length
391
- const indexes = []
392
- let newStr = str
393
- while (newStr && newStr.indexOf(char) > -1) {
394
- indexes.push(newStr.indexOf(char) + strLength - newStr.length)
395
- newStr = newStr.substring(newStr.indexOf(char) + 1)
396
- newStr = newStr.substring(newStr.indexOf(char) + 1)
388
+ if (serachValue) {
389
+ var text1 = serachValue.replace('?', '')
390
+ var text2 = item
391
+ var text3 = item
392
+ function findIndex(str, char) {
393
+ const strLength = str.length
394
+ const indexes = []
395
+ let newStr = str
396
+ while (newStr && newStr.indexOf(char) > -1) {
397
+ indexes.push(newStr.indexOf(char) + strLength - newStr.length)
398
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
399
+ newStr = newStr.substring(newStr.indexOf(char) + 1)
400
+ }
401
+ return indexes
397
402
  }
398
- return indexes
403
+ let chars = text1.split('')
404
+ let indexs = []
405
+ chars.map((i) => {
406
+ let findIndexes = findIndex(text3, i)
407
+ if (findIndexes.length > 0) {
408
+ text3 = text3.split('')
409
+ text3[findIndexes] = '$'
410
+ text3 = text3.join('')
411
+ indexs = [...indexs, ...findIndexes]
412
+ }
413
+ })
414
+
415
+ text2.split('').map((itemValue, index) => {
416
+ let check = indexs.find((i) => i === index)
417
+ if (check !== undefined) {
418
+ itemHtml += `${itemValue}`
419
+ } else {
420
+ itemHtml += `<span class='highlight'>${itemValue}</span>`
421
+ }
422
+ })
423
+ } else {
424
+
425
+ itemHtml = item
399
426
  }
400
- let chars = text1.split('')
401
- let indexs = []
402
- chars.map((i) => {
403
- let findIndexes = findIndex(text3, i)
404
- if (findIndexes.length > 0) {
405
- text3 = text3.split('')
406
- text3[findIndexes] = '$'
407
- text3 = text3.join('')
408
- indexs = [...indexs, ...findIndexes]
409
- }
410
- })
411
- let itemHtml = ''
412
- text2.split('').map((itemValue, index) => {
413
- let check = indexs.find((i) => i === index)
414
- if (check !== undefined) {
415
- itemHtml += `${itemValue}`
416
- } else {
417
- itemHtml += `<span class='highlight'>${itemValue}</span>`
418
- }
419
- })
420
427
 
421
428
  dataArr.push(item)
422
429
  return `<a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item}">
@@ -436,10 +443,37 @@ function x_with_letters(data) {
436
443
  </div>
437
444
  `;
438
445
  }
439
-
446
+ if (serachValue) {
440
447
  wordCount.innerHTML = `<strong>Found ${newWordsLength} words with letters with ${serachValue.split(
441
448
  ''
442
449
  )}</strong>`
450
+ }else{
451
+
452
+ let startwithMsg = ""
453
+ let endwithMsg = ""
454
+ let containsMsg = ""
455
+ let lengthMsg = ""
456
+ let inputVal = ""
457
+ if (serachValue) {
458
+ inputVal = `${input.value.split("")} `
459
+ }
460
+ if (prefixValue) {
461
+ startwithMsg = `starting with ${prefixValue.split("")}`
462
+ }
463
+ if (suffixValue) {
464
+ endwithMsg = `ending with ${suffixValue.split("")} `
465
+ }
466
+ if (containsValue) {
467
+ containsMsg = `containing with ${containsValue.split("")} `
468
+ }
469
+ if (lengthValue) {
470
+ lengthMsg = `with ${lengthValue} letter words`
471
+ }
472
+ let msg = `<strong> Found ${newWordsLength} words with letters
473
+ ${lengthMsg} ${inputVal} ${startwithMsg} ${endwithMsg} ${containsMsg} </strong>`
474
+
475
+ wordCount.innerHTML = `${msg} `
476
+ }
443
477
  }
444
478
  }
445
479
 
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: 2.6.7
4
+ version: 2.6.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: 2024-03-12 00:00:00.000000000 Z
11
+ date: 2024-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll