word-games-theme 2.9.4 → 2.9.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/assets/js/theme.js +27 -50
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebb79dc0f063db51be2c1c982e979e05e9f1d8ed6584ed2f9223f03fc1e7f557
4
- data.tar.gz: 3842931fcae3d7632924eb95b2d738e07141ef779d18c5f3e3ab3779567d05bf
3
+ metadata.gz: '0811628371d094ba8e6511f09dc9d4e8baf5c607bb413d1c12f87266d352a1b7'
4
+ data.tar.gz: f2d94a24451e5cd3b6334f727dbc06422a51faa9ee8d830106f746093284ae69
5
5
  SHA512:
6
- metadata.gz: f54f722ef5deca02fd2feeedfaa98fb64a2207e954d0bb06cdd490598ee9279af66969eec8d88e770c953e6ba7ede7e0fcce1362f8ba928dbd6b34cf141f3583
7
- data.tar.gz: 7230c55447d7f948e61e8a4ec7f976940a0e21e5cb22dd5e2b2807362b08cbe6afa96ffd3789ab9f881d36adfa70c70a19eff33362dc87003666f71d5de78231
6
+ metadata.gz: f30f2fefe4113e7fc6ac556fcba8f6bab4e5539b04708066e00eca28cb1a8e49a9b38fa7c1093072b7f1382da3d01dbe127674cb506c17646b79682e7225b617
7
+ data.tar.gz: a77777769b56d97c5fa3c9e195678ea0adbef2de82387de2fdac649118b396bca8fd896d3abb1d9830602c96ed4b56bace01e32b6b3277cd6c5d8d00bb125e53
data/assets/js/theme.js CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  ---
3
3
 
4
- console.log(document.querySelectorAll('*').length);
4
+ console.log(document.querySelectorAll('*').length);
5
5
 
6
6
  if ("{{ site.removeBootstrapJs }}" === "true") {
7
7
  const languagesModal = document.querySelector("#staticBackdrop");
@@ -24,57 +24,32 @@ if ("{{ site.removeBootstrapJs }}" === "true") {
24
24
  });
25
25
  }
26
26
 
27
-
28
27
  var mediaQuery = window.matchMedia("(max-width: 768px)")
29
- let navbarDropdown = document.querySelector("#navbarDropdown");
30
- let dropmenu = document.querySelector(".dropmenu");
31
- // navbarDropdown.addEventListener("click", () => {
32
- // if (dropmenu.classList.contains("show")) {
33
- // dropmenu.classList.remove("show");
34
- // dropmenu.style.display = "none"
35
- // } else {
36
- // dropmenu.classList.add("show");
37
- // if (mediaQuery.matches) {
38
- // dropmenu.style.display = "block"
39
- // } else {
40
- // dropmenu.style.display = "grid"
41
- // dropmenu.style.padding = "3.5rem"
42
- // dropmenu.style.gridTemplateColumns = "auto auto";
43
- // dropmenu.style.columnGap = "5rem";
44
- // dropmenu.style.rowGap = "1rem";
45
- // dropmenu.style.borderBottom = "1px solid rgba(0, 0, 0, 0.1)"
46
- // dropmenu.style.borderLeft = "1px solid rgba(0, 0, 0, 0.1)"
47
- // dropmenu.style.borderRight = "1px solid rgba(0, 0, 0, 0.1)"
48
- // }
49
-
50
- // }
51
- // });
52
-
53
-
28
+
54
29
  const wordGamesToolbarListItems = document.querySelectorAll(
55
30
  ".wordgames-toolbar-list-item-span"
56
31
  );
57
-
58
- Array.from(wordGamesToolbarListItems).map((item) => {
59
- item.addEventListener("click", (e) => {
60
- e.preventDefault();
61
- var style = window.getComputedStyle(item.nextElementSibling);
62
- var maxHeight = style.getPropertyValue("max-height");
63
- console.log(maxHeight)
64
- if (maxHeight && maxHeight !== "0px") {
65
- // If the item is expanded, collapse it
66
- item.nextElementSibling.style.maxHeight = "0";
67
- item.nextElementSibling.style.opacity = "0";
68
- item.nextElementSibling.style.height = "0";
69
- } else {
70
- // If the item is collapsed, expand it
71
- item.nextElementSibling.style.maxHeight =
72
- item.nextElementSibling.scrollHeight + "px";
73
- item.nextElementSibling.style.opacity = "1";
74
- item.nextElementSibling.style.height = "auto";
75
- }
32
+ if (mediaQuery.matches) {
33
+ Array.from(wordGamesToolbarListItems).map((item) => {
34
+ item.addEventListener("click", (e) => {
35
+ e.preventDefault();
36
+ var style = window.getComputedStyle(item.nextElementSibling);
37
+ var maxHeight = style.getPropertyValue("max-height");
38
+ if (maxHeight && maxHeight !== "0px") {
39
+ // If the item is expanded, collapse it
40
+ item.nextElementSibling.style.maxHeight = "0";
41
+ item.nextElementSibling.style.opacity = "0";
42
+ item.nextElementSibling.style.height = "0";
43
+ } else {
44
+ // If the item is collapsed, expand it
45
+ item.nextElementSibling.style.maxHeight =
46
+ item.nextElementSibling.scrollHeight + "px";
47
+ item.nextElementSibling.style.opacity = "1";
48
+ item.nextElementSibling.style.height = "auto";
49
+ }
50
+ });
76
51
  });
77
- });
52
+ }
78
53
 
79
54
 
80
55
 
@@ -83,7 +58,6 @@ if ("{{ site.removeBootstrapJs }}" === "true") {
83
58
  const menuIcon = '/assets/images/hamburger-menu.svg';
84
59
  const closeIcon = '/assets/images/close-menu.svg';
85
60
  const imgElement = navbarToggler.querySelector('img');
86
-
87
61
  navbarToggler.addEventListener('click', () => {
88
62
  if (navBar.classList.contains('show')) {
89
63
  navBar.classList.remove('show');
@@ -125,9 +99,13 @@ function displayResults(results) {
125
99
 
126
100
  // Handle search input
127
101
  const searchInput = document.querySelector('.searchBar input');
102
+ let data;
128
103
  searchInput.addEventListener('input', async (event) => {
129
104
  const query = event.target.value;
130
- const data = await fetchData();
105
+ if (!data) {
106
+ // Fetch the data only if it hasn't been fetched before
107
+ data = await fetchData();
108
+ }
131
109
  const filteredResults = filterData(data, query);
132
110
  displayResults(filteredResults);
133
111
 
@@ -136,7 +114,6 @@ searchInput.addEventListener('input', async (event) => {
136
114
  'event_label': 'Search Box',
137
115
  'value': query
138
116
  });
139
-
140
117
  });
141
118
 
142
119
  // Hide results when clicking outside search input and results container
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: 2.9.4
4
+ version: 2.9.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: 2024-07-05 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll