nbinteract.html 891 B

123456789101112131415161718192021222324252627282930313233
  1. {% if site.use_show_widgets_button and page.has_widgets %}
  2. <!-- Include nbinteract for interactive widgets -->
  3. <script src="https://unpkg.com/nbinteract-core" async></script>
  4. <script>
  5. let interact
  6. const initializeNbinteract = () => {
  7. // If NbInteract hasn't loaded, wait one second and try again
  8. if (window.NbInteract === undefined) {
  9. setTimeout(initializeNbinteract, 1000)
  10. return
  11. }
  12. if (interact === undefined) {
  13. console.log('Initializing nbinteract...')
  14. interact = new window.NbInteract({
  15. baseUrl: 'https://mybinder.org',
  16. spec: '{{ site.binder_repo_org }}/{{ site.binder_repo_name }}/{{ site.binder_repo_branch }}',
  17. provider: 'gh',
  18. })
  19. window.interact = interact
  20. } else {
  21. console.log("nbinteract already initialized...")
  22. }
  23. interact.prepare()
  24. }
  25. // Initialize nbinteract
  26. initFunction(initializeNbinteract);
  27. </script>
  28. {% endif %}