diff --git a/htdocs/js/MathJaxConfig/mathjax-config.js b/htdocs/js/MathJaxConfig/mathjax-config.js index c998d67ce5..0d52c5095a 100644 --- a/htdocs/js/MathJaxConfig/mathjax-config.js +++ b/htdocs/js/MathJaxConfig/mathjax-config.js @@ -1,7 +1,6 @@ if (!window.MathJax) { window.MathJax = { - tex: { packages: { '[+]': ['noerrors'] } }, - loader: { load: ['input/asciimath', '[tex]/noerrors'] }, + loader: { load: ['input/asciimath'] }, startup: { ready() { const AM = MathJax.InputJax.AsciiMath.AM; diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index be8ce17e7e..8185d8b3a1 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -32,6 +32,7 @@ use MIME::Base64; use Scalar::Util qw(weaken); use HTML::Entities; use Encode; +use Mojo::JSON qw(encode_json); use WeBWorK::File::Scoring qw(parse_scoring_file); use WeBWorK::Localize; @@ -682,20 +683,15 @@ sub page_title ($c) { return route_title($c, $c->current_route, 1); } -=item webwork_url +=item webwork_js_config -Defined in this package. - -Outputs the $webwork_url defined in site.conf, unless $webwork_url is equal to -"/", in which case this outputs the empty string. - -This is used to set a value in a global webworkConfig javascript variable, -that can be accessed in javascript files. +Outputs the webwork2 JavaScript configuration. This configuration can be +accessed by JavaScript files to obtain various webwork2 settings. =cut -sub webwork_url ($c) { - return $c->location; +sub webwork_js_config ($c) { + return encode_json({ webwork_url => $c->location }); } =item warnings() diff --git a/templates/ContentGenerator/SampleProblemViewer.html.ep b/templates/ContentGenerator/SampleProblemViewer.html.ep index e8d24daf4f..6837417146 100644 --- a/templates/ContentGenerator/SampleProblemViewer.html.ep +++ b/templates/ContentGenerator/SampleProblemViewer.html.ep @@ -14,7 +14,7 @@ <%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'node_modules/minisearch/dist/umd/index.js' }), defer => undef =%> - + <%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/SampleProblemViewer/documentation-search.js' }), defer => undef =%> diff --git a/templates/layouts/system.html.ep b/templates/layouts/system.html.ep index f2b0be7f1b..282890b782 100644 --- a/templates/layouts/system.html.ep +++ b/templates/layouts/system.html.ep @@ -20,7 +20,7 @@ % } % % # Webwork configuration for javascript - + % % # JS Loads <%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/MathJaxConfig/mathjax-config.js' }),