word-games-theme 1.7.3 → 1.7.5

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: e1136ad1d34b760451995ab577776147d661d904c63868991a8aeeb4a706db44
4
- data.tar.gz: 52292e2d2d86c15db1b28f7cdd8e9c20ad51963e50565a69ebec6075b466d944
3
+ metadata.gz: 385fc40b50cbe6b42a1f658d82feee181ec84295e5b66996a3c8a702dbacfab3
4
+ data.tar.gz: 07f6e06440b7ad60f8609b1781a5739315d28e46d8680284656fc2215a4f7c8b
5
5
  SHA512:
6
- metadata.gz: 20f67ddd898e62b27bb65a7cc293cfe4661b27f2a539400cb53d0ef1b1759b52f00a7c0f2fb069e6a88e81ecb85efb9413cfca5a2abdc9396482414751393dd7
7
- data.tar.gz: 210d8e4cf70917e3abe500e2e1e7815313b5495a516978e55edd276c26b1bf6e33cc87f15619e5280ea083054497108315bd836287e34bbfe295672d909c7e81
6
+ metadata.gz: 73a241a68514054a99ecb265350b55f8718d32eea8e6cf25594ff2069937e5f86c74d50a1d995471d8d6003b38fef3d1da1af9bed9160b1b86325e3b03113f46
7
+ data.tar.gz: 4c2487286ae9062d27d5d312474244ed46146c0267ca193b9042e1fc0dc0b3fa6076634e0d970fc8f985310c53a398ca3739a298b6fd61efce113a96d94f979c
@@ -1,3 +1,5 @@
1
+ {% assign wordLength = page.length %}
2
+
1
3
  <div class="content">
2
4
  <div class="row m-0">
3
5
  <div class="col-md-6 mx-auto p-0">
@@ -74,6 +76,8 @@
74
76
  </select>
75
77
  </div>
76
78
  </div>
79
+
80
+ {%- if wordLength == nil -%}
77
81
  <div class="col-md-6">
78
82
  <div class="form-group">
79
83
  <label>Max Words</label>
@@ -87,6 +91,8 @@
87
91
  </select>
88
92
  </div>
89
93
  </div>
94
+ {%- endif -%}
95
+
90
96
  <div class="col-md-6">
91
97
  <div class="form-group">
92
98
  <label>Results</label>
@@ -140,4 +146,6 @@
140
146
  </div>
141
147
  </div>
142
148
  </div>
149
+
150
+ <div id="word-length" data-word_length="{{page.length}}"></div>
143
151
  </div>
@@ -20,6 +20,9 @@ var scrabbleWordArr = [];
20
20
  input.focus();
21
21
  var wcount = 0;
22
22
  var m_words = 0;
23
+ var wlength = document.getElementById("word-length");
24
+
25
+ var max_word_length = wlength.dataset.word_length;
23
26
  function getCombinations(arr, n) {
24
27
  var i,
25
28
  j,
@@ -57,53 +60,19 @@ const getData = async (e) => {
57
60
  <div style="font-weight:900;font-size:14px" >Finding words - Powered by anagramsolvers.org</div>
58
61
  </div>`;
59
62
  const response = await fetch(
60
- `/.netlify/functions/getWords?name=${input.value.toLowerCase()}&selecteddictionary=${
63
+ `./netlify/functions/getWords?name=${input.value.toLowerCase()}&selecteddictionary=${
61
64
  selectedDictionary.value
62
65
  }`
63
66
  );
64
67
  var data = await response.json();
65
68
 
66
- console.time("time taken");
67
- data = getCombo(data, max_words.value);
68
- console.timeEnd("time taken");
69
-
70
- // main.innerHTML = "";
71
-
72
- // let newdata = data;
69
+ max_word_length == ""
70
+ ? (m_length = +max_words.value)
71
+ : (m_length = max_word_length);
73
72
 
74
- // if (newdata.length == []) {
75
- // errorMessage.style.display = "block";
76
- // document.querySelector(".heading-result").style.display = "none";
77
- // } else {
78
- // errorMessage.style.display = "none";
79
- // document.querySelector(".heading-result").style.display = "block";
80
- // if (sort_dir.value === "desc") {
81
- // newdata = data.reverse();
82
- // }
83
- // if (contains.value) {
84
- // newdata = newdata.filter((item) =>
85
- // item.includes(contains.value.toLowerCase())
86
- // );
87
- // }
88
-
89
- // newdata.map((item) => {
90
- // let nWords = item.split(" ");
91
- // var wordHtml = "";
92
-
93
- // nWords.map((word) => {
94
- // wordHtml += `<a style="margin:0 5px 0 0; font-size:14px; color:#007bff" title="Lookup ${word} in Dictionary" target="_blank" href="/word-meaning?search=${word}">${word}</a>`;
95
- // });
96
- // let html = `<div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
97
- // ${wordHtml}
98
- // </div>`;
99
- // // main.innerHTML += `${html}`;
100
- // main.insertAdjacentHTML("beforeend", html);
101
- // });
102
- // }
103
- // resultArr = [];
104
- // found.clear();
105
- // scrabbleWordArr = [];
106
- // console.timeEnd("Process time");
73
+ // m_length is maximum word length
74
+ data = getCombo(data, m_length);
75
+ console.timeEnd("time taken");
107
76
  };
108
77
 
109
78
  form.addEventListener("submit", getData);
@@ -116,8 +85,11 @@ async function getCombo(arr, m_words) {
116
85
  var userValue = input.value.trim().toLowerCase().split("");
117
86
  var combinations = [];
118
87
  scrabbleWordArr = arr;
119
- m_words = +max_words.value;
120
-
88
+ if (max_word_length == "") {
89
+ m_words = +max_words.value;
90
+ } else {
91
+ m_words = max_word_length;
92
+ }
121
93
  arr.map((v) => {
122
94
  validWord(v.replace(" ", "").split(""), userValue, v);
123
95
  });
@@ -274,6 +246,16 @@ const getMatchedChars = (str, userInput) => {
274
246
  //n is max word
275
247
  async function displayUi(newdata, combinations, userValue, n, wordArr) {
276
248
  // console.log("printed for firsTime");
249
+
250
+ if (max_word_length != "") {
251
+ newdata = newdata.filter((w) => {
252
+ var arr1 = w.split(" ");
253
+ if (arr1.length == max_word_length) {
254
+ return w;
255
+ }
256
+ });
257
+ }
258
+
277
259
  if (newdata.length == []) {
278
260
  if (found.size == 0) {
279
261
  errorMessage.style.display = "block";
@@ -325,14 +307,14 @@ async function displayUi(newdata, combinations, userValue, n, wordArr) {
325
307
  } else {
326
308
  found.clear();
327
309
  // console.log("refreshing");
328
- m_words = +max_words.value;
310
+ wlength != null ? (m_words = wlength) : (m_words = +max_words.value);
329
311
  scrabbleWordArr = [];
330
312
  lazyLoader.style.display = "none";
331
313
  }
332
314
  } else {
333
315
  found.clear();
334
316
  // console.log("refreshing");
335
- m_words = +max_words.value;
317
+ wlength != null ? (m_words = wlength) : (m_words = +max_words.value);
336
318
  scrabbleWordArr = [];
337
319
  lazyLoader.style.display = "none";
338
320
  }
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: 1.7.3
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - manpreet-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-12 00:00:00.000000000 Z
11
+ date: 2023-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll