Browse Source

Changed: more sidebar progress

James Doyle 3 years ago
parent
commit
e1fe558aff
2 changed files with 25 additions and 4 deletions
  1. 24 3
      resources/js/theme-default.js
  2. 1 1
      resources/views/themes/default/sidebar.blade.php

+ 24 - 3
resources/js/theme-default.js

@@ -1,10 +1,31 @@
-// window.addEventListener('load', function() {
 document.addEventListener('DOMContentLoaded', function() {
 document.addEventListener('DOMContentLoaded', function() {
-    // const exampleLanguages = JSON.parse(document.body.getAttribute('data-languages'));
     window.hljs.highlightAll();
     window.hljs.highlightAll();
     // https://jets.js.org/
     // https://jets.js.org/
+    const wrapper = document.getElementById('toc');
     window.jets = new window.Jets({
     window.jets = new window.Jets({
+        // *OR - Selects elements whose values contains at least one part of search substring
+        searchSelector: '*OR',
         searchTag: '#input-search',
         searchTag: '#input-search',
-        contentTag: '#toc li'
+        contentTag: '#toc li',
+        didSearch: function(term) {
+            wrapper.classList.toggle('jets-searching', String(term).length > 0)
+        },
+        // map these accent keys to plain values
+        diacriticsMap: {
+            a: 'ÀÁÂÃÄÅàáâãäåĀāąĄ',
+            c: 'ÇçćĆčČ',
+            d: 'đĐďĎ',
+            e: 'ÈÉÊËèéêëěĚĒēęĘ',
+            i: 'ÌÍÎÏìíîïĪī',
+            l: 'łŁ',
+            n: 'ÑñňŇńŃ',
+            o: 'ÒÓÔÕÕÖØòóôõöøŌō',
+            r: 'řŘ',
+            s: 'ŠšśŚ',
+            t: 'ťŤ',
+            u: 'ÙÚÛÜùúûüůŮŪū',
+            y: 'ŸÿýÝ',
+            z: 'ŽžżŻźŹ'
+        }
     });
     });
 });
 });

+ 1 - 1
resources/views/themes/default/sidebar.blade.php

@@ -4,7 +4,7 @@
         <a href="#{!! Str::slug($group['name']) !!}">{!! $group['name'] !!}</a>
         <a href="#{!! Str::slug($group['name']) !!}">{!! $group['name'] !!}</a>
     </li>
     </li>
     @foreach($group['endpoints'] as $endpoint)
     @foreach($group['endpoints'] as $endpoint)
-    <ul class="tocify-subheader" data-tag="{{ $loop->index }}" style="display: block;">
+    <ul class="tocify-subheader" data-tag="{{ $loop->index }}">
         <li class="tocify-item" data-unique="{!! Str::slug($group['name']) !!}-{!! $endpoint->endpointId() !!}">
         <li class="tocify-item" data-unique="{!! Str::slug($group['name']) !!}-{!! $endpoint->endpointId() !!}">
             <a href="#{!! Str::slug($group['name']) !!}-{!! $endpoint->endpointId() !!}">{{ $endpoint->metadata->title ?: ($endpoint->httpMethods[0]." ".$endpoint->uri)}}</a>
             <a href="#{!! Str::slug($group['name']) !!}-{!! $endpoint->endpointId() !!}">{{ $endpoint->metadata->title ?: ($endpoint->httpMethods[0]." ".$endpoint->uri)}}</a>
         </li>
         </li>