Add comments

This commit is contained in:
Elara 2021-12-09 18:10:08 -08:00
parent a6e397f50b
commit f45802f372
3 changed files with 9 additions and 1 deletions

View File

@ -26,9 +26,11 @@ import (
) )
const calcExtraHead = ` const calcExtraHead = `
<!-- Import KaTeX for math rendering -->
<link rel="stylesheet" href="/static/katex.min.css"> <link rel="stylesheet" href="/static/katex.min.css">
<script defer src="/static/katex.min.js"></script> <script defer src="/static/katex.min.js"></script>
<!-- Import Nerdamer for equation evaluator -->
<script src="/static/nerdamer.core.js"></script> <script src="/static/nerdamer.core.js"></script>
<script src="/static/Algebra.js"></script> <script src="/static/Algebra.js"></script>
<script src="/static/Calculus.js"></script> <script src="/static/Calculus.js"></script>
@ -38,7 +40,9 @@ const solveRenderScript = `
<div id="calc-content" class="subtitle mx-2 my-0"></div> <div id="calc-content" class="subtitle mx-2 my-0"></div>
<script> <script>
window.onload = () => { window.onload = () => {
latex = nerdamer.convertToLaTeX(nerdamer('%s').toString()) // Execute input and get output as LaTeX
latex = nerdamer('%s').latex()
// Use KaTeX to render output to #calc-content div
katex.render(latex, document.getElementById('calc-content')) katex.render(latex, document.getElementById('calc-content'))
} }
</script>` </script>`

View File

@ -35,6 +35,7 @@ const plotExtraHead = `
const plotScript = ` const plotScript = `
<div id="plot-content" class="container"></div> <div id="plot-content" class="container"></div>
<script> <script>
// Create function to draw plot in #plot-content
plotFn = () => functionPlot({ plotFn = () => functionPlot({
target: '#plot-content', target: '#plot-content',
grid: true, grid: true,
@ -43,6 +44,7 @@ plotFn = () => functionPlot({
fn: '%s' fn: '%s'
}] }]
}) })
// Create resize observer that runs plot function
new ResizeObserver(plotFn).observe(document.getElementById('plot-content')) new ResizeObserver(plotFn).observe(document.getElementById('plot-content'))
</script>` </script>`

View File

@ -26,6 +26,8 @@ import (
"net" "net"
"net/http" "net/http"
"os" "os"
"path"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"