Skip to content
Snippets Groups Projects
Commit 9bcd174a authored by Matti Harjula's avatar Matti Harjula
Browse files

Load MathJax into [[jsxgraph]], fro now loads CDN which is sub optimal for...

Load MathJax into [[jsxgraph]], fro now loads CDN which is sub optimal for closed network users, but this will surely get fixed at soem point.
parent ccf9dea6
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,7 @@ class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block {
if (isset($xpars['overridejs'])) {
unset($xpars['overridejs']);
}
// Disable scrolling for this.
$xpars['scrolling'] = false;
// Set a title.
......@@ -91,6 +92,11 @@ class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block {
$r->items[] = new MP_String(json_encode($xpars));
// Plug in some style and scripts.
$mathjax = stack_get_mathjax_url();
$r->items[] = new MP_List([
new MP_String('script'),
new MP_String(json_encode(['type' => 'text/javascript', 'src' => $mathjax]))
]);
$r->items[] = new MP_List([
new MP_String('style'),
new MP_String(json_encode(['href' => $css]))
......
......@@ -179,3 +179,11 @@ function stack_cors_link(string $filename): string {
return (new moodle_url(
'/question/type/stack/corsscripts/cors.php', ['name' => $filename]))->out(false);
}
/*
* Gets the URL used for MathJax, might be VLE local.
*/
function stack_get_mathjax_url(): string {
// TODO: figure out how to support VLE local with CORS.
return 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment