word-games-theme 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,7 @@ self.onmessage = async (event) => {
10
10
  const data = await response.json();
11
11
  self.postMessage({ data });
12
12
  }
13
+
13
14
  if (event.data.type === "filterwords") {
14
15
  const { data, serachValue, prefixValue, containsValue, suffixValue, exculdeValue, includeValue, lengthValue, sortingFilter, dictonary } = event.data
15
16
  let newWordsLength = 0;
@@ -71,71 +72,84 @@ self.onmessage = async (event) => {
71
72
  if (lengthValue) {
72
73
  newdata = newdata.filter((item) => item.length == lengthValue);
73
74
  }
74
- // if (newdata.length === 0) {
75
- // } else {
76
- newWordsLength += newdata.length;
77
- newdata = sortWords(sortingFilter, newdata, dictonary);
78
- let result = newdata.map((item) => {
79
- let itemHtml = "";
80
- if (serachValue) {
81
- var text1 = serachValue.replace("?", "");
82
- var text2 = item;
83
- var text3 = item;
84
- let chars = text1.split("");
85
- let indexs = [];
86
- chars.map((i) => {
87
- let findIndexes = findIndex(text3, i);
88
- if (findIndexes.length > 0) {
89
- text3 = text3.split("");
90
- text3[findIndexes] = "$";
91
- text3 = text3.join("");
92
- indexs = [...indexs, ...findIndexes];
93
- }
94
- });
95
- text2.split("").map((itemValue, index) => {
96
- let check = indexs.find((i) => i === index);
97
- if (check !== undefined) {
98
- itemHtml += `${itemValue}`;
99
- } else {
100
- itemHtml += `<span class='highlight'>${itemValue}</span>`;
101
- }
102
- });
103
- } else {
104
- itemHtml = item
105
- }
106
- if (item.length === 1) {
107
- ok = false;
108
- newWordsLength = newWordsLength - 1;
109
- } else {
110
- let ScrabbleLetterScore = ScrabbleScore();
111
- sum = 0;
112
- item = item.toLowerCase();
113
- for (let i = 0; i < item.length; i++) {
114
- sum += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
75
+ if (newdata.length === 0) {
76
+ self.postMessage({
77
+ type: "filterwords",
78
+ prefixValue: prefixValue,
79
+ containsValue: containsValue,
80
+ suffixValue: suffixValue,
81
+ exculdeValue: exculdeValue,
82
+ includeValue: includeValue,
83
+ lengthValue: lengthValue,
84
+ newdata: newdata,
85
+ i: i,
86
+ newWordsLength: newWordsLength,
87
+ });
88
+
89
+ } else {
90
+ newWordsLength += newdata.length;
91
+ newdata = sortWords(sortingFilter, newdata, dictonary);
92
+ let result = newdata.map((item) => {
93
+ let itemHtml = "";
94
+ if (serachValue) {
95
+ var text1 = serachValue.replace("?", "");
96
+ var text2 = item;
97
+ var text3 = item;
98
+ let chars = text1.split("");
99
+ let indexs = [];
100
+ chars.map((i) => {
101
+ let findIndexes = findIndex(text3, i);
102
+ if (findIndexes.length > 0) {
103
+ text3 = text3.split("");
104
+ text3[findIndexes] = "$";
105
+ text3 = text3.join("");
106
+ indexs = [...indexs, ...findIndexes];
107
+ }
108
+ });
109
+ text2.split("").map((itemValue, index) => {
110
+ let check = indexs.find((i) => i === index);
111
+ if (check !== undefined) {
112
+ itemHtml += `${itemValue}`;
113
+ } else {
114
+ itemHtml += `<span class='highlight'>${itemValue}</span>`;
115
+ }
116
+ });
117
+ } else {
118
+ itemHtml = item
115
119
  }
116
- return `
120
+ if (item.length === 1) {
121
+ ok = false;
122
+ newWordsLength = newWordsLength - 1;
123
+ } else {
124
+ let ScrabbleLetterScore = ScrabbleScore();
125
+ sum = 0;
126
+ item = item.toLowerCase();
127
+ for (let i = 0; i < item.length; i++) {
128
+ sum += ScrabbleLetterScore[item[i]] || 0; // for unknown characters
129
+ }
130
+ return `
117
131
  <a class="anchor__style" title="Lookup ${item} in Dictionary" target="_blank" href="/word-meaning?search=${item.toLowerCase()}">
118
132
  ${itemHtml}
119
133
  <span class="points" value="${sum}" style="position:relative; top:4px; font-size:12px">${sum}</span>
120
134
  </a>
121
135
  `;
122
- }
123
- });
124
- result = result.slice(0, 25)
125
- self.postMessage({
126
- type: "filterwords",
127
- prefixValue: prefixValue,
128
- containsValue: containsValue,
129
- suffixValue: suffixValue,
130
- exculdeValue: exculdeValue,
131
- includeValue: includeValue,
132
- lengthValue: lengthValue,
133
- newdata: newdata,
134
- i: i,
135
- newWordsLength: newWordsLength,
136
- result,
137
- });
138
- // }
136
+ }
137
+ });
138
+ result = result.slice(0, 25)
139
+ self.postMessage({
140
+ type: "filterwords",
141
+ prefixValue: prefixValue,
142
+ containsValue: containsValue,
143
+ suffixValue: suffixValue,
144
+ exculdeValue: exculdeValue,
145
+ includeValue: includeValue,
146
+ lengthValue: lengthValue,
147
+ newdata: newdata,
148
+ i: i,
149
+ newWordsLength: newWordsLength,
150
+ result,
151
+ });
152
+ }
139
153
  }
140
154
  }
141
155
  };
@@ -635,4 +635,4 @@ function findIndex(str, char) {
635
635
  }
636
636
 
637
637
  return indexes;
638
- }
638
+ }
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: 3.1.0
4
+ version: 3.1.1
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-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll