slide.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. $content_p = strpos($content, "\n");
  3. $slide_config = substr($content, 0, $content_p);
  4. $slide_content = substr($content, $content_p + 1);
  5. $slide_config = json_decode($slide_config, true);
  6. if ($slide_config === null) {
  7. die('error');
  8. }
  9. if (!isset($slide_config['theme'])) {
  10. $slide_config['theme'] = 'moon';
  11. }
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="zh-cn">
  15. <head>
  16. <meta charset="utf-8">
  17. <title><?= isset($PageTitle) ? $PageTitle : UOJConfig::$data['profile']['oj-name-short'] ?> - <?= isset($PageMainTitle) ? $PageMainTitle : UOJConfig::$data['profile']['oj-name'] ?></title>
  18. <meta name="apple-mobile-web-app-capable" content="yes" />
  19. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
  21. <?= HTML::css_link('/css/reveal/reveal.css') ?>
  22. <link rel="stylesheet" type="text/css" href="<?= HTML::url('/css/reveal/theme/'.HTML::escape($slide_config['theme']).'.css') ?>" id="theme">
  23. <!-- Code syntax highlighting -->
  24. <?= HTML::css_link('/css/zenburn.css') ?>
  25. <!-- Printing and PDF exports -->
  26. <script>
  27. var link = document.createElement('link');
  28. link.rel = 'stylesheet';
  29. link.type = 'text/css';
  30. link.href = window.location.search.match(/print-pdf/gi) ? '<?= HTML::url('/css/reveal/print/pdf.css') ?>' : '<?= HTML::url('/css/reveal/print/paper.css') ?>';
  31. document.getElementsByTagName('head')[0].appendChild(link);
  32. </script>
  33. <!--[if lt IE 9]>
  34. <script src="<?= HTML::url('/js/html5shiv.js') ?>"></script>
  35. <![endif]-->
  36. </head>
  37. <body>
  38. <div class="reveal">
  39. <div class="slides"><?= $slide_content ?></div>
  40. </div>
  41. <script src="<?= HTML::url('/js/head.min.js') ?>"></script>
  42. <script src="<?= HTML::url('/js/reveal.js') ?>"></script>
  43. <script type="text/javascript">
  44. Reveal.initialize({
  45. controls: true,
  46. progress: true,
  47. history: true,
  48. center: true,
  49. help: true,
  50. transition: 'slide',
  51. math: {
  52. mathjax: '/mathjax/2.7.7/MathJax.js',
  53. config: 'TeX-AMS_HTML-full'
  54. },
  55. dependencies: [
  56. { src: '<?= HTML::url('/js/classList.js') ?>', condition: function() { return !document.body.classList; } },
  57. { src: '<?= HTML::url('/js/reveal/plugin/highlight/highlight.js') ?>', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
  58. { src: '<?= HTML::url('/js/reveal/plugin/zoom-js/zoom.js') ?>', async: true },
  59. { src: '<?= HTML::url('/js/reveal/plugin/notes/notes.js') ?>', async: true },
  60. { src: '<?= HTML::url('/js/reveal/plugin/math/math.js') ?>', async: true }
  61. ]
  62. });
  63. </script>
  64. </body>
  65. </html>