acharyaaditya26 commited on
Commit
b68dea1
·
verified ·
1 Parent(s): 3b5118f

Update templates/result.html

Browse files
Files changed (1) hide show
  1. templates/result.html +40 -11
templates/result.html CHANGED
@@ -21,17 +21,46 @@
21
  resultsContainer.appendChild(pageDiv);
22
  });
23
 
24
- // Simulate loading for each page
25
- results.forEach((result, index) => {
26
- const contentDiv = document.getElementById(`result-content-${result.page_number}`);
27
- const loadingDiv = document.getElementById(`loading-indicator-${result.page_number}`);
28
-
29
- // Simulate a delay to mimic loading
30
- setTimeout(() => {
31
- loadingDiv.style.display = 'none';
32
- contentDiv.style.display = 'block';
33
- }, index * 2000); // Adjust the delay as needed
34
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  });
36
  </script>
37
  </head>
 
21
  resultsContainer.appendChild(pageDiv);
22
  });
23
 
24
+ // Load MathJax and MathPix Markdown-It scripts
25
+ const script1 = document.createElement('script');
26
+ script1.src = "https://cdn.jsdelivr.net/npm/mathpix-markdown-it@1.3.6/es5/bundle.js";
27
+ document.head.appendChild(script1);
28
+
29
+ script1.onload = function() {
30
+ const script2 = document.createElement('script');
31
+ script2.src = "https://polyfill.io/v3/polyfill.min.js?features=es6";
32
+ document.head.appendChild(script2);
33
+
34
+ script2.onload = function() {
35
+ const script3 = document.createElement('script');
36
+ script3.type = 'text/javascript';
37
+ script3.textContent = `
38
+ window.onload = function() {
39
+ const isLoaded = window.loadMathJax();
40
+ if (isLoaded) {
41
+ console.log('Styles loaded!');
42
+ }
43
+
44
+ const results = ${JSON.stringify(results)};
45
+ results.forEach(result => {
46
+ const contentDiv = document.getElementById(\`result-content-\${result.page_number}\`);
47
+ const loadingDiv = document.getElementById(\`loading-indicator-\${result.page_number}\`);
48
+
49
+ if (contentDiv) {
50
+ const options = {
51
+ htmlTags: true
52
+ };
53
+ const html = window.render(result.text, options);
54
+ contentDiv.innerHTML = html;
55
+ loadingDiv.style.display = 'none';
56
+ contentDiv.style.display = 'block';
57
+ }
58
+ });
59
+ };
60
+ `;
61
+ document.head.appendChild(script3);
62
+ };
63
+ };
64
  });
65
  </script>
66
  </head>