word-games-theme 0.1.4 → 0.1.9

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.
@@ -1,5 +1,5 @@
1
- const Advancedbtn = document.querySelector('.Advancedbtn')
2
- Advancedbtn.style.display = 'none'
1
+ const wordLength = document.querySelector('.wordLength')
2
+ wordLength.style.display = 'none'
3
3
 
4
- const sortSelect = document.querySelector('#sort-select')
5
- sortSelect.style.display = 'none'
4
+ // const sortSelect = document.querySelector('#sort-select')
5
+ // sortSelect.style.display = 'none'
@@ -1,5 +1,12 @@
1
- const advancedFilter = document.querySelector('.advancedFilter')
2
- const fillterWrapper = document.querySelector('.fillterWrapper')
3
- advancedFilter.addEventListener('click', () => {
4
- fillterWrapper.classList.toggle('active')
5
- })
1
+ // const advancedFilter = document.querySelector('.advancedFilter')
2
+ // const fillterWrapper = document.querySelector('.fillterWrapper')
3
+ // advancedFilter.addEventListener('click', () => {
4
+ // fillterWrapper.classList.toggle('active')
5
+ // fillterWrapper.classList.remove('hide')
6
+ // })
7
+
8
+ // const close = document.querySelector('.fa-times')
9
+ // close.addEventListener('click', () => {
10
+ // fillterWrapper.classList.remove('active')
11
+ // fillterWrapper.classList.add('hide')
12
+ // })
@@ -1,2 +1,2 @@
1
- const advancedFilter = document.querySelector('.advancedFilter')
2
- advancedFilter.style.display = ' none'
1
+ // const advancedFilter = document.querySelector('.advancedFilter')
2
+ // advancedFilter.style.display = ' none'
@@ -2,6 +2,9 @@
2
2
  const params = new URLSearchParams(window.location.search)
3
3
  let serachValue = params.get('search')
4
4
 
5
+ let txtBox = document.querySelector('.txtBox')
6
+ txtBox.value = serachValue
7
+
5
8
  // DICTONARY
6
9
  const fetchTWL06Dic = async (serachValue) => {
7
10
  let newAlphabet = {
@@ -1,3 +1,7 @@
1
+ /***************
2
+ SCRABBLER_JS
3
+ ***************/
4
+
1
5
  // grab some html elements
2
6
  let form = document.querySelector('#form')
3
7
  let wordCount = document.querySelector('.wordCount')
@@ -13,13 +17,25 @@ let suffixValue = params.get('suffix')
13
17
  let lengthValue = params.get('length')
14
18
  let dictonary = params.get('dictonary')
15
19
 
20
+ // advanced filter element grabs
21
+ let tick
22
+ let startsWith = document.getElementById('startsWith')
23
+ let mustInclude = document.getElementById('mustInclude')
24
+ let endsWith = document.getElementById('endsWith')
25
+ let wordLength = document.getElementById('wordLength')
26
+
16
27
  let ok = true
17
28
 
18
29
  let tab_container = document.querySelector('.tab_container')
19
30
 
20
31
  var sortValue
21
32
  var sortBool = false
33
+
34
+ let txtBox = document.querySelector('.txtBox')
35
+ txtBox.value = serachValue
36
+
22
37
  var theSelect = document.getElementById('select_dropDown')
38
+ document.querySelector('.select_dropDown2').value = dictonary
23
39
 
24
40
  // getWords define...
25
41
  const getData = async (serachValue) => {
@@ -66,6 +82,10 @@ function getWords(data) {
66
82
  sortBool = false
67
83
  sortby(sortBool, data)
68
84
  }
85
+ if (sortValue == 'Points') {
86
+ sortBool = true
87
+ sortPointsby(sortBool, data)
88
+ }
69
89
  })
70
90
 
71
91
  for (let i = serachValue.length; i >= 1; i--) {
@@ -74,20 +94,30 @@ function getWords(data) {
74
94
  newdata = newdata.filter((item2) =>
75
95
  item2.startsWith(prefixValue.toLowerCase())
76
96
  )
97
+ startsWith.classList.add('tick')
98
+ startsWith.value = prefixValue
77
99
  }
100
+
78
101
  if (containsValue) {
79
102
  newdata = newdata.filter((item) =>
80
103
  item.includes(containsValue.toLowerCase())
81
104
  )
105
+ mustInclude.classList.add('tick')
106
+ mustInclude.value = containsValue
82
107
  }
83
108
  if (suffixValue) {
84
109
  newdata = newdata.filter((item) =>
85
110
  item.endsWith(suffixValue.toLowerCase())
86
111
  )
112
+ endsWith.classList.add('tick')
113
+ endsWith.value = suffixValue
87
114
  }
88
115
  if (lengthValue) {
89
116
  newdata = newdata.filter((item) => item.length == lengthValue)
117
+ wordLength.classList.add('tick')
118
+ wordLength.value = lengthValue
90
119
  }
120
+
91
121
  if (newdata.length === 0) {
92
122
  main.innerHTML += ''
93
123
  } else {
@@ -145,6 +175,66 @@ function getWords(data) {
145
175
  }
146
176
  }
147
177
 
178
+ // sorting by points
179
+ function sortPointsby(sortValue, data) {
180
+ main.innerHTML = ''
181
+ if (sortValue) {
182
+ let newWordsLength = 0
183
+ for (let i = serachValue.length; i >= 1; i--) {
184
+ var newdata = data.filter((item) => item.length === i)
185
+
186
+ if (newdata.length === 0) {
187
+ main.innerHTML += ''
188
+ } else {
189
+ newWordsLength += newdata.length
190
+ var newArray = []
191
+ newdata.map((item) => {
192
+ if (item.length === 1) {
193
+ ok = false
194
+ newWordsLength = newWordsLength - 1
195
+ } else {
196
+ let ScrabbleLetterScore = ScrabbleScore()
197
+ let points = 0
198
+ item = item.toLowerCase()
199
+ for (let i = 0; i < item.length; i++) {
200
+ points += ScrabbleLetterScore[item[i]] || 0 // for unknown characters
201
+ }
202
+ const value = {
203
+ words: item,
204
+ points: points,
205
+ }
206
+ newArray.push(value)
207
+ }
208
+ })
209
+
210
+ newArray.sort(function (a, b) {
211
+ return b.points - a.points
212
+ })
213
+
214
+ const result = newArray.map((item) => {
215
+ return `<a class="anchor__style" title="Lookup python in Dictionary" target="_blank" href="/word-meaning?search=${item.words}">
216
+ <li>${item.words}
217
+ <span class="points" value="${item.points}" style="position:relative; top:4px; font-size:12px"> ${item.points}</span>
218
+ </li></a>`
219
+ })
220
+
221
+ main.innerHTML += `
222
+ <div class="allGroupWords wordlistContainer" id="alpha_${i}">
223
+ <div class="wordListHeading">
224
+ <h3 class="lead">${i} Letter Words</h3>
225
+ </div>
226
+ <div class="wordList">
227
+ <ul class="ul list-unstyled">
228
+ ${result.join('')}
229
+ </ul>
230
+ </div>
231
+ </div>
232
+ `
233
+ }
234
+ }
235
+ }
236
+ }
237
+
148
238
  // sort by aplhabets
149
239
  function sortby(sortBool, data) {
150
240
  if (sortBool) {
@@ -234,7 +324,7 @@ function sortby(sortBool, data) {
234
324
  }
235
325
  }
236
326
 
237
- // Scrabble Point Counts
327
+ // Scrabble Point Array
238
328
  const ScrabbleScore = () => {
239
329
  let twl06_sowpods = {
240
330
  a: 1,
@@ -301,7 +391,61 @@ const ScrabbleScore = () => {
301
391
  }
302
392
  }
303
393
 
304
- // Implement Filtering
394
+ //Handling of filter counter in advanced filter
395
+ function addFilterCount() {
396
+ let filter_val = document.getElementsByClassName('filter_val')
397
+ let filter = document.querySelector('.filter_count')
398
+ let filter_count = 0
399
+
400
+ filter_val[0].value = prefixValue
401
+ filter_val[1].value = containsValue
402
+ filter_val[2].value = suffixValue
403
+ filter_val[3].value = lengthValue
404
+
405
+ for (var i = 0; i < 4; i++) {
406
+ if (filter_val[i].value != '') {
407
+ filter_count += 1
408
+ }
409
+ if (filter_count === 0) {
410
+ filter.style.display = 'none'
411
+ } else {
412
+ filter.style.display = 'inline-block'
413
+ }
414
+
415
+ filter.innerHTML = filter_count
416
+ }
417
+ }
418
+ addFilterCount()
419
+
420
+ // handling of filter on scroll
421
+ window.onscroll = function () {
422
+ var section = document.querySelectorAll('.wordlistContainer')
423
+ let new_sections = {}
424
+ Array.prototype.forEach.call(section, function (e) {
425
+ if (document.body.clientWidth > 991) {
426
+ new_sections[e.id] = e.offsetTop - 10
427
+ } else {
428
+ new_sections[e.id] = e.offsetTop - 10
429
+ }
430
+ })
431
+ var scrollPosition =
432
+ document.documentElement.scrollTop || document.body.scrollTop
433
+ for (i in new_sections) {
434
+ let sort_val = document.querySelector('.sort-select').value
435
+ if (
436
+ i.split('_')[0] == sort_val &&
437
+ new_sections[i] &&
438
+ new_sections[i] <= scrollPosition
439
+ ) {
440
+ document.querySelector('.active-tab').classList.remove('active-tab')
441
+ var active_now = document.querySelector('#Tab_' + i.split('_')[1])
442
+ active_now.classList.add('active-tab')
443
+ // active_now.scrollIntoView()
444
+ }
445
+ }
446
+ }
447
+
448
+ // Add Filtering
305
449
  let sections = {}
306
450
  function Filtering(id) {
307
451
  let tabs = document.getElementsByClassName('tab_link')
@@ -312,23 +456,22 @@ function Filtering(id) {
312
456
  })
313
457
  main.innerHTML += ``
314
458
  let activeLetter = event.target
315
- // console.log(activeLetter)
316
459
  activeLetter.classList.add('active-tab')
317
460
 
318
461
  var section = document.querySelectorAll('.wordlistContainer')
319
462
  var sort_val = document.querySelector('.sort-select').value
320
- sections = {}
321
463
  Array.prototype.forEach.call(section, function (e) {
322
464
  if (document.body.clientWidth > 991) {
323
465
  sections[e.id] = e.offsetTop - 10
324
466
  } else {
325
467
  sections[e.id] = e.offsetTop - 10
326
- console.log(sections)
327
468
  }
328
469
  })
470
+
329
471
  document.body.scrollTop = sections[sort_val + '_' + id] + 5
330
472
  }
331
473
 
474
+ // next && previous functionality
332
475
  let prev = document.getElementById('prev')
333
476
  let next = document.getElementById('next')
334
477
 
@@ -341,9 +484,12 @@ if (next) {
341
484
  window.addEventListener('resize', function () {
342
485
  scroll_visible()
343
486
  })
487
+ window.addEventListener('scroll', function () {
488
+ scroll_visible()
489
+ })
344
490
  function scroll_visible() {
345
491
  let tab_container = document.querySelector('#tab-container')
346
- console.log(tab_container)
492
+
347
493
  if (tab_container) {
348
494
  if (tab_container.clientWidth === tab_container.scrollWidth) {
349
495
  prev.style.display = 'none'
@@ -355,6 +501,7 @@ function scroll_visible() {
355
501
  }
356
502
  }
357
503
  scroll_visible()
504
+
358
505
  function scroll_Left() {
359
506
  tab_container.scrollLeft += 130
360
507
  }
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: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - manpreet-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-23 00:00:00.000000000 Z
11
+ date: 2021-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -125,6 +125,7 @@ files:
125
125
  - _layouts/default.html
126
126
  - _layouts/disclaimer.html
127
127
  - _layouts/page.html
128
+ - _layouts/page2.html
128
129
  - _layouts/post.html
129
130
  - _layouts/privacyPolicy.html
130
131
  - _layouts/termAndCondition.html
@@ -161,6 +162,7 @@ files:
161
162
  - assets/images/right2.svg
162
163
  - assets/images/right3.svg
163
164
  - assets/images/right_obj_01.png
165
+ - assets/images/search.svg
164
166
  - assets/images/word-games-logo.svg
165
167
  - assets/images/yellow_bg.png
166
168
  - assets/js/TopScroll.js