mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Remove gzip compression
This commit is contained in:
		@@ -115,37 +115,12 @@
 | 
			
		||||
    M.toast({html: 'Query has been sent!'});
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  function decodeResults(resultsByteArray) {
 | 
			
		||||
    console.log(resultsByteArray);
 | 
			
		||||
    var decompressedData = pako.inflate(resultsByteArray); // decompresses the recieved ArrayBuffer holding the compressed Byte data
 | 
			
		||||
    console.log(decompressedData);
 | 
			
		||||
    utf8decoder = new TextDecoder(); // default is utf-8
 | 
			
		||||
    var decodedStrData = utf8decoder.decode(decompressedData); // decodes the decompressed Uint8Array as an utf-8 string
 | 
			
		||||
    console.log(decodedStrData);
 | 
			
		||||
    return decodedStrData
 | 
			
		||||
  }
 | 
			
		||||
  function getResultInfos(matchObject) {
 | 
			
		||||
    for (var key in matchObject) {
 | 
			
		||||
        var token = matchObject[key];
 | 
			
		||||
        for (var key in token) {
 | 
			
		||||
          infos += token[key]['word'] + ' ';
 | 
			
		||||
        }
 | 
			
		||||
        var infos = infos;
 | 
			
		||||
    }
 | 
			
		||||
    return infos
 | 
			
		||||
  }
 | 
			
		||||
  socket.on('corpus_analysis', function(results) {
 | 
			
		||||
    console.log(results);
 | 
			
		||||
    var decodedJSONStr = decodeResults(results);
 | 
			
		||||
    var results = JSON.parse(decodedJSONStr);
 | 
			
		||||
    if (results === null){
 | 
			
		||||
    if (results === null) {
 | 
			
		||||
      M.toast({html: 'Query has no results!'});
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      console.log(results);
 | 
			
		||||
    } else {
 | 
			
		||||
      html_txt = '<table class="highlight"> <thead><tr><th>Left context</th><th>Match</th><th>Right Context</th></tr></thead>';
 | 
			
		||||
      for (var key in results) {
 | 
			
		||||
        var hit = results[key];
 | 
			
		||||
      for (let [key, hit] of Object.entries(results)) {
 | 
			
		||||
        var left_context = hit['context_before_cpos_list']
 | 
			
		||||
        var match = hit['match_cpos_list']
 | 
			
		||||
        var right_context = hit['context_after_cpos_list']
 | 
			
		||||
@@ -161,5 +136,16 @@
 | 
			
		||||
      queryResultsElement.innerHTML = html_txt;
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  function getResultInfos(matchObject) {
 | 
			
		||||
    infos = '';
 | 
			
		||||
    for (var key in matchObject) {
 | 
			
		||||
        var token = matchObject[key];
 | 
			
		||||
        for (var key in token) {
 | 
			
		||||
          infos += token[key]['word'] + ' ';
 | 
			
		||||
        }
 | 
			
		||||
        var infos = infos;
 | 
			
		||||
    }
 | 
			
		||||
    return infos
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user