word-games-theme 2.9.0 → 2.9.2

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: 3f65bcfb20e1866513c140faad2139f779b1c3cd1e4f5bb4accea4a342d70ec0
4
- data.tar.gz: 2297d369885c957f6051007453184bc58eedd1c24d84e1be772a56c0892f3744
3
+ metadata.gz: e4d43ae91c1161c53a4feda7aa88e9913276f3229eeb5c0298ec6ab40f8f980b
4
+ data.tar.gz: 88ae5ae8fdb7cedf770f5eb22b092fd8c878232155caef6455a3bb8e7486d184
5
5
  SHA512:
6
- metadata.gz: 16cd60ae33fa7891025f6a97ac86f7ac54b7f086c3254ad488eb65f1189afa1125bcbda066eb9cfef09ee875f57a895169dc8d46974470065572eb2a80ee07ba
7
- data.tar.gz: da22d7da56cfe62cdd24bf3994b7d06940b55b9e7c4acffcfc604c4f84898ed967bf02e5c28974a376dbf02ed52d8f0f8f28d9ac021bde73aef243eb7f65f5fa
6
+ metadata.gz: c75ce8ba4304ae6754fb9cfe5ab7b78f8ac4d537bafa1b446f50abb8bab6e96d115eff73538d7d6b943e817fa7b70974ff70610bf0f624000bab5af09f4f16d4
7
+ data.tar.gz: 8a785b845d0dfb2575994637b71e8dab6ac551bac767ac737638e568cd12887e3affa10fd1552ce6573473c0cb30f4f648da5fd121a1b4a549d5015e0c132b4b
@@ -9,7 +9,7 @@
9
9
 
10
10
  <div class="fillterWrapper my-5 filterShow">
11
11
  <div class="startsWith">
12
- <input class="filter_val" autocomplete="off" type="text" id="startsWith" placeholder="Starts with" value=""
12
+ <input class="filter_val textBoxes" autocomplete="off" type="text" id="startsWith" placeholder="Starts with" value=""
13
13
  name="prefix">
14
14
  <div class="filter-tooltip" data-tip="Find words that start with these letters(AB-&gt; Able)"
15
15
  id="Find words that start with these letters(AB-&gt; Able)">
@@ -17,14 +17,14 @@
17
17
  </div>
18
18
  </div>
19
19
  <div class="endsWith">
20
- <input class="filter_val" autocomplete="off" type="text" id="endsWith" placeholder="Ends with" name="suffix">
20
+ <input class="filter_val textBoxes" autocomplete="off" type="text" id="endsWith" placeholder="Ends with" name="suffix">
21
21
  <div class="filter-tooltip" data-toggle="tooltip" data-placement="top"
22
22
  data-tip="Filter for words that ends with these letters" id="Filter for words that ends with these letters">
23
23
  <img width="30px" height="30px" src="/assets/images/questionmark.svg" alt="Question Mark" />
24
24
  </div>
25
25
  </div>
26
26
  <div class="wordLength same">
27
- <input autocomplete="off" type="number" class="filter_val" id="wordLength" placeholder="Length" name="length"
27
+ <input autocomplete="off" type="number" class="filter_val textBoxes" id="wordLength" placeholder="Length" name="length"
28
28
  value="{{page.letter}}">
29
29
 
30
30
  <div class="filter-tooltip" data-toggle="tooltip" data-placement="top"
@@ -33,7 +33,7 @@
33
33
  </div>
34
34
  </div>
35
35
  <div class="inculdeWith">
36
- <input class="filter_val" autocomplete="off" type="text" id="inculdeWith" placeholder="Include" value=""
36
+ <input class="filter_val textBoxes" autocomplete="off" type="text" id="inculdeWith" placeholder="Include" value=""
37
37
  name="include">
38
38
  <div class="filter-tooltip" data-toggle="tooltip" data-placement="top"
39
39
  data-tip="Only words that contain the letters you enter here"
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  </div>
44
44
  <div class="mustInclude">
45
- <input class="filter_val" autocomplete="off" type="text" id="mustInclude" placeholder="Contains"
45
+ <input class="filter_val textBoxes" autocomplete="off" type="text" id="mustInclude" placeholder="Contains"
46
46
  name="contains">
47
47
  <div class="filter-tooltip" data-tip="Words that contain letters in this order(ab)"
48
48
  id="Words that contain letters in this order(ab)">
@@ -52,7 +52,7 @@
52
52
  </div>
53
53
 
54
54
  <div class="exculdeWith">
55
- <input class="filter_val" autocomplete="off" type="text" id="exculdeWith" placeholder="Exclude" value=""
55
+ <input class="filter_val textBoxes" autocomplete="off" type="text" id="exculdeWith" placeholder="Exclude" value=""
56
56
  name="exclude">
57
57
  <div class="filter-tooltip" data-toggle="tooltip" data-placement="top"
58
58
  data-tip="Only words that not contain the letters you enter here"
@@ -7,7 +7,7 @@
7
7
  <div class="txt-box-container" style="position: relative;">
8
8
  <input type="text"
9
9
  placeholder="{% if page.size > 15 %}Enter up to {{page.size}} letters?{% else %}Enter up to 15 letters?{% endif %}"
10
- class="txtBox" name="search"
10
+ class="textBoxes txtBox" name="search"
11
11
  maxlength="{% if page.size > 15 %}{{page.size}}{% else %}15?{% endif %}"
12
12
  autocomplete="off" value="{{page.value}}">
13
13
  <div class="letter-close-button">
@@ -125,10 +125,10 @@ input[type="number"] {
125
125
 
126
126
  @keyframes blinkBoxShadow {
127
127
  0% {
128
- box-shadow: 0 0 5px 5px var(--primary-color);
128
+ box-shadow: 0 0 2px 2px var(--primary-color);
129
129
  }
130
130
  100% {
131
- box-shadow: 0 0 8px 8px var(--primary-color);
131
+ box-shadow: 0 0 4px 4px var(--primary-color);
132
132
  }
133
133
  }
134
134
 
@@ -1,11 +1,5 @@
1
1
  let txtBox = document.querySelector('.txtBox')
2
2
  txtBox.focus()
3
-
4
-
5
-
6
- txtBox.addEventListener("input",()=>{
7
- txtBox.classList.add('blinkBoxShadow');
8
- })
9
3
  let letterCloseButton = document.querySelector('.letter-close-button')
10
4
  let startsWith = document.getElementById("startsWith");
11
5
  let mustInclude = document.getElementById("mustInclude");
@@ -17,6 +11,25 @@ let wordLength = document.getElementById("wordLength");
17
11
  const serachSection = document.querySelector(".serachSection");
18
12
  let rangeOfBlankTile = serachSection.dataset.range;
19
13
 
14
+
15
+
16
+ const textBoxes = document.querySelectorAll('.textBoxes');
17
+ textBoxes.forEach(txtBox => {
18
+ txtBox.addEventListener("input", () => {
19
+ if (txtBox.value !== '') {
20
+ txtBox.classList.add('blinkBoxShadow');
21
+ } else {
22
+ txtBox.classList.remove('blinkBoxShadow');
23
+ }
24
+ });
25
+
26
+ txtBox.addEventListener('blur', () => {
27
+ txtBox.classList.remove('blinkBoxShadow');
28
+ });
29
+ });
30
+
31
+
32
+
20
33
  // // when typing on input
21
34
  txtBox.addEventListener('input', (e) => {
22
35
  if (e.target.value === "") {
@@ -63,7 +76,7 @@ Array.from(filterInputs).forEach((item) => {
63
76
  imgElement.src = "/assets/images/close-btn.svg"
64
77
  tooltipElement.style.setProperty('--tooltip-padding', '0');
65
78
  tooltipElement.style.setProperty('--tooltip-border-style', 'none');
66
- }
79
+ }
67
80
  })
68
81
 
69
82
  item.nextElementSibling.addEventListener("click", () => {
@@ -224,7 +237,7 @@ formElement.addEventListener("submit", function (e) {
224
237
  }
225
238
  }
226
239
  } else {
227
- console.log("Please Enter Valid Letters.");
240
+ console.log("Please Enter Valid Letters.");
228
241
  }
229
242
  });
230
243
  // Now you can use the loadScript function with additional data
@@ -41,34 +41,313 @@ for (let e = 0; e < greyLetters.length; e++) {
41
41
  })
42
42
  }
43
43
 
44
+ let wordleSolverData = document.getElementById('wordleSolverData')
45
+ greenLetters[0].focus()
46
+ let wordleWordCount = document.querySelector('#wordleWordCount')
47
+ let wordleSolvererrorMsg = document.querySelector('#wordleSolvererrorMsg')
48
+ let wordlesolver_submit = document.getElementById('wordlesolver_submit')
49
+ let newWordsLength = 0
50
+
51
+ let errMessage = document.querySelector('.errMessage')
52
+ let wrapper_div = document.querySelector('.wrapper_div')
53
+ const params = new URLSearchParams(window.location.search)
54
+ let spinner = document.querySelector('.spinner')
55
+
56
+ let featureContainer = document.querySelector("#featureContainer")
57
+ let howContainer = document.querySelector("#howContainer")
58
+ let faqsContainer = document.querySelector("#faqsContainer")
59
+ let infographicsContainer = document.querySelector("#infographicsContainer")
60
+ let authorsLists = document.querySelector(".authors-list")
61
+
44
62
  function handleSubmit(e) {
45
63
  e.preventDefault()
64
+
65
+ if (featureContainer) {
66
+ featureContainer.remove()
67
+ }
68
+ if (howContainer) {
69
+ howContainer.remove()
70
+ }
71
+ if (faqsContainer) {
72
+ faqsContainer.remove()
73
+ }
74
+ if (infographicsContainer) {
75
+ infographicsContainer.remove()
76
+ }
77
+ if (authorsLists) {
78
+ authorsLists.remove()
79
+ }
80
+
81
+
82
+
83
+ document.querySelector(".refineSerach").style.display = "block"
84
+ const scrollingElement = (document.scrollingElement || document.body);
85
+ scrollingElement.scroll({ top: 515, behavior: 'smooth' });
86
+
87
+ let greenWithIndex = getIndexs('.greenWithIndex')
88
+
46
89
  let corretLettterArray = []
90
+ let getGreenLetters = []
47
91
  Array.from(greenLetters).map((item) => {
48
92
  if (!item.value) {
49
- corretLettterArray.push(item.value.replace("", "_"))
93
+ corretLettterArray.push(item.value.replace("", "_").toLowerCase())
50
94
  } else {
51
- corretLettterArray.push(item.value)
95
+ getGreenLetters.push(item.value.toLowerCase())
96
+ corretLettterArray.push(item.value.toLowerCase())
52
97
  }
53
98
  })
54
- let includesLettterArray = []
99
+ let includesLettersArray = []
100
+ let getYellowLetters = []
55
101
  Array.from(yellowLetters).map((item) => {
56
102
  if (!item.value) {
57
- includesLettterArray.push(item.value.replace("", "_"))
103
+ includesLettersArray.push(item.value.replace("", "_").toLowerCase())
58
104
  } else {
59
- includesLettterArray.push(item.value)
105
+ getYellowLetters.push(item.value.toLowerCase())
106
+ includesLettersArray.push(item.value.toLowerCase())
60
107
  }
61
108
  })
62
- let exculdesLettterArray = []
109
+ let excludesLettersArray = []
110
+ let getGreyLetters = []
63
111
  Array.from(greyLetters).map((item) => {
64
112
  if (!item.value) {
65
- exculdesLettterArray.push(item.value.replace("", "_"))
113
+ excludesLettersArray.push(item.value.replace("", "_").toLowerCase())
66
114
  } else {
67
- exculdesLettterArray.push(item.value)
115
+ getGreyLetters.push(item.value.toLowerCase())
116
+ excludesLettersArray.push(item.value.toLowerCase())
68
117
  }
69
118
  })
119
+ if (history.pushState) {
120
+ var newurl = window.location.protocol + "//" + window.location.host +
121
+ window.location.pathname + '?' + "correct" + "=" + corretLettterArray.join("")
122
+ + '&includes' + '=' + includesLettersArray.join("") + "&excludes" + '=' + excludesLettersArray.join("")
123
+ window.history.pushState({ path: newurl }, '', newurl);
124
+
125
+ const params = new URLSearchParams(window.location.search)
126
+ let correct = params.get('correct')
127
+ let includes = params.get('includes')
128
+ let excludes = params.get('excludes')
129
+
130
+ gtag('event', 'page_view', {
131
+ page_location: window.location.pathname + location.search,
132
+ })
133
+ }
134
+ wordleSolver(getGreenLetters, getYellowLetters, getGreyLetters, greenWithIndex)
135
+ }
136
+ if (params.size > 0) {
137
+ window.onload = function (e) {
138
+ handleSubmit(e);
139
+ }
140
+ let correct = params.get('correct').toLowerCase()
141
+ let includes = params.get('includes').toLowerCase()
142
+ let excludes = params.get('excludes').toLowerCase()
143
+ for (let g = 0; g < greenLetters.length; g++) {
144
+ const elem = greenLetters[g]
145
+ let values = correct.split("")
146
+ values.map((item, index) => {
147
+ if (Number(elem.dataset.id) === index) {
148
+ elem.value = item.replace("_", "")
149
+ if (elem.value != "") {
150
+ elem.classList.add('ws-fcs')
151
+ }
152
+ }
153
+ })
154
+ elem.addEventListener('input', (e) => {
155
+ e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "")
156
+ if (e.target.value) {
157
+ e.target.classList.add('ws-fcs')
158
+ } else {
159
+ e.target.classList.remove('ws-fcs')
160
+ }
161
+ })
162
+ }
163
+ for (let y = 0; y < yellowLetters.length; y++) {
164
+ const elem = yellowLetters[y]
165
+ let values = includes.split("")
166
+ values.map((item, index) => {
167
+ if (Number(elem.dataset.id) === index) {
168
+ elem.value = item.replace("_", "")
169
+ if (elem.value != "") {
170
+ elem.classList.add('ws-fcs2')
171
+ }
172
+ }
173
+ })
174
+ elem.addEventListener('input', (e) => {
175
+ e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "")
176
+ if (e.target.value) {
177
+ e.target.classList.add('ws-fcs2')
178
+ } else {
179
+ e.target.classList.remove('ws-fcs2')
180
+ }
181
+ })
182
+ }
183
+ for (let e = 0; e < greyLetters.length; e++) {
184
+ const elem = greyLetters[e]
185
+ let values = excludes.split("")
186
+ values.map((item, index) => {
187
+ if (Number(elem.dataset.id) === index) {
188
+ elem.value = item.replace("_", "")
189
+ if (elem.value != "") {
190
+ elem.classList.add('ws-fcs3')
191
+ }
192
+ }
193
+ })
194
+
195
+ elem.addEventListener('input', (e) => {
196
+ e.target.value = e.target.value.replace(/[^a-zA-Z? ]/g, "")
197
+ if (e.target.value) {
198
+ e.target.classList.add('ws-fcs3')
199
+ } else {
200
+ e.target.classList.remove('ws-fcs3')
201
+ }
202
+ })
203
+ }
70
204
 
71
- window.location = `/${permalink}/result` + '?' + "correct" + "=" + corretLettterArray.join("")
72
- + '&includes' + '=' + includesLettterArray.join("") + "&excludes" + '=' + exculdesLettterArray.join("")
73
205
  }
74
- form.addEventListener('submit', handleSubmit)
206
+ form.addEventListener('submit', handleSubmit)
207
+
208
+ const wordleSolver = async (value, value2, value3, greenWithIndex) => {
209
+ try {
210
+ let result = ''
211
+ document.querySelector('#updateTxt').innerHTML = ''
212
+ spinner.classList.add('spinner-border')
213
+ wordleWordCount.innerHTML = 'Searching for best possible letters...'
214
+ let response = await fetch('/.netlify/functions/wordleSolver', {
215
+ method: 'POST',
216
+ body: JSON.stringify({
217
+ greenLetters: value,
218
+ yellowLetters: value2,
219
+ greyLetters: value3,
220
+ greenWithIndex: greenWithIndex,
221
+ }),
222
+ })
223
+ let data = await response.json()
224
+ data = data.slice(0, 1000)
225
+ document.querySelector('#updateTxt').innerHTML = 'Solve'
226
+ spinner.classList.remove('spinner-border')
227
+
228
+ let ok = true
229
+ if (data.length === 0) {
230
+ newWordsLength = ''
231
+ wordleSolverData.innerHTML = ''
232
+ wordleSolvererrorMsg.classList.add('alert-danger')
233
+ wordleSolvererrorMsg.innerHTML = 'Sorry!! No words found'
234
+ wordleWordCount.style.display = 'none'
235
+ // console.log(wordleWordCount)
236
+ } else {
237
+ wordleWordCount.style.display = 'block'
238
+ wordleSolverData.innerHTML = ''
239
+ wordleSolvererrorMsg.classList.remove('alert-danger')
240
+ wordleSolvererrorMsg.innerHTML = ''
241
+ newWordsLength = ''
242
+ newWordsLength += data.length
243
+ result = data.map((item) => {
244
+ if (item.length === 1) {
245
+ ok = false
246
+ newWordsLength = newWordsLength - 1
247
+ } else {
248
+ // console.log(newWordsLength);
249
+ let ScrabbleLetterScore = ScrabbleScore()
250
+ sum = 0
251
+ item = item.toLowerCase()
252
+ for (let i = 0; i < item.length; i++) {
253
+ sum += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
254
+ }
255
+ return `
256
+ <a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.toLowerCase()}">
257
+ <li>
258
+ ${item.toLowerCase()}
259
+ <span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px"> ${sum}</span>
260
+ </li>
261
+ </a>
262
+ `
263
+ }
264
+ })
265
+ if (ok) {
266
+ wordleSolverData.innerHTML += `
267
+ <div class="allfiveletterswords wordlistContainer">
268
+ <div class="wordListHeading">
269
+ <h3 class="lead">Solve wordle with these words</h3>
270
+ </div>
271
+ <div class="wordList">
272
+ <ul class="ul list-unstyled">
273
+ ${result.join('')}
274
+ </ul>
275
+ </div>
276
+ </div>
277
+ `
278
+ }
279
+ }
280
+
281
+ if (newWordsLength === 0) {
282
+ console.log(true)
283
+ wordleSolvererrorMsg.classList.add('alert-danger')
284
+ wordleSolvererrorMsg.innerHTML = 'Sorry!! No words found'
285
+ } else {
286
+ wordleWordCount.innerHTML = `<strong>Found <span style="color:#20a815">${newWordsLength}</span> matching words for wordle</strong>`
287
+ }
288
+ } catch (error) {
289
+ console.log(error)
290
+ }
291
+ }
292
+ const getLetters = (object) => {
293
+ let letters = []
294
+ if (typeof object === 'string') {
295
+ object = document.querySelectorAll(object)
296
+ }
297
+ for (let item of object) {
298
+ if (item.value.trim().length === 1) {
299
+ letters.push(item.value.toLowerCase())
300
+ }
301
+ }
302
+ return letters
303
+ }
304
+ const getIndexs = (object) => {
305
+ let index = []
306
+ if (typeof object === 'string') {
307
+ object = document.querySelectorAll(object)
308
+ }
309
+ for (let item of object) {
310
+ if (item.value.trim().length === 1) {
311
+ index.push({
312
+ value: item.value.toLowerCase(),
313
+ index: item.dataset.id,
314
+ })
315
+ }
316
+ }
317
+ return index
318
+ }
319
+ document.querySelector(".refineSerach").addEventListener("click", () => {
320
+ const scrollingElement = (document.scrollingElement || document.body);
321
+ scrollingElement.scroll({ top: 0, behavior: 'smooth' });
322
+ })
323
+ const ScrabbleScore = () => {
324
+ let twl06_sowpods = {
325
+ a: 1,
326
+ e: 1,
327
+ i: 1,
328
+ o: 1,
329
+ u: 1,
330
+ l: 1,
331
+ n: 1,
332
+ r: 1,
333
+ s: 1,
334
+ t: 1,
335
+ d: 2,
336
+ g: 2,
337
+ b: 3,
338
+ c: 3,
339
+ m: 3,
340
+ p: 3,
341
+ f: 4,
342
+ h: 4,
343
+ v: 4,
344
+ w: 4,
345
+ y: 4,
346
+ k: 5,
347
+ j: 8,
348
+ x: 8,
349
+ q: 10,
350
+ z: 10,
351
+ }
352
+ return twl06_sowpods
353
+ }
@@ -19,29 +19,6 @@ let includes = params.get('includes').toLowerCase()
19
19
  let excludes = params.get('excludes').toLowerCase()
20
20
 
21
21
 
22
- // let addMore = document.querySelector('#addMore')
23
-
24
- // addMore.addEventListener('click', (e) => {
25
- // e.preventDefault()
26
- // let div = document.createElement('div')
27
- // div.classList.add('d-flex')
28
- // div.classList.add('mt-2')
29
-
30
- // for (let i = 20; i <= 24; i++) {
31
- // let input = document.createElement('input')
32
- // input.type = 'text'
33
- // input.setAttribute('maxlength', '1')
34
- // input.setAttribute('autocomplete', 'off')
35
- // if (i <= 24) {
36
- // input.setAttribute('tabIndex', i)
37
- // }
38
- // let classes = ['wordleSolver-field', 'greyLetters', 'form-control', 'px-5']
39
- // input.classList.add(...classes)
40
- // input.id = 'greyLetters'
41
- // div.append(input)
42
- // wrapper_div.append(div)
43
- // }
44
- // })
45
22
 
46
23
  let spinner = document.querySelector('.spinner')
47
24
  const wordleSolver = async (value, value2, value3, greenWithIndex) => {
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.9.0
4
+ version: 2.9.2
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-06-19 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll