word-games-theme 2.9.6 → 2.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/js/theme.js +16 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c98904560055d0f2c42398d1b9e4b7ac197e0e74870dc2467c431c12a87a52e
|
4
|
+
data.tar.gz: 55241b01608d1d986b1a4422c3f30af16a82d17bd668195a77be05f818321c54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f116421297f717576fc2020da33ed2c100a1643b5f5a48274d5b90bd228cb61a4c01024447655c03f59cd43624887c8e20b15293e8d578d961264276aed19842
|
7
|
+
data.tar.gz: 9e4039a255d4a41a48892d21658977c4bbee65d6f7c6bd95f1e71ea993f718291c9e0448dbca2b67dbec068d92c847bb760cc67f652c0f4b9fa6714d451b96bc
|
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
|
if ("{{ site.removeBootstrapJs }}" === "true") {
|
6
6
|
const languagesModal = document.querySelector("#staticBackdrop");
|
7
7
|
const intModalBtn = document.querySelector("#int-modal-btn");
|
@@ -24,7 +24,7 @@ if ("{{ site.removeBootstrapJs }}" === "true") {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
var mediaQuery = window.matchMedia("(max-width: 768px)")
|
27
|
-
|
27
|
+
|
28
28
|
const wordGamesToolbarListItems = document.querySelectorAll(
|
29
29
|
".wordgames-toolbar-list-item-span"
|
30
30
|
);
|
@@ -72,19 +72,19 @@ if ("{{ site.removeBootstrapJs }}" === "true") {
|
|
72
72
|
|
73
73
|
}
|
74
74
|
|
75
|
-
const
|
75
|
+
const searchWorker = new Worker('/assets/js/search-worker.js');
|
76
76
|
function fetchData() {
|
77
77
|
return new Promise((resolve, reject) => {
|
78
|
-
|
78
|
+
searchWorker.postMessage({
|
79
79
|
type: "api",
|
80
80
|
endpoint: `/alllinks.json`
|
81
81
|
});
|
82
82
|
|
83
|
-
|
83
|
+
searchWorker.onmessage = (event) => {
|
84
84
|
resolve(event.data.data.featuredLinks);
|
85
85
|
};
|
86
86
|
|
87
|
-
|
87
|
+
searchWorker.onerror = (error) => {
|
88
88
|
reject(error);
|
89
89
|
};
|
90
90
|
});
|
@@ -102,6 +102,12 @@ function displayResults(results) {
|
|
102
102
|
const searchInput = document.querySelector('.searchBar input');
|
103
103
|
let data;
|
104
104
|
searchInput.addEventListener('input', async (event) => {
|
105
|
+
if (searchInput.value !== '') {
|
106
|
+
searchInput.classList.add('blinkBoxShadow');
|
107
|
+
} else {
|
108
|
+
searchInput.classList.remove('blinkBoxShadow');
|
109
|
+
}
|
110
|
+
|
105
111
|
const query = event.target.value;
|
106
112
|
if (!data) {
|
107
113
|
// Fetch the data only if it hasn't been fetched before
|
@@ -116,6 +122,10 @@ searchInput.addEventListener('input', async (event) => {
|
|
116
122
|
'value': query
|
117
123
|
});
|
118
124
|
});
|
125
|
+
searchInput.addEventListener('blur', () => {
|
126
|
+
searchInput.classList.remove('blinkBoxShadow');
|
127
|
+
});
|
128
|
+
|
119
129
|
document.addEventListener('click', (event) => {
|
120
130
|
const resultsContainer = document.getElementById('results');
|
121
131
|
if (!searchInput.contains(event.target) && !resultsContainer.contains(event.target)) {
|