crowi-presentation.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const Reveal = require('reveal.js');
  2. require('reveal.js/lib/js/head.min.js');
  3. require('reveal.js/lib/js/html5shiv.js');
  4. if (!window) {
  5. window = {};
  6. }
  7. window.Reveal = Reveal;
  8. Reveal.initialize({
  9. controls: true,
  10. progress: true,
  11. history: true,
  12. center: true,
  13. transition: 'slide',
  14. // // This specification method can't be used
  15. // // sice deleting symlink prevented `src` from being resolved -- 2017.06.15 Yuki Takei
  16. //
  17. // Optional libraries used to extend on reveal.js
  18. // dependencies: [
  19. // { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
  20. // { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
  21. // { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
  22. // { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
  23. // { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
  24. // { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
  25. // ]
  26. });
  27. require.ensure([], () => {
  28. require('reveal.js/lib/js/classList.js');
  29. require('reveal.js/plugin/zoom-js/zoom.js');
  30. require('reveal.js/plugin/notes/notes.js');
  31. require('../util/reveal/plugins/growi-renderer.js');
  32. // fix https://github.com/weseek/crowi-plus/issues/96
  33. Reveal.slide(0, 0);
  34. Reveal.sync();
  35. });
  36. Reveal.addEventListener('ready', (event) => {
  37. // event.currentSlide, event.indexh, event.indexv
  38. $('.reveal section').each(function(e) {
  39. const $self = $(this);
  40. if ($self.children().length !== 1) {
  41. $self.addClass('only');
  42. }
  43. });
  44. });