refactor: move search utils to util.js
This commit is contained in:
		
							parent
							
								
									93d039fe7c
								
							
						
					
					
						commit
						14b89105dc
					
				
					 4 changed files with 224 additions and 213 deletions
				
			
		| 
						 | 
				
			
			@ -40,10 +40,13 @@
 | 
			
		|||
  <link href="{{$lightSyntax.Permalink}}" rel="stylesheet" id="theme-link">
 | 
			
		||||
 | 
			
		||||
   <!-- Base scripts -->
 | 
			
		||||
  {{ $darkMode := resources.Get "js/darkmode.js" | resources.ExecuteAsTemplate "js/darkmode.js" . | resources.Fingerprint "md5" | resources.Minify }}
 | 
			
		||||
  <script src="{{$darkMode.Permalink}}"></script>
 | 
			
		||||
  {{$scripts := (slice "js/darkmode.js" "js/util.js")}}
 | 
			
		||||
  {{range $scripts}}
 | 
			
		||||
  {{$scriptname := .}}
 | 
			
		||||
  {{ $s := resources.Get $scriptname | resources.ExecuteAsTemplate $scriptname . | resources.Fingerprint "md5" | resources.Minify }}
 | 
			
		||||
  <script src="{{$s.Permalink}}"></script>
 | 
			
		||||
  {{end}}
 | 
			
		||||
  {{partial "katex.html" .}}
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  <script src="https://unpkg.com/@floating-ui/core@0.7.3"></script>
 | 
			
		||||
  <script src="https://unpkg.com/@floating-ui/dom@0.5.4"></script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,12 @@
 | 
			
		|||
<div id="search-container">
 | 
			
		||||
    <div id="search-space">
 | 
			
		||||
        <input autocomplete="off" id="search-bar" name="search" type="text" aria-label="Search" placeholder="Search for something...">
 | 
			
		||||
        <div id="results-container">
 | 
			
		||||
        </div>
 | 
			
		||||
  <div id="search-space">
 | 
			
		||||
    <input autocomplete="off" id="search-bar" name="search" type="text" aria-label="Search"
 | 
			
		||||
      placeholder="Search for something...">
 | 
			
		||||
    <div id="results-container">
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
<script src="https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js" integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin="anonymous" defer></script>
 | 
			
		||||
{{ $js := resources.Get "js/search.js" |  resources.Fingerprint "md5" | resources.Minify }}
 | 
			
		||||
<script src="https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js"
 | 
			
		||||
  integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin="anonymous" defer></script>
 | 
			
		||||
{{ $js := resources.Get "js/search.js" | resources.Fingerprint "md5" | resources.Minify }}
 | 
			
		||||
<script defer src="{{ $js.Permalink }}"></script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue