word-games-theme 1.7.6 → 1.7.8

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: ebe6df27a5994a3102a6d89bb4443118922861d54ab6da9eb42fa56951f864bc
4
- data.tar.gz: cb92d758fb765147cf85acf7d9d326dc52b07e0ffb0b38450f428e32da795ae6
3
+ metadata.gz: 4f6c28a1bd607ef9b459ba346567684172ece53a55d84ba341cc59fe2cabff7d
4
+ data.tar.gz: ef2e9b56926c18ec63be7765f1931df184556349760f8fb2afca3044f68a4880
5
5
  SHA512:
6
- metadata.gz: 218f68b2bac163a1454d79905e8cf6e19eede7e882abf613975b146c45db981cd23db30f88592e4588e809fdf7548f41ae9ca36198049f0db73a32120cd16d19
7
- data.tar.gz: c797dde9a3668056853df20c3ebac3d982e513bbf6e1f2560d326e4397d2513a04be3004937a9d8cd1b7b8b28f1eaf21c652c55e8c4da43355d6e836c43859c6
6
+ metadata.gz: 5b345ce63b46960bd3588f46d26a7f2f07f730b11b4d908e38e6a747f81f2d1ddaea226082c74094262291e21f539cb3f5b155be503dce52e3412355fa9bf7bf
7
+ data.tar.gz: 58ab9a3248c9a8fc99c4983205341d2d913ce3b718da58a32f949b1a04b5c400211d28806e9dd8f3185401e929de3625ede6fbaa222dc8e9b95be669f13acb70
@@ -71,8 +71,16 @@ const getData = async (e) => {
71
71
  : (m_length = max_word_length);
72
72
 
73
73
  // m_length is maximum word length
74
- data = getCombo(data, m_length);
75
- console.timeEnd("time taken");
74
+ if (
75
+ data !=
76
+ "No combination of these letters creates a word in the Engish language."
77
+ ) {
78
+ data = getCombo(data, m_length);
79
+ } else {
80
+ subResult.innerHTML = "";
81
+ errorMessage.style.display = "block";
82
+ document.querySelector(".heading-result").style.display = "none";
83
+ }
76
84
  };
77
85
 
78
86
  form.addEventListener("submit", getData);
@@ -101,7 +109,10 @@ async function getCombo(arr, m_words) {
101
109
  return newWord;
102
110
  });
103
111
  });
104
- displayUi(resultArr, combinations, userValue, m_words, scrabbleWordArr);
112
+
113
+ if (combinations.length > 0) {
114
+ displayUi(resultArr, combinations, userValue, m_words, scrabbleWordArr);
115
+ }
105
116
  }
106
117
 
107
118
  const equalsCheck = (a, b) => {
@@ -245,19 +256,14 @@ const getMatchedChars = (str, userInput) => {
245
256
  };
246
257
  //n is max word
247
258
  async function displayUi(newdata, combinations, userValue, n, wordArr) {
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
-
259
259
  if (newdata.length == []) {
260
260
  if (found.size == 0) {
261
+ subResult.innerHTML = "";
262
+ errorMessage.style.display = "block";
263
+ document.querySelector(".heading-result").style.display = "none";
264
+ }
265
+ if (n > 2) {
266
+ subResult.innerHTML = "";
261
267
  errorMessage.style.display = "block";
262
268
  document.querySelector(".heading-result").style.display = "none";
263
269
  }
@@ -274,6 +280,15 @@ async function displayUi(newdata, combinations, userValue, n, wordArr) {
274
280
  }
275
281
 
276
282
  requestAnimationFrame(() => {
283
+ if (max_word_length != "") {
284
+ newdata = newdata.filter((w) => {
285
+ var arr1 = w.split(" ");
286
+ if (arr1.length == max_word_length) {
287
+ return w;
288
+ }
289
+ });
290
+ }
291
+
277
292
  newdata.map((item, index) => {
278
293
  var i = 0;
279
294
  let nWords = item.split(" ");
@@ -297,23 +312,27 @@ async function displayUi(newdata, combinations, userValue, n, wordArr) {
297
312
  wordArr = wordArr.filter(
298
313
  (w) => w.length < Math.round(userValue.length / 2)
299
314
  );
300
- // console.time("combination time");
315
+
301
316
  var data = getComboWords(combinations, wordArr, userValue);
302
- // console.timeEnd("combination time");
317
+
303
318
  n--;
304
319
  console.log("calling display ui from recursion");
305
320
  if (data.length != 0) {
306
321
  displayUi(resultArr, data, userValue, n, wordArr);
307
322
  } else {
323
+ if (found.size == 0 || main.innerHTML == "") {
324
+ subResult.innerHTML = "";
325
+ errorMessage.style.display = "block";
326
+ document.querySelector(".heading-result").style.display = "none";
327
+ }
328
+
308
329
  found.clear();
309
- // console.log("refreshing");
310
330
  wlength != null ? (m_words = wlength) : (m_words = +max_words.value);
311
331
  scrabbleWordArr = [];
312
332
  lazyLoader.style.display = "none";
313
333
  }
314
334
  } else {
315
335
  found.clear();
316
- // console.log("refreshing");
317
336
  wlength != null ? (m_words = wlength) : (m_words = +max_words.value);
318
337
  scrabbleWordArr = [];
319
338
  lazyLoader.style.display = "none";