fni-docs-theme 0.6.4 → 0.6.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.
- checksums.yaml +4 -4
- data/assets/js/just-the-docs.js +27 -2
- 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: fba2933df6e923516834811b07bbb917a5d438c76fa865da595a0f6a9355e268
|
4
|
+
data.tar.gz: e2ce7fe989d83601bc683abe26e1b1b0a161890445b9b16b3b5b8d1a35d3193c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b37f4db6a79ca7c2f46865ab9c946b19bcabe13126add9f9cf6f841c90e302363dba1257ee85196cf6b71bbb7bd204fe210a4a387af99e14035ef3173a1e3d
|
7
|
+
data.tar.gz: 6fbfd3b32d32032b7bd8439fee2040aee2bfe01eff3786bece89fcfa22d19014ac1e86ce9aed57f4a1b220b6460787c1698933d696e1d2e6342fcddd8f924809
|
data/assets/js/just-the-docs.js
CHANGED
@@ -23,6 +23,7 @@ jtd.onReady = function(ready) {
|
|
23
23
|
|
24
24
|
// Show/hide mobile menu
|
25
25
|
|
26
|
+
|
26
27
|
function initNav() {
|
27
28
|
jtd.addEvent(document, 'click', function(e){
|
28
29
|
var target = e.target;
|
@@ -95,6 +96,7 @@ function initNav() {
|
|
95
96
|
const searchButton = document.getElementById('search-button');
|
96
97
|
const mobileSearchButton = document.getElementById('mobile-search-button');
|
97
98
|
|
99
|
+
|
98
100
|
{%- if site.search.button %}
|
99
101
|
if (searchButton) {
|
100
102
|
jtd.addEvent(searchButton, 'click', function(e){
|
@@ -225,6 +227,10 @@ function searchLoaded(index, docs) {
|
|
225
227
|
|
226
228
|
function hideSearch() {
|
227
229
|
document.documentElement.classList.remove('search-active');
|
230
|
+
document.body.classList.remove('search-active');
|
231
|
+
if (mainHeader) {
|
232
|
+
mainHeader.classList.remove('nav-open');
|
233
|
+
}
|
228
234
|
}
|
229
235
|
|
230
236
|
function update() {
|
@@ -232,7 +238,11 @@ function searchLoaded(index, docs) {
|
|
232
238
|
|
233
239
|
var input = searchInput.value;
|
234
240
|
if (input === '') {
|
235
|
-
|
241
|
+
// Only hide search if it's not already active/visible
|
242
|
+
if (!document.body.classList.contains('search-active') &&
|
243
|
+
!document.documentElement.classList.contains('search-active')) {
|
244
|
+
hideSearch();
|
245
|
+
}
|
236
246
|
} else {
|
237
247
|
showSearch();
|
238
248
|
// scroll search input into view, workaround for iOS Safari
|
@@ -537,7 +547,22 @@ function searchLoaded(index, docs) {
|
|
537
547
|
});
|
538
548
|
|
539
549
|
jtd.addEvent(document, 'click', function(e){
|
540
|
-
if
|
550
|
+
// Check if the click is on a search button or inside one
|
551
|
+
var target = e.target;
|
552
|
+
var isSearchButton = false;
|
553
|
+
|
554
|
+
while (target && target !== document) {
|
555
|
+
if (target.id === 'search-button' ||
|
556
|
+
target.id === 'mobile-search-button' ||
|
557
|
+
target.classList.contains('search-button') ||
|
558
|
+
target.classList.contains('mobile-search-button')) {
|
559
|
+
isSearchButton = true;
|
560
|
+
break;
|
561
|
+
}
|
562
|
+
target = target.parentNode;
|
563
|
+
}
|
564
|
+
|
565
|
+
if (e.target != searchInput && !isSearchButton) {
|
541
566
|
hideSearch();
|
542
567
|
}
|
543
568
|
});
|