word-games-theme 2.6.7 → 2.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17e32113e5fded96d16258968b572c13ee60119ae0e6bbe5add6d74a6457f688
4
- data.tar.gz: 6b9ad1a465b551a95c3de7b622c45eff9e3ee7d3163675395fbedeb340542e86
3
+ metadata.gz: 5084b4dc9c2614ed9647ca741c03ee93e8fbcefce6fa8dfe5565c42bf663a915
4
+ data.tar.gz: ffedbb712145c2b34631d237383d8ac5686d24f9f4819d696e416bde015a1605
5
5
  SHA512:
6
- metadata.gz: f597fcbd9491f79dab91626b6af46b08d4ce8a6dae0043fec3100beca731e04f3d69f13446755bd02859bc4e3d7850860bf416b3acefc962ceaeeee68c11bb60
7
- data.tar.gz: 3caee3e6da1f867fb048498bce1beb60250c4162986234473cdf895325871d1a353e2ed0e993611263515ce54aaca5089481ea22a1c8e5ba6409459c0780c199
6
+ metadata.gz: 367fe83fe2f0445ba6925ba7b7979b2cee0fcbd0db0d76e9eb3799382043607450a75ec7094c78e8282e53a84060c2f6557cc8ddda578ba0e4828f8b391f9c9a
7
+ data.tar.gz: 6c3f8413ff16050e37cc3f9603151682391a1c8b6c4e74e61f369c5e9f2bce6e76a4f445cf879f0d020d33363a16d84e24116efcb2b9a903342b7d329811282b
@@ -6,9 +6,9 @@
6
6
  <div class="txt-box-container" style="position: relative;">
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
- class="txtBox" value='' name="search"
10
- maxlength="{% if page.size > 15 %}{{page.size}}{% else %}15?{% endif %}" required
11
- autocomplete="off">
9
+ class="txtBox" name="search"
10
+ maxlength="{% if page.size > 15 %}{{page.size}}{% else %}15?{% endif %}"
11
+ autocomplete="off" value="{{page.value}}">
12
12
  <div class="letter-close-button">
13
13
  <img width="40px" height="40px" src="/assets/images/close-button.svg" alt="close-btn">
14
14
  </div>
@@ -14,7 +14,7 @@
14
14
  <div class="wordCount"><strong>
15
15
  {{dataToShow.wordLength}}
16
16
  </strong></div>
17
-
17
+
18
18
  <div class="d-none tab_link_wrapper" style="position: relative;">
19
19
  <div id="tab-scroll" class="tab-scroll flex-row">
20
20
  <input type="button" name="" id="prev" class="prev tabsBg noOutline cursorPointer" value=" "
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  <div class="wrapper_dropDown mt-3 d-flex justify-content-end" style="gap:10px;">
43
43
  <div class="letter-length">
44
- <select class="form-select length-select" onchange="Filtering(2)">
44
+ <select class="form-select length-select xyz-length-select" onchange="Filtering(2)">
45
45
  <option selected="true" hidden>Letter Length</option>
46
46
  {%- for scrabblewords in dataToShow.words-%}
47
47
  {%- for item in scrabblewords %}
@@ -50,12 +50,10 @@
50
50
  {%- endif -%}
51
51
  {%- endfor -%}
52
52
  {%- endfor -%}
53
-
54
-
55
53
  </select>
56
54
  </div>
57
55
  <div id="sort-select">
58
- <select class="form-select sort-select" id="select_dropDown">
56
+ <select class="form-select xyz_select_dropDown sort-select" id="select_dropDown">
59
57
  <option selected="true" hidden id="alpha" value="alpha">Sort by</option>
60
58
  <option id="alpha" value="alpha">A-Z</option>
61
59
  <option id="alpha" value="alpha">Z-A</option>
@@ -65,7 +63,7 @@
65
63
  </div>
66
64
  </div>
67
65
 
68
- <div class="main">
66
+ <div class="xyz-main-content main">
69
67
  {%- for scrabblewords in dataToShow.words-%}
70
68
  {%- for item in scrabblewords %}
71
69
  {%- if forloop.index == 1 -%}
@@ -1,75 +1,12 @@
1
1
  {% assign file = page.fileName %}
2
2
  {% assign lang = page.lang %}
3
3
  {% assign dataToShow = site.data.[page.folderName][lang][file] %}
4
-
5
4
  {%- assign CustomColor = site.data.theme.colors -%}
6
-
7
- <style>
8
- .sticky_nav {
9
- position: sticky;
10
- width: inherit;
11
- top: 58px;
12
- background-color: #fff;
13
- z-index: 99;
14
- }
15
- </style>
16
5
  <!-- start commonPage as LandingPage -->
17
- <section class="sticky_nav">
18
- <div class="pageHeading text-center pt-5">
19
- <h1 class="heading m-0 pb-0">
20
- {{dataToShow.h1}}</h1>
21
- {%- if dataToShow.h2 -%}
22
- <h2>
23
- {{dataToShow.h2}}</h2>
24
- {%- endif -%}
25
- </div>
26
- <div class="serachSection">
27
- <div class="position-relative serachBox">
28
- <form action="{{page.url}}/result" id='form'>
29
- <div class="container" id="containerWd">
30
- <input style="border-radius: {{CustomColor.inputFieldBorder}}" type="text"
31
- placeholder="Enter up to 15 letters?" class="txtBox" name="search" maxlength="15"
32
- value={{page.value}} required>
33
- <input
34
- style="border-radius: {{CustomColor.inputFieldBorder}}; background-color: {{CustomColor.inputButtonBg}};"
35
- type="submit" class="serachBtn" id="serach" value>
36
- <div class="letter-close-button">
37
- <svg width="40px" height="40px" viewBox="0 0 24 24" fill="none"
38
- xmlns="http://www.w3.org/2000/svg">
39
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
40
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
41
- <g id="SVGRepo_iconCarrier">
42
- <path
43
- d="M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2ZM15.36 14.3C15.65 14.59 15.65 15.07 15.36 15.36C15.21 15.51 15.02 15.58 14.83 15.58C14.64 15.58 14.45 15.51 14.3 15.36L12 13.06L9.7 15.36C9.55 15.51 9.36 15.58 9.17 15.58C8.98 15.58 8.79 15.51 8.64 15.36C8.35 15.07 8.35 14.59 8.64 14.3L10.94 12L8.64 9.7C8.35 9.41 8.35 8.93 8.64 8.64C8.93 8.35 9.41 8.35 9.7 8.64L12 10.94L14.3 8.64C14.59 8.35 15.07 8.35 15.36 8.64C15.65 8.93 15.65 9.41 15.36 9.7L13.06 12L15.36 14.3Z"
44
- fill="#292D32"></path>
45
- </g>
46
- </svg>
47
- </div>
48
- <span class="d-none focus-border">
49
- <i></i>
50
- </span>
51
- <div class="dictonaryDropdown">
52
- <!-- <div class="dictonaryDropdown"> -->
53
- <select class="form-select select_dropDown2" name="dictionary"
54
- aria-label="Default select example">
55
- <option value="Dictionary">Dictionary</option>
56
- <option value="twl06" id="twl06">TWL06 (US, Canada, Thailand)</option>
57
- <option selected value="sowpods" id="sowpods">SOWPODS (Uk and Others)</option>
58
- <option value="wwf" id="wwf">Enable (Words With Friends)</option>
59
- </select>
60
- <!-- </div> -->
61
- </div>
62
- </div>
63
-
64
- <div class="container">
65
- {%- include wordgames/advanced-filter/advanced-filter.html -%}
66
- </div>
67
-
68
-
69
- </form>
70
- </div>
71
- </div>
72
- </section>
6
+ <div class="main-header m-0">
7
+ {% include wordgames/headings/headings.html %}
8
+ {% include wordgames/search-box/search-box.html %}
9
+ </div>
73
10
  <div class="container" id="containerWd">
74
11
  {% include wordgames/xyzpages/xyz-words.html %}
75
12
  </div>
@@ -93,6 +93,7 @@
93
93
  <div class="wordgametheme-sidebar-right"></div>
94
94
  {%- endif -%}
95
95
 
96
+
96
97
  {%- include wordgames/xyzpages/xyz.html -%}
97
98
 
98
99
  {% include wordgames/featurehighlights/featurehighlights.html %}
@@ -110,8 +111,6 @@
110
111
 
111
112
  {%- include wordgames/rating/rating.html -%}
112
113
 
113
- <!-- {%- include share/socialshare.html -%} -->
114
-
115
114
  {% include wordgames/adblocker/adblocker.html %}
116
115
 
117
116
  {% include wordgames/xyzpages/xyzFooter.html %}
@@ -119,7 +118,6 @@
119
118
 
120
119
  <script defer src="/assets/js/wordgames-xyz.js"></script>
121
120
  <script defer src="/assets/js/theme.js"></script>
122
- <script defer src="/assets/js/wordgames-home.js"></script>
123
121
 
124
122
  {%- include wordgames/scripts/scripts.html -%}
125
123
  </body>
@@ -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
  }
@@ -1,69 +1,64 @@
1
- let main = document.querySelector('.main')
2
- let tab_container = document.querySelector('.tab_container')
3
- var sortValue
4
- var sortBool = false
5
- var theSelect = document.getElementById('select_dropDown')
6
- let lengthSelect = document.querySelector(".length-select");
7
-
8
- // Add Filtering
9
- let sections = {}
1
+
2
+ let mainContent = document.querySelector('.xyz-main-content')
3
+ let xyzsortValue
4
+ let xyzsortBool = false
5
+ let thexyzSelect = document.querySelector('.xyz_select_dropDown')
6
+ let xyzlengthSelect = document.querySelector(".xyz-length-select");
7
+
8
+ let wordSections = {}
10
9
  function Filtering(id) {
11
- id = lengthSelect.value
12
- main.innerHTML += ``
10
+ id = xyzlengthSelect.value
11
+ mainContent.innerHTML += ``
13
12
  var section = document.querySelectorAll('.allGroupWords')
14
13
  var sort_val = "alpha";
15
14
  Array.prototype.forEach.call(section, function (e) {
16
15
  if (document.body.clientWidth > 991) {
17
- sections[e.id] = e.offsetTop - 10
16
+ wordSections[e.id] = e.offsetTop - 10
18
17
  } else {
19
- sections[e.id] = e.offsetTop - 10
18
+ wordSections[e.id] = e.offsetTop - 10
20
19
  }
21
20
  })
22
21
  console.log(sort_val + '_' + id);
23
- document.documentElement.scrollTop = sections[sort_val + '_' + id] + 5
22
+ document.documentElement.scrollTop = wordSections[sort_val + '_' + id] + 5
24
23
  }
25
-
26
-
27
-
28
24
  // sorting for words
29
- theSelect.addEventListener("change", () => {
30
- sortValue = theSelect[theSelect.selectedIndex].text;
25
+ thexyzSelect.addEventListener("change", () => {
26
+ xyzsortValue = thexyzSelect[thexyzSelect.selectedIndex].text;
31
27
  let list_word = document.getElementsByClassName("list_word")
32
28
  let data = []
33
29
  Array.from(list_word).forEach(item => {
34
30
  item.removeChild(item.lastElementChild);
35
31
  data.push(item.innerHTML.replace(/\s/g, ''))
36
32
  })
37
- if (sortValue == "Z-A") {
38
- sortBool = "Z-A";
39
- sortby(sortBool, data);
40
- } else if (sortValue == "Points") {
41
- sortBool = "Points";
42
- sortPointsby(sortBool, data);
33
+ if (xyzsortValue == "Z-A") {
34
+ xyzsortBool = "Z-A";
35
+ sortby(xyzsortBool, data);
36
+ } else if (xyzsortValue == "Points") {
37
+ xyzsortBool = "Points";
38
+ sortPointsby(xyzsortBool, data);
43
39
  } else {
44
- sortBool = "A-Z";
45
- sortby(sortBool, data);
40
+ xyzsortBool = "A-Z";
41
+ sortby(xyzsortBool, data);
46
42
  }
47
43
  });
48
-
49
44
  // sort by aplhabets
50
- function sortby(sortValue, data) {
51
- if (sortValue === "Z-A") {
52
- appendData(sortValue, data.reverse())
45
+ function sortby(xyzsortValue, data) {
46
+ if (xyzsortValue === "Z-A") {
47
+ appendData(xyzsortValue, data.reverse())
53
48
  }
54
- else if (sortValue === "A-Z") {
55
- appendData(sortValue, data.sort())
49
+ else if (xyzsortValue === "A-Z") {
50
+ appendData(xyzsortValue, data.sort())
56
51
  }
57
52
  }
58
53
  // sorting by points
59
- function sortPointsby(sortValue, data) {
60
- if (sortValue === "Points") {
54
+ function sortPointsby(xyzsortValue, data) {
55
+ if (xyzsortValue === "Points") {
61
56
  let newArray = [];
62
57
  data.map((item) => {
63
58
  if (item.length === 1) {
64
59
  ok = false;
65
60
  } else {
66
- let ScrabbleLetterScore = ScrabbleScore();
61
+ let ScrabbleLetterScore = xyzScrabbleScore();
67
62
  let points = 0;
68
63
  let word = item.replace(/<\/?[^>]+>/gi, '')
69
64
  for (let i = 0; i < word.length; i++) {
@@ -79,29 +74,29 @@ function sortPointsby(sortValue, data) {
79
74
  newArray.sort(function (a, b) {
80
75
  return b.points - a.points;
81
76
  });
82
- appendData(sortValue, newArray)
77
+ appendData(xyzsortValue, newArray)
83
78
  }
84
79
  }
85
80
 
86
- function appendData(sortValue, data) {
87
- main.innerHTML = "";
81
+ function appendData(xyzsortValue, data) {
82
+ mainContent.innerHTML = "";
88
83
  let newWordsLength = 0;
89
84
  for (let i = 15; i > 0; i--) {
90
85
  let newdata
91
- if (sortValue === "Points") {
86
+ if (xyzsortValue === "Points") {
92
87
  newdata = data.filter((item) => item.words.replace(/<\/?[^>]+>/gi, '').length === i)
93
88
  } else {
94
89
  newdata = data.filter((item) => item.replace(/<\/?[^>]+>/gi, '').length === i)
95
90
  }
96
91
  if (newdata.length === 0) {
97
- main.innerHTML += "";
92
+ mainContent.innerHTML += "";
98
93
  } else {
99
94
  newWordsLength += newdata.length;
100
95
  const result = newdata.map((item) => {
101
- let ScrabbleLetterScore = ScrabbleScore();
96
+ let ScrabbleLetterScore = xyzScrabbleScore();
102
97
  let points = 0;
103
98
  let word
104
- if (sortValue === "Points") {
99
+ if (xyzsortValue === "Points") {
105
100
  word = item.words.replace(/<\/?[^>]+>/gi, '')
106
101
  item = item.words
107
102
  } else {
@@ -120,7 +115,7 @@ function appendData(sortValue, data) {
120
115
  </a>
121
116
  `});
122
117
 
123
- main.innerHTML += `
118
+ mainContent.innerHTML += `
124
119
  <div class="allGroupWords wordlistContainer" id="alpha_${i}">
125
120
  <div class="wordListHeading">
126
121
  <h3 class="lead">${i} Letter Words</h3>
@@ -136,7 +131,7 @@ function appendData(sortValue, data) {
136
131
  }
137
132
  }
138
133
  // Scrabble Point Array
139
- const ScrabbleScore = () => {
134
+ const xyzScrabbleScore = () => {
140
135
  let twl06_sowpods = {
141
136
  a: 1,
142
137
  e: 1,
@@ -201,3 +196,255 @@ const ScrabbleScore = () => {
201
196
  return twl06_sowpods;
202
197
  // }
203
198
  };
199
+
200
+
201
+
202
+
203
+
204
+ let txtBox = document.querySelector('.txtBox')
205
+ let letterCloseButton = document.querySelector('.letter-close-button')
206
+ let startsWith = document.getElementById("startsWith");
207
+ let mustInclude = document.getElementById("mustInclude");
208
+ let endsWith = document.getElementById("endsWith");
209
+ let exculdeWith = document.getElementById("exculdeWith");
210
+ let inculdeWith = document.getElementById("inculdeWith");
211
+ let wordLength = document.getElementById("wordLength");
212
+ const serachSection = document.querySelector(".serachSection");
213
+ let rangeOfBlankTile = serachSection.dataset.range;
214
+
215
+ // // when typing on input
216
+ txtBox.addEventListener('input', (e) => {
217
+ if (e.target.value === "") {
218
+ letterCloseButton.style.display = "none"
219
+ }
220
+ else {
221
+ letterCloseButton.style.display = "block"
222
+ }
223
+ e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "")
224
+ let rangeOfBlankTile = 3
225
+ if (rangeOfBlankTile === "") {
226
+ rangeOfBlankTile = 3
227
+ }
228
+ e.target.value = e.target.value.replace(/ /g, '?')
229
+ let data = []
230
+ data = e.target.value.split('').filter((i) => i === '?')
231
+ if (data.length > rangeOfBlankTile) {
232
+ e.target.value = e.target.value.replace(/\?$/, '')
233
+ }
234
+ })
235
+ letterCloseButton.addEventListener("click", () => {
236
+ txtBox.value = ""
237
+ letterCloseButton.style.display = "none"
238
+ })
239
+ //tooltips for advanced filter
240
+ const filterInputs = document.querySelectorAll('.filter_val');
241
+ Array.from(filterInputs).forEach((item) => {
242
+ item.addEventListener("input", (e) => {
243
+ const inputValue = e.target.value;
244
+ const parentElement = e.target.parentElement;
245
+ const imgElement = parentElement.querySelector('img');
246
+ const tooltipElement = parentElement.querySelector('.filter-tooltip');
247
+
248
+ if (inputValue == "") {
249
+ imgElement.src = "/assets/images/questionmark.svg"
250
+ setTimeout(() => {
251
+ item.nextElementSibling.setAttribute("data-tip", item.nextElementSibling.id)
252
+ }, 100);
253
+ tooltipElement.style.setProperty('--tooltip-padding', '0.5rem');
254
+ tooltipElement.style.setProperty('--tooltip-border-style', 'soild');
255
+
256
+ } else {
257
+ item.nextElementSibling.removeAttribute("data-tip")
258
+ imgElement.src = "/assets/images/close-btn.svg"
259
+ tooltipElement.style.setProperty('--tooltip-padding', '0');
260
+ tooltipElement.style.setProperty('--tooltip-border-style', 'none');
261
+ }
262
+ item.nextElementSibling.addEventListener("click", () => {
263
+ e.target.value = ""
264
+ imgElement.src = "/assets/images/questionmark.svg"
265
+ setTimeout(() => {
266
+ item.nextElementSibling.setAttribute("data-tip", item.nextElementSibling.id)
267
+ }, 100);
268
+ tooltipElement.style.setProperty('--tooltip-padding', '0.5rem');
269
+ tooltipElement.style.setProperty('--tooltip-border-style', 'soild');
270
+ })
271
+ })
272
+ })
273
+ const loadResource = (FILE_URL, data = {}, async = true, type = "text/javascript") => {
274
+ return new Promise((resolve, reject) => {
275
+ let resourceEle;
276
+
277
+ if (type === "text/javascript") {
278
+ resourceEle = document.createElement("script");
279
+ resourceEle.src = FILE_URL;
280
+ resourceEle.classList.add("loaded-js");
281
+ } else if (type === "text/css") {
282
+ resourceEle = document.createElement("link");
283
+ resourceEle.rel = "stylesheet";
284
+ resourceEle.href = FILE_URL;
285
+ } else {
286
+ reject({
287
+ status: false,
288
+ message: `Unsupported resource type: ${type}`,
289
+ });
290
+ return;
291
+ }
292
+
293
+ resourceEle.type = type;
294
+ resourceEle.async = async;
295
+
296
+ Object.keys(data).forEach((key) => {
297
+ resourceEle.setAttribute(`data-${key}`, data[key]);
298
+ });
299
+
300
+ resourceEle.addEventListener("load", () => {
301
+ resolve({ status: true });
302
+ });
303
+
304
+ resourceEle.addEventListener("error", () => {
305
+ reject({
306
+ status: false,
307
+ message: `Failed to load the resource ${FILE_URL}`,
308
+ });
309
+ });
310
+
311
+ if (type === "text/javascript") {
312
+ // console.log(resourceEle);
313
+ // console.log(FILE_URL);
314
+ document.body.appendChild(resourceEle);
315
+ } else if (type === "text/css") {
316
+ document.head.appendChild(resourceEle);
317
+ }
318
+ });
319
+ };
320
+ const formElement = document.querySelector("#form");
321
+ formElement.addEventListener("submit", function (e) {
322
+ e.preventDefault();
323
+ document.querySelector(".xyzPad").style.display = "none"
324
+ let quesMark = "?";
325
+ if (rangeOfBlankTile) {
326
+ if (!txtBox.value.includes("?")) {
327
+ txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
328
+ txtBox.value = txtBox.value;
329
+ }
330
+ }
331
+ document.querySelector(".fillterWrapper").classList.add("hide")
332
+ let selectedDictionary = document.querySelector(".select_dropDown2").value;
333
+ if (history.pushState) {
334
+ var newurl =
335
+ window.location.protocol +
336
+ "//" +
337
+ window.location.host +
338
+ window.location.pathname +
339
+ "?" +
340
+ "search" +
341
+ "=" +
342
+ txtBox.value.toLowerCase() +
343
+ "&" +
344
+ "dictionary" +
345
+ "=" +
346
+ selectedDictionary +
347
+ "&" +
348
+ "prefix" +
349
+ "=" +
350
+ startsWith.value +
351
+ "&" +
352
+ "contains" +
353
+ "=" +
354
+ mustInclude.value +
355
+ "&" +
356
+ "suffix" +
357
+ "=" +
358
+ endsWith.value +
359
+ "&" +
360
+ "exclude" +
361
+ "=" +
362
+ exculdeWith.value +
363
+ "&" +
364
+ "include" +
365
+ "=" +
366
+ inculdeWith.value +
367
+ "&" +
368
+ "length" +
369
+ "=" +
370
+ wordLength.value;
371
+ window.history.pushState({ path: newurl }, "", newurl);
372
+
373
+ const params = new URLSearchParams(window.location.search);
374
+ serachValue = params.get("search");
375
+ prefixValue = params.get("prefix");
376
+ containsValue = params.get("contains");
377
+ suffixValue = params.get("suffix");
378
+ exculdeValue = params.get("exclude");
379
+ includeValue = params.get("include");
380
+ lengthValue = params.get("length");
381
+ dictonary = params.get("dictionary");
382
+
383
+ gtag("event", "page_view", {
384
+ page_location: window.location.pathname + location.search,
385
+ });
386
+ }
387
+
388
+
389
+ const paramName = 'search';
390
+ if (new URLSearchParams(window.location.search).has(paramName)) {
391
+ const additionalData = {
392
+ url: "{{site.url}}",
393
+ range: "{{page.blanktilerange}}"
394
+ }
395
+ var loadJs = document.querySelector(".loaded-js");
396
+ if (loadJs == null) {
397
+ loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
398
+ .then((data) => {
399
+ console.log("CSS loaded:", data);
400
+ })
401
+ .then(() => {
402
+ // Load the JavaScript file after the CSS file has loaded
403
+ loadResource("/assets/js/wordfinder.js", additionalData, true, "text/javascript")
404
+ .then((data) => {
405
+ console.log("JavaScript loaded:", data);
406
+ getData(txtBox.value.toLowerCase());
407
+ })
408
+ .catch((error) => {
409
+ console.error("Error loading JavaScript:", error);
410
+ });
411
+ })
412
+ .catch((error) => {
413
+ console.error("Error loading CSS:", error);
414
+ });
415
+ }
416
+ }
417
+ });
418
+ // Now you can use the loadScript function with additional data
419
+ function checkQueryParam() {
420
+ const urlParams = new URLSearchParams(window.location.search);
421
+ const paramName = 'search';
422
+ if (urlParams.has(paramName)) {
423
+ document.querySelector(".xyzPad").style.display = "none"
424
+ const additionalData = {
425
+ url: "{{site.url}}",
426
+ range: "{{page.blanktilerange}}"
427
+ };
428
+ loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
429
+ .then((data) => {
430
+ console.log("CSS loaded:", data);
431
+ })
432
+ .then(() => {
433
+ // Load the JavaScript file after the CSS file has loaded
434
+ loadResource("/assets/js/wordfinder.js", additionalData, true, "text/javascript")
435
+ .then((data) => {
436
+ console.log("JavaScript loaded:", data);
437
+ getData(txtBox.value.toLowerCase());
438
+ })
439
+ .catch((error) => {
440
+ console.error("Error loading JavaScript:", error);
441
+ });
442
+ })
443
+ .catch((error) => {
444
+ console.error("Error loading CSS:", error);
445
+ });
446
+ }
447
+ }
448
+ checkQueryParam();
449
+
450
+
@@ -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.9
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-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll