assets/js/X-letter.js in word-games-theme-0.6.6 vs assets/js/X-letter.js in word-games-theme-0.6.7
- old
+ new
@@ -10,10 +10,12 @@
const params = new URLSearchParams(window.location.search)
let serachValue = params.get('search')
let prefixValue = params.get('prefix')
let containsValue = params.get('contains')
let suffixValue = params.get('suffix')
+let exculdeValue = params.get('exculde')
+let includeValue = params.get('include')
let lengthValue = params.get('length')
let dictonary = params.get('dictionary')
let tab_container = document.querySelector('.tab_container')
@@ -77,10 +79,56 @@
)
endsWith.classList.add('tick')
endsWith.value = suffixValue
}
+ if (exculdeValue) {
+ let data = []
+ filterData.map((item) => {
+ let check = false
+ for (let e = 0; e < exculdeValue.length; e++) {
+ const element = exculdeValue[e]
+ if (item.includes(element)) {
+ check = true
+ break
+ } else {
+ check = false
+ }
+ }
+ if (check === false) {
+ data.push(item)
+ }
+ })
+ exculdeWith.classList.add('tick')
+ exculdeWith.value = exculdeValue
+ filterData = data
+ }
+
+ if (includeValue) {
+ let data = []
+ filterData.map((item) => {
+ let check = false
+ for (let e = 0; e < includeValue.length; e++) {
+ const element = includeValue[e]
+ if (!item.includes(element)) {
+ check = true
+ break
+ } else {
+ check = false
+ }
+ }
+ if (check === false) {
+ data.push(item)
+ }
+ })
+ inculdeWith.classList.add('tick')
+ inculdeWith.value = includeValue
+ filterData = data
+ }
+
+
+
if (filterData.length === 0) {
main.innerHTML += ''
errorMsg.innerHTML = 'No words Found with this length'
} else {
// sort eventlistener
@@ -152,12 +200,14 @@
let filter_count = 0
filter_val[0].value = prefixValue
filter_val[1].value = containsValue
filter_val[2].value = suffixValue
- filter_val[3].value = lengthValue
+ filter_val[3].value = exculdeValue
+ filter_val[4].value = includeValue
+ filter_val[5].value = lengthValue
- for (var i = 0; i < 4; i++) {
+ for (var i = 0; i <= 4; i++) {
if (filter_val[i].value != '') {
filter_count += 1
}
if (filter_count === 0) {
filter.style.display = 'none'