j1-template 2022.2.2 → 2022.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
  3. data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
  4. data/assets/data/fab.html +2 -2
  5. data/assets/data/footer.html +2 -2
  6. data/assets/themes/j1/adapter/js/analytics.js +13 -13
  7. data/assets/themes/j1/adapter/js/cookieConsent.js +1 -1
  8. data/assets/themes/j1/adapter/js/nbinteract.js +366 -120
  9. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +30 -40
  10. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  11. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +85 -216
  12. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  13. data/assets/themes/j1/core/js/template.js +1 -1
  14. data/assets/themes/j1/core/js/template.min.js +1 -1
  15. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  16. data/assets/themes/j1/modules/carousel/css/theme/uno.css +5 -0
  17. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  18. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +1 -0
  19. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.css +6 -0
  20. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.min.css +1 -1
  21. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.css +2 -2
  22. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.min.css +1 -2
  23. data/assets/themes/j1/modules/nbInteract/README.md +169 -0
  24. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
  25. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
  26. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.css +33 -33
  27. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.min.css +1 -1
  28. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.js +2068 -0
  29. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.min.js +36 -0
  30. data/assets/themes/j1/modules/plotly/LICENSE +21 -0
  31. data/assets/themes/j1/modules/plotly/README.md +32 -0
  32. data/assets/themes/j1/modules/plotly/js/plotly.js +265345 -0
  33. data/assets/themes/j1/modules/plotly/js/plotly.min.js +65 -0
  34. data/assets/themes/j1/modules/requirejs/LICENSE +45 -0
  35. data/assets/themes/j1/modules/requirejs/README.md +79 -0
  36. data/assets/themes/j1/modules/requirejs/js/require.js +2068 -0
  37. data/assets/themes/j1/modules/requirejs/js/require.min.js +36 -0
  38. data/lib/j1/version.rb +1 -1
  39. data/lib/starter_web/Gemfile +1 -1
  40. data/lib/starter_web/_config.yml +1 -1
  41. data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
  42. data/lib/starter_web/_data/blocks/footer.yml +78 -65
  43. data/lib/starter_web/_data/modules/analytics.yml +8 -23
  44. data/lib/starter_web/_data/modules/defaults/analytics.yml +1 -1
  45. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +4 -1
  46. data/lib/starter_web/_data/modules/justifiedGallery.yml +14 -8
  47. data/lib/starter_web/_data/modules/navigator_menu.yml +6 -3
  48. data/lib/starter_web/_data/modules/nbinteract.yml +12 -48
  49. data/lib/starter_web/_data/resources.yml +52 -18
  50. data/lib/starter_web/_includes/attributes.asciidoc +25 -0
  51. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  52. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge-1920x1200.jpg +0 -0
  53. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge.png +0 -0
  54. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_bar.jpg +0 -0
  55. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_hist.jpg +0 -0
  56. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_line.jpg +0 -0
  57. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_multiple_choice.jpg +0 -0
  58. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter.jpg +0 -0
  59. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter_drag.jpg +0 -0
  60. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_short_answer.jpg +0 -0
  61. data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
  62. data/lib/starter_web/assets/videos/gallery/kick-it-old-school-poster.jpg +0 -0
  63. data/lib/starter_web/assets/videos/gallery/nye-party-shop-poster.jpg +0 -0
  64. data/lib/starter_web/assets/videos/gallery/stay-colorful-poster.jpg +0 -0
  65. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-wiki-series.adoc +1 -0
  66. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-wiki-series.adoc +1 -0
  67. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-wiki-series.adoc +1 -0
  68. data/lib/starter_web/package.json +1 -2
  69. data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
  70. data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +165 -149
  71. data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +156 -11
  72. data/lib/starter_web/pages/public/jupyter/docs/nbinteract-doc.adoc +11 -6
  73. data/lib/starter_web/pages/public/jupyter/examples/j1-circular-times-table.adoc +136 -0
  74. data/lib/starter_web/pages/public/jupyter/examples/j1-interactive-widgets.adoc +9 -5
  75. data/lib/starter_web/pages/public/jupyter/examples/j1-odes-in-python.adoc +16 -7
  76. data/lib/starter_web/pages/public/jupyter/examples/j1-testing-plotly.adoc +95 -0
  77. data/lib/starter_web/pages/public/jupyter/examples/j1_climate-change-forecast.adoc +4 -4
  78. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/{algebra_with_sympy-checkpoint.ipynb → j1_circular_times_table-checkpoint.ipynb} +5190 -7291
  79. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +2 -2
  80. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +1 -1
  81. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
  82. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +1 -1
  83. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +520 -111
  84. data/lib/starter_web/pages/public/jupyter/notebooks/j1/factor_by_factor.mp4 +0 -0
  85. data/lib/starter_web/pages/public/jupyter/notebooks/j1/{.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb → j1_circular_times_table.ipynb} +5178 -7308
  86. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_climate_change_forecast.ipynb +2 -2
  87. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_docs_example_dynamic.ipynb +1 -1
  88. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
  89. data/lib/starter_web/pages/public/jupyter/notebooks/j1/{j1_ode_selected.ipynb → j1_odes_in_python.ipynb} +783 -34
  90. data/lib/starter_web/pages/public/jupyter/notebooks/j1/line_by_line.mp4 +0 -0
  91. data/lib/starter_web/pages/public/jupyter/notebooks/j1/point_by_point.mp4 +0 -0
  92. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
  93. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_interact-checkpoint.ipynb +254 -0
  94. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_monty_hall-checkpoint.ipynb +732 -0
  95. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
  96. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_tutorial_monty_hall.ipynb +25 -26
  97. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_circular_times_table.html +746 -0
  98. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_climate_change_forecast.html +2 -2
  99. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +217 -0
  100. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_odes_in_python.html +955 -0
  101. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +1 -2
  102. data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +25 -28
  103. data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +8 -9
  104. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
  105. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +9 -15
  106. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
  107. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +12 -1
  108. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
  109. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
  110. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
  111. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +117 -12
  112. data/lib/starter_web/pages/public/se/se-fake.adoc +47 -0
  113. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  114. data/lib/starter_web/utilsrv/package.json +1 -1
  115. metadata +41 -41
  116. data/lib/starter_web/_data/_resources.yml +0 -1668
  117. data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
  118. data/lib/starter_web/assets/videos/gallery/adriana-lima-poster.jpg +0 -0
  119. data/lib/starter_web/pages/public/jupyter/notebooks/binder/binder-launches.ipynb +0 -385
  120. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -6
  121. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/binder-launches-checkpoint.ipynb +0 -385
  122. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
  123. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/google_altair-checkpoint.ipynb +0 -33
  124. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
  125. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
  126. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive_test-checkpoint.ipynb +0 -14697
  127. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
  128. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
  129. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
  130. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
  131. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
  132. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
  133. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
  134. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
  135. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
  136. data/lib/starter_web/pages/public/jupyter/notebooks/j1/binder-launches.ipynb +0 -411
  137. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
  138. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +0 -546
  139. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +0 -186
  140. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/excel.py +0 -55
  141. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot.py +0 -108
  142. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot2.py +0 -108
  143. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/husky.py +0 -121
  144. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/latimes.py +0 -149
  145. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/pcolor.py +0 -6
  146. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/quartz.py +0 -55
  147. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_base.py +0 -94
  148. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_mono.py +0 -158
  149. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/sunsentinel.py +0 -125
@@ -83,6 +83,9 @@ j1.adapter.nbinteract = (function (j1, window) {
83
83
  var moduleOptions = {};
84
84
  var moduleSettings = {};
85
85
  var message = {};
86
+ var flags = {
87
+ checkURL: false
88
+ };
86
89
  var spinnerOpts = { // (default) options for a spinner
87
90
  lines: 13, // number of lines to draw
88
91
  length: 38, // length of each line
@@ -107,7 +110,8 @@ j1.adapter.nbinteract = (function (j1, window) {
107
110
  var nbiContentModalInfoID = 'nbiModalInfoBody'; // ID of the content (messages) for the INFO modal
108
111
  var nbiContentModalSuccessID = 'nbiModalSuccessBody'; // ID of the content (messages) for the SUCCESS modal
109
112
  var nbiContentModalErrorID = 'nbiModalErrorBody'; // ID of the content (messages) for the SUCCESS modal
110
- var nbiModalInfoID = '#' + 'nbiModalTopInfo'; // ID of the SUCCESS modal
113
+ var nbiModalTopInfo = '#' + 'nbiModalTopInfo'; // ID of the TopInfo modal
114
+ var nbiModalTRInfo = '#' + 'nbiModalTRInfo'; // ID of the TRInfo modal
111
115
  var nbiModalSuccessID = '#' + 'nbiModalTRSuccess'; // ID of the SUCCESS modal
112
116
  var nbiModalErrorID = '#' + 'nbiModalTLDanger'; // ID of the ERROR modal
113
117
  var nbinteract_prepared = false; // switch to indicate if ???
@@ -187,11 +191,13 @@ j1.adapter.nbinteract = (function (j1, window) {
187
191
  // run a spinner to indicate activity of 'nbInteract' if enabled
188
192
  // -------------------------------------------------------------------
189
193
  $(document).ready(function() {
194
+
190
195
  if (nbiIndicateNbiActivity && !spinnerStarted) {
191
196
  spinnerStarted = true;
192
197
  target = document.getElementById('content');
193
198
  spinner = new Spinner(spinnerOpts).spin(target);
194
199
  }
200
+
195
201
  });
196
202
 
197
203
  // -----------------------------------------------------------------------
@@ -219,32 +225,128 @@ j1.adapter.nbinteract = (function (j1, window) {
219
225
  var scriptMathjax = document.createElement('script');
220
226
  var scriptMathjaxConfig = document.createElement('script');
221
227
 
228
+ // Loading MathJax from a CDN
229
+ //
222
230
  scriptMathjax.setAttribute('src','//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML');
223
231
 
232
+ // create/load MathJax configuration settings
233
+ //
224
234
  scriptMathjaxConfig.setAttribute('type','text/x-mathjax-config');
225
235
  scriptMathjaxConfig.innerHTML = `
226
236
  MathJax.Hub.Config({
227
237
  tex2jax: {
228
- inlineMath: [ ['$','$'], ["\\(","\\)"] ],
229
- displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
230
- processEscapes: true,
231
- processEnvironments: true,
232
- processClass: "mathjax",
233
- ignoreClass: "nomathjax"
238
+ // inlineMath, displayMath
239
+ // ---------------------------------------------------------------
240
+ // TeX 'delimiters'. By default, the tex2jax preprocessor
241
+ // definesthe LaTeX math delimiters, which are \(...\) for
242
+ // 'in-line' math, and \[...\] for 'displayed' equations.
243
+ // It also defines the TeX delimiters $$...$$ for displayed
244
+ // equations, but it does not define $...$ as in-line math
245
+ // delimiters. That is because dollar signs appear too often
246
+ // in non-mathematical settings, which could cause some text
247
+ // to be treated as mathematics unexpectedly. For example,
248
+ // with single-dollar delimiters, 'the cost is $2.50' for the
249
+ // first one, and '$2.00' for each additional one would cause
250
+ // the phrase '2.50 for the first one' to be treated as
251
+ // mathematics since it falls between dollar signs. For this
252
+ // reason, if you want to use single-dollars for in-line math
253
+ // mode, you must enable that explicitly.
254
+ //
255
+ inlineMath: [ ['$','$'], ["\\(","\\) "] ],
256
+ displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
257
+
258
+ // processEscapes
259
+ // ---------------------------------------------------------------
260
+ // When 'processEscapes' set to true, you may use \$ to
261
+ // representa literal dollar sign, rather than using it as
262
+ // a math delimiter. When false, \$ will not be altered,
263
+ // and the dollar sign may be considered part of a math
264
+ // delimiter. Typically this is set to 'true' if you enable
265
+ // the $ ... $ in-line delimiters, so you can type \$ and
266
+ // tex2jax will convert it to a regular dollar sign in the
267
+ // rendered document.
268
+ //
269
+ processEscapes: true,
270
+
271
+ // processEnvironments
272
+ // ---------------------------------------------------------------
273
+ // When 'processEnvironments' true, tex2jax looks not only
274
+ // for the in-line and display math delimiters, but also for
275
+ // LaTeX environments (\begin{something}...\end{something})
276
+ // and marks them forprocessing by MathJax. When false, LaTeX
277
+ // environments will not be processed outside of math mode.
278
+ //
279
+ processEnvironments: false,
280
+
281
+ // skipTags
282
+ // ---------------------------------------------------------------
283
+ // The array 'skipTags' lists the names of the tags whose
284
+ // contents should NOT be processed by tex2jax.
285
+ //
286
+ skipTags: ["script","noscript","style","textarea","pre","code"],
287
+
288
+ // processClass, ignoreClass
289
+ // ---------------------------------------------------------------
290
+ // These are the (CSS) classes name used to mark elements whose
291
+ // contents should or should NOT be processed by tex2jax.
292
+ //
293
+ processClass: "mathjax",
294
+ ignoreClass: "nomathjax"
234
295
  },
235
- // jadams, 2022-04-22, NOTE: 'MathJax_Display' overloaded by
236
- // THEME CSS. Unclear how to configure 'HTML-CSS' correctly.
296
+
297
+ // displayAlign
298
+ // -----------------------------------------------------------------
299
+ // Align (displayMath) equations left-sided in code and all
300
+ // markdown cells.
237
301
  //
238
- // Center justify equations in code and markdown cells. Elsewhere
239
- // we use CSS to left justify single line equations in code cells.
240
- displayAlign: 'center',
241
- "HTML-CSS": {
242
- styles: {'.MathJax_Display': {
243
- "margin": 0,
244
- }},
245
- linebreaks: { automatic: true }
246
- }
302
+ displayAlign: 'left',
303
+
304
+ // preview
305
+ // -----------------------------------------------------------------
306
+ // Controls whether tex2jax inserts 'MathJax_Preview' spans to
307
+ // make a preview available, and what preview to use, when it
308
+ // locates in-line or display mathematics in the page. The default
309
+ // is 'TeX', which means use the TeX code as the preview (which
310
+ // will be visible until it is processed by MathJax). Set to
311
+ // 'none' to prevent previews from being inserted.
312
+ //
313
+ preview: "TeX",
314
+
315
+ // CommonHTML, HTML-CSS, and SVG output processors
316
+ // -----------------------------------------------------------------
317
+ // The CommonHTML, HTML-CSS, and SVG output processors implement
318
+ // most of the MathML3 automatic line-breaking specification.
319
+ // Since line-breaking takes extra processing and so can slow
320
+ // down the mathematical output, it is off by default
321
+ //
322
+ CommonHTML: { linebreaks: { automatic: false } },
323
+ "HTML-CSS": { linebreaks: { automatic: false } },
324
+ SVG: { linebreaks: { automatic: false } }
325
+ });
326
+
327
+ // Use Jax renderer 'CommonHTML' for default
328
+ //
329
+ MathJax.Hub.Register.StartupHook("End Jax",function () {
330
+ var BROWSER = MathJax.Hub.Browser;
331
+ var jax = "CommonHTML";
332
+ if (BROWSER.hasMathPlayer) jax = "NativeMML";
333
+ return MathJax.Hub.setRenderer(jax);
247
334
  });
335
+
336
+ // Register a message MessageHook
337
+ // ---------------------------------------------------------------------
338
+ // MathJax.Hub.Register.MessageHook("New Math", function (message) {
339
+ // var script = MathJax.Hub.getJaxFor(message[1]).SourceElement();
340
+ // var j1_message = {};
341
+ // j1_message.type = 'command';
342
+ // j1_message.action = 'mathjax';
343
+ // j1_message.text = message[1];
344
+ // this.j1.sendMessage('MathJax.Hub.MessageHook', 'j1.adapter.nbinteract', j1_message);
345
+ // // console.error('nbinteract, Hub - New Math: ' + message[1]);
346
+ // });
347
+
348
+ // ---------------------------------------------------------------------
349
+ // END config
248
350
  `;
249
351
 
250
352
  // add Mathjax resources
@@ -277,6 +379,7 @@ j1.adapter.nbinteract = (function (j1, window) {
277
379
  xhr_data: textbook.xhr_data,
278
380
  xhr_data_path: textbook.xhr_data_path,
279
381
  use_mathjax: textbook.use_mathjax,
382
+ translate_mathjax: textbook.translate_mathjax,
280
383
  altair_cleanups: textbook.altair_cleanups,
281
384
  buttonStyles: settings.button_styles,
282
385
  });
@@ -293,98 +396,124 @@ j1.adapter.nbinteract = (function (j1, window) {
293
396
  // controlled by nbinteract_prepared.
294
397
  // -------------------------------------------------------------------------
295
398
  interactNbiTextbooks: function (options) {
399
+ var state;
296
400
  var textbook = options;
297
401
 
298
402
  // initialize state flag
299
403
  _this.setState('started');
300
404
  logger.debug('\n' + 'state: ' + _this.getState());
301
405
 
406
+ // check if the Binder Service is available
407
+ //
408
+ _this.checkURL(options.baseUrl, flags);
409
+
302
410
  var log_text = '\n' + 'nbinteract is being initialized';
303
411
  logger.info(log_text);
304
412
 
305
- // var nbiButtonsFound = document.querySelectorAll('.js-nbinteract-widget')
306
-
307
- {% comment %} initialize nbinteract per textbook
308
- {% assign textbook_spec = item.textbook.spec %}
309
- {% assign textbook_baseUrl = item.textbook.baseUrl %}
310
- {% assign textbook_provider = item.textbook.provider %}
311
- -------------------------------------------------------------------------- {% endcomment %}
312
- {% for item in nbinteract_options.textbooks %} {% if item.textbook.enabled %}
313
- {% assign textbook_id = item.textbook.id %}
314
-
315
- if ($('#{{textbook_id}}').length) {
316
- var dependencies_met_nb_loaded = setInterval(function() {
317
- if ($('#{{textbook_id}}').attr('data-nb-textbook') == 'loaded') {
318
-
319
- var nbiButtonsFound = document.querySelectorAll('.js-nbinteract-widget').length
320
- if (nbiIndicateNbiActivity && nbiButtonsFound == 1) {
321
- var log_text = '\n' + 'non-nbi textbook found, skip NBI initialization for: {{textbook_id}}';
322
- logger.warn(log_text);
323
- spinner.stop();
324
- }
325
-
326
- if(!nbinteract_prepared && nbiButtonsFound > 1) {
327
- logText = '\n' + 'jupyter kernel is being generated ...';
328
- logger.info(logText);
413
+ var dependencies_met_binder_responsive = setInterval(function() {
414
+ state = _this.getState();
415
+ if (state == 'finished_checks') {
416
+ clearInterval(dependencies_met_binder_responsive);
417
+ if (flags.checkURL) {
418
+ {% comment %} initialize nbinteract per textbook
419
+ {% assign textbook_spec = item.textbook.spec %}
420
+ {% assign textbook_baseUrl = item.textbook.baseUrl %}
421
+ {% assign textbook_provider = item.textbook.provider %}
422
+ -------------------------------------------------------------------------- {% endcomment %}
423
+ {% for item in nbinteract_options.textbooks %} {% if item.textbook.enabled %}
424
+ {% assign textbook_id = item.textbook.id %}
425
+
426
+ if ($('#{{textbook_id}}').length) {
427
+ var dependencies_met_nb_loaded = setInterval(function() {
428
+ if ($('#{{textbook_id}}').attr('data-nb-textbook') == 'loaded') {
429
+
430
+ var nbiButtonsFound = document.querySelectorAll('.js-nbinteract-widget').length
431
+ if (nbiIndicateNbiActivity && nbiButtonsFound == 1) {
432
+ var log_text = '\n' + 'non-nbi textbook found, skip NBI initialization for: {{textbook_id}}';
433
+ logger.warn(log_text);
434
+ spinner.stop();
435
+ }
329
436
 
330
- // create nbInteract (core) instance
331
- //
332
- coreLogger = log4javascript.getLogger('nbinteract.core');
333
- interact = new NbInteract({
334
- spec: options.spec,
335
- baseUrl: options.baseUrl,
336
- provider: options.provider,
337
- logger: coreLogger,
338
- j1API: j1,
339
- });
340
-
341
- // generate a jupyter kernel via BinderHub
342
- interact.prepare();
343
- nbinteract_prepared = true;
344
-
345
- // issue an error if the NBI (init) button never removed by
346
- // nbInteract-core (util or manager)
347
- // TODO: The 'timeout' condition should be replaced
348
- // state-based triggered from nbInteract-core.
349
- //
350
- window.setTimeout(function() {
351
- var nbiButtonState = _this.getNbiButtonState();
352
- if (nbiButtonState) {
353
- // button NOT removed
354
- logger.warn('NBI initialialization failed on textbook: {{textbook_id}}');
355
- // hide the info modal
356
- $(nbiModalSuccessID).modal('hide');
357
-
358
- // show the error modal
359
- $(nbiModalSuccessID).on('hidden.bs.modal', function () {
360
- if ($(nbiModalErrorID).is(':hidden')) {
361
- var messageErrorUL = document.getElementById(nbiModalErrorMessagesID);
362
- _this.appendModalMessage(messageErrorUL, 'NBI initialialization failed for textbook: {{textbook_id}}')
363
- $(nbiModalErrorID).modal('show');
364
-
365
- // auto-close the error modal
366
- if (nbiModalAutoClose) {
367
- window.setTimeout(function() {
368
- $(nbiModalErrorID).modal('hide');
369
- }, nbiModalAutoCloseDelay);
437
+ if(!nbinteract_prepared && nbiButtonsFound > 1) {
438
+ logText = '\n' + 'jupyter kernel is being generated ...';
439
+ logger.info(logText);
440
+
441
+ // create nbInteract (core) instance
442
+ //
443
+ coreLogger = log4javascript.getLogger('nbinteract.core');
444
+ interact = new NbInteract({
445
+ spec: options.spec,
446
+ baseUrl: options.baseUrl,
447
+ provider: options.provider,
448
+ logger: coreLogger,
449
+ j1API: j1,
450
+ });
451
+
452
+ // generate a jupyter kernel via BinderHub
453
+ interact.prepare();
454
+ nbinteract_prepared = true;
455
+
456
+ // issue an error if the NBI (init) button never removed by
457
+ // nbInteract-core (util or manager)
458
+ // TODO: The 'timeout' condition should be replaced
459
+ // state-based triggered from nbInteract-core.
460
+ //
461
+ window.setTimeout(function() {
462
+ var nbiButtonState = _this.getNbiButtonState();
463
+ if (nbiButtonState) {
464
+ // button NOT removed
465
+ logger.warn('NBI initialialization failed on textbook: {{textbook_id}}');
466
+ // hide the info modal
467
+ $(nbiModalSuccessID).modal('hide');
468
+
469
+ // show the error modal
470
+ $(nbiModalSuccessID).on('hidden.bs.modal', function () {
471
+ if ($(nbiModalErrorID).is(':hidden')) {
472
+ var messageErrorUL = document.getElementById(nbiModalErrorMessagesID);
473
+ _this.appendModalMessage(messageErrorUL, 'NBI initialialization failed for textbook: {{textbook_id}}')
474
+ $(nbiModalErrorID).modal('show');
475
+
476
+ // auto-close the error modal
477
+ if (nbiModalAutoClose) {
478
+ window.setTimeout(function() {
479
+ $(nbiModalErrorID).modal('hide');
480
+ }, nbiModalAutoCloseDelay);
481
+ }
482
+ }
483
+ });
484
+ } else {
485
+ // button removed
486
+ logger.info('NBI initialized successfully.');
370
487
  }
371
- }
372
- });
373
- } else {
374
- // button removed
375
- logger.info('NBI initialized successfully.');
376
- }
377
- }, nbiInitTimeout);
488
+ }, nbiInitTimeout);
378
489
 
490
+ }
491
+
492
+ clearInterval(dependencies_met_nb_loaded);
493
+ } // END dependencies_met_nb_loaded
494
+ }, 25);
495
+ return;
496
+ }
497
+ // END textbook_id: {{ textbook_id }}
498
+ {% endif %} {% endfor %}
499
+ } else {
500
+ spinner.stop();
501
+ var modaBodyText = `
502
+ The <i>Binder Service</i> is currently not available or is overloaded.
503
+ All interactive components on the page are <b>not</b> available.
504
+ You can reload the page or re-open later again.
505
+ `;
506
+ logger.error('\n', 'Binder access: failed');
507
+ if ($(nbiModalTRInfo).is(':hidden')) {
508
+ document.getElementById('nbiModalTRInfoBody').innerHTML = modaBodyText;
509
+ $(nbiModalTRInfo).modal('show');
379
510
  }
511
+ clearInterval(dependencies_met_binder_responsive);
512
+ }
513
+
514
+ }
515
+ }, 25); // END dependencies_met_binder_responsive
380
516
 
381
- clearInterval(dependencies_met_nb_loaded);
382
- } // END dependencies_met_nb_loaded
383
- }, 25);
384
- return;
385
- }
386
- // END textbook_id: {{ textbook_id }}
387
- {% endif %} {% endfor %}
388
517
  },
389
518
 
390
519
  // -------------------------------------------------------------------------
@@ -393,11 +522,16 @@ j1.adapter.nbinteract = (function (j1, window) {
393
522
  // (e.g. <div>) specified by xhr_container_id, xhr_data_path
394
523
  // -------------------------------------------------------------------------
395
524
  loadTextbookHTML: function (options) {
396
- var html_data_path = options.xhr_data_path + '/' + options.xhr_data;
397
- var id = options.xhr_container_id;
398
- var mathjaxEnabled = options.use_mathjax;
399
- var cleanupAltair = options.altair_cleanups;
400
- var $selector = $('#' + id);
525
+ var html_data_path = options.xhr_data_path + '/' + options.xhr_data;
526
+ var id = options.xhr_container_id;
527
+ var mathjaxEnabled = options.use_mathjax ? options.use_mathjax : false;
528
+ var mathjaxTranslate = options.translate_mathjax ? options.translate_mathjax : false;
529
+ var cleanupAltair = options.altair_cleanups ? options.altair_cleanups : false;
530
+ var isPageRendered = false;
531
+ var $selector = $('#' + id);
532
+ var allID;
533
+ var allMathJaxSpan;
534
+ var allMathJaxElement;
401
535
  var logText;
402
536
 
403
537
  var cb_load_closure = function(id, mathjaxFlag) {
@@ -446,7 +580,6 @@ j1.adapter.nbinteract = (function (j1, window) {
446
580
  //
447
581
  if (cleanupAltair) {
448
582
 
449
-
450
583
  var reUnderscores = new RegExp(/_/, 'g');
451
584
  var reMultipleSpaces = new RegExp(/\s+/, 'g');
452
585
  var reMultipleSpacesStart = new RegExp(/^\s+/, 'g');
@@ -457,16 +590,15 @@ j1.adapter.nbinteract = (function (j1, window) {
457
590
  var newContent;
458
591
  var newContentWritten = false;
459
592
  var isWidget;
460
- var isPageRendered = false;
461
593
  var outputDiv;
462
594
  var childNodes;
463
595
  var clientHeight;
464
596
  var lastWidget = false;
465
- var allID = document.querySelectorAll('*[id^="altair-viz"]');
466
597
 
467
- // check/wait for ALL widgets in the page are rendered (by JS)
598
+ // check/wait for ALL Altair widgets in the page are rendered (by JS)
468
599
  // if rendering finished, flag 'isPageRendered' is set to 'true'
469
600
  //
601
+ allID = document.querySelectorAll('*[id^="altair-viz"]');
470
602
  for (var l = 0; l < allID.length; l++) {
471
603
  outputDiv = document.getElementById(allID[l].id);
472
604
  var dependencies_met_page_rendered = setInterval(function() {
@@ -505,7 +637,7 @@ j1.adapter.nbinteract = (function (j1, window) {
505
637
  clearInterval(dependencies_met_widgets_updated);
506
638
  }
507
639
  }, 25); // END interval
508
- } // END if cleanupAltair
640
+ } // END if cleanup Altair
509
641
 
510
642
  // disable MathJax for all HTML 'output_wrapper' elements
511
643
  //
@@ -514,29 +646,56 @@ j1.adapter.nbinteract = (function (j1, window) {
514
646
  x.className += ' nomathjax';
515
647
  }
516
648
  });
649
+
517
650
  // make all 'image' elements responsive (BS@4)
518
651
  //
519
652
  var images = document.getElementsByTagName('img');;
520
653
  [...images].forEach(function(x) {
521
654
  if (!x.className.includes('img-fluid')) {
522
- x.className += 'img-fluid';
655
+ x.className += ' img-fluid';
523
656
  }
524
657
  });
525
658
 
526
- // NOTE: DISABLED. Doesn't work that way. The class 'nbinteract-hide_in'
527
- // is used in combination with hidden code cells as well!
659
+ // disable for now
528
660
  //
529
- // Remove all childs in a element having the class 'nbinteract-hide_in'
530
- // document.querySelectorAll('.nbinteract-hide_in').forEach(el => el.remove());
661
+ mathjaxTranslate = true
662
+
663
+ // disable translation on MathJax containers
664
+ // -----------------------------------------------------------------
665
+ if (mathjaxEnabled && !mathjaxTranslate) {
666
+
667
+ var dependencies_met_mathjax_available = setInterval(function() {
668
+ // document.getElementsByClassName('MJXc-display');
669
+ // document.querySelectorAll('*[id^="MathJax-Element"]');
670
+ // allMathJaxSpan = document.querySelectorAll('*[id^="MathJax-Element"]');
671
+ // allMathJaxSpan = document.querySelectorAll('*[id^="MathJax-Element-"]');
672
+ // allMathJaxSpan = document.getElementsByClassName('mjx-chtml');
673
+ allMathJaxSpan = document.querySelectorAll('*[id$="-Frame"]');
674
+
675
+ if (allMathJaxSpan.length) {
676
+ // var lastElm = document.getElementById(allMathJaxSpan[allMathJaxSpan.length-1].id);
677
+ var dependencies_met_mathjax_rendered = setInterval(function() {
678
+ // var isProcessing = lastElm.classList.contains('MathJax_Processing');
679
+ var mj_state = j1.adapter.nbinteract.getState()
680
+ if (mj_state == 'mathjax_finished') {
681
+ allMathJaxSpan = document.querySelectorAll('*[id$="-Frame"]');
682
+ for (var l = 0; l < allMathJaxSpan.length; l++) {
683
+ // outputDiv = document.getElementById(allMathJaxSpan[l].id);
684
+ outputDiv = allMathJaxSpan[l];
685
+ logger.error('\n' + 'element: ' + outputDiv.id );
686
+ // outputDiv.classList.remove('MJXc-processing');
687
+ outputDiv.classList.add('notranslate');
688
+ }
689
+ clearInterval(dependencies_met_mathjax_rendered);
690
+ }
691
+ }, 25); // END interval dependencies_met_mathjax_rendered
692
+ clearInterval(dependencies_met_mathjax_available);
693
+ };
694
+ }, 25); // END interval dependencies_met_mathjax_available
531
695
 
532
- // Adding class on input_area NOT needed. This element contains
533
- // and 'highlight' element that is processed for 'notranslate'
534
- // in adapter rouge.js already
535
- //
536
- // var input_area = document.getElementsByClassName('input_area');
537
- // [...input_area].forEach(x => x.className += " notranslate");
696
+ } // END // disable translation on MathJax
538
697
 
539
- // cleanup headlines in textbook HTML and add an id used by toccer
698
+ // rewrite headlines in textbook HTML, add an id used by toccer
540
699
  //
541
700
  $selector.find('h1').replaceWith( function() {
542
701
  // return '<h1 id="' + $(this)[0].id.replace(/\$/g, '') + '">' + $(this).text().slice(0,-1) + '</h1>';
@@ -687,6 +846,45 @@ j1.adapter.nbinteract = (function (j1, window) {
687
846
  </div>
688
847
  </div>
689
848
  `
849
+
850
+ const nbiModalTRInfo = `
851
+ <div id="nbiModalTRInfo"
852
+ class="modal fade right"
853
+ tabindex="-1"
854
+ role="dialog"
855
+ aria-labelledby="myModalLabel" aria-hidden="true"
856
+ data-bs-keyboard="false"
857
+ data-bs-backdrop="static">
858
+ <div class="modal-dialog modal-dialog-scrollable modal-side-2x modal-top-right modal-notify modal-success" role="document">
859
+ <!-- Content -->
860
+ <div class="modal-content">
861
+ <!-- Header -->
862
+ <div class="modal-header">
863
+ <p class="lead">Information</p>
864
+ <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
865
+ <i class="mdi mdi-close mdi-dark mdi-48px"></i>
866
+ </button>
867
+ </div>
868
+ <!-- Icon -->
869
+ <div class="text-center">
870
+ <i class="mdi mdi-10x mdi-information-variant mdi-spin md-green mb-1"></i>
871
+ </div>
872
+ <!-- Body -->
873
+ <div id="nbiModalTRInfoBody" class="modal-body">
874
+ <div>
875
+ <p> Placeholder </p>
876
+ </div>
877
+ </div>
878
+ <!-- Footer -->
879
+ <div class="modal-footer justify-content-center">
880
+ <a type="button" class="btn btn-primary" data-bs-dismiss="modal">OK, thanks</a>
881
+ </div>
882
+ </div>
883
+ <!-- END Content -->
884
+ </div>
885
+ </div>
886
+ `
887
+
690
888
  const nbiModalTRSuccess = `
691
889
  <div id="nbiModalTRSuccess"
692
890
  class="modal fade right"
@@ -700,7 +898,7 @@ j1.adapter.nbinteract = (function (j1, window) {
700
898
  <div class="modal-content">
701
899
  <!-- Header -->
702
900
  <div class="modal-header">
703
- <p class="lead">Info - NbInteract</p>
901
+ <p class="lead">NBI - Information</p>
704
902
  <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
705
903
  <i class="mdi mdi-close mdi-dark mdi-48px"></i>
706
904
  </button>
@@ -725,6 +923,7 @@ j1.adapter.nbinteract = (function (j1, window) {
725
923
  </div>
726
924
  </div>
727
925
  `
926
+
728
927
  const nbiModalTLDanger = `
729
928
  <div id="nbiModalTLDanger"
730
929
  class="modal fade left"
@@ -738,7 +937,7 @@ j1.adapter.nbinteract = (function (j1, window) {
738
937
  <div id="nbiModalErrorBody" class="modal-content">
739
938
  <!--Header-->
740
939
  <div class="modal-header">
741
- <p class="lead">Error - NbInteract</p>
940
+ <p class="lead">NBI - Error</p>
742
941
  <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
743
942
  <i class="mdi mdi-close mdi-dark mdi-48px"></i>
744
943
  </button>
@@ -769,6 +968,12 @@ j1.adapter.nbinteract = (function (j1, window) {
769
968
  nbiModal.innerHTML = nbiModalTopInfo;
770
969
  document.body.appendChild(nbiModal);
771
970
 
971
+ nbiModal = document.createElement('div');
972
+ nbiModal.id = 'nbi-modal-info';
973
+ nbiModal.className = 'nbi-modal';
974
+ nbiModal.innerHTML = nbiModalTRInfo;
975
+ document.body.appendChild(nbiModal);
976
+
772
977
  nbiModal = document.createElement('div');
773
978
  nbiModal.id = 'nbi-modal-success';
774
979
  nbiModal.className = 'nbi-modal';
@@ -791,6 +996,7 @@ j1.adapter.nbinteract = (function (j1, window) {
791
996
  var json_message = JSON.stringify(message, undefined, 2);
792
997
  var messageSuccessUL = document.getElementById(nbiModalSuccessMessagesID);
793
998
  var messageErrorUL = document.getElementById(nbiModalErrorMessagesID);
999
+ var isUpdated = false;
794
1000
  var message;
795
1001
 
796
1002
  logText = '\n' + 'received message from ' + sender + ': ' + json_message;
@@ -823,6 +1029,30 @@ j1.adapter.nbinteract = (function (j1, window) {
823
1029
 
824
1030
  } // END message command/nbi_init_finished
825
1031
 
1032
+ if (message.type === 'command' && message.action === 'mathjax') {
1033
+ logger.error('\n' + 'New Math, ID: ' + message.text);
1034
+
1035
+ MathJax.Hub.Startup.signal.Interest(function (message) {
1036
+ logger.error("Startup: " + message)
1037
+ // if (message.contains('End')) {
1038
+ // logger.error("Startup: " + message)
1039
+ // }
1040
+ });
1041
+
1042
+ var dependencies_met_mathjax_rendered = setInterval(function() {
1043
+ var elm = document.getElementById('MathJax-Element-6' + '-Frame');
1044
+ var isProcessing = (elm.classList.contains('MJXc-processing') || elm.classList.contains('MJXc-processed')) ? true : false;
1045
+ if (!isProcessing && !isUpdated) {
1046
+ isUpdated = true;
1047
+ elm.classList.add('notranslate');
1048
+ logger.error('\n' + 'New Math, ID: ' + message.text);
1049
+ //clearInterval(dependencies_met_mathjax_rendered);
1050
+ }
1051
+ clearInterval(dependencies_met_mathjax_rendered);
1052
+ }, 25); // END interval dependencies_met_mathjax_rendered
1053
+
1054
+ } // END message command/nbi_init_finished
1055
+
826
1056
  // -----------------------------------------------------------------------
827
1057
  // command|info
828
1058
  //
@@ -943,6 +1173,22 @@ j1.adapter.nbinteract = (function (j1, window) {
943
1173
  return _this.state;
944
1174
  }, // END getState
945
1175
 
1176
+ // -------------------------------------------------------------------------
1177
+ // getState()
1178
+ // Returns the current (processing) state of the module
1179
+ // -------------------------------------------------------------------------
1180
+ checkURL: function (uri, flags) {
1181
+ _this.setState('process_checks');
1182
+ $.get(uri).done(function () {
1183
+ _this.setState('finished_checks');
1184
+ flags.checkURL = true;
1185
+ return true;
1186
+ }).fail(function () {
1187
+ _this.setState('finished_checks');
1188
+ flags.checkURL = false;
1189
+ });
1190
+
1191
+ }, // END checkURL
946
1192
  // -------------------------------------------------------------------------
947
1193
  // appendModalMessage()
948
1194
  // Appends a message to given (NBI) modal