j1-template 2023.3.0 → 2023.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +11 -9
- data/_includes/themes/j1/layouts/content_generator_post.html +1 -1
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +0 -3
- data/_includes/themes/j1/modules/navigator/generator.html +3 -3
- data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +5 -5
- data/_includes/themes/j1/procedures/collections/create_collection_article_preview.proc +3 -3
- data/_includes/themes/j1/procedures/global/select_icon_size.proc +9 -2
- data/_includes/themes/j1/procedures/layouts/default_writer.proc +1 -1
- data/_includes/themes/j1/procedures/posts/collate_timeline.proc +8 -8
- data/_includes/themes/j1/procedures/posts/create_series_header.proc +2 -2
- data/_layouts/category.html +2 -2
- data/assets/data/authclient.html +10 -12
- data/assets/data/banner.html +3 -3
- data/assets/data/fab.html +11 -8
- data/assets/data/footer.html +2 -3
- data/assets/data/gallery_customizer.html +2 -2
- data/assets/data/masonry.html +5 -5
- data/assets/data/masterslider.html +1 -1
- data/assets/data/menu.html +9 -6
- data/assets/data/panel.html +8 -8
- data/assets/data/quicklinks.html +3 -1
- data/assets/data/rtext_resizer.html +1 -1
- data/assets/data/slick.html +2 -2
- data/assets/data/translator.html +1 -1
- data/assets/themes/j1/adapter/js/advertising.js +302 -96
- data/assets/themes/j1/adapter/js/carousel.js +2 -2
- data/assets/themes/j1/adapter/js/j1.js +92 -25
- data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +1 -1
- data/assets/themes/j1/adapter/js/lazyLoader.js +221 -0
- data/assets/themes/j1/adapter/js/lunr.js +3 -3
- data/assets/themes/j1/adapter/js/navigator.js +3 -5
- data/assets/themes/j1/adapter/js/themeToggler.js +3 -3
- data/assets/themes/j1/adapter/js/themer.js +55 -21
- data/assets/themes/j1/core/css/icon-fonts/mdi.css +3 -7
- data/assets/themes/j1/core/css/icon-fonts/mdi.min.css +1 -1
- data/assets/themes/j1/core/css/icon-fonts/mdib.css +8337 -0
- data/assets/themes/j1/core/css/icon-fonts/mdib.min.css +1 -0
- data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +104 -30
- data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +19 -5
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +98 -31
- data/assets/themes/j1/core/js/template.min.js +2 -2
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-base.json +2690 -0
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-base.min.json +1 -0
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-light.json +2 -2
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-light.min.json +1 -1
- data/assets/themes/j1/modules/materialize/scss/components/_global.scss +1 -1
- data/assets/themes/j1/modules/materialize/scss/components/_navbar.scss +2 -2
- data/assets/themes/j1/modules/materialize/scss/components/_sidenav.scss +1 -1
- data/assets/themes/j1/modules/materialize/scss/components/forms/_input-fields.scss +2 -2
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +1 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +2 -2
- data/lib/starter_web/README.md +5 -5
- data/lib/starter_web/_config.yml +2 -2
- data/lib/starter_web/_data/blocks/banner.yml +1 -1
- data/lib/starter_web/_data/blocks/defaults/footer.yml +1 -1
- data/lib/starter_web/_data/blocks/footer.yml +4 -1
- data/lib/starter_web/_data/blocks/panel.yml +47 -47
- data/lib/starter_web/_data/layouts/default.yml +1 -1
- data/lib/starter_web/_data/layouts/home.yml +29 -0
- data/lib/starter_web/_data/modules/advertising.yml +120 -42
- data/lib/starter_web/_data/modules/defaults/advertising.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/attics.yml +2 -2
- data/lib/starter_web/_data/modules/defaults/authentication.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/blog_navigator.yml +20 -20
- data/lib/starter_web/_data/modules/defaults/fab.yml +3 -3
- data/lib/starter_web/_data/modules/defaults/iconPicker.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/lazyLoader.yml +33 -0
- data/lib/starter_web/_data/modules/defaults/lunr.yml +2 -2
- data/lib/starter_web/_data/modules/defaults/masterslider.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/navigator.yml +18 -18
- data/lib/starter_web/_data/modules/defaults/themer.yml +2 -2
- data/lib/starter_web/_data/modules/fab.yml +7 -7
- data/lib/starter_web/_data/modules/iconPicker.yml +3 -3
- data/lib/starter_web/_data/modules/lazyLoader.yml +93 -0
- data/lib/starter_web/_data/modules/masonry.yml +2 -2
- data/lib/starter_web/_data/modules/navigator_menu.yml +190 -148
- data/lib/starter_web/_data/modules/slick.yml +47 -86
- data/lib/starter_web/_data/resources.yml +68 -70
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_includes/attributes.0.asciidoc +626 -0
- data/lib/starter_web/_includes/attributes.asciidoc +26 -24
- data/lib/starter_web/_includes/custom/templates/collection_panel.html +2 -2
- data/lib/starter_web/_includes/google/static/google_ad_5128488466.html +19 -0
- data/lib/starter_web/_includes/google/static/google_ad_7284712660.html +19 -0
- data/lib/starter_web/_includes/google/templates/google_ads.html +55 -0
- data/lib/starter_web/_plugins/asciidoctor/fab-icon-inline.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/fas-icon-inline.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/mdil-icon-inline.rb +1 -1
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/assets/images/badges/configBinder.jpg +0 -0
- data/lib/starter_web/assets/images/badges/docsBinder.jpg +0 -0
- data/lib/starter_web/assets/images/badges/notebookBinder.jpg +0 -0
- data/lib/starter_web/assets/images/badges/scaleable/configBinder.svg +1 -1
- data/lib/starter_web/assets/images/badges/scaleable/docsBinder.svg +1 -1
- data/lib/starter_web/assets/images/badges/scaleable/myBinder.svg +1 -1
- data/lib/starter_web/assets/images/badges/scaleable/notebookBinder.svg +1 -1
- data/lib/starter_web/assets/images/icons/hyvor-talk/jpg/hyvor-logo.512x512.jpg +0 -0
- data/lib/starter_web/assets/images/icons/hyvor-talk/png/hyvor-logo.24x24.jpg +0 -0
- data/lib/starter_web/assets/images/icons/hyvor-talk/scalable/hyvor-logo.svg +1 -1
- data/lib/starter_web/assets/images/icons/j1/jpg/j1-256x256.jpg +0 -0
- data/lib/starter_web/assets/images/icons/j1/jpg/j1-512x512.jpg +0 -0
- data/lib/starter_web/assets/images/icons/j1/jpg/j1-64x64.jpg +0 -0
- data/lib/starter_web/assets/images/icons/j1/png/j1-256x256.png +0 -0
- data/lib/starter_web/assets/images/icons/j1/png/j1-512x512.jpg +0 -0
- data/lib/starter_web/assets/images/icons/j1/png/j1-512x512.jpg.png +0 -0
- data/lib/starter_web/assets/images/icons/j1/png/j1-512x512.png +0 -0
- data/lib/starter_web/assets/images/icons/j1/png/j1-64x64.png +0 -0
- data/lib/starter_web/assets/images/icons/j1/scalable/j1.svg +1 -1
- data/lib/starter_web/assets/images/modules/attics/1920x1280/brigitta-schneiter.jpg +0 -0
- data/lib/starter_web/assets/images/modules/icons/j1/scalable/j1.svg +1 -1
- data/lib/starter_web/assets/images/pages/asciidoc_skeletons/example-pdf-screenshot.jpg +0 -0
- data/lib/starter_web/assets/images/pages/core_web_vitals/200-create-a-link-1.jpg +0 -0
- data/lib/starter_web/assets/images/pages/core_web_vitals/core_web_vitals_best.jpg +0 -0
- data/lib/starter_web/assets/images/pages/core_web_vitals/core_web_vitals_best_full.jpg +0 -0
- data/lib/starter_web/assets/images/pages/features/bootswatch-themes-1280x800.jpg +0 -0
- data/lib/starter_web/assets/images/pages/features/global-mobile-traffic-1920x1080.jpg +0 -0
- data/lib/starter_web/assets/images/pages/features/google-lighthouse-1080x300.jpg +0 -0
- data/lib/starter_web/assets/images/pages/features/mobile-navigation-600x800.jpg +0 -0
- data/lib/starter_web/assets/images/pages/features/native-speakers-by-language.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/dynamic-web-access.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/jamstack-generators.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/jekyll.1200x400.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/jekyll.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/static-web-access.jpg +0 -0
- data/lib/starter_web/assets/images/promo/home/screenshot.jpg +0 -0
- data/lib/starter_web/assets/images/promo/jekyll/jekyll-faq.jpg +0 -0
- data/lib/starter_web/assets/images/promo/jekyll/jekyll-generator.jpg +0 -0
- data/lib/starter_web/assets/images/promo/jekyll/jekyll-generator.png +0 -0
- data/lib/starter_web/assets/images/promo/jekyll/jekyll-og.png +0 -0
- data/lib/starter_web/assets/images/promo/jekyll/scalable/jekyll-faq.psd +0 -0
- data/lib/starter_web/collections/_biography/a-life-in-questions.adoc +1 -1
- data/lib/starter_web/collections/_biography/becoming.adoc +1 -1
- data/lib/starter_web/collections/_biography/born-to-run.adoc +1 -1
- data/lib/starter_web/collections/_biography/forty-autumns.adoc +1 -1
- data/lib/starter_web/collections/_biography/not-dead-yet.adoc +1 -1
- data/lib/starter_web/collections/_biography/princess-diarist-the.adoc +1 -1
- data/lib/starter_web/collections/_biography/when-breath-becomes-air.adoc +1 -1
- data/lib/starter_web/collections/_fantasy/harry-potter-deathly-hallows.adoc +1 -1
- data/lib/starter_web/collections/_fantasy/harry-potter-philosophers-stone.adoc +1 -1
- data/lib/starter_web/collections/_fantasy/mistborn-trilogy.adoc +26 -1
- data/lib/starter_web/collections/_fantasy/ready-player-one.adoc +1 -1
- data/lib/starter_web/collections/_fantasy/sword-of-destiny.adoc +17 -2
- data/lib/starter_web/collections/_fantasy/terry-pratchet-diary.adoc +24 -1
- data/lib/starter_web/collections/_romance/{breath-of-snow-and-ashes-a.adoc → breath-of-snow-and-ashes.adoc} +13 -1
- data/lib/starter_web/collections/_romance/dressmaker-the.adoc +13 -1
- data/lib/starter_web/collections/_romance/fiery-cross-the.adoc +1 -1
- data/lib/starter_web/collections/_romance/it-ends-with-us.adoc +1 -1
- data/lib/starter_web/collections/_romance/outlander-novel.adoc +1 -1
- data/lib/starter_web/collections/_romance/virgins-outlander-short-story.adoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +4 -2
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +4 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +5 -3
- data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +4 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/_includes/attributes.asciidoc +2 -2
- data/lib/starter_web/index.html +0 -9
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter/112_getting_started.asciidoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/200_themes/212_values.asciidoc +4 -4
- data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/attributes.asciidoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/attributes.0.asciidoc +112 -0
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/attributes.asciidoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/themes_rouge.asciidoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/icon_fonts.adoc +152 -12
- data/lib/starter_web/pages/public/learn/roundtrip/present_images.adoc +28 -4
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +11 -13
- data/lib/starter_web/pages/public/{learn → tools}/cheatsheet/gem.adoc +5 -5
- data/lib/starter_web/pages/public/{learn → tools}/cheatsheet/git.adoc +14 -14
- data/lib/starter_web/pages/public/{learn → tools}/cheatsheet/j1.adoc +1 -1
- data/lib/starter_web/pages/public/{learn → tools}/cheatsheet/yaml.adoc +1 -1
- data/lib/starter_web/pages/public/{previewer → tools/previewer}/preview_bootstrap_theme.adoc +1 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +58 -88
- data/assets/data/nbinteract.html +0 -129
- data/assets/themes/j1/adapter/js/nbinteract.js +0 -1485
- data/assets/themes/j1/modules/advertising/js/adInitializer.js +0 -160
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-regular.json +0 -7312
- data/assets/themes/j1/modules/iconPicker/icons-libraries/mdi-icons-regular.min.json +0 -1
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.css +0 -1315
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.min.css +0 -7
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.structure.css +0 -886
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.structure.min.css +0 -5
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.theme.css +0 -446
- data/assets/themes/j1/modules/jquery-3.5.1/css/jquery-ui/jquery-ui.theme.min.css +0 -5
- data/assets/themes/j1/modules/jquery-3.5.1/js/extensions/hasClass.js +0 -37
- data/assets/themes/j1/modules/jquery-3.5.1/js/extensions/hasClass.min.js +0 -17
- data/assets/themes/j1/modules/jquery-3.5.1/js/extensions/removeClass.js +0 -42
- data/assets/themes/j1/modules/jquery-3.5.1/js/extensions/removeClass.min.js +0 -17
- data/assets/themes/j1/modules/jquery-3.5.1/js/jquery-ui.js +0 -19057
- data/assets/themes/j1/modules/jquery-3.5.1/js/jquery-ui.min.js +0 -6
- data/assets/themes/j1/modules/jquery-3.5.1/js/jquery.js +0 -10872
- data/assets/themes/j1/modules/jquery-3.5.1/js/jquery.min.js +0 -2
- data/assets/themes/j1/modules/jquery-3.5.1/js/jquery.min.map +0 -1
- data/assets/themes/j1/modules/jquery-3.5.1/js/require.js +0 -2145
- data/assets/themes/j1/modules/jquery-3.5.1/js/require.min.js +0 -5
- data/assets/themes/j1/modules/nbinteract-core/LICENSE.txt +0 -60
- data/assets/themes/j1/modules/nbinteract-core/README.md +0 -226
- data/assets/themes/j1/modules/nbinteract-core/css/nbinteract.css +0 -191
- data/assets/themes/j1/modules/nbinteract-core/css/nbinteract.min.css +0 -19
- data/assets/themes/j1/modules/nbinteract-core/css/theme/uno/nbinteract.css +0 -250
- data/assets/themes/j1/modules/nbinteract-core/css/theme/uno/nbinteract.min.css +0 -15
- data/assets/themes/j1/modules/nbinteract-core/js/mathjax/latest.js +0 -19
- data/assets/themes/j1/modules/nbinteract-core/js/mathjax/tex-chtml-full.js +0 -34
- data/assets/themes/j1/modules/nbinteract-core/js/mathjax/tex-chtml.js +0 -1
- data/assets/themes/j1/modules/nbinteract-core/js/mathjax/tex-mml-chtml.js +0 -1
- data/assets/themes/j1/modules/nbinteract-core/js/nbinteract/README +0 -1
- data/assets/themes/j1/modules/nbinteract-core/js/nbinteract/j1-nbinteract-core.js +0 -94
- data/assets/themes/j1/modules/nbinteract-core/js/nbinteract/j1-nbinteract-core.js.map +0 -1
- data/assets/themes/j1/modules/nbinteract-core/js/requireJS/require.js +0 -2068
- data/assets/themes/j1/modules/nbinteract-core/js/requireJS/require.min.js +0 -36
- data/lib/starter_web/_data/modules/defaults/nbinteract.yml +0 -281
- data/lib/starter_web/assets/images/icons/j1/j1-256x256.gif +0 -0
- data/lib/starter_web/assets/images/pages/asciidoc_skeletons/example-pdf-screenshot.png +0 -0
- data/lib/starter_web/assets/images/pages/core_web_vitals/core_web_vitals_best.png +0 -0
- data/lib/starter_web/assets/images/pages/core_web_vitals/core_web_vitals_best_full.png +0 -0
- data/lib/starter_web/assets/images/pages/features/bootswatch-themes-1280x800.png +0 -0
- data/lib/starter_web/assets/images/pages/features/global-mobile-traffic-1920x1080.png +0 -0
- data/lib/starter_web/assets/images/pages/features/google-lighthouse-1080x300.png +0 -0
- data/lib/starter_web/assets/images/pages/features/mobile-navigation-600x800.png +0 -0
- data/lib/starter_web/assets/images/pages/features/native-speakers-by-language.png +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/jupyterlab-architecture.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge-1920x1200.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge.png +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi-textbook-example.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_bar.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_hist.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_line.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_multiple_choice.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter_drag.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_short_answer.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/dynamic-web-access.png +0 -0
- data/lib/starter_web/assets/images/posts/featured/jamstack-generators.png +0 -0
- data/lib/starter_web/assets/images/posts/featured/jekyll.1200x400.png +0 -0
- data/lib/starter_web/assets/images/posts/featured/jekyll.png +0 -0
- data/lib/starter_web/assets/images/posts/featured/post-1.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/post-2.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/post-3.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/post-4.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/post-5.jpg +0 -0
- data/lib/starter_web/assets/images/posts/featured/static-web-access.png +0 -0
- data/lib/starter_web/collections/posts/public/series/_posts/2022-08-01-organize-your-life.adoc +0 -118
- data/lib/starter_web/collections/posts/public/series/_posts/2022-08-02-organize-your-life.adoc +0 -118
- data/lib/starter_web/collections/posts/public/series/_posts/2022-08-03-organize-your-life.adoc +0 -118
- data/lib/starter_web/collections/posts/public/series/_posts/2022-09-01-organize-your-life.adoc +0 -117
- data/lib/starter_web/collections/posts/public/series/_posts/2022-09-02-organize-your-life.adoc +0 -117
- /data/lib/starter_web/assets/images/badges/{configBinder.png → png/configBinder.png} +0 -0
- /data/lib/starter_web/assets/images/badges/{docsBinder.png → png/docsBinder.png} +0 -0
- /data/lib/starter_web/assets/images/badges/{notebookBinder.png → png/notebookBinder.png} +0 -0
- /data/lib/starter_web/assets/images/icons/hyvor-talk/{hyvor-logo.24x24.png → png/hyvor-logo.24x24.png} +0 -0
- /data/lib/starter_web/assets/images/icons/hyvor-talk/{hyvor-logo.512x512.png → png/hyvor-logo.512x512.png} +0 -0
@@ -1,1485 +0,0 @@
|
|
1
|
-
---
|
2
|
-
regenerate: true
|
3
|
-
---
|
4
|
-
|
5
|
-
{% capture cache %}
|
6
|
-
|
7
|
-
{% comment %}
|
8
|
-
# -----------------------------------------------------------------------------
|
9
|
-
# ~/assets/themes/j1/adapter/js/nbinteract.js
|
10
|
-
# Liquid template to adapt nbinteract-core JS API
|
11
|
-
#
|
12
|
-
# Product/Info:
|
13
|
-
# https://jekyll.one
|
14
|
-
# Copyright (C) 2023 Juergen Adams
|
15
|
-
#
|
16
|
-
# J1 Theme is licensed under the MIT License.
|
17
|
-
# For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
|
18
|
-
# -----------------------------------------------------------------------------
|
19
|
-
# Test data:
|
20
|
-
# {{ liquid_var | debug }}
|
21
|
-
# -----------------------------------------------------------------------------
|
22
|
-
{% endcomment %}
|
23
|
-
|
24
|
-
{% comment %} Liquid procedures
|
25
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
26
|
-
|
27
|
-
{% comment %} Set global settings
|
28
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
29
|
-
{% assign environment = site.environment %}
|
30
|
-
{% assign asset_path = "/assets/themes/j1" %}
|
31
|
-
|
32
|
-
{% comment %} Process YML config data
|
33
|
-
================================================================================ {% endcomment %}
|
34
|
-
|
35
|
-
{% comment %} Set config files
|
36
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
37
|
-
{% assign template_config = site.data.j1_config %}
|
38
|
-
{% assign blocks = site.data.blocks %}
|
39
|
-
{% assign modules = site.data.modules %}
|
40
|
-
|
41
|
-
{% comment %} Set config data
|
42
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
43
|
-
{% assign nbinteract_defaults = modules.defaults.nbinteract.defaults %}
|
44
|
-
{% assign nbinteract_settings = modules.nbinteract.settings %}
|
45
|
-
|
46
|
-
{% comment %} Set config options
|
47
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
48
|
-
{% assign nbinteract_options = nbinteract_defaults | merge: nbinteract_settings %}
|
49
|
-
|
50
|
-
{% comment %} Detect prod mode
|
51
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
52
|
-
{% assign production = false %}
|
53
|
-
{% if environment == 'prod' or environment == 'production' %}
|
54
|
-
{% assign production = true %}
|
55
|
-
{% endif %}
|
56
|
-
|
57
|
-
/*
|
58
|
-
# -----------------------------------------------------------------------------
|
59
|
-
# ~/assets/themes/j1/adapter/js/nbinteract.js
|
60
|
-
# J1 Adapter for j1-nbinteract
|
61
|
-
#
|
62
|
-
# Product/Info:
|
63
|
-
# https://jekyll.one
|
64
|
-
#
|
65
|
-
# Copyright (C) 2023 Juergen Adams
|
66
|
-
#
|
67
|
-
# J1 Theme is licensed under the MIT License.
|
68
|
-
# For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
|
69
|
-
# -----------------------------------------------------------------------------
|
70
|
-
# Adapter generated: {{site.time}}
|
71
|
-
# -----------------------------------------------------------------------------
|
72
|
-
*/
|
73
|
-
|
74
|
-
// -----------------------------------------------------------------------------
|
75
|
-
// ESLint shimming
|
76
|
-
// -----------------------------------------------------------------------------
|
77
|
-
/* eslint indent: "off" */
|
78
|
-
// -----------------------------------------------------------------------------
|
79
|
-
'use strict';
|
80
|
-
j1.adapter.nbinteract = (function (j1, window) {
|
81
|
-
|
82
|
-
{% comment %} Set global variables
|
83
|
-
------------------------------------------------------------------------------ {% endcomment %}
|
84
|
-
var environment = '{{environment}}';
|
85
|
-
var message = {};
|
86
|
-
var flags = {
|
87
|
-
checkURL: false
|
88
|
-
};
|
89
|
-
var spinnerOpts = { // (default) options for a spinner
|
90
|
-
lines: 13, // number of lines to draw
|
91
|
-
length: 38, // length of each line
|
92
|
-
width: 17, // line thickness
|
93
|
-
radius: 45, // radius of the inner circle
|
94
|
-
scale: 2, // scales overall size of the spinner
|
95
|
-
corners: 1, // corner roundness (0..1)
|
96
|
-
speed: 0.5, // rounds per second
|
97
|
-
rotate: 0, // rotation offset
|
98
|
-
animation: 'spinner-line-fade-more', // CSS animation name for the lines: spinner-line-fade-quick | spinner-line-shrink | spinner-line-fade-more
|
99
|
-
direction: 1, // 1: clockwise, -1: counterclockwise
|
100
|
-
color: '#424242', // CSS color or array of colors: orange (EF6C00) | blue (1565C0) | gray (424242)
|
101
|
-
fadeColor: 'transparent', // CSS color or array of colors
|
102
|
-
top: '70%', // top position relative to parent
|
103
|
-
left: '50%', // left position relative to parent
|
104
|
-
shadow: '0 0 1px transparent', // box-shadow for the lines
|
105
|
-
zIndex: 2000000000, // z-index (defaults to 2e9)
|
106
|
-
className: 'spinner', // CSS class assined to the spinner
|
107
|
-
position: 'fixed', // element positioning: absolute|fixed
|
108
|
-
};
|
109
|
-
|
110
|
-
var nbActions = {
|
111
|
-
"resetLocalStorage": true
|
112
|
-
};
|
113
|
-
|
114
|
-
var spinnerStarted = false; // switch to indicate a started spinner
|
115
|
-
var nbiContentModalInfoID = 'nbiModalInfoBody'; // ID of the content (messages) for the INFO modal
|
116
|
-
var nbiContentModalSuccessID = 'nbiModalSuccessBody'; // ID of the content (messages) for the SUCCESS modal
|
117
|
-
var nbiContentModalErrorID = 'nbiModalErrorBody'; // ID of the content (messages) for the SUCCESS modal
|
118
|
-
var nbiModalTopInfo = '#' + 'nbiModalTopInfo'; // ID of the TopInfo modal
|
119
|
-
var nbiModalTRInfo = '#' + 'nbiModalTRInfo'; // ID of the TRInfo modal
|
120
|
-
var nbiModalSuccessID = '#' + 'nbiModalTRSuccess'; // ID of the SUCCESS modal
|
121
|
-
var nbiModalErrorID = '#' + 'nbiModalTLDanger'; // ID of the ERROR modal
|
122
|
-
var nbinteract_prepared = false; // switch to indicate if ???
|
123
|
-
var nbiModalSuccessMessagesID = 'nbiModalSuccessMessages'; // UL contalner SUCCESS messages
|
124
|
-
var nbiModalErrorMessagesID = 'nbiModalErrorMessages'; // UL contalner ERROR messages
|
125
|
-
var nbiCellsRendered = false; // flag indicates if all widgets in page are rendered
|
126
|
-
var nbiShowMessages; // switch to show NBI messages
|
127
|
-
var nbiIndicateNbiActivity; // switch to show a spinner while NBI is being initialized
|
128
|
-
var nbiModalAutoClose; // switch to auto-close nbi message modals
|
129
|
-
var nbiModalAutoCloseDelay; // delay auto-close nbi message modals
|
130
|
-
var nbiInitTimeout; // delay indicate NBI failed
|
131
|
-
var nbiInitMathJax; // Load and run MathJax at runtime
|
132
|
-
var textbooks; // ALL notebokks enabled
|
133
|
-
var textbook; // current textbook (processed)
|
134
|
-
var target; // target container for the (activity) spinner
|
135
|
-
var spinner; // the (activity) spinner
|
136
|
-
var nbiModal;
|
137
|
-
var _this;
|
138
|
-
var interact;
|
139
|
-
var logger;
|
140
|
-
var coreLogger;
|
141
|
-
var logText;
|
142
|
-
var widgetCells;
|
143
|
-
var widgetCellsRendered;
|
144
|
-
var nbiNotebookReady;
|
145
|
-
var nbinteractDefaults;
|
146
|
-
var nbinteractSettings;
|
147
|
-
var nbinteractOptions;
|
148
|
-
var Events;
|
149
|
-
|
150
|
-
// ---------------------------------------------------------------------------
|
151
|
-
// Helper functions
|
152
|
-
// ---------------------------------------------------------------------------
|
153
|
-
|
154
|
-
// ---------------------------------------------------------------------------
|
155
|
-
// Main object
|
156
|
-
// ---------------------------------------------------------------------------
|
157
|
-
return {
|
158
|
-
|
159
|
-
// -------------------------------------------------------------------------
|
160
|
-
// Initializer
|
161
|
-
// -------------------------------------------------------------------------
|
162
|
-
init: function (options) {
|
163
|
-
|
164
|
-
// -----------------------------------------------------------------------
|
165
|
-
// global event handler
|
166
|
-
// -----------------------------------------------------------------------
|
167
|
-
Events = {
|
168
|
-
documentReady: function (onDocumentReady) {
|
169
|
-
if (document.readyState !== 'loading') {
|
170
|
-
onDocumentReady();
|
171
|
-
} else {
|
172
|
-
document.addEventListener('DOMContentLoaded', onDocumentReady);
|
173
|
-
}
|
174
|
-
}
|
175
|
-
};
|
176
|
-
|
177
|
-
// -----------------------------------------------------------------------
|
178
|
-
// Default module settings
|
179
|
-
// -----------------------------------------------------------------------
|
180
|
-
var settings = $.extend ({
|
181
|
-
module_name: 'j1.adapter.nbinteract',
|
182
|
-
generated: '{{site.time}}'
|
183
|
-
}, options);
|
184
|
-
|
185
|
-
// -----------------------------------------------------------------------
|
186
|
-
// Global variable settings
|
187
|
-
// -----------------------------------------------------------------------
|
188
|
-
_this = j1.adapter.nbinteract;
|
189
|
-
logger = log4javascript.getLogger('j1.adapter.nbinteract');
|
190
|
-
|
191
|
-
// Load module DEFAULTS|CONFIG
|
192
|
-
nbinteractDefaults = $.extend({}, {{nbinteract_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
|
193
|
-
nbinteractSettings = $.extend({}, {{nbinteract_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
|
194
|
-
nbinteractOptions = $.extend({}, nbinteractDefaults, nbinteractSettings);
|
195
|
-
|
196
|
-
nbiModalAutoClose = nbinteractOptions.nbi_messages_auto_close;
|
197
|
-
nbiModalAutoCloseDelay = nbinteractOptions.nbi_messages_auto_close_delay;
|
198
|
-
nbiInitTimeout = nbinteractOptions.nbi_init_timeout;
|
199
|
-
nbiShowMessages = nbinteractOptions.show_nbi_messages;
|
200
|
-
nbiIndicateNbiActivity = nbinteractOptions.indicate_nbi_activity;
|
201
|
-
nbiInitMathJax = nbinteractOptions.nbi_init_mathjax;
|
202
|
-
nbiNotebookReady = nbinteractOptions.notebook_ready;
|
203
|
-
|
204
|
-
// -----------------------------------------------------------------------
|
205
|
-
// load|configure Mathjax
|
206
|
-
// -----------------------------------------------------------------------
|
207
|
-
if (nbiInitMathJax) {
|
208
|
-
_this.initMathJax();
|
209
|
-
}
|
210
|
-
// -----------------------------------------------------------------------
|
211
|
-
// load|configure NBI dialog (modal)
|
212
|
-
// -----------------------------------------------------------------------
|
213
|
-
_this.loadDialog(nbinteractOptions);
|
214
|
-
|
215
|
-
// -----------------------------------------------------------------------
|
216
|
-
// load all modals (HTML portion) used by NBI
|
217
|
-
// -----------------------------------------------------------------------
|
218
|
-
_this.loadNbiModals();
|
219
|
-
|
220
|
-
// -----------------------------------------------------------------------
|
221
|
-
// load all textbooks (HTML portion) configured|enabled
|
222
|
-
// -----------------------------------------------------------------------
|
223
|
-
_this.loadNbiTextbooks(nbinteractOptions);
|
224
|
-
|
225
|
-
// -----------------------------------------------------------------------
|
226
|
-
// run a spinner to indicate activity of 'nbInteract' if enabled
|
227
|
-
// -----------------------------------------------------------------------
|
228
|
-
$(document).ready(function() {
|
229
|
-
if (nbiIndicateNbiActivity && !spinnerStarted) {
|
230
|
-
spinnerStarted = true;
|
231
|
-
target = document.getElementById('content');
|
232
|
-
spinner = new Spinner(spinnerOpts).spin(target);
|
233
|
-
}
|
234
|
-
|
235
|
-
});
|
236
|
-
|
237
|
-
// -----------------------------------------------------------------------
|
238
|
-
// register callbacks (actions) for all modals used
|
239
|
-
// -----------------------------------------------------------------------
|
240
|
-
if (nbiShowMessages) {
|
241
|
-
_this.registerNbiModalsCB();
|
242
|
-
}
|
243
|
-
|
244
|
-
// -----------------------------------------------------------------------
|
245
|
-
// interactNbiTextbooks()
|
246
|
-
// connect to the configured BinderHub instance to create a
|
247
|
-
// Jupyter kernel if required
|
248
|
-
// -----------------------------------------------------------------------
|
249
|
-
_this.interactNbiTextbooks(nbinteractOptions);
|
250
|
-
|
251
|
-
// toggle hide|show the FAB button, if to wait on 'last_widget' rendered
|
252
|
-
//
|
253
|
-
if (nbiNotebookReady == 'last_widget') {
|
254
|
-
var dependencies_met_page_rendered = setInterval(function() {
|
255
|
-
if (nbiCellsRendered) {
|
256
|
-
$('.fab-btn').show();
|
257
|
-
clearInterval(dependencies_met_page_rendered);
|
258
|
-
} else {
|
259
|
-
$('.fab-btn').hide();
|
260
|
-
}
|
261
|
-
}, 10); // END interval dependencies_met_page_rendered
|
262
|
-
}
|
263
|
-
|
264
|
-
}, // END init
|
265
|
-
|
266
|
-
// -------------------------------------------------------------------------
|
267
|
-
// initMathJax()
|
268
|
-
// load|configure MathJax at runtime
|
269
|
-
// See: https://docs.mathjax.org/en/v2.7-latest/options/preprocessors/tex2jax.html
|
270
|
-
// -------------------------------------------------------------------------
|
271
|
-
initMathJax: function () {
|
272
|
-
var scriptMathjax = document.createElement('script');
|
273
|
-
var scriptMathjaxConfig = document.createElement('script');
|
274
|
-
|
275
|
-
// Loading MathJax from a CDN
|
276
|
-
//
|
277
|
-
scriptMathjax.setAttribute('src','//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML');
|
278
|
-
|
279
|
-
// create/load MathJax configuration settings
|
280
|
-
//
|
281
|
-
scriptMathjaxConfig.setAttribute('type','text/x-mathjax-config');
|
282
|
-
scriptMathjaxConfig.innerHTML = `
|
283
|
-
MathJax.Hub.Config({
|
284
|
-
tex2jax: {
|
285
|
-
// inlineMath, displayMath
|
286
|
-
// ---------------------------------------------------------------
|
287
|
-
// TeX 'delimiters'. By default, the tex2jax preprocessor
|
288
|
-
// definesthe LaTeX math delimiters, which are \(...\) for
|
289
|
-
// 'in-line' math, and \[...\] for 'displayed' equations.
|
290
|
-
// It also defines the TeX delimiters $$...$$ for displayed
|
291
|
-
// equations, but it does not define $...$ as in-line math
|
292
|
-
// delimiters. That is because dollar signs appear too often
|
293
|
-
// in non-mathematical settings, which could cause some text
|
294
|
-
// to be treated as mathematics unexpectedly. For example,
|
295
|
-
// with single-dollar delimiters, 'the cost is $2.50' for the
|
296
|
-
// first one, and '$2.00' for each additional one would cause
|
297
|
-
// the phrase '2.50 for the first one' to be treated as
|
298
|
-
// mathematics since it falls between dollar signs. For this
|
299
|
-
// reason, if you want to use single-dollars for in-line math
|
300
|
-
// mode, you must enable that explicitly.
|
301
|
-
//
|
302
|
-
inlineMath: [ ['$','$'], ["\\(","\\) "] ],
|
303
|
-
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
304
|
-
|
305
|
-
// processEscapes
|
306
|
-
// ---------------------------------------------------------------
|
307
|
-
// When 'processEscapes' set to true, you may use \$ to
|
308
|
-
// representa literal dollar sign, rather than using it as
|
309
|
-
// a math delimiter. When false, \$ will not be altered,
|
310
|
-
// and the dollar sign may be considered part of a math
|
311
|
-
// delimiter. Typically this is set to 'true' if you enable
|
312
|
-
// the $ ... $ in-line delimiters, so you can type \$ and
|
313
|
-
// tex2jax will convert it to a regular dollar sign in the
|
314
|
-
// rendered document.
|
315
|
-
//
|
316
|
-
processEscapes: true,
|
317
|
-
|
318
|
-
// processEnvironments
|
319
|
-
// ---------------------------------------------------------------
|
320
|
-
// When 'processEnvironments' true, tex2jax looks not only
|
321
|
-
// for the in-line and display math delimiters, but also for
|
322
|
-
// LaTeX environments (\begin{something}...\end{something})
|
323
|
-
// and marks them forprocessing by MathJax. When false, LaTeX
|
324
|
-
// environments will not be processed outside of math mode.
|
325
|
-
//
|
326
|
-
processEnvironments: false,
|
327
|
-
|
328
|
-
// skipTags
|
329
|
-
// ---------------------------------------------------------------
|
330
|
-
// The array 'skipTags' lists the names of the tags whose
|
331
|
-
// contents should NOT be processed by tex2jax.
|
332
|
-
//
|
333
|
-
skipTags: ["script","noscript","style","textarea","pre","code"],
|
334
|
-
|
335
|
-
// processClass, ignoreClass
|
336
|
-
// ---------------------------------------------------------------
|
337
|
-
// These are the (CSS) classes name used to mark elements whose
|
338
|
-
// contents should or should NOT be processed by tex2jax.
|
339
|
-
//
|
340
|
-
processClass: "mathjax",
|
341
|
-
ignoreClass: "nomathjax"
|
342
|
-
},
|
343
|
-
|
344
|
-
// displayAlign
|
345
|
-
// -----------------------------------------------------------------
|
346
|
-
// Align (displayMath) equations left-sided in code and all
|
347
|
-
// markdown cells.
|
348
|
-
//
|
349
|
-
displayAlign: 'left',
|
350
|
-
|
351
|
-
// preview
|
352
|
-
// -----------------------------------------------------------------
|
353
|
-
// Controls whether tex2jax inserts 'MathJax_Preview' spans to
|
354
|
-
// make a preview available, and what preview to use, when it
|
355
|
-
// locates in-line or display mathematics in the page. The default
|
356
|
-
// is 'TeX', which means use the TeX code as the preview (which
|
357
|
-
// will be visible until it is processed by MathJax). Set to
|
358
|
-
// 'none' to prevent previews from being inserted.
|
359
|
-
//
|
360
|
-
preview: "TeX",
|
361
|
-
|
362
|
-
// CommonHTML, HTML-CSS, and SVG output processors
|
363
|
-
// -----------------------------------------------------------------
|
364
|
-
// The CommonHTML, HTML-CSS, and SVG output processors implement
|
365
|
-
// most of the MathML3 automatic line-breaking specification.
|
366
|
-
// Since line-breaking takes extra processing and so can slow
|
367
|
-
// down the mathematical output, it is off by default
|
368
|
-
//
|
369
|
-
CommonHTML: { linebreaks: { automatic: false } },
|
370
|
-
"HTML-CSS": { linebreaks: { automatic: false } },
|
371
|
-
SVG: { linebreaks: { automatic: false } }
|
372
|
-
});
|
373
|
-
|
374
|
-
// Use Jax renderer 'CommonHTML' for default
|
375
|
-
//
|
376
|
-
MathJax.Hub.Register.StartupHook("End Jax",function () {
|
377
|
-
var BROWSER = MathJax.Hub.Browser;
|
378
|
-
var jax = "CommonHTML";
|
379
|
-
if (BROWSER.hasMathPlayer) jax = "NativeMML";
|
380
|
-
return MathJax.Hub.setRenderer(jax);
|
381
|
-
});
|
382
|
-
|
383
|
-
// Register a message MessageHook
|
384
|
-
// ---------------------------------------------------------------------
|
385
|
-
// MathJax.Hub.Register.MessageHook("New Math", function (message) {
|
386
|
-
// var script = MathJax.Hub.getJaxFor(message[1]).SourceElement();
|
387
|
-
// var j1_message = {};
|
388
|
-
// j1_message.type = 'command';
|
389
|
-
// j1_message.action = 'mathjax';
|
390
|
-
// j1_message.text = message[1];
|
391
|
-
// this.j1.sendMessage('MathJax.Hub.MessageHook', 'j1.adapter.nbinteract', j1_message);
|
392
|
-
// // console.error('nbinteract, Hub - New Math: ' + message[1]);
|
393
|
-
// });
|
394
|
-
|
395
|
-
// ---------------------------------------------------------------------
|
396
|
-
// END config
|
397
|
-
`;
|
398
|
-
|
399
|
-
// add Mathjax resources
|
400
|
-
//
|
401
|
-
document.head.appendChild(scriptMathjax);
|
402
|
-
document.head.appendChild(scriptMathjaxConfig);
|
403
|
-
|
404
|
-
return;
|
405
|
-
}, // END intMathjax
|
406
|
-
|
407
|
-
// -------------------------------------------------------------------------
|
408
|
-
// loadNbiTextbooks()
|
409
|
-
// load the HTML portion for all textbooks configured (enabled)
|
410
|
-
// -------------------------------------------------------------------------
|
411
|
-
loadNbiTextbooks: function (settings) {
|
412
|
-
var textbooks = settings.textbooks;
|
413
|
-
|
414
|
-
textbooks.forEach (function (elm) {
|
415
|
-
if (elm.textbook.enabled) {
|
416
|
-
textbook = elm.textbook;
|
417
|
-
|
418
|
-
var textbook_id = textbook.id;
|
419
|
-
var $selector = $('#' + textbook_id);
|
420
|
-
|
421
|
-
// load the HTML portion for the textbook
|
422
|
-
//
|
423
|
-
if ($selector.length) {
|
424
|
-
_this.loadTextbookHTML ({
|
425
|
-
xhr_container_id: textbook.id,
|
426
|
-
xhr_data: textbook.xhr_data,
|
427
|
-
xhr_data_path: textbook.xhr_data_path,
|
428
|
-
use_mathjax: textbook.use_mathjax,
|
429
|
-
translate_mathjax: textbook.translate_mathjax,
|
430
|
-
altair_cleanups: textbook.altair_cleanups,
|
431
|
-
buttonStyles: settings.button_styles,
|
432
|
-
});
|
433
|
-
}
|
434
|
-
}
|
435
|
-
});
|
436
|
-
},
|
437
|
-
|
438
|
-
// -------------------------------------------------------------------------
|
439
|
-
// interactNbiTextbooks()
|
440
|
-
// connect to the configured BinderHub instance to create a
|
441
|
-
// Jupyter kernel if required. A BinderHub instance in created
|
442
|
-
// on a per textbook basis but trigeered only done once,
|
443
|
-
// controlled by nbinteract_prepared.
|
444
|
-
// -------------------------------------------------------------------------
|
445
|
-
interactNbiTextbooks: function (options) {
|
446
|
-
var state;
|
447
|
-
// collect (preferred) Binder references
|
448
|
-
//
|
449
|
-
var preferredBaseUrl = options.baseUrls.preferred;
|
450
|
-
var myBaseUrl = options.baseUrls[preferredBaseUrl];
|
451
|
-
var preferredProvider = options.providers.preferred;
|
452
|
-
var myProviderId = options.providers[preferredProvider].provider_id;
|
453
|
-
var myProviderSpec = options.providers[preferredProvider].provider_spec;
|
454
|
-
|
455
|
-
// initialize state flag
|
456
|
-
_this.setState('started');
|
457
|
-
logger.debug('\n' + 'state: ' + _this.getState());
|
458
|
-
|
459
|
-
// check if the Binder Service is available
|
460
|
-
//
|
461
|
-
_this.checkURL(myBaseUrl, flags);
|
462
|
-
|
463
|
-
var log_text = '\n' + 'nbinteract is being initialized';
|
464
|
-
logger.info(log_text);
|
465
|
-
|
466
|
-
var dependencies_met_binder_responsive = setInterval(function() {
|
467
|
-
state = _this.getState();
|
468
|
-
if (state == 'finished_checks') {
|
469
|
-
clearInterval(dependencies_met_binder_responsive);
|
470
|
-
if (flags.checkURL) {
|
471
|
-
{% comment %} initialize nbinteract per textbook
|
472
|
-
{% assign textbook_spec = item.textbook.spec %}
|
473
|
-
{% assign textbook_baseUrl = item.textbook.baseUrl %}
|
474
|
-
{% assign textbook_provider = item.textbook.provider %}
|
475
|
-
-------------------------------------------------------------------------- {% endcomment %}
|
476
|
-
{% for item in nbinteract_options.textbooks %} {% if item.textbook.enabled %}
|
477
|
-
{% assign textbook_id = item.textbook.id %}
|
478
|
-
|
479
|
-
if ($('#{{textbook_id}}').length) {
|
480
|
-
var dependencies_met_nb_loaded = setInterval(function() {
|
481
|
-
if ($('#{{textbook_id}}').attr('data-nb-textbook') == 'loaded') {
|
482
|
-
|
483
|
-
var nbiButtonsFound = document.querySelectorAll('.js-nbinteract-widget').length
|
484
|
-
if (nbiIndicateNbiActivity && nbiButtonsFound == 1) {
|
485
|
-
var log_text = '\n' + 'localized textbook found, skip NBI initialization for: {{textbook_id}}';
|
486
|
-
logger.warn(log_text);
|
487
|
-
spinner.stop();
|
488
|
-
}
|
489
|
-
|
490
|
-
if(!nbinteract_prepared && nbiButtonsFound > 1) {
|
491
|
-
logText = '\n' + 'jupyter kernel is being generated ...';
|
492
|
-
logger.info(logText);
|
493
|
-
|
494
|
-
// create nbInteract (core) instance
|
495
|
-
//
|
496
|
-
coreLogger = log4javascript.getLogger('j1.nbinteract-core');
|
497
|
-
interact = new NbInteract({
|
498
|
-
baseUrl: myBaseUrl,
|
499
|
-
provider: myProviderId,
|
500
|
-
spec: myProviderSpec,
|
501
|
-
logger: coreLogger,
|
502
|
-
j1API: j1,
|
503
|
-
});
|
504
|
-
|
505
|
-
// generate a jupyter kernel via BinderHub
|
506
|
-
interact.prepare();
|
507
|
-
nbinteract_prepared = true;
|
508
|
-
|
509
|
-
// issue an error if the NBI (init) button never removed by
|
510
|
-
// nbInteract-core (util or manager)
|
511
|
-
// TODO: The 'timeout' condition should be replaced
|
512
|
-
// state-based triggered from nbinteract-core.
|
513
|
-
//
|
514
|
-
window.setTimeout(function() {
|
515
|
-
var nbiButtonState = _this.getNbiButtonState();
|
516
|
-
if (nbiButtonState) {
|
517
|
-
// button NOT removed
|
518
|
-
logger.warn('NBI initialialization failed on textbook: {{textbook_id}}');
|
519
|
-
spinner.stop();
|
520
|
-
// hide the info modal
|
521
|
-
$(nbiModalSuccessID).modal('hide');
|
522
|
-
|
523
|
-
// show the error modal
|
524
|
-
$(nbiModalSuccessID).on('hidden.bs.modal', function () {
|
525
|
-
if ($(nbiModalErrorID).is(':hidden')) {
|
526
|
-
var messageErrorUL = document.getElementById(nbiModalErrorMessagesID);
|
527
|
-
_this.appendModalMessage(messageErrorUL, 'NBI initialialization failed for textbook: {{textbook_id}}')
|
528
|
-
$(nbiModalErrorID).modal('show');
|
529
|
-
|
530
|
-
// auto-close the error modal
|
531
|
-
if (nbiModalAutoClose) {
|
532
|
-
window.setTimeout(function() {
|
533
|
-
$(nbiModalErrorID).modal('hide');
|
534
|
-
}, nbiModalAutoCloseDelay);
|
535
|
-
}
|
536
|
-
}
|
537
|
-
});
|
538
|
-
} else {
|
539
|
-
// button removed
|
540
|
-
logger.info('NBI initialized successfully.');
|
541
|
-
}
|
542
|
-
}, nbiInitTimeout);
|
543
|
-
|
544
|
-
}
|
545
|
-
|
546
|
-
clearInterval(dependencies_met_nb_loaded);
|
547
|
-
} // END dependencies_met_nb_loaded
|
548
|
-
}, 10);
|
549
|
-
return;
|
550
|
-
}
|
551
|
-
// END textbook_id: {{ textbook_id }}
|
552
|
-
{% endif %} {% endfor %}
|
553
|
-
} else {
|
554
|
-
spinner.stop();
|
555
|
-
var modaBodyText = `
|
556
|
-
The <i>Binder Service</i> is currently not available or is overloaded.
|
557
|
-
All interactive components on the page are <b>not</b> available.
|
558
|
-
You can reload the page or re-open later again.
|
559
|
-
`;
|
560
|
-
logger.error('\n', 'Binder access: failed');
|
561
|
-
if ($(nbiModalTRInfo).is(':hidden')) {
|
562
|
-
document.getElementById('nbiModalTRInfoBody').innerHTML = modaBodyText;
|
563
|
-
$(nbiModalTRInfo).modal('show');
|
564
|
-
}
|
565
|
-
clearInterval(dependencies_met_binder_responsive);
|
566
|
-
}
|
567
|
-
|
568
|
-
}
|
569
|
-
}, 10); // END dependencies_met_binder_responsive
|
570
|
-
|
571
|
-
},
|
572
|
-
|
573
|
-
// -------------------------------------------------------------------------
|
574
|
-
// loadTextbookHTML()
|
575
|
-
// Load HTML data asychronously using XHR|jQuery on an element
|
576
|
-
// (e.g. <div>) specified by xhr_container_id, xhr_data_path
|
577
|
-
// -------------------------------------------------------------------------
|
578
|
-
loadTextbookHTML: function (options) {
|
579
|
-
var html_data_path = options.xhr_data_path + '/' + options.xhr_data;
|
580
|
-
var id = options.xhr_container_id;
|
581
|
-
var mathjaxEnabled = options.use_mathjax ? options.use_mathjax : false;
|
582
|
-
var mathjaxTranslate = options.translate_mathjax ? options.translate_mathjax : false;
|
583
|
-
var cleanupAltair = options.altair_cleanups ? options.altair_cleanups : false;
|
584
|
-
var isPageRendered = false;
|
585
|
-
var $selector = $('#' + id);
|
586
|
-
var allID;
|
587
|
-
var allMathJaxSpan;
|
588
|
-
var allMathJaxElement;
|
589
|
-
var logText;
|
590
|
-
|
591
|
-
var cb_load_closure = function(id, mathjaxFlag) {
|
592
|
-
return function (responseTxt, statusTxt, xhr) {
|
593
|
-
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
594
|
-
|
595
|
-
if (statusTxt === 'success') {
|
596
|
-
j1.setXhrDataState(id, statusTxt);
|
597
|
-
j1.setXhrDomState(id, 'pending');
|
598
|
-
|
599
|
-
// set data attribute to indicate HTML data loaded
|
600
|
-
//
|
601
|
-
$selector.attr('data-nb-textbook', 'loaded');
|
602
|
-
|
603
|
-
// run HTML cleanups
|
604
|
-
//
|
605
|
-
$selector.find('button').replaceWith( function() {
|
606
|
-
return '<button class="' + options.buttonStyles + ' js-nbinteract-widget"> Loading widgets ...</button>';
|
607
|
-
});
|
608
|
-
|
609
|
-
// enable MathJax for the (current) J1 Textbook container
|
610
|
-
// processed if enabled for the (containing) textbook
|
611
|
-
//
|
612
|
-
var currentTextbook = document.getElementById(id);
|
613
|
-
if (mathjaxFlag) {
|
614
|
-
currentTextbook.classList.add('mathjax');
|
615
|
-
} else {
|
616
|
-
currentTextbook.classList.add('nomathjax');
|
617
|
-
}
|
618
|
-
|
619
|
-
// ------------------------------------------------------------------
|
620
|
-
// see: https://www.codingexercises.com/replace-all-instances-of-css-class-in-vanilla-js
|
621
|
-
// see: https://wiki.thishtml.org/wiki/JavaScript/Operatoren/Rest-_oder_Spread-Operator
|
622
|
-
// ------------------------------------------------------------------
|
623
|
-
|
624
|
-
// disable (Google) translation for all HTML 'output_wrapper' elements
|
625
|
-
//
|
626
|
-
var output_wrapper = document.getElementsByClassName('output_wrapper');
|
627
|
-
[...output_wrapper].forEach(function(x) {
|
628
|
-
if (!x.className.includes('notranslate')) {
|
629
|
-
x.className += ' notranslate';
|
630
|
-
}
|
631
|
-
});
|
632
|
-
|
633
|
-
// make all output_wrapper cells "responsive" (especially for tables)
|
634
|
-
//
|
635
|
-
var output_wrapper = document.getElementsByClassName('output_wrapper');
|
636
|
-
[...output_wrapper].forEach(function(x) {
|
637
|
-
if (!x.className.includes('cell-responsive')) {
|
638
|
-
x.className += ' cell-responsive';
|
639
|
-
}
|
640
|
-
});
|
641
|
-
|
642
|
-
// cleanups for Altair for all HTML 'output_wrapper' elements
|
643
|
-
//
|
644
|
-
if (cleanupAltair) {
|
645
|
-
|
646
|
-
var reUnderscores = new RegExp(/_/, 'g');
|
647
|
-
var reMultipleSpaces = new RegExp(/\s+/, 'g');
|
648
|
-
var reMultipleSpacesStart = new RegExp(/^\s+/, 'g');
|
649
|
-
var reMultipleSpacesEnd = new RegExp(/\s+$/, 'g');
|
650
|
-
var reSkipWords = new RegExp(/vgsid|bla/, 'g');
|
651
|
-
var reDuplicateWords = new RegExp(/(\b\S.+\b)(?=.*\1)/, 'g');
|
652
|
-
var content;
|
653
|
-
var newContent;
|
654
|
-
var newContentWritten = false;
|
655
|
-
var isWidget;
|
656
|
-
var outputDiv;
|
657
|
-
var childNodes;
|
658
|
-
var clientHeight;
|
659
|
-
var lastWidget = false;
|
660
|
-
|
661
|
-
// check/wait for ALL Altair widgets in the page are rendered (by JS)
|
662
|
-
// if rendering finished, flag 'isPageRendered' is set to 'true'
|
663
|
-
//
|
664
|
-
allID = document.querySelectorAll('*[id^="altair-viz"]');
|
665
|
-
for (var l = 0; l < allID.length; l++) {
|
666
|
-
outputDiv = document.getElementById(allID[l].id);
|
667
|
-
var dependencies_met_page_rendered = setInterval(function() {
|
668
|
-
lastWidget = (l == allID.length) ? true : false;
|
669
|
-
if (outputDiv.clientHeight && lastWidget && !isPageRendered) {
|
670
|
-
isPageRendered = true;
|
671
|
-
logger.debug('\n' + 'last widget rendered ' + outputDiv.id + ' : ' + outputDiv.clientHeight);
|
672
|
-
clearInterval(dependencies_met_page_rendered);
|
673
|
-
}
|
674
|
-
}, 10); // END interval
|
675
|
-
} // END for all ID
|
676
|
-
|
677
|
-
var dependencies_met_widgets_updated = setInterval(function() {
|
678
|
-
if (isPageRendered) {
|
679
|
-
for (var item of allID) {
|
680
|
-
outputDiv = document.getElementById(item.id);
|
681
|
-
logger.debug('\n' + 'processing widget on id: ' + item.id);
|
682
|
-
|
683
|
-
childNodes = outputDiv.getElementsByClassName('vega-bind-name');
|
684
|
-
if (childNodes.length) {
|
685
|
-
for (var i = 0; i < childNodes.length; i++) {
|
686
|
-
content = childNodes[i].innerHTML;
|
687
|
-
newContent = content.replace(reUnderscores, ' ');
|
688
|
-
newContent = newContent.replace(reDuplicateWords, '');
|
689
|
-
newContent = newContent.replace(reSkipWords, '');
|
690
|
-
newContent = newContent.replace(reMultipleSpaces, ' ');
|
691
|
-
newContent = newContent.replace(reMultipleSpacesStart, '');
|
692
|
-
newContent = newContent.replace(reMultipleSpacesEnd, '');
|
693
|
-
childNodes[i].innerHTML = newContent;
|
694
|
-
newContentWritten = true;
|
695
|
-
} // END for
|
696
|
-
} // END if childNodes.length
|
697
|
-
} // END for
|
698
|
-
logger.debug('\n' + 'all widgets updated');
|
699
|
-
|
700
|
-
clearInterval(dependencies_met_widgets_updated);
|
701
|
-
}
|
702
|
-
}, 10); // END interval
|
703
|
-
} // END if cleanup Altair
|
704
|
-
|
705
|
-
// disable MathJax for all HTML 'output_wrapper' elements
|
706
|
-
//
|
707
|
-
[...output_wrapper].forEach(function(x) {
|
708
|
-
if (x.className.includes('nomathjax')) {
|
709
|
-
x.className += ' nomathjax';
|
710
|
-
}
|
711
|
-
});
|
712
|
-
|
713
|
-
// make all 'image' elements responsive (BS@5)
|
714
|
-
//
|
715
|
-
var images = document.getElementsByTagName('img');;
|
716
|
-
[...images].forEach(function(x) {
|
717
|
-
if (!x.className.includes('img-fluid')) {
|
718
|
-
x.className += ' img-fluid';
|
719
|
-
}
|
720
|
-
});
|
721
|
-
|
722
|
-
// disable for now
|
723
|
-
//
|
724
|
-
mathjaxTranslate = true
|
725
|
-
|
726
|
-
// disable translation on MathJax containers
|
727
|
-
// -----------------------------------------------------------------
|
728
|
-
if (mathjaxEnabled && !mathjaxTranslate) {
|
729
|
-
|
730
|
-
var dependencies_met_mathjax_available = setInterval(function() {
|
731
|
-
// document.getElementsByClassName('MJXc-display');
|
732
|
-
// document.querySelectorAll('*[id^="MathJax-Element"]');
|
733
|
-
// allMathJaxSpan = document.querySelectorAll('*[id^="MathJax-Element"]');
|
734
|
-
// allMathJaxSpan = document.querySelectorAll('*[id^="MathJax-Element-"]');
|
735
|
-
// allMathJaxSpan = document.getElementsByClassName('mjx-chtml');
|
736
|
-
allMathJaxSpan = document.querySelectorAll('*[id$="-Frame"]');
|
737
|
-
|
738
|
-
if (allMathJaxSpan.length) {
|
739
|
-
// var lastElm = document.getElementById(allMathJaxSpan[allMathJaxSpan.length-1].id);
|
740
|
-
var dependencies_met_mathjax_rendered = setInterval(function() {
|
741
|
-
// var isProcessing = lastElm.classList.contains('MathJax_Processing');
|
742
|
-
var mj_state = j1.adapter.nbinteract.getState()
|
743
|
-
if (mj_state == 'mathjax_finished') {
|
744
|
-
allMathJaxSpan = document.querySelectorAll('*[id$="-Frame"]');
|
745
|
-
for (var l = 0; l < allMathJaxSpan.length; l++) {
|
746
|
-
// outputDiv = document.getElementById(allMathJaxSpan[l].id);
|
747
|
-
outputDiv = allMathJaxSpan[l];
|
748
|
-
logger.error('\n' + 'element: ' + outputDiv.id );
|
749
|
-
// outputDiv.classList.remove('MJXc-processing');
|
750
|
-
outputDiv.classList.add('notranslate');
|
751
|
-
}
|
752
|
-
clearInterval(dependencies_met_mathjax_rendered);
|
753
|
-
}
|
754
|
-
}, 10); // END interval dependencies_met_mathjax_rendered
|
755
|
-
clearInterval(dependencies_met_mathjax_available);
|
756
|
-
};
|
757
|
-
}, 10); // END interval dependencies_met_mathjax_available
|
758
|
-
|
759
|
-
} // END // disable translation on MathJax
|
760
|
-
|
761
|
-
// rewrite headlines in textbook HTML, add an id to be used by toccer
|
762
|
-
//
|
763
|
-
$selector.find('h1').replaceWith( function() {
|
764
|
-
// return '<h1 id="' + $(this)[0].id.replace(/\$/g, '') + '">' + $(this).text().slice(0,-1) + '</h1>';
|
765
|
-
return '<h1 id="' + $(this)[0].id + '">' + $(this).text().slice(0,-1) + '</h1>';
|
766
|
-
});
|
767
|
-
|
768
|
-
$selector.find('h2').replaceWith( function() {
|
769
|
-
return '<h2 id="' + $(this)[0].id + '">' + $(this).text().slice(0,-1) + '</h2>';
|
770
|
-
});
|
771
|
-
|
772
|
-
$selector.find('h3').replaceWith( function() {
|
773
|
-
return '<h3 id="' + $(this)[0].id + '">' + $(this).text().slice(0,-1) + '</h3>';
|
774
|
-
});
|
775
|
-
|
776
|
-
$selector.find('h4').replaceWith( function() {
|
777
|
-
return '<h4 id="' + $(this)[0].id + '">' + $(this).text().slice(0,-1) + '</h4>';
|
778
|
-
});
|
779
|
-
|
780
|
-
$selector.find('h5').replaceWith( function() {
|
781
|
-
return '<h5 id="' + $(this)[0].id + '">' + $(this).text().slice(0,-1) + '</h5>';
|
782
|
-
});
|
783
|
-
|
784
|
-
logText = '\n' + 'data loaded successfully on id: ' + id;
|
785
|
-
logger.info(logText);
|
786
|
-
}
|
787
|
-
|
788
|
-
if (statusTxt === 'error') {
|
789
|
-
// jadams, 2020-07-21: to be checked why id could be UNDEFINED
|
790
|
-
if (typeof(id) != "undefined") {
|
791
|
-
var state = 'failed';
|
792
|
-
if (nbiIndicateNbiActivity) {
|
793
|
-
spinner.stop();
|
794
|
-
}
|
795
|
-
// logger.info('\n' + 'set state for ' + mod + ' to: ' + state);
|
796
|
-
// jadams, 2020-07-21: intermediate state should DISABLED
|
797
|
-
// executeFunctionByName(mod + '.setState', window, state);
|
798
|
-
j1.setXhrDataState(id, statusTxt);
|
799
|
-
j1.setXhrDomState(id, 'pending');
|
800
|
-
logText = '\n' + 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
801
|
-
logger.error(logText);
|
802
|
-
state = false;
|
803
|
-
}
|
804
|
-
}
|
805
|
-
};
|
806
|
-
};
|
807
|
-
|
808
|
-
// failsafe - prevent XHR load errors
|
809
|
-
//
|
810
|
-
if (options.xhr_data !== '') {
|
811
|
-
logger.info('\n' + 'HTML data file found: ' + options.xhr_data);
|
812
|
-
} else {
|
813
|
-
logger.warning('\n' + 'no HTML data file found, loading data aborted');
|
814
|
-
return;
|
815
|
-
}
|
816
|
-
|
817
|
-
if ($selector.length) {
|
818
|
-
$selector.load( html_data_path, cb_load_closure(id, mathjaxEnabled));
|
819
|
-
}
|
820
|
-
|
821
|
-
return;
|
822
|
-
},
|
823
|
-
|
824
|
-
// -------------------------------------------------------------------------
|
825
|
-
// registerNbiModalsCB()
|
826
|
-
// regsiter callbacks for all (NBI) modals used
|
827
|
-
// -------------------------------------------------------------------------
|
828
|
-
registerNbiModalsCB: function () {
|
829
|
-
|
830
|
-
// auto-scroll to the END of the SUCCESS messages
|
831
|
-
// see: https://stackoverflow.com/questions/7303948/how-to-auto-scroll-to-end-of-div-when-data-is-added
|
832
|
-
//
|
833
|
-
window.setInterval(function() {
|
834
|
-
var contentModalSuccess = document.getElementById(nbiContentModalSuccessID);
|
835
|
-
contentModalSuccess.scrollTop = contentModalSuccess.scrollHeight;
|
836
|
-
}, 500);
|
837
|
-
|
838
|
-
// remove all INFO messages on modal CLOSED
|
839
|
-
//
|
840
|
-
$('#nbiModalTopInfo').on('hidden.bs.modal', function () {
|
841
|
-
var ul = document.getElementById(nbiModalInfoMessagesID);
|
842
|
-
var listLength = ul.children.length;
|
843
|
-
|
844
|
-
if (listLength) {
|
845
|
-
logger.debug('modal closed nbiModalTopInfo: remove all messages');
|
846
|
-
_this.removeModalMessages(nbiModalInfoMessagesID);
|
847
|
-
}
|
848
|
-
});
|
849
|
-
// remove all SUCCESS messages on modal CLOSED
|
850
|
-
//
|
851
|
-
$('#nbiModalTRSuccess').on('hidden.bs.modal', function () {
|
852
|
-
var ul = document.getElementById(nbiModalSuccessMessagesID);
|
853
|
-
var listLength = ul.children.length;
|
854
|
-
|
855
|
-
if (listLength) {
|
856
|
-
logger.debug('modal closed nbiModalTRSuccess: remove all messages');
|
857
|
-
_this.removeModalMessages(nbiModalSuccessMessagesID);
|
858
|
-
}
|
859
|
-
});
|
860
|
-
// remove all ERROR messages on modal CLOSED
|
861
|
-
//
|
862
|
-
$('#nbiModalTLDanger').on('hidden.bs.modal', function () {
|
863
|
-
var ul = document.getElementById(nbiModalErrorMessagesID);
|
864
|
-
var listLength = ul.children.length;
|
865
|
-
|
866
|
-
if (listLength) {
|
867
|
-
logger.debug('modal closed nbiModalTLDanger: remove all messages');
|
868
|
-
_this.removeModalMessages(nbiModalErrorMessagesID);
|
869
|
-
}
|
870
|
-
if (nbiIndicateNbiActivity) {
|
871
|
-
spinner.stop();
|
872
|
-
}
|
873
|
-
});
|
874
|
-
},
|
875
|
-
|
876
|
-
// -------------------------------------------------------------------------
|
877
|
-
// loadNbiModals()
|
878
|
-
// Load HTML data for all (NBI) modals used
|
879
|
-
// -------------------------------------------------------------------------
|
880
|
-
loadNbiModals: function () {
|
881
|
-
|
882
|
-
const nbiModalTopInfo = `
|
883
|
-
<div id="nbiModalTopInfo"
|
884
|
-
class="modal fade top"
|
885
|
-
tabindex="-1"
|
886
|
-
role="dialog"
|
887
|
-
aria-labelledby="myModalLabel" aria-hidden="true"
|
888
|
-
data-keyboard="false"
|
889
|
-
data-backdrop="static">
|
890
|
-
<div class="modal-dialog modal-frame modal-top modal-notify modal-info" role="document">
|
891
|
-
<!-- Icon -->
|
892
|
-
<div class="text-center">
|
893
|
-
<i class="mdi mdi-10x mdi-progress-clock mdi-spin md-green mb-1"></i>
|
894
|
-
</div>
|
895
|
-
<!-- Content -->
|
896
|
-
<div class="modal-content">
|
897
|
-
<!-- Body -->
|
898
|
-
<div id="nbiModalInfoBody" class="modal-body">
|
899
|
-
<div>
|
900
|
-
<ul id="nbiModalInfoMessages"></ul>
|
901
|
-
</div>
|
902
|
-
<!-- Footer -->
|
903
|
-
<div class="modal-footer justify-content-center">
|
904
|
-
<a type="button" class="btn btn-primary" data-bs-dismiss="modal">OK, thanks</a>
|
905
|
-
</div>
|
906
|
-
</div>
|
907
|
-
</div>
|
908
|
-
<!-- END Content -->
|
909
|
-
</div>
|
910
|
-
</div>
|
911
|
-
`
|
912
|
-
|
913
|
-
const nbiModalTRInfo = `
|
914
|
-
<div id="nbiModalTRInfo"
|
915
|
-
class="modal fade right"
|
916
|
-
tabindex="-1"
|
917
|
-
role="dialog"
|
918
|
-
aria-labelledby="myModalLabel" aria-hidden="true"
|
919
|
-
data-bs-keyboard="false"
|
920
|
-
data-bs-backdrop="static">
|
921
|
-
<div class="modal-dialog modal-dialog-scrollable modal-side-2x modal-top-right modal-notify modal-success" role="document">
|
922
|
-
<!-- Content -->
|
923
|
-
<div class="modal-content">
|
924
|
-
<!-- Header -->
|
925
|
-
<div class="modal-header">
|
926
|
-
<p class="lead">Information</p>
|
927
|
-
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
928
|
-
<i class="mdi mdi-close mdi-dark mdi-48px"></i>
|
929
|
-
</button>
|
930
|
-
</div>
|
931
|
-
<!-- Icon -->
|
932
|
-
<div class="text-center">
|
933
|
-
<i class="mdi mdi-10x mdi-information-variant mdi-spin md-green mb-1"></i>
|
934
|
-
</div>
|
935
|
-
<!-- Body -->
|
936
|
-
<div id="nbiModalTRInfoBody" class="modal-body">
|
937
|
-
<div>
|
938
|
-
<p> Placeholder </p>
|
939
|
-
</div>
|
940
|
-
</div>
|
941
|
-
<!-- Footer -->
|
942
|
-
<div class="modal-footer justify-content-center">
|
943
|
-
<a type="button" class="btn btn-primary" data-bs-dismiss="modal">OK, thanks</a>
|
944
|
-
</div>
|
945
|
-
</div>
|
946
|
-
<!-- END Content -->
|
947
|
-
</div>
|
948
|
-
</div>
|
949
|
-
`
|
950
|
-
|
951
|
-
const nbiModalTRSuccess = `
|
952
|
-
<div id="nbiModalTRSuccess"
|
953
|
-
class="modal fade right"
|
954
|
-
tabindex="-1"
|
955
|
-
role="dialog"
|
956
|
-
aria-labelledby="myModalLabel" aria-hidden="true"
|
957
|
-
data-bs-keyboard="false"
|
958
|
-
data-bs-backdrop="static">
|
959
|
-
<div class="modal-dialog modal-dialog-scrollable modal-side-2x modal-top-right modal-notify modal-success" role="document">
|
960
|
-
<!-- Content -->
|
961
|
-
<div class="modal-content">
|
962
|
-
<!-- Header -->
|
963
|
-
<div class="modal-header">
|
964
|
-
<p class="lead">NBI - Information</p>
|
965
|
-
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
966
|
-
<i class="mdi mdi-close mdi-dark mdi-48px"></i>
|
967
|
-
</button>
|
968
|
-
</div>
|
969
|
-
<!-- Icon -->
|
970
|
-
<div class="text-center">
|
971
|
-
<i class="mdi mdi-10x mdi-loading mdi-spin md-green mb-1"></i>
|
972
|
-
</div>
|
973
|
-
<!-- Body -->
|
974
|
-
<div id="nbiModalSuccessBody" class="modal-body">
|
975
|
-
<div>
|
976
|
-
<p> Initializing your Binder. This may take a while ...</p>
|
977
|
-
<ul id="nbiModalSuccessMessages"></ul>
|
978
|
-
</div>
|
979
|
-
</div>
|
980
|
-
<!-- Footer -->
|
981
|
-
<div class="modal-footer justify-content-center">
|
982
|
-
<a type="button" class="btn btn-primary" data-bs-dismiss="modal">OK, thanks</a>
|
983
|
-
</div>
|
984
|
-
</div>
|
985
|
-
<!-- END Content -->
|
986
|
-
</div>
|
987
|
-
</div>
|
988
|
-
`
|
989
|
-
|
990
|
-
const nbiModalTLDanger = `
|
991
|
-
<div id="nbiModalTLDanger"
|
992
|
-
class="modal fade left"
|
993
|
-
tabindex="-1"
|
994
|
-
role="dialog"
|
995
|
-
aria-labelledby="myModalLabel" aria-hidden="true"
|
996
|
-
data-bs-keyboard="false"
|
997
|
-
data-bs-backdrop="static">
|
998
|
-
<div class="modal-dialog modal-side-2x modal-top-left modal-notify modal-danger" role="document">
|
999
|
-
<!-- Content -->
|
1000
|
-
<div id="nbiModalErrorBody" class="modal-content">
|
1001
|
-
<!--Header-->
|
1002
|
-
<div class="modal-header">
|
1003
|
-
<p class="lead">NBI - Error</p>
|
1004
|
-
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
1005
|
-
<i class="mdi mdi-close mdi-dark mdi-48px"></i>
|
1006
|
-
</button>
|
1007
|
-
</div>
|
1008
|
-
<!-- Icon -->
|
1009
|
-
<div class="text-center">
|
1010
|
-
<i class="mdi mdi-10x mdi-alert md-red mb-1"></i>
|
1011
|
-
</div>
|
1012
|
-
<!-- Body -->
|
1013
|
-
<div id="nbiModalErrorBody" class="modal-body">
|
1014
|
-
<p> Initializing NbInteract failed:</p>
|
1015
|
-
<div>
|
1016
|
-
<ul id="nbiModalErrorMessages"></ul>
|
1017
|
-
</div>
|
1018
|
-
</div>
|
1019
|
-
<!-- Footer -->
|
1020
|
-
<div class="modal-footer justify-content-center">
|
1021
|
-
<a type="button" class="btn btn-primary" data-bs-dismiss="modal">OK, thanks</a>
|
1022
|
-
</div>
|
1023
|
-
</div>
|
1024
|
-
<!-- END Content -->
|
1025
|
-
</div>
|
1026
|
-
</div>
|
1027
|
-
`
|
1028
|
-
nbiModal = document.createElement('div');
|
1029
|
-
nbiModal.id = 'nbi-modal-info';
|
1030
|
-
nbiModal.className = 'nbi-modal';
|
1031
|
-
nbiModal.innerHTML = nbiModalTopInfo;
|
1032
|
-
document.body.appendChild(nbiModal);
|
1033
|
-
|
1034
|
-
nbiModal = document.createElement('div');
|
1035
|
-
nbiModal.id = 'nbi-modal-info';
|
1036
|
-
nbiModal.className = 'nbi-modal';
|
1037
|
-
nbiModal.innerHTML = nbiModalTRInfo;
|
1038
|
-
document.body.appendChild(nbiModal);
|
1039
|
-
|
1040
|
-
nbiModal = document.createElement('div');
|
1041
|
-
nbiModal.id = 'nbi-modal-success';
|
1042
|
-
nbiModal.className = 'nbi-modal';
|
1043
|
-
nbiModal.innerHTML = nbiModalTRSuccess;
|
1044
|
-
document.body.appendChild(nbiModal);
|
1045
|
-
|
1046
|
-
nbiModal = document.createElement('div');
|
1047
|
-
nbiModal.id = 'nbi-modal-danger';
|
1048
|
-
nbiModal.className = 'nbi-modal';
|
1049
|
-
nbiModal.innerHTML = nbiModalTLDanger;
|
1050
|
-
document.body.appendChild(nbiModal);
|
1051
|
-
|
1052
|
-
},
|
1053
|
-
|
1054
|
-
// -------------------------------------------------------------------------
|
1055
|
-
// messageHandler()
|
1056
|
-
// Manage messages send from other J1 modules
|
1057
|
-
// -------------------------------------------------------------------------
|
1058
|
-
messageHandler: function (sender, message) {
|
1059
|
-
var json_message = JSON.stringify(message, undefined, 2);
|
1060
|
-
var messageSuccessUL = document.getElementById(nbiModalSuccessMessagesID);
|
1061
|
-
var messageErrorUL = document.getElementById(nbiModalErrorMessagesID);
|
1062
|
-
var isUpdated = false;
|
1063
|
-
var message;
|
1064
|
-
|
1065
|
-
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
1066
|
-
logger.debug(logText);
|
1067
|
-
|
1068
|
-
// -----------------------------------------------------------------------
|
1069
|
-
// Process commands|actions
|
1070
|
-
// -----------------------------------------------------------------------
|
1071
|
-
|
1072
|
-
// -----------------------------------------------------------------------
|
1073
|
-
// command|nbi_init_started
|
1074
|
-
// -----------------------------------------------------------------------
|
1075
|
-
if (message.type === 'command' && message.action === 'nbi_init_started') {
|
1076
|
-
|
1077
|
-
if (nbiShowMessages) {
|
1078
|
-
if (nbiModalAutoClose) {
|
1079
|
-
window.setTimeout(function() {
|
1080
|
-
$(nbiModalSuccessID).modal('hide');
|
1081
|
-
}, nbiModalAutoCloseDelay);
|
1082
|
-
}
|
1083
|
-
}
|
1084
|
-
|
1085
|
-
if (nbiNotebookReady == 'first_widget') {
|
1086
|
-
if (nbiIndicateNbiActivity) spinner.stop();
|
1087
|
-
$('.fab-btn').show();
|
1088
|
-
}
|
1089
|
-
|
1090
|
-
widgetCells = document.querySelectorAll('.output_widget_view').length;
|
1091
|
-
var dependencies_met_page_rendered = setInterval(function() {
|
1092
|
-
widgetCellsRendered = document.querySelectorAll('.widget-vbox').length;
|
1093
|
-
if (widgetCellsRendered >= widgetCells) {
|
1094
|
-
logger.info('\n' + 'widgets rendered in page (interactive|total) : ' + widgetCells + '|' + widgetCellsRendered);
|
1095
|
-
nbiCellsRendered = true;
|
1096
|
-
if (nbiIndicateNbiActivity) spinner.stop();
|
1097
|
-
_this.setState('finished');
|
1098
|
-
logger.debug('\n' + 'state: ' + _this.getState());
|
1099
|
-
logger.info('\n' + 'initializing module finished');
|
1100
|
-
|
1101
|
-
clearInterval(dependencies_met_page_rendered);
|
1102
|
-
}
|
1103
|
-
}, 10); // END interval dependencies_met_page_rendered
|
1104
|
-
|
1105
|
-
// ---------------------------------------------------------------------
|
1106
|
-
// show the quicklinks icon
|
1107
|
-
// ---------------------------------------------------------------------
|
1108
|
-
$('#quickLinksNotebookseButton').show();
|
1109
|
-
|
1110
|
-
} // END message command/nbi_init_started
|
1111
|
-
|
1112
|
-
// -----------------------------------------------------------------------
|
1113
|
-
// command|mathjax
|
1114
|
-
// -----------------------------------------------------------------------
|
1115
|
-
if (message.type === 'command' && message.action === 'mathjax') {
|
1116
|
-
logger.error('\n' + 'New Math, ID: ' + message.text);
|
1117
|
-
|
1118
|
-
// Register a MathJax callback if page is FULLY rendered
|
1119
|
-
// TODO: Dosn't for now tha way !!!
|
1120
|
-
// MathJax.Hub.Startup.signal.Interest(function (message) {
|
1121
|
-
// logger.error("Startup: " + message)
|
1122
|
-
// if (message.contains('End')) {
|
1123
|
-
// logger.error("Startup: " + message)
|
1124
|
-
// }
|
1125
|
-
// });
|
1126
|
-
|
1127
|
-
var dependencies_met_mathjax_rendered = setInterval(function() {
|
1128
|
-
var elm = document.getElementById('MathJax-Element-6' + '-Frame');
|
1129
|
-
var isProcessing = (elm.classList.contains('MJXc-processing') || elm.classList.contains('MJXc-processed')) ? true : false;
|
1130
|
-
if (!isProcessing && !isUpdated) {
|
1131
|
-
isUpdated = true;
|
1132
|
-
elm.classList.add('notranslate');
|
1133
|
-
logger.error('\n' + 'New Math, ID: ' + message.text);
|
1134
|
-
//clearInterval(dependencies_met_mathjax_rendered);
|
1135
|
-
}
|
1136
|
-
clearInterval(dependencies_met_mathjax_rendered);
|
1137
|
-
}, 10); // END interval dependencies_met_mathjax_rendered
|
1138
|
-
|
1139
|
-
} // END message command/mathjax
|
1140
|
-
|
1141
|
-
// -----------------------------------------------------------------------
|
1142
|
-
// command|info
|
1143
|
-
// TODO: count messages contain 'Pulling image'.
|
1144
|
-
// Potentially a enless loop
|
1145
|
-
// -----------------------------------------------------------------------
|
1146
|
-
if (message.type === 'command' && message.action === 'info') {
|
1147
|
-
// var reMessageTS = new RegExp('/(?:[1-9]\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{1,9})?(?:Z|[+-][01]\d:[0-5]\d)/');
|
1148
|
-
var messageTS;
|
1149
|
-
|
1150
|
-
// widget render info messages for logging
|
1151
|
-
//
|
1152
|
-
if (message.text.includes('Displaying widget') || message.text.includes('First widget')) {
|
1153
|
-
logger.debug('\n' + message.text);
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
// remove timestamp|loglevel from message if exists
|
1157
|
-
//
|
1158
|
-
messageTS = message.text.split('] ')[1];
|
1159
|
-
if (messageTS) {
|
1160
|
-
message.text = messageTS;
|
1161
|
-
}
|
1162
|
-
|
1163
|
-
_this.appendModalMessage(messageSuccessUL, message.text)
|
1164
|
-
logger.debug('\n' + message.text);
|
1165
|
-
|
1166
|
-
// show the info modal
|
1167
|
-
//
|
1168
|
-
if (nbiShowMessages) {
|
1169
|
-
if ($(nbiModalSuccessID).is(':hidden')) {
|
1170
|
-
$(nbiModalSuccessID).modal('show');
|
1171
|
-
}
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
} // END message command/info
|
1175
|
-
|
1176
|
-
// -----------------------------------------------------------------------
|
1177
|
-
// command|error
|
1178
|
-
// -----------------------------------------------------------------------
|
1179
|
-
if (message.type === 'command' && message.action === 'error') {
|
1180
|
-
var messageTS;
|
1181
|
-
|
1182
|
-
if (message.text.includes('Too many users') ||
|
1183
|
-
message.text.includes('Insufficent nodes') ||
|
1184
|
-
message.text.includes('ImagePullBackOff') ||
|
1185
|
-
message.text.includes('kernel failed') ||
|
1186
|
-
message.text.includes('failed to connect')
|
1187
|
-
) {
|
1188
|
-
var modaBodyText = `
|
1189
|
-
The <i>Binder Service</i> seems currently not available or is overloaded.
|
1190
|
-
All interactive components on the page are <b>not</b> available.
|
1191
|
-
You can reload the page now to re-connect or re-open it at a later time.
|
1192
|
-
`;
|
1193
|
-
logger.error('\n', 'Binder access failed: ' + message.text);
|
1194
|
-
|
1195
|
-
if ($(nbiModalTRInfo).is(':hidden')) {
|
1196
|
-
document.getElementById('nbiModalTRInfoBody').innerHTML = modaBodyText;
|
1197
|
-
$(nbiModalTRInfo).modal('show');
|
1198
|
-
}
|
1199
|
-
|
1200
|
-
return;
|
1201
|
-
}
|
1202
|
-
|
1203
|
-
// remove timestamp|loglevel from message if exists
|
1204
|
-
//
|
1205
|
-
messageTS = message.text.split('] ')[1];
|
1206
|
-
if (messageTS) {
|
1207
|
-
message.text = messageTS;
|
1208
|
-
}
|
1209
|
-
|
1210
|
-
_this.appendModalMessage(messageErrorUL, message.text)
|
1211
|
-
logger.error('\n' + message.text);
|
1212
|
-
|
1213
|
-
// stop the (progress) spinner
|
1214
|
-
//
|
1215
|
-
if (nbinteractOptions.indicate_nbi_activity) {
|
1216
|
-
spinner.stop();
|
1217
|
-
}
|
1218
|
-
|
1219
|
-
if (nbiShowMessages) {
|
1220
|
-
// hide the info modal if shown
|
1221
|
-
//
|
1222
|
-
$(nbiModalSuccessID).on('shown.bs.modal', function () {
|
1223
|
-
$(nbiModalSuccessID).modal('hide');
|
1224
|
-
});
|
1225
|
-
|
1226
|
-
// hide the info modal uncondionally (need ???)
|
1227
|
-
//
|
1228
|
-
$(nbiModalSuccessID).modal('hide');
|
1229
|
-
|
1230
|
-
// show the error modal
|
1231
|
-
//
|
1232
|
-
$(nbiModalSuccessID).on('hidden.bs.modal', function () {
|
1233
|
-
if ($(nbiModalErrorID).is(':hidden')) {
|
1234
|
-
$(nbiModalErrorID).modal('show');
|
1235
|
-
|
1236
|
-
// auto-close the error modal
|
1237
|
-
//
|
1238
|
-
if (nbiModalAutoClose) {
|
1239
|
-
window.setTimeout(function() {
|
1240
|
-
$(nbiModalErrorID).modal('hide');
|
1241
|
-
}, nbiModalAutoCloseDelay);
|
1242
|
-
}
|
1243
|
-
}
|
1244
|
-
});
|
1245
|
-
}
|
1246
|
-
|
1247
|
-
if (nbiIndicateNbiActivity) {
|
1248
|
-
spinner.stop();
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
} // END message command/error
|
1252
|
-
|
1253
|
-
return true;
|
1254
|
-
}, // END messageHandler
|
1255
|
-
|
1256
|
-
// -------------------------------------------------------------------------
|
1257
|
-
// getNbiButtonsState()
|
1258
|
-
// Gets the current (processing) state of NBI widget buttons
|
1259
|
-
// -------------------------------------------------------------------------
|
1260
|
-
getNbiButtonState: function () {
|
1261
|
-
var state;
|
1262
|
-
var cellButtons = document.querySelectorAll('.js-nbinteract-widget')
|
1263
|
-
if (cellButtons.length) {
|
1264
|
-
state = true;
|
1265
|
-
} else {
|
1266
|
-
state = false;
|
1267
|
-
}
|
1268
|
-
|
1269
|
-
return state;
|
1270
|
-
}, // END getNbiButtonsState
|
1271
|
-
|
1272
|
-
// -------------------------------------------------------------------------
|
1273
|
-
// setState()
|
1274
|
-
// Sets the current (processing) state of the module
|
1275
|
-
// -------------------------------------------------------------------------
|
1276
|
-
setState: function (stat) {
|
1277
|
-
_this.state = stat;
|
1278
|
-
}, // END setState
|
1279
|
-
|
1280
|
-
// -------------------------------------------------------------------------
|
1281
|
-
// getState()
|
1282
|
-
// Returns the current (processing) state of the module
|
1283
|
-
// -------------------------------------------------------------------------
|
1284
|
-
getState: function () {
|
1285
|
-
return _this.state;
|
1286
|
-
}, // END getState
|
1287
|
-
|
1288
|
-
// -------------------------------------------------------------------------
|
1289
|
-
// checkURL()
|
1290
|
-
// Returns the current (processing) state of the module
|
1291
|
-
// -------------------------------------------------------------------------
|
1292
|
-
checkURL: function (uri, flags) {
|
1293
|
-
_this.setState('process_checks');
|
1294
|
-
if (uri.includes('localhost')) {
|
1295
|
-
_this.setState('finished_checks');
|
1296
|
-
flags.checkURL = true;
|
1297
|
-
return true;
|
1298
|
-
} else {
|
1299
|
-
$.get(uri).done(function (e) {
|
1300
|
-
_this.setState('finished_checks');
|
1301
|
-
flags.checkURL = true;
|
1302
|
-
return true;
|
1303
|
-
}).fail(function (e) {
|
1304
|
-
_this.setState('finished_checks');
|
1305
|
-
flags.checkURL = false;
|
1306
|
-
});
|
1307
|
-
}
|
1308
|
-
}, // END checkURL
|
1309
|
-
|
1310
|
-
// -------------------------------------------------------------------------
|
1311
|
-
// loadDialog()
|
1312
|
-
// Loads the NBI dialog (modal)
|
1313
|
-
// -------------------------------------------------------------------------
|
1314
|
-
loadDialog: function (options) {
|
1315
|
-
Events.documentReady(function () {
|
1316
|
-
|
1317
|
-
_this.modal = document.getElementById(options.dialogContainerID);
|
1318
|
-
if (!_this.modal) {
|
1319
|
-
logger.info('\n' + 'load consent modal');
|
1320
|
-
|
1321
|
-
_this.modal = document.createElement('div');
|
1322
|
-
_this.modal.id = options.dialogContainerID;
|
1323
|
-
_this.modal.style.display = 'none';
|
1324
|
-
|
1325
|
-
_this.modal.setAttribute('class', 'modal fade');
|
1326
|
-
_this.modal.setAttribute('tabindex', '-1');
|
1327
|
-
_this.modal.setAttribute('role', 'dialog');
|
1328
|
-
_this.modal.setAttribute('aria-labelledby', options.dialogContainerID);
|
1329
|
-
document.body.append(_this.modal);
|
1330
|
-
_this.$modal = $(_this.modal);
|
1331
|
-
|
1332
|
-
// -------------------------------------------------------------------
|
1333
|
-
// load|initialize the dialog (modal content)
|
1334
|
-
// -------------------------------------------------------------------
|
1335
|
-
var templateUrl = options.contentURL + '/' + 'index.html';
|
1336
|
-
$.get(templateUrl)
|
1337
|
-
.done(function (data) {
|
1338
|
-
// load ALL modals HTML
|
1339
|
-
_this.modal.innerHTML = data;
|
1340
|
-
// select only the requested modal
|
1341
|
-
_this.modal.innerHTML = $('#' + options.xhrDataElement).eq(0).html();
|
1342
|
-
|
1343
|
-
// set dialog type to 'modal'
|
1344
|
-
//
|
1345
|
-
$(_this.modal).modal({
|
1346
|
-
backdrop: 'static',
|
1347
|
-
keyboard: false
|
1348
|
-
});
|
1349
|
-
|
1350
|
-
// register all button links
|
1351
|
-
//
|
1352
|
-
_this.$buttonDoNotAgree = $('#nbi-buttonDoNotAgree');
|
1353
|
-
_this.$buttonAgree = $('#nbi-buttonAgree');
|
1354
|
-
_this.$buttonSave = $('#nbi-buttonSave');
|
1355
|
-
_this.$buttonAgreeAll = $('#nbi-buttonAgreeAll');
|
1356
|
-
|
1357
|
-
// register all actions
|
1358
|
-
//
|
1359
|
-
_this.registerActions();
|
1360
|
-
|
1361
|
-
// register button event handler
|
1362
|
-
//
|
1363
|
-
_this.$buttonDoNotAgree.click(function () {
|
1364
|
-
_this.doNotAgree();
|
1365
|
-
});
|
1366
|
-
|
1367
|
-
_this.$buttonAgree.click(function () {
|
1368
|
-
_this.agreeAll();
|
1369
|
-
});
|
1370
|
-
})
|
1371
|
-
.fail(function () {
|
1372
|
-
logger.error('\n' + 'loading nbi dialog (modal): failed');
|
1373
|
-
logger.warn('\n' + 'probably no|wrong `contentURL` set');
|
1374
|
-
});
|
1375
|
-
}
|
1376
|
-
|
1377
|
-
// ---------------------------------------------------------------------
|
1378
|
-
// register events for the dialog (modal)
|
1379
|
-
// ---------------------------------------------------------------------
|
1380
|
-
|
1381
|
-
// ---------------------------------------------------------------------
|
1382
|
-
// on 'show'
|
1383
|
-
// ---------------------------------------------------------------------
|
1384
|
-
// _this.$modal.on('show.bs.modal', function () {
|
1385
|
-
// // hide the menubar for the modal header
|
1386
|
-
// $('#navigator_nav_navbar').hide();
|
1387
|
-
// }); // END modal on 'show'
|
1388
|
-
|
1389
|
-
// ---------------------------------------------------------------------
|
1390
|
-
// on 'hidden'
|
1391
|
-
// ---------------------------------------------------------------------
|
1392
|
-
// _this.$modal.on('hidden.bs.modal', function () {
|
1393
|
-
// // if the modal is closed, show the menubar
|
1394
|
-
// $('#navigator_nav_navbar').show();
|
1395
|
-
// }); // END modal on 'hidden'
|
1396
|
-
|
1397
|
-
}.bind(_this));
|
1398
|
-
}, // END loadDialog
|
1399
|
-
|
1400
|
-
// -------------------------------------------------------------------------
|
1401
|
-
// showDialog()
|
1402
|
-
// Show the NBI dialog (modal)
|
1403
|
-
// -------------------------------------------------------------------------
|
1404
|
-
showDialog: function () {
|
1405
|
-
this.$modal.modal('show');
|
1406
|
-
}, // END showDialog
|
1407
|
-
|
1408
|
-
// -------------------------------------------------------------------------
|
1409
|
-
// registerActions()
|
1410
|
-
// register actions to run
|
1411
|
-
// -------------------------------------------------------------------------
|
1412
|
-
registerActions: function () {
|
1413
|
-
|
1414
|
-
$('input:checkbox[name="checkboxClearLocalStorage"]').on('click', function (e) {
|
1415
|
-
nbActions.resetLocalStorage = $(this).is(':checked');
|
1416
|
-
logText = '\n' + 'action ClearLocalStorage changed to: ' + value;
|
1417
|
-
logger.info(logText);
|
1418
|
-
|
1419
|
-
e.stopPropagation();
|
1420
|
-
});
|
1421
|
-
|
1422
|
-
}, // END registerActions
|
1423
|
-
|
1424
|
-
// -------------------------------------------------------------------------
|
1425
|
-
// doNotAgree()
|
1426
|
-
// action to run ...
|
1427
|
-
// -------------------------------------------------------------------------
|
1428
|
-
doNotAgree: function (elmID, msg) {
|
1429
|
-
_this.$modal.modal('hide');
|
1430
|
-
}, // END doNotAgree
|
1431
|
-
|
1432
|
-
// -------------------------------------------------------------------------
|
1433
|
-
// agreeAll()
|
1434
|
-
// caction to run ...
|
1435
|
-
// -------------------------------------------------------------------------
|
1436
|
-
agreeAll: function (elmID, msg) {
|
1437
|
-
|
1438
|
-
if (nbActions.resetLocalStorage) {
|
1439
|
-
logText = '\n' + 'run action: "Clear Binder Settings"';
|
1440
|
-
logger.info(logText);
|
1441
|
-
localStorage.removeItem('serverParams');
|
1442
|
-
localStorage.removeItem('kernelId');
|
1443
|
-
}
|
1444
|
-
|
1445
|
-
_this.$modal.modal('hide');
|
1446
|
-
location.reload(true);
|
1447
|
-
}, // END agreeAll
|
1448
|
-
|
1449
|
-
// -------------------------------------------------------------------------
|
1450
|
-
// appendModalMessage()
|
1451
|
-
// Appends a message to given (NBI) modal
|
1452
|
-
// -------------------------------------------------------------------------
|
1453
|
-
appendModalMessage: function (elmID, msg) {
|
1454
|
-
var li = document.createElement('li');
|
1455
|
-
|
1456
|
-
li.setAttribute('class','item');
|
1457
|
-
elmID.appendChild(li);
|
1458
|
-
li.innerHTML = li.innerHTML + msg;
|
1459
|
-
}, // END appendModalMessage
|
1460
|
-
|
1461
|
-
// -------------------------------------------------------------------------
|
1462
|
-
// removeModalMessages()
|
1463
|
-
// Remove (clear) all modal messages if a given (NBI) modal
|
1464
|
-
// -------------------------------------------------------------------------
|
1465
|
-
removeModalMessages: function (elmID) {
|
1466
|
-
var ul = document.getElementById(elmID);
|
1467
|
-
var listLength = ul.children.length;
|
1468
|
-
|
1469
|
-
if (listLength) {
|
1470
|
-
for (var i = 0; i < listLength; i++) {
|
1471
|
-
ul.removeChild(ul.children[0]);
|
1472
|
-
}
|
1473
|
-
}
|
1474
|
-
} // END removeModalMessages
|
1475
|
-
|
1476
|
-
}; // END return
|
1477
|
-
})(j1, window);
|
1478
|
-
|
1479
|
-
{% endcapture %}
|
1480
|
-
{% if production %}
|
1481
|
-
{{ cache | minifyJS }}
|
1482
|
-
{% else %}
|
1483
|
-
{{ cache | strip_empty_lines }}
|
1484
|
-
{% endif %}
|
1485
|
-
{% assign cache = nil %}
|