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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/assets/js/just-the-docs.js +27 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5da153deee1782c2f6ea5f63ef757b28dfc09efa7e0f4e6f8dfb72915a838d21
4
- data.tar.gz: 94097ecbd14efbfdb0f6aa2f158ab69a7f5fb1950ba4b98c8397d424d1d32895
3
+ metadata.gz: fba2933df6e923516834811b07bbb917a5d438c76fa865da595a0f6a9355e268
4
+ data.tar.gz: e2ce7fe989d83601bc683abe26e1b1b0a161890445b9b16b3b5b8d1a35d3193c
5
5
  SHA512:
6
- metadata.gz: 968ac6ee68c5b97311e7632abb2802194cdc879be641e22f8833a115328237e6ff5b3c1b7c542cc2034d9f0b7114c012a51de54891faef89761d1248209adf50
7
- data.tar.gz: af9906fdec4ae17b3e12de632541a6c5082929631ca825d406adc05b9322e35fbdc1fcf558d29eaacc18ab575b90c80941b8ae08aaacbba3fed7ce4e7c5988c1
6
+ metadata.gz: 88b37f4db6a79ca7c2f46865ab9c946b19bcabe13126add9f9cf6f841c90e302363dba1257ee85196cf6b71bbb7bd204fe210a4a387af99e14035ef3173a1e3d
7
+ data.tar.gz: 6fbfd3b32d32032b7bd8439fee2040aee2bfe01eff3786bece89fcfa22d19014ac1e86ce9aed57f4a1b220b6460787c1698933d696e1d2e6342fcddd8f924809
@@ -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
- hideSearch();
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 (e.target != searchInput) {
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
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fni-docs-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Marsceill