parent
							
								
									f321503b94
								
							
						
					
					
						commit
						7dff0a3f08
					
				| 
						 | 
				
			
			@ -558,6 +558,8 @@
 | 
			
		|||
    var searchMenu = null;
 | 
			
		||||
    var searchText = null;
 | 
			
		||||
    
 | 
			
		||||
    {{ $enableSearch := ($.Param "enableSearch") }}
 | 
			
		||||
    var enableSearch = JSON.parse({{ $enableSearch | jsonify }});
 | 
			
		||||
    {{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }}
 | 
			
		||||
    var enableSearchHighlight = JSON.parse({{ $enableSearchHighlight | jsonify }});
 | 
			
		||||
    {{ $searchResultPosition := ($.Param "searchResultPosition") }}
 | 
			
		||||
| 
						 | 
				
			
			@ -567,30 +569,32 @@
 | 
			
		|||
 | 
			
		||||
    var fuse = null;
 | 
			
		||||
    
 | 
			
		||||
    (function initFuse() {
 | 
			
		||||
      var xhr = new XMLHttpRequest();
 | 
			
		||||
      xhr.open('GET', baseurl + "/index.json");
 | 
			
		||||
      xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
 | 
			
		||||
      xhr.onload = function () {
 | 
			
		||||
        if (xhr.status === 200) {
 | 
			
		||||
          fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), {
 | 
			
		||||
            keys: sectionType.includes('publication') ? ['title', 'abstract'] : ['title', 'description', 'content'],
 | 
			
		||||
            includeMatches: enableSearchHighlight,
 | 
			
		||||
            shouldSort: true,
 | 
			
		||||
            threshold: 0.4,
 | 
			
		||||
            location: 0,
 | 
			
		||||
            distance: 100,
 | 
			
		||||
            maxPatternLength: 32,
 | 
			
		||||
            minMatchCharLength: 1,
 | 
			
		||||
          });
 | 
			
		||||
          window.fuse = fuse;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
          console.error('[' + xhr.status + ']Error:', xhr.statusText);
 | 
			
		||||
        }
 | 
			
		||||
      };
 | 
			
		||||
      xhr.send();
 | 
			
		||||
    })();
 | 
			
		||||
    if (enableSearch) {
 | 
			
		||||
      (function initFuse() {
 | 
			
		||||
        var xhr = new XMLHttpRequest();
 | 
			
		||||
        xhr.open('GET', baseurl + "/index.json");
 | 
			
		||||
        xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
 | 
			
		||||
        xhr.onload = function () {
 | 
			
		||||
          if (xhr.status === 200) {
 | 
			
		||||
            fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), {
 | 
			
		||||
              keys: sectionType.includes('publication') ? ['title', 'abstract'] : ['title', 'description', 'content'],
 | 
			
		||||
              includeMatches: enableSearchHighlight,
 | 
			
		||||
              shouldSort: true,
 | 
			
		||||
              threshold: 0.4,
 | 
			
		||||
              location: 0,
 | 
			
		||||
              distance: 100,
 | 
			
		||||
              maxPatternLength: 32,
 | 
			
		||||
              minMatchCharLength: 1,
 | 
			
		||||
            });
 | 
			
		||||
            window.fuse = fuse;
 | 
			
		||||
          }
 | 
			
		||||
          else {
 | 
			
		||||
            console.error('[' + xhr.status + ']Error:', xhr.statusText);
 | 
			
		||||
          }
 | 
			
		||||
        };
 | 
			
		||||
        xhr.send();
 | 
			
		||||
      })();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function makeLi(ulElem, obj) {
 | 
			
		||||
      var li = document.createElement('li');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue