99open Js_utils
1010open Lwt.Infix
1111open Learnocaml_data
12+ open Learnocaml_config
1213
1314module H = Tyxml_js. Html
1415
@@ -171,7 +172,7 @@ let show_loading ?(id = "ocp-loading-layer") contents f =
171172 Manip. (removeClass elt " loaded" ) ;
172173 Manip. (addClass elt " loading" ) ;
173174 let chamo_src =
174- " /icons/tryocaml_loading_" ^ string_of_int (Random. int 9 + 1 ) ^ " .gif" in
175+ api_server ^ " /icons/tryocaml_loading_" ^ string_of_int (Random. int 9 + 1 ) ^ " .gif" in
175176 Manip. replaceChildren elt
176177 H. [
177178 div ~a: [ a_id " chamo" ] [ img ~alt: " loading" ~src: chamo_src () ] ;
@@ -286,7 +287,7 @@ let button ~container ~theme ?group ?state ~icon lbl cb =
286287 | Some group -> group in
287288 let button =
288289 H. (button [
289- img ~alt: " " ~src: (" /icons/icon_" ^ icon ^ " _" ^ theme ^ " .svg" ) () ;
290+ img ~alt: " " ~src: (api_server ^ " /icons/icon_" ^ icon ^ " _" ^ theme ^ " .svg" ) () ;
290291 pcdata " " ;
291292 span ~a: [ a_class [ " label" ] ] [ pcdata lbl ]
292293 ]) in
@@ -537,13 +538,13 @@ let stars_div stars =
537538 let num = 5 * int_of_float (stars *. 2. ) in
538539 let num = max (min num 40 ) 0 in
539540 let alt = Format. asprintf [% if " difficulty: %d / 40" ] num in
540- let src = Format. asprintf " /icons/stars_%02d.svg" num in
541+ let src = Format. asprintf " %s /icons/stars_%02d.svg" api_server num in
541542 H. img ~alt ~src ()
542543 ]
543544
544545let exercise_text ex_meta exo =
545546 let mathjax_url =
546- " /js/mathjax/MathJax.js?delayStartupUntil=configured"
547+ api_server ^ " /js/mathjax/MathJax.js?delayStartupUntil=configured"
547548 in
548549 let mathjax_config =
549550 " MathJax.Hub.Config({\n \
@@ -578,7 +579,7 @@ let exercise_text ex_meta exo =
578579 <html><head>\
579580 <title>%s - exercise text</title>\
580581 <meta charset='UTF-8'>\
581- <link rel='stylesheet' href='/css/learnocaml_standalone_description.css'>\
582+ <link rel='stylesheet' href='%s /css/learnocaml_standalone_description.css'>\
582583 <script type='text/x-mathjax-config'>%s</script>
583584 <script type='text/javascript' src='%s'></script>\
584585 </head>\
@@ -588,6 +589,7 @@ let exercise_text ex_meta exo =
588589 <script type='text/javascript'>MathJax.Hub.Configured()</script>\
589590 </html>"
590591 ex_meta.Exercise.Meta. title
592+ api_server
591593 mathjax_config
592594 mathjax_url
593595 descr
@@ -1023,7 +1025,7 @@ module Display_exercise =
10231025 let num = 5 * int_of_float (ex_meta.Meta. stars *. 2. ) in
10241026 let num = max (min num 40 ) 0 in
10251027 let alt = Format. asprintf [% if " difficulty: %d / 40" ] num in
1026- let src = Format. asprintf " /icons/stars_%02d.svg" num in
1028+ let src = Format. asprintf " %s /icons/stars_%02d.svg" api_server num in
10271029 img ~alt ~src ()
10281030 in
10291031 div ~a: [ a_class [ " stars" ] ] [
0 commit comments