Слайды на основе Reveal.js для презентации обучения детей в 2018-м году для конференции eKIDS в августе 2019-го
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8002 lines
229KB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  6. <style>
  7. /* reset.css */
  8. /* http://meyerweb.com/eric/tools/css/reset/
  9. v4.0 | 20180602
  10. License: none (public domain)
  11. */
  12. html, body, div, span, applet, object, iframe,
  13. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  14. a, abbr, acronym, address, big, cite, code,
  15. del, dfn, em, img, ins, kbd, q, s, samp,
  16. small, strike, strong, sub, sup, tt, var,
  17. b, u, i, center,
  18. dl, dt, dd, ol, ul, li,
  19. fieldset, form, label, legend,
  20. table, caption, tbody, tfoot, thead, tr, th, td,
  21. article, aside, canvas, details, embed,
  22. figure, figcaption, footer, header, hgroup,
  23. main, menu, nav, output, ruby, section, summary,
  24. time, mark, audio, video {
  25. margin: 0;
  26. padding: 0;
  27. border: 0;
  28. font-size: 100%;
  29. font: inherit;
  30. vertical-align: baseline;
  31. }
  32. /* HTML5 display-role reset for older browsers */
  33. article, aside, details, figcaption, figure,
  34. footer, header, hgroup, main, menu, nav, section {
  35. display: block;
  36. }
  37. /*!
  38. * reveal.js
  39. * http://revealjs.com
  40. * MIT licensed
  41. *
  42. * Copyright (C) 2019 Hakim El Hattab, http://hakim.se
  43. */
  44. /*********************************************
  45. * GLOBAL STYLES
  46. *********************************************/
  47. html {
  48. width: 100%;
  49. height: 100%;
  50. height: 100vh;
  51. height: calc( var(--vh, 1vh) * 100);
  52. overflow: hidden; }
  53. body {
  54. height: 100%;
  55. overflow: hidden;
  56. position: relative;
  57. line-height: 1;
  58. margin: 0;
  59. background-color: #fff;
  60. color: #000; }
  61. /*********************************************
  62. * VIEW FRAGMENTS
  63. *********************************************/
  64. .reveal .slides section .fragment {
  65. opacity: 0;
  66. visibility: hidden;
  67. transition: all .2s ease; }
  68. .reveal .slides section .fragment.visible {
  69. opacity: 1;
  70. visibility: inherit; }
  71. .reveal .slides section .fragment.grow {
  72. opacity: 1;
  73. visibility: inherit; }
  74. .reveal .slides section .fragment.grow.visible {
  75. -webkit-transform: scale(1.3);
  76. transform: scale(1.3); }
  77. .reveal .slides section .fragment.shrink {
  78. opacity: 1;
  79. visibility: inherit; }
  80. .reveal .slides section .fragment.shrink.visible {
  81. -webkit-transform: scale(0.7);
  82. transform: scale(0.7); }
  83. .reveal .slides section .fragment.zoom-in {
  84. -webkit-transform: scale(0.1);
  85. transform: scale(0.1); }
  86. .reveal .slides section .fragment.zoom-in.visible {
  87. -webkit-transform: none;
  88. transform: none; }
  89. .reveal .slides section .fragment.fade-out {
  90. opacity: 1;
  91. visibility: inherit; }
  92. .reveal .slides section .fragment.fade-out.visible {
  93. opacity: 0;
  94. visibility: hidden; }
  95. .reveal .slides section .fragment.semi-fade-out {
  96. opacity: 1;
  97. visibility: inherit; }
  98. .reveal .slides section .fragment.semi-fade-out.visible {
  99. opacity: 0.5;
  100. visibility: inherit; }
  101. .reveal .slides section .fragment.strike {
  102. opacity: 1;
  103. visibility: inherit; }
  104. .reveal .slides section .fragment.strike.visible {
  105. text-decoration: line-through; }
  106. .reveal .slides section .fragment.fade-up {
  107. -webkit-transform: translate(0, 20%);
  108. transform: translate(0, 20%); }
  109. .reveal .slides section .fragment.fade-up.visible {
  110. -webkit-transform: translate(0, 0);
  111. transform: translate(0, 0); }
  112. .reveal .slides section .fragment.fade-down {
  113. -webkit-transform: translate(0, -20%);
  114. transform: translate(0, -20%); }
  115. .reveal .slides section .fragment.fade-down.visible {
  116. -webkit-transform: translate(0, 0);
  117. transform: translate(0, 0); }
  118. .reveal .slides section .fragment.fade-right {
  119. -webkit-transform: translate(-20%, 0);
  120. transform: translate(-20%, 0); }
  121. .reveal .slides section .fragment.fade-right.visible {
  122. -webkit-transform: translate(0, 0);
  123. transform: translate(0, 0); }
  124. .reveal .slides section .fragment.fade-left {
  125. -webkit-transform: translate(20%, 0);
  126. transform: translate(20%, 0); }
  127. .reveal .slides section .fragment.fade-left.visible {
  128. -webkit-transform: translate(0, 0);
  129. transform: translate(0, 0); }
  130. .reveal .slides section .fragment.fade-in-then-out,
  131. .reveal .slides section .fragment.current-visible {
  132. opacity: 0;
  133. visibility: hidden; }
  134. .reveal .slides section .fragment.fade-in-then-out.current-fragment,
  135. .reveal .slides section .fragment.current-visible.current-fragment {
  136. opacity: 1;
  137. visibility: inherit; }
  138. .reveal .slides section .fragment.fade-in-then-semi-out {
  139. opacity: 0;
  140. visibility: hidden; }
  141. .reveal .slides section .fragment.fade-in-then-semi-out.visible {
  142. opacity: 0.5;
  143. visibility: inherit; }
  144. .reveal .slides section .fragment.fade-in-then-semi-out.current-fragment {
  145. opacity: 1;
  146. visibility: inherit; }
  147. .reveal .slides section .fragment.highlight-red,
  148. .reveal .slides section .fragment.highlight-current-red,
  149. .reveal .slides section .fragment.highlight-green,
  150. .reveal .slides section .fragment.highlight-current-green,
  151. .reveal .slides section .fragment.highlight-blue,
  152. .reveal .slides section .fragment.highlight-current-blue {
  153. opacity: 1;
  154. visibility: inherit; }
  155. .reveal .slides section .fragment.highlight-red.visible {
  156. color: #ff2c2d; }
  157. .reveal .slides section .fragment.highlight-green.visible {
  158. color: #17ff2e; }
  159. .reveal .slides section .fragment.highlight-blue.visible {
  160. color: #1b91ff; }
  161. .reveal .slides section .fragment.highlight-current-red.current-fragment {
  162. color: #ff2c2d; }
  163. .reveal .slides section .fragment.highlight-current-green.current-fragment {
  164. color: #17ff2e; }
  165. .reveal .slides section .fragment.highlight-current-blue.current-fragment {
  166. color: #1b91ff; }
  167. /*********************************************
  168. * DEFAULT ELEMENT STYLES
  169. *********************************************/
  170. /* Fixes issue in Chrome where italic fonts did not appear when printing to PDF */
  171. .reveal:after {
  172. content: '';
  173. font-style: italic; }
  174. .reveal iframe {
  175. z-index: 1; }
  176. /** Prevents layering issues in certain browser/transition combinations */
  177. .reveal a {
  178. position: relative; }
  179. .reveal .stretch {
  180. max-width: none;
  181. max-height: none; }
  182. .reveal pre.stretch code {
  183. height: 100%;
  184. max-height: 100%;
  185. box-sizing: border-box; }
  186. /*********************************************
  187. * CONTROLS
  188. *********************************************/
  189. @-webkit-keyframes bounce-right {
  190. 0%, 10%, 25%, 40%, 50% {
  191. -webkit-transform: translateX(0);
  192. transform: translateX(0); }
  193. 20% {
  194. -webkit-transform: translateX(10px);
  195. transform: translateX(10px); }
  196. 30% {
  197. -webkit-transform: translateX(-5px);
  198. transform: translateX(-5px); } }
  199. @keyframes bounce-right {
  200. 0%, 10%, 25%, 40%, 50% {
  201. -webkit-transform: translateX(0);
  202. transform: translateX(0); }
  203. 20% {
  204. -webkit-transform: translateX(10px);
  205. transform: translateX(10px); }
  206. 30% {
  207. -webkit-transform: translateX(-5px);
  208. transform: translateX(-5px); } }
  209. @-webkit-keyframes bounce-down {
  210. 0%, 10%, 25%, 40%, 50% {
  211. -webkit-transform: translateY(0);
  212. transform: translateY(0); }
  213. 20% {
  214. -webkit-transform: translateY(10px);
  215. transform: translateY(10px); }
  216. 30% {
  217. -webkit-transform: translateY(-5px);
  218. transform: translateY(-5px); } }
  219. @keyframes bounce-down {
  220. 0%, 10%, 25%, 40%, 50% {
  221. -webkit-transform: translateY(0);
  222. transform: translateY(0); }
  223. 20% {
  224. -webkit-transform: translateY(10px);
  225. transform: translateY(10px); }
  226. 30% {
  227. -webkit-transform: translateY(-5px);
  228. transform: translateY(-5px); } }
  229. .reveal .controls {
  230. display: none;
  231. position: absolute;
  232. top: auto;
  233. bottom: 12px;
  234. right: 12px;
  235. left: auto;
  236. z-index: 1;
  237. color: #000;
  238. pointer-events: none;
  239. font-size: 10px; }
  240. .reveal .controls button {
  241. position: absolute;
  242. padding: 0;
  243. background-color: transparent;
  244. border: 0;
  245. outline: 0;
  246. cursor: pointer;
  247. color: currentColor;
  248. -webkit-transform: scale(0.9999);
  249. transform: scale(0.9999);
  250. transition: color 0.2s ease, opacity 0.2s ease, -webkit-transform 0.2s ease;
  251. transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  252. z-index: 2;
  253. pointer-events: auto;
  254. font-size: inherit;
  255. visibility: hidden;
  256. opacity: 0;
  257. -webkit-appearance: none;
  258. -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
  259. .reveal .controls .controls-arrow:before,
  260. .reveal .controls .controls-arrow:after {
  261. content: '';
  262. position: absolute;
  263. top: 0;
  264. left: 0;
  265. width: 2.6em;
  266. height: 0.5em;
  267. border-radius: 0.25em;
  268. background-color: currentColor;
  269. transition: all 0.15s ease, background-color 0.8s ease;
  270. -webkit-transform-origin: 0.2em 50%;
  271. transform-origin: 0.2em 50%;
  272. will-change: transform; }
  273. .reveal .controls .controls-arrow {
  274. position: relative;
  275. width: 3.6em;
  276. height: 3.6em; }
  277. .reveal .controls .controls-arrow:before {
  278. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(45deg);
  279. transform: translateX(0.5em) translateY(1.55em) rotate(45deg); }
  280. .reveal .controls .controls-arrow:after {
  281. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(-45deg);
  282. transform: translateX(0.5em) translateY(1.55em) rotate(-45deg); }
  283. .reveal .controls .controls-arrow:hover:before {
  284. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(40deg);
  285. transform: translateX(0.5em) translateY(1.55em) rotate(40deg); }
  286. .reveal .controls .controls-arrow:hover:after {
  287. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(-40deg);
  288. transform: translateX(0.5em) translateY(1.55em) rotate(-40deg); }
  289. .reveal .controls .controls-arrow:active:before {
  290. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(36deg);
  291. transform: translateX(0.5em) translateY(1.55em) rotate(36deg); }
  292. .reveal .controls .controls-arrow:active:after {
  293. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(-36deg);
  294. transform: translateX(0.5em) translateY(1.55em) rotate(-36deg); }
  295. .reveal .controls .navigate-left {
  296. right: 6.4em;
  297. bottom: 3.2em;
  298. -webkit-transform: translateX(-10px);
  299. transform: translateX(-10px); }
  300. .reveal .controls .navigate-right {
  301. right: 0;
  302. bottom: 3.2em;
  303. -webkit-transform: translateX(10px);
  304. transform: translateX(10px); }
  305. .reveal .controls .navigate-right .controls-arrow {
  306. -webkit-transform: rotate(180deg);
  307. transform: rotate(180deg); }
  308. .reveal .controls .navigate-right.highlight {
  309. -webkit-animation: bounce-right 2s 50 both ease-out;
  310. animation: bounce-right 2s 50 both ease-out; }
  311. .reveal .controls .navigate-up {
  312. right: 3.2em;
  313. bottom: 6.4em;
  314. -webkit-transform: translateY(-10px);
  315. transform: translateY(-10px); }
  316. .reveal .controls .navigate-up .controls-arrow {
  317. -webkit-transform: rotate(90deg);
  318. transform: rotate(90deg); }
  319. .reveal .controls .navigate-down {
  320. right: 3.2em;
  321. bottom: 0;
  322. -webkit-transform: translateY(10px);
  323. transform: translateY(10px); }
  324. .reveal .controls .navigate-down .controls-arrow {
  325. -webkit-transform: rotate(-90deg);
  326. transform: rotate(-90deg); }
  327. .reveal .controls .navigate-down.highlight {
  328. -webkit-animation: bounce-down 2s 50 both ease-out;
  329. animation: bounce-down 2s 50 both ease-out; }
  330. .reveal .controls[data-controls-back-arrows="faded"] .navigate-left.enabled,
  331. .reveal .controls[data-controls-back-arrows="faded"] .navigate-up.enabled {
  332. opacity: 0.3; }
  333. .reveal .controls[data-controls-back-arrows="faded"] .navigate-left.enabled:hover,
  334. .reveal .controls[data-controls-back-arrows="faded"] .navigate-up.enabled:hover {
  335. opacity: 1; }
  336. .reveal .controls[data-controls-back-arrows="hidden"] .navigate-left.enabled,
  337. .reveal .controls[data-controls-back-arrows="hidden"] .navigate-up.enabled {
  338. opacity: 0;
  339. visibility: hidden; }
  340. .reveal .controls .enabled {
  341. visibility: visible;
  342. opacity: 0.9;
  343. cursor: pointer;
  344. -webkit-transform: none;
  345. transform: none; }
  346. .reveal .controls .enabled.fragmented {
  347. opacity: 0.5; }
  348. .reveal .controls .enabled:hover,
  349. .reveal .controls .enabled.fragmented:hover {
  350. opacity: 1; }
  351. .reveal[data-navigation-mode="linear"].has-horizontal-slides .navigate-up,
  352. .reveal[data-navigation-mode="linear"].has-horizontal-slides .navigate-down {
  353. display: none; }
  354. .reveal[data-navigation-mode="linear"].has-horizontal-slides .navigate-left,
  355. .reveal:not(.has-vertical-slides) .controls .navigate-left {
  356. bottom: 1.4em;
  357. right: 5.5em; }
  358. .reveal[data-navigation-mode="linear"].has-horizontal-slides .navigate-right,
  359. .reveal:not(.has-vertical-slides) .controls .navigate-right {
  360. bottom: 1.4em;
  361. right: 0.5em; }
  362. .reveal:not(.has-horizontal-slides) .controls .navigate-up {
  363. right: 1.4em;
  364. bottom: 5em; }
  365. .reveal:not(.has-horizontal-slides) .controls .navigate-down {
  366. right: 1.4em;
  367. bottom: 0.5em; }
  368. .reveal.has-dark-background .controls {
  369. color: #fff; }
  370. .reveal.has-light-background .controls {
  371. color: #000; }
  372. .reveal.no-hover .controls .controls-arrow:hover:before,
  373. .reveal.no-hover .controls .controls-arrow:active:before {
  374. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(45deg);
  375. transform: translateX(0.5em) translateY(1.55em) rotate(45deg); }
  376. .reveal.no-hover .controls .controls-arrow:hover:after,
  377. .reveal.no-hover .controls .controls-arrow:active:after {
  378. -webkit-transform: translateX(0.5em) translateY(1.55em) rotate(-45deg);
  379. transform: translateX(0.5em) translateY(1.55em) rotate(-45deg); }
  380. @media screen and (min-width: 500px) {
  381. .reveal .controls[data-controls-layout="edges"] {
  382. top: 0;
  383. right: 0;
  384. bottom: 0;
  385. left: 0; }
  386. .reveal .controls[data-controls-layout="edges"] .navigate-left,
  387. .reveal .controls[data-controls-layout="edges"] .navigate-right,
  388. .reveal .controls[data-controls-layout="edges"] .navigate-up,
  389. .reveal .controls[data-controls-layout="edges"] .navigate-down {
  390. bottom: auto;
  391. right: auto; }
  392. .reveal .controls[data-controls-layout="edges"] .navigate-left {
  393. top: 50%;
  394. left: 8px;
  395. margin-top: -1.8em; }
  396. .reveal .controls[data-controls-layout="edges"] .navigate-right {
  397. top: 50%;
  398. right: 8px;
  399. margin-top: -1.8em; }
  400. .reveal .controls[data-controls-layout="edges"] .navigate-up {
  401. top: 8px;
  402. left: 50%;
  403. margin-left: -1.8em; }
  404. .reveal .controls[data-controls-layout="edges"] .navigate-down {
  405. bottom: 8px;
  406. left: 50%;
  407. margin-left: -1.8em; } }
  408. /*********************************************
  409. * PROGRESS BAR
  410. *********************************************/
  411. .reveal .progress {
  412. position: absolute;
  413. display: none;
  414. height: 3px;
  415. width: 100%;
  416. bottom: 0;
  417. left: 0;
  418. z-index: 10;
  419. background-color: rgba(0, 0, 0, 0.2);
  420. color: #fff; }
  421. .reveal .progress:after {
  422. content: '';
  423. display: block;
  424. position: absolute;
  425. height: 10px;
  426. width: 100%;
  427. top: -10px; }
  428. .reveal .progress span {
  429. display: block;
  430. height: 100%;
  431. width: 0px;
  432. background-color: currentColor;
  433. transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
  434. /*********************************************
  435. * SLIDE NUMBER
  436. *********************************************/
  437. .reveal .slide-number {
  438. position: absolute;
  439. display: block;
  440. right: 8px;
  441. bottom: 8px;
  442. z-index: 31;
  443. font-family: Helvetica, sans-serif;
  444. font-size: 12px;
  445. line-height: 1;
  446. color: #fff;
  447. background-color: rgba(0, 0, 0, 0.4);
  448. padding: 5px; }
  449. .reveal .slide-number a {
  450. color: currentColor; }
  451. .reveal .slide-number-delimiter {
  452. margin: 0 3px; }
  453. /*********************************************
  454. * SLIDES
  455. *********************************************/
  456. .reveal {
  457. position: relative;
  458. width: 100%;
  459. height: 100%;
  460. overflow: hidden;
  461. -ms-touch-action: pinch-zoom;
  462. touch-action: pinch-zoom; }
  463. .reveal .slides {
  464. position: absolute;
  465. width: 100%;
  466. height: 100%;
  467. top: 0;
  468. right: 0;
  469. bottom: 0;
  470. left: 0;
  471. margin: auto;
  472. pointer-events: none;
  473. overflow: visible;
  474. z-index: 1;
  475. text-align: center;
  476. -webkit-perspective: 600px;
  477. perspective: 600px;
  478. -webkit-perspective-origin: 50% 40%;
  479. perspective-origin: 50% 40%; }
  480. .reveal .slides > section {
  481. -webkit-perspective: 600px;
  482. perspective: 600px; }
  483. .reveal .slides > section,
  484. .reveal .slides > section > section {
  485. display: none;
  486. position: absolute;
  487. width: 100%;
  488. padding: 20px 0px;
  489. pointer-events: auto;
  490. z-index: 10;
  491. -webkit-transform-style: flat;
  492. transform-style: flat;
  493. transition: -webkit-transform-origin 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), -webkit-transform 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), visibility 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), opacity 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
  494. transition: transform-origin 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), transform 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), visibility 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), opacity 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
  495. /* Global transition speed settings */
  496. .reveal[data-transition-speed="fast"] .slides section {
  497. transition-duration: 400ms; }
  498. .reveal[data-transition-speed="slow"] .slides section {
  499. transition-duration: 1200ms; }
  500. /* Slide-specific transition speed overrides */
  501. .reveal .slides section[data-transition-speed="fast"] {
  502. transition-duration: 400ms; }
  503. .reveal .slides section[data-transition-speed="slow"] {
  504. transition-duration: 1200ms; }
  505. .reveal .slides > section.stack {
  506. padding-top: 0;
  507. padding-bottom: 0;
  508. pointer-events: none;
  509. height: 100%; }
  510. .reveal .slides > section.present,
  511. .reveal .slides > section > section.present {
  512. display: block;
  513. z-index: 11;
  514. opacity: 1; }
  515. .reveal .slides > section:empty,
  516. .reveal .slides > section > section:empty,
  517. .reveal .slides > section[data-background-interactive],
  518. .reveal .slides > section > section[data-background-interactive] {
  519. pointer-events: none; }
  520. .reveal.center,
  521. .reveal.center .slides,
  522. .reveal.center .slides section {
  523. min-height: 0 !important; }
  524. /* Don't allow interaction with invisible slides */
  525. .reveal .slides > section.future,
  526. .reveal .slides > section > section.future,
  527. .reveal .slides > section.past,
  528. .reveal .slides > section > section.past {
  529. pointer-events: none; }
  530. .reveal.overview .slides > section,
  531. .reveal.overview .slides > section > section {
  532. pointer-events: auto; }
  533. .reveal .slides > section.past,
  534. .reveal .slides > section.future,
  535. .reveal .slides > section > section.past,
  536. .reveal .slides > section > section.future {
  537. opacity: 0; }
  538. /*********************************************
  539. * Mixins for readability of transitions
  540. *********************************************/
  541. /*********************************************
  542. * SLIDE TRANSITION
  543. * Aliased 'linear' for backwards compatibility
  544. *********************************************/
  545. .reveal.slide section {
  546. -webkit-backface-visibility: hidden;
  547. backface-visibility: hidden; }
  548. .reveal .slides > section[data-transition=slide].past,
  549. .reveal .slides > section[data-transition~=slide-out].past,
  550. .reveal.slide .slides > section:not([data-transition]).past {
  551. -webkit-transform: translate(-150%, 0);
  552. transform: translate(-150%, 0); }
  553. .reveal .slides > section[data-transition=slide].future,
  554. .reveal .slides > section[data-transition~=slide-in].future,
  555. .reveal.slide .slides > section:not([data-transition]).future {
  556. -webkit-transform: translate(150%, 0);
  557. transform: translate(150%, 0); }
  558. .reveal .slides > section > section[data-transition=slide].past,
  559. .reveal .slides > section > section[data-transition~=slide-out].past,
  560. .reveal.slide .slides > section > section:not([data-transition]).past {
  561. -webkit-transform: translate(0, -150%);
  562. transform: translate(0, -150%); }
  563. .reveal .slides > section > section[data-transition=slide].future,
  564. .reveal .slides > section > section[data-transition~=slide-in].future,
  565. .reveal.slide .slides > section > section:not([data-transition]).future {
  566. -webkit-transform: translate(0, 150%);
  567. transform: translate(0, 150%); }
  568. .reveal.linear section {
  569. -webkit-backface-visibility: hidden;
  570. backface-visibility: hidden; }
  571. .reveal .slides > section[data-transition=linear].past,
  572. .reveal .slides > section[data-transition~=linear-out].past,
  573. .reveal.linear .slides > section:not([data-transition]).past {
  574. -webkit-transform: translate(-150%, 0);
  575. transform: translate(-150%, 0); }
  576. .reveal .slides > section[data-transition=linear].future,
  577. .reveal .slides > section[data-transition~=linear-in].future,
  578. .reveal.linear .slides > section:not([data-transition]).future {
  579. -webkit-transform: translate(150%, 0);
  580. transform: translate(150%, 0); }
  581. .reveal .slides > section > section[data-transition=linear].past,
  582. .reveal .slides > section > section[data-transition~=linear-out].past,
  583. .reveal.linear .slides > section > section:not([data-transition]).past {
  584. -webkit-transform: translate(0, -150%);
  585. transform: translate(0, -150%); }
  586. .reveal .slides > section > section[data-transition=linear].future,
  587. .reveal .slides > section > section[data-transition~=linear-in].future,
  588. .reveal.linear .slides > section > section:not([data-transition]).future {
  589. -webkit-transform: translate(0, 150%);
  590. transform: translate(0, 150%); }
  591. /*********************************************
  592. * CONVEX TRANSITION
  593. * Aliased 'default' for backwards compatibility
  594. *********************************************/
  595. .reveal .slides section[data-transition=default].stack,
  596. .reveal.default .slides section.stack {
  597. -webkit-transform-style: preserve-3d;
  598. transform-style: preserve-3d; }
  599. .reveal .slides > section[data-transition=default].past,
  600. .reveal .slides > section[data-transition~=default-out].past,
  601. .reveal.default .slides > section:not([data-transition]).past {
  602. -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0);
  603. transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); }
  604. .reveal .slides > section[data-transition=default].future,
  605. .reveal .slides > section[data-transition~=default-in].future,
  606. .reveal.default .slides > section:not([data-transition]).future {
  607. -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0);
  608. transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); }
  609. .reveal .slides > section > section[data-transition=default].past,
  610. .reveal .slides > section > section[data-transition~=default-out].past,
  611. .reveal.default .slides > section > section:not([data-transition]).past {
  612. -webkit-transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0);
  613. transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); }
  614. .reveal .slides > section > section[data-transition=default].future,
  615. .reveal .slides > section > section[data-transition~=default-in].future,
  616. .reveal.default .slides > section > section:not([data-transition]).future {
  617. -webkit-transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0);
  618. transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); }
  619. .reveal .slides section[data-transition=convex].stack,
  620. .reveal.convex .slides section.stack {
  621. -webkit-transform-style: preserve-3d;
  622. transform-style: preserve-3d; }
  623. .reveal .slides > section[data-transition=convex].past,
  624. .reveal .slides > section[data-transition~=convex-out].past,
  625. .reveal.convex .slides > section:not([data-transition]).past {
  626. -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0);
  627. transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); }
  628. .reveal .slides > section[data-transition=convex].future,
  629. .reveal .slides > section[data-transition~=convex-in].future,
  630. .reveal.convex .slides > section:not([data-transition]).future {
  631. -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0);
  632. transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); }
  633. .reveal .slides > section > section[data-transition=convex].past,
  634. .reveal .slides > section > section[data-transition~=convex-out].past,
  635. .reveal.convex .slides > section > section:not([data-transition]).past {
  636. -webkit-transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0);
  637. transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); }
  638. .reveal .slides > section > section[data-transition=convex].future,
  639. .reveal .slides > section > section[data-transition~=convex-in].future,
  640. .reveal.convex .slides > section > section:not([data-transition]).future {
  641. -webkit-transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0);
  642. transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); }
  643. /*********************************************
  644. * CONCAVE TRANSITION
  645. *********************************************/
  646. .reveal .slides section[data-transition=concave].stack,
  647. .reveal.concave .slides section.stack {
  648. -webkit-transform-style: preserve-3d;
  649. transform-style: preserve-3d; }
  650. .reveal .slides > section[data-transition=concave].past,
  651. .reveal .slides > section[data-transition~=concave-out].past,
  652. .reveal.concave .slides > section:not([data-transition]).past {
  653. -webkit-transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0);
  654. transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); }
  655. .reveal .slides > section[data-transition=concave].future,
  656. .reveal .slides > section[data-transition~=concave-in].future,
  657. .reveal.concave .slides > section:not([data-transition]).future {
  658. -webkit-transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0);
  659. transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); }
  660. .reveal .slides > section > section[data-transition=concave].past,
  661. .reveal .slides > section > section[data-transition~=concave-out].past,
  662. .reveal.concave .slides > section > section:not([data-transition]).past {
  663. -webkit-transform: translate3d(0, -80%, 0) rotateX(-70deg) translate3d(0, -80%, 0);
  664. transform: translate3d(0, -80%, 0) rotateX(-70deg) translate3d(0, -80%, 0); }
  665. .reveal .slides > section > section[data-transition=concave].future,
  666. .reveal .slides > section > section[data-transition~=concave-in].future,
  667. .reveal.concave .slides > section > section:not([data-transition]).future {
  668. -webkit-transform: translate3d(0, 80%, 0) rotateX(70deg) translate3d(0, 80%, 0);
  669. transform: translate3d(0, 80%, 0) rotateX(70deg) translate3d(0, 80%, 0); }
  670. /*********************************************
  671. * ZOOM TRANSITION
  672. *********************************************/
  673. .reveal .slides section[data-transition=zoom],
  674. .reveal.zoom .slides section:not([data-transition]) {
  675. transition-timing-function: ease; }
  676. .reveal .slides > section[data-transition=zoom].past,
  677. .reveal .slides > section[data-transition~=zoom-out].past,
  678. .reveal.zoom .slides > section:not([data-transition]).past {
  679. visibility: hidden;
  680. -webkit-transform: scale(16);
  681. transform: scale(16); }
  682. .reveal .slides > section[data-transition=zoom].future,
  683. .reveal .slides > section[data-transition~=zoom-in].future,
  684. .reveal.zoom .slides > section:not([data-transition]).future {
  685. visibility: hidden;
  686. -webkit-transform: scale(0.2);
  687. transform: scale(0.2); }
  688. .reveal .slides > section > section[data-transition=zoom].past,
  689. .reveal .slides > section > section[data-transition~=zoom-out].past,
  690. .reveal.zoom .slides > section > section:not([data-transition]).past {
  691. -webkit-transform: scale(16);
  692. transform: scale(16); }
  693. .reveal .slides > section > section[data-transition=zoom].future,
  694. .reveal .slides > section > section[data-transition~=zoom-in].future,
  695. .reveal.zoom .slides > section > section:not([data-transition]).future {
  696. -webkit-transform: scale(0.2);
  697. transform: scale(0.2); }
  698. /*********************************************
  699. * CUBE TRANSITION
  700. *
  701. * WARNING:
  702. * this is deprecated and will be removed in a
  703. * future version.
  704. *********************************************/
  705. .reveal.cube .slides {
  706. -webkit-perspective: 1300px;
  707. perspective: 1300px; }
  708. .reveal.cube .slides section {
  709. padding: 30px;
  710. min-height: 700px;
  711. -webkit-backface-visibility: hidden;
  712. backface-visibility: hidden;
  713. box-sizing: border-box;
  714. -webkit-transform-style: preserve-3d;
  715. transform-style: preserve-3d; }
  716. .reveal.center.cube .slides section {
  717. min-height: 0; }
  718. .reveal.cube .slides section:not(.stack):before {
  719. content: '';
  720. position: absolute;
  721. display: block;
  722. width: 100%;
  723. height: 100%;
  724. left: 0;
  725. top: 0;
  726. background: rgba(0, 0, 0, 0.1);
  727. border-radius: 4px;
  728. -webkit-transform: translateZ(-20px);
  729. transform: translateZ(-20px); }
  730. .reveal.cube .slides section:not(.stack):after {
  731. content: '';
  732. position: absolute;
  733. display: block;
  734. width: 90%;
  735. height: 30px;
  736. left: 5%;
  737. bottom: 0;
  738. background: none;
  739. z-index: 1;
  740. border-radius: 4px;
  741. box-shadow: 0px 95px 25px rgba(0, 0, 0, 0.2);
  742. -webkit-transform: translateZ(-90px) rotateX(65deg);
  743. transform: translateZ(-90px) rotateX(65deg); }
  744. .reveal.cube .slides > section.stack {
  745. padding: 0;
  746. background: none; }
  747. .reveal.cube .slides > section.past {
  748. -webkit-transform-origin: 100% 0%;
  749. transform-origin: 100% 0%;
  750. -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg);
  751. transform: translate3d(-100%, 0, 0) rotateY(-90deg); }
  752. .reveal.cube .slides > section.future {
  753. -webkit-transform-origin: 0% 0%;
  754. transform-origin: 0% 0%;
  755. -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg);
  756. transform: translate3d(100%, 0, 0) rotateY(90deg); }
  757. .reveal.cube .slides > section > section.past {
  758. -webkit-transform-origin: 0% 100%;
  759. transform-origin: 0% 100%;
  760. -webkit-transform: translate3d(0, -100%, 0) rotateX(90deg);
  761. transform: translate3d(0, -100%, 0) rotateX(90deg); }
  762. .reveal.cube .slides > section > section.future {
  763. -webkit-transform-origin: 0% 0%;
  764. transform-origin: 0% 0%;
  765. -webkit-transform: translate3d(0, 100%, 0) rotateX(-90deg);
  766. transform: translate3d(0, 100%, 0) rotateX(-90deg); }
  767. /*********************************************
  768. * PAGE TRANSITION
  769. *
  770. * WARNING:
  771. * this is deprecated and will be removed in a
  772. * future version.
  773. *********************************************/
  774. .reveal.page .slides {
  775. -webkit-perspective-origin: 0% 50%;
  776. perspective-origin: 0% 50%;
  777. -webkit-perspective: 3000px;
  778. perspective: 3000px; }
  779. .reveal.page .slides section {
  780. padding: 30px;
  781. min-height: 700px;
  782. box-sizing: border-box;
  783. -webkit-transform-style: preserve-3d;
  784. transform-style: preserve-3d; }
  785. .reveal.page .slides section.past {
  786. z-index: 12; }
  787. .reveal.page .slides section:not(.stack):before {
  788. content: '';
  789. position: absolute;
  790. display: block;
  791. width: 100%;
  792. height: 100%;
  793. left: 0;
  794. top: 0;
  795. background: rgba(0, 0, 0, 0.1);
  796. -webkit-transform: translateZ(-20px);
  797. transform: translateZ(-20px); }
  798. .reveal.page .slides section:not(.stack):after {
  799. content: '';
  800. position: absolute;
  801. display: block;
  802. width: 90%;
  803. height: 30px;
  804. left: 5%;
  805. bottom: 0;
  806. background: none;
  807. z-index: 1;
  808. border-radius: 4px;
  809. box-shadow: 0px 95px 25px rgba(0, 0, 0, 0.2);
  810. -webkit-transform: translateZ(-90px) rotateX(65deg); }
  811. .reveal.page .slides > section.stack {
  812. padding: 0;
  813. background: none; }
  814. .reveal.page .slides > section.past {
  815. -webkit-transform-origin: 0% 0%;
  816. transform-origin: 0% 0%;
  817. -webkit-transform: translate3d(-40%, 0, 0) rotateY(-80deg);
  818. transform: translate3d(-40%, 0, 0) rotateY(-80deg); }
  819. .reveal.page .slides > section.future {
  820. -webkit-transform-origin: 100% 0%;
  821. transform-origin: 100% 0%;
  822. -webkit-transform: translate3d(0, 0, 0);
  823. transform: translate3d(0, 0, 0); }
  824. .reveal.page .slides > section > section.past {
  825. -webkit-transform-origin: 0% 0%;
  826. transform-origin: 0% 0%;
  827. -webkit-transform: translate3d(0, -40%, 0) rotateX(80deg);
  828. transform: translate3d(0, -40%, 0) rotateX(80deg); }
  829. .reveal.page .slides > section > section.future {
  830. -webkit-transform-origin: 0% 100%;
  831. transform-origin: 0% 100%;
  832. -webkit-transform: translate3d(0, 0, 0);
  833. transform: translate3d(0, 0, 0); }
  834. /*********************************************
  835. * FADE TRANSITION
  836. *********************************************/
  837. .reveal .slides section[data-transition=fade],
  838. .reveal.fade .slides section:not([data-transition]),
  839. .reveal.fade .slides > section > section:not([data-transition]) {
  840. -webkit-transform: none;
  841. transform: none;
  842. transition: opacity 0.5s; }
  843. .reveal.fade.overview .slides section,
  844. .reveal.fade.overview .slides > section > section {
  845. transition: none; }
  846. /*********************************************
  847. * NO TRANSITION
  848. *********************************************/
  849. .reveal .slides section[data-transition=none],
  850. .reveal.none .slides section:not([data-transition]) {
  851. -webkit-transform: none;
  852. transform: none;
  853. transition: none; }
  854. /*********************************************
  855. * PAUSED MODE
  856. *********************************************/
  857. .reveal .pause-overlay {
  858. position: absolute;
  859. top: 0;
  860. left: 0;
  861. width: 100%;
  862. height: 100%;
  863. background: black;
  864. visibility: hidden;
  865. opacity: 0;
  866. z-index: 100;
  867. transition: all 1s ease; }
  868. .reveal .pause-overlay .resume-button {
  869. position: absolute;
  870. bottom: 20px;
  871. right: 20px;
  872. color: #ccc;
  873. border-radius: 2px;
  874. padding: 6px 14px;
  875. border: 2px solid #ccc;
  876. font-size: 16px;
  877. background: transparent;
  878. cursor: pointer; }
  879. .reveal .pause-overlay .resume-button:hover {
  880. color: #fff;
  881. border-color: #fff; }
  882. .reveal.paused .pause-overlay {
  883. visibility: visible;
  884. opacity: 1; }
  885. /*********************************************
  886. * FALLBACK
  887. *********************************************/
  888. .no-transforms {
  889. overflow-y: auto; }
  890. .no-transforms .reveal {
  891. overflow: visible; }
  892. .no-transforms .reveal .slides {
  893. position: relative;
  894. width: 80%;
  895. max-width: 1280px;
  896. height: auto;
  897. top: 0;
  898. margin: 0 auto;
  899. text-align: center; }
  900. .no-transforms .reveal .controls,
  901. .no-transforms .reveal .progress {
  902. display: none; }
  903. .no-transforms .reveal .slides section {
  904. display: block;
  905. opacity: 1;
  906. position: relative;
  907. height: auto;
  908. min-height: 0;
  909. top: 0;
  910. left: 0;
  911. margin: 10vh 0;
  912. margin: 70px 0;
  913. -webkit-transform: none;
  914. transform: none; }
  915. .reveal .no-transition,
  916. .reveal .no-transition * {
  917. transition: none !important; }
  918. /*********************************************
  919. * PER-SLIDE BACKGROUNDS
  920. *********************************************/
  921. .reveal .backgrounds {
  922. position: absolute;
  923. width: 100%;
  924. height: 100%;
  925. top: 0;
  926. left: 0;
  927. -webkit-perspective: 600px;
  928. perspective: 600px; }
  929. .reveal .slide-background {
  930. display: none;
  931. position: absolute;
  932. width: 100%;
  933. height: 100%;
  934. opacity: 0;
  935. visibility: hidden;
  936. overflow: hidden;
  937. background-color: rgba(0, 0, 0, 0);
  938. transition: all 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
  939. .reveal .slide-background-content {
  940. position: absolute;
  941. width: 100%;
  942. height: 100%;
  943. background-position: 50% 50%;
  944. background-repeat: no-repeat;
  945. background-size: cover; }
  946. .reveal .slide-background.stack {
  947. display: block; }
  948. .reveal .slide-background.present {
  949. opacity: 1;
  950. visibility: visible;
  951. z-index: 2; }
  952. .print-pdf .reveal .slide-background {
  953. opacity: 1 !important;
  954. visibility: visible !important; }
  955. /* Video backgrounds */
  956. .reveal .slide-background video {
  957. position: absolute;
  958. width: 100%;
  959. height: 100%;
  960. max-width: none;
  961. max-height: none;
  962. top: 0;
  963. left: 0;
  964. -o-object-fit: cover;
  965. object-fit: cover; }
  966. .reveal .slide-background[data-background-size="contain"] video {
  967. -o-object-fit: contain;
  968. object-fit: contain; }
  969. /* Immediate transition style */
  970. .reveal[data-background-transition=none] > .backgrounds .slide-background,
  971. .reveal > .backgrounds .slide-background[data-background-transition=none] {
  972. transition: none; }
  973. /* Slide */
  974. .reveal[data-background-transition=slide] > .backgrounds .slide-background,
  975. .reveal > .backgrounds .slide-background[data-background-transition=slide] {
  976. opacity: 1;
  977. -webkit-backface-visibility: hidden;
  978. backface-visibility: hidden; }
  979. .reveal[data-background-transition=slide] > .backgrounds .slide-background.past,
  980. .reveal > .backgrounds .slide-background.past[data-background-transition=slide] {
  981. -webkit-transform: translate(-100%, 0);
  982. transform: translate(-100%, 0); }
  983. .reveal[data-background-transition=slide] > .backgrounds .slide-background.future,
  984. .reveal > .backgrounds .slide-background.future[data-background-transition=slide] {
  985. -webkit-transform: translate(100%, 0);
  986. transform: translate(100%, 0); }
  987. .reveal[data-background-transition=slide] > .backgrounds .slide-background > .slide-background.past,
  988. .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=slide] {
  989. -webkit-transform: translate(0, -100%);
  990. transform: translate(0, -100%); }
  991. .reveal[data-background-transition=slide] > .backgrounds .slide-background > .slide-background.future,
  992. .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=slide] {
  993. -webkit-transform: translate(0, 100%);
  994. transform: translate(0, 100%); }
  995. /* Convex */
  996. .reveal[data-background-transition=convex] > .backgrounds .slide-background.past,
  997. .reveal > .backgrounds .slide-background.past[data-background-transition=convex] {
  998. opacity: 0;
  999. -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0);
  1000. transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); }
  1001. .reveal[data-background-transition=convex] > .backgrounds .slide-background.future,
  1002. .reveal > .backgrounds .slide-background.future[data-background-transition=convex] {
  1003. opacity: 0;
  1004. -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0);
  1005. transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); }
  1006. .reveal[data-background-transition=convex] > .backgrounds .slide-background > .slide-background.past,
  1007. .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=convex] {
  1008. opacity: 0;
  1009. -webkit-transform: translate3d(0, -100%, 0) rotateX(90deg) translate3d(0, -100%, 0);
  1010. transform: translate3d(0, -100%, 0) rotateX(90deg) translate3d(0, -100%, 0); }
  1011. .reveal[data-background-transition=convex] > .backgrounds .slide-background > .slide-background.future,
  1012. .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=convex] {
  1013. opacity: 0;
  1014. -webkit-transform: translate3d(0, 100%, 0) rotateX(-90deg) translate3d(0, 100%, 0);
  1015. transform: translate3d(0, 100%, 0) rotateX(-90deg) translate3d(0, 100%, 0); }
  1016. /* Concave */
  1017. .reveal[data-background-transition=concave] > .backgrounds .slide-background.past,
  1018. .reveal > .backgrounds .slide-background.past[data-background-transition=concave] {
  1019. opacity: 0;
  1020. -webkit-transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0);
  1021. transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); }
  1022. .reveal[data-background-transition=concave] > .backgrounds .slide-background.future,
  1023. .reveal > .backgrounds .slide-background.future[data-background-transition=concave] {
  1024. opacity: 0;
  1025. -webkit-transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0);
  1026. transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); }
  1027. .reveal[data-background-transition=concave] > .backgrounds .slide-background > .slide-background.past,
  1028. .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=concave] {
  1029. opacity: 0;
  1030. -webkit-transform: translate3d(0, -100%, 0) rotateX(-90deg) translate3d(0, -100%, 0);
  1031. transform: translate3d(0, -100%, 0) rotateX(-90deg) translate3d(0, -100%, 0); }
  1032. .reveal[data-background-transition=concave] > .backgrounds .slide-background > .slide-background.future,
  1033. .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=concave] {
  1034. opacity: 0;
  1035. -webkit-transform: translate3d(0, 100%, 0) rotateX(90deg) translate3d(0, 100%, 0);
  1036. transform: translate3d(0, 100%, 0) rotateX(90deg) translate3d(0, 100%, 0); }
  1037. /* Zoom */
  1038. .reveal[data-background-transition=zoom] > .backgrounds .slide-background,
  1039. .reveal > .backgrounds .slide-background[data-background-transition=zoom] {
  1040. transition-timing-function: ease; }
  1041. .reveal[data-background-transition=zoom] > .backgrounds .slide-background.past,
  1042. .reveal > .backgrounds .slide-background.past[data-background-transition=zoom] {
  1043. opacity: 0;
  1044. visibility: hidden;
  1045. -webkit-transform: scale(16);
  1046. transform: scale(16); }
  1047. .reveal[data-background-transition=zoom] > .backgrounds .slide-background.future,
  1048. .reveal > .backgrounds .slide-background.future[data-background-transition=zoom] {
  1049. opacity: 0;
  1050. visibility: hidden;
  1051. -webkit-transform: scale(0.2);
  1052. transform: scale(0.2); }
  1053. .reveal[data-background-transition=zoom] > .backgrounds .slide-background > .slide-background.past,
  1054. .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=zoom] {
  1055. opacity: 0;
  1056. visibility: hidden;
  1057. -webkit-transform: scale(16);
  1058. transform: scale(16); }
  1059. .reveal[data-background-transition=zoom] > .backgrounds .slide-background > .slide-background.future,
  1060. .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=zoom] {
  1061. opacity: 0;
  1062. visibility: hidden;
  1063. -webkit-transform: scale(0.2);
  1064. transform: scale(0.2); }
  1065. /* Global transition speed settings */
  1066. .reveal[data-transition-speed="fast"] > .backgrounds .slide-background {
  1067. transition-duration: 400ms; }
  1068. .reveal[data-transition-speed="slow"] > .backgrounds .slide-background {
  1069. transition-duration: 1200ms; }
  1070. /*********************************************
  1071. * OVERVIEW
  1072. *********************************************/
  1073. .reveal.overview {
  1074. -webkit-perspective-origin: 50% 50%;
  1075. perspective-origin: 50% 50%;
  1076. -webkit-perspective: 700px;
  1077. perspective: 700px; }
  1078. .reveal.overview .slides {
  1079. -moz-transform-style: preserve-3d; }
  1080. .reveal.overview .slides section {
  1081. height: 100%;
  1082. top: 0 !important;
  1083. opacity: 1 !important;
  1084. overflow: hidden;
  1085. visibility: visible !important;
  1086. cursor: pointer;
  1087. box-sizing: border-box; }
  1088. .reveal.overview .slides section:hover,
  1089. .reveal.overview .slides section.present {
  1090. outline: 10px solid rgba(150, 150, 150, 0.4);
  1091. outline-offset: 10px; }
  1092. .reveal.overview .slides section .fragment {
  1093. opacity: 1;
  1094. transition: none; }
  1095. .reveal.overview .slides section:after,
  1096. .reveal.overview .slides section:before {
  1097. display: none !important; }
  1098. .reveal.overview .slides > section.stack {
  1099. padding: 0;
  1100. top: 0 !important;
  1101. background: none;
  1102. outline: none;
  1103. overflow: visible; }
  1104. .reveal.overview .backgrounds {
  1105. -webkit-perspective: inherit;
  1106. perspective: inherit;
  1107. -moz-transform-style: preserve-3d; }
  1108. .reveal.overview .backgrounds .slide-background {
  1109. opacity: 1;
  1110. visibility: visible;
  1111. outline: 10px solid rgba(150, 150, 150, 0.1);
  1112. outline-offset: 10px; }
  1113. .reveal.overview .backgrounds .slide-background.stack {
  1114. overflow: visible; }
  1115. .reveal.overview .slides section,
  1116. .reveal.overview-deactivating .slides section {
  1117. transition: none; }
  1118. .reveal.overview .backgrounds .slide-background,
  1119. .reveal.overview-deactivating .backgrounds .slide-background {
  1120. transition: none; }
  1121. /*********************************************
  1122. * RTL SUPPORT
  1123. *********************************************/
  1124. .reveal.rtl .slides,
  1125. .reveal.rtl .slides h1,
  1126. .reveal.rtl .slides h2,
  1127. .reveal.rtl .slides h3,
  1128. .reveal.rtl .slides h4,
  1129. .reveal.rtl .slides h5,
  1130. .reveal.rtl .slides h6 {
  1131. direction: rtl;
  1132. font-family: sans-serif; }
  1133. .reveal.rtl pre,
  1134. .reveal.rtl code {
  1135. direction: ltr; }
  1136. .reveal.rtl ol,
  1137. .reveal.rtl ul {
  1138. text-align: right; }
  1139. .reveal.rtl .progress span {
  1140. float: right; }
  1141. /*********************************************
  1142. * PARALLAX BACKGROUND
  1143. *********************************************/
  1144. .reveal.has-parallax-background .backgrounds {
  1145. transition: all 0.8s ease; }
  1146. /* Global transition speed settings */
  1147. .reveal.has-parallax-background[data-transition-speed="fast"] .backgrounds {
  1148. transition-duration: 400ms; }
  1149. .reveal.has-parallax-background[data-transition-speed="slow"] .backgrounds {
  1150. transition-duration: 1200ms; }
  1151. /*********************************************
  1152. * OVERLAY FOR LINK PREVIEWS AND HELP
  1153. *********************************************/
  1154. .reveal > .overlay {
  1155. position: absolute;
  1156. top: 0;
  1157. left: 0;
  1158. width: 100%;
  1159. height: 100%;
  1160. z-index: 1000;
  1161. background: rgba(0, 0, 0, 0.9);
  1162. opacity: 0;
  1163. visibility: hidden;
  1164. transition: all 0.3s ease; }
  1165. .reveal > .overlay.visible {
  1166. opacity: 1;
  1167. visibility: visible; }
  1168. .reveal > .overlay .spinner {
  1169. position: absolute;
  1170. display: block;
  1171. top: 50%;
  1172. left: 50%;
  1173. width: 32px;
  1174. height: 32px;
  1175. margin: -16px 0 0 -16px;
  1176. z-index: 10;
  1177. background-image: url(data:image/gif;base64,R0lGODlhIAAgAPMAAJmZmf%2F%2F%2F6%2Bvr8nJybW1tcDAwOjo6Nvb26ioqKOjo7Ozs%2FLy8vz8%2FAAAAAAAAAAAACH%2FC05FVFNDQVBFMi4wAwEAAAAh%2FhpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh%2BQQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ%2FV%2FnmOM82XiHRLYKhKP1oZmADdEAAAh%2BQQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY%2FCZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB%2BA4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6%2BHo7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq%2BB6QDtuetcaBPnW6%2BO7wDHpIiK9SaVK5GgV543tzjgGcghAgAh%2BQQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK%2B%2BG%2Bw48edZPK%2BM6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE%2BG%2BcD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm%2BFNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk%2BaV%2BoJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0%2FVNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc%2BXiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30%2FiI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE%2FjiuL04RGEBgwWhShRgQExHBAAh%2BQQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR%2BipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY%2BYip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd%2BMFCN6HAAIKgNggY0KtEBAAh%2BQQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1%2BvsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d%2BjYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg%2BygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0%2Bbm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h%2BKr0SJ8MFihpNbx%2B4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX%2BBP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA%3D%3D);
  1178. visibility: visible;
  1179. opacity: 0.6;
  1180. transition: all 0.3s ease; }
  1181. .reveal > .overlay header {
  1182. position: absolute;
  1183. left: 0;
  1184. top: 0;
  1185. width: 100%;
  1186. height: 40px;
  1187. z-index: 2;
  1188. border-bottom: 1px solid #222; }
  1189. .reveal > .overlay header a {
  1190. display: inline-block;
  1191. width: 40px;
  1192. height: 40px;
  1193. line-height: 36px;
  1194. padding: 0 10px;
  1195. float: right;
  1196. opacity: 0.6;
  1197. box-sizing: border-box; }
  1198. .reveal > .overlay header a:hover {
  1199. opacity: 1; }
  1200. .reveal > .overlay header a .icon {
  1201. display: inline-block;
  1202. width: 20px;
  1203. height: 20px;
  1204. background-position: 50% 50%;
  1205. background-size: 100%;
  1206. background-repeat: no-repeat; }
  1207. .reveal > .overlay header a.close .icon {
  1208. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABkklEQVRYR8WX4VHDMAxG6wnoJrABZQPYBCaBTWAD2g1gE5gg6OOsXuxIlr40d81dfrSJ9V4c2VLK7spHuTJ/5wpM07QXuXc5X0opX2tEJcadjHuV80li/FgxTIEK/5QBCICBD6xEhSMGHgQPgBgLiYVAB1dpSqKDawxTohFw4JSEA3clzgIBPCURwE2JucBR7rhPJJv5OpJwDX+SfDjgx1wACQeJG1aChP9K/IMmdZ8DtESV1WyP3Bt4MwM6sj4NMxMYiqUWHQu4KYA/SYkIjOsm3BXYWMKFDwU2khjCQ4ELJUJ4SmClRArOCmSXGuKma0fYD5CbzHxFpCSGAhfAVSSUGDUk2BWZaff2g6GE15BsBQ9nwmpIGDiyHQddwNTMKkbZaf9fajXQca1EX44puJZUsnY0ObGmITE3GVLCbEhQUjGVt146j6oasWN+49Vph2w1pZ5EansNZqKBm1txbU57iRRcZ86RWMDdWtBJUHBHwoQPi1GV+JCbntmvok7iTX4/Up9mgyTc/FJYDTcndgH/AA5A/CHsyEkVAAAAAElFTkSuQmCC); }
  1209. .reveal > .overlay header a.external .icon {
  1210. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAcElEQVRYR+2WSQoAIQwEzf8f7XiOMkUQxUPlGkM3hVmiQfQR9GYnH1SsAQlI4DiBqkCMoNb9y2e90IAEJPAcgdznU9+engMaeJ7Azh5Y1U67gAho4DqBqmB1buAf0MB1AlVBek83ZPkmJMGc1wAR+AAqod/B97TRpQAAAABJRU5ErkJggg==); }
  1211. .reveal > .overlay .viewport {
  1212. position: absolute;
  1213. display: -webkit-box;
  1214. display: -ms-flexbox;
  1215. display: flex;
  1216. top: 40px;
  1217. right: 0;
  1218. bottom: 0;
  1219. left: 0; }
  1220. .reveal > .overlay.overlay-preview .viewport iframe {
  1221. width: 100%;
  1222. height: 100%;
  1223. max-width: 100%;
  1224. max-height: 100%;
  1225. border: 0;
  1226. opacity: 0;
  1227. visibility: hidden;
  1228. transition: all 0.3s ease; }
  1229. .reveal > .overlay.overlay-preview.loaded .viewport iframe {
  1230. opacity: 1;
  1231. visibility: visible; }
  1232. .reveal > .overlay.overlay-preview.loaded .viewport-inner {
  1233. position: absolute;
  1234. z-index: -1;
  1235. left: 0;
  1236. top: 45%;
  1237. width: 100%;
  1238. text-align: center;
  1239. letter-spacing: normal; }
  1240. .reveal > .overlay.overlay-preview .x-frame-error {
  1241. opacity: 0;
  1242. transition: opacity 0.3s ease 0.3s; }
  1243. .reveal > .overlay.overlay-preview.loaded .x-frame-error {
  1244. opacity: 1; }
  1245. .reveal > .overlay.overlay-preview.loaded .spinner {
  1246. opacity: 0;
  1247. visibility: hidden;
  1248. -webkit-transform: scale(0.2);
  1249. transform: scale(0.2); }
  1250. .reveal > .overlay.overlay-help .viewport {
  1251. overflow: auto;
  1252. color: #fff; }
  1253. .reveal > .overlay.overlay-help .viewport .viewport-inner {
  1254. width: 600px;
  1255. margin: auto;
  1256. padding: 20px 20px 80px 20px;
  1257. text-align: center;
  1258. letter-spacing: normal; }
  1259. .reveal > .overlay.overlay-help .viewport .viewport-inner .title {
  1260. font-size: 20px; }
  1261. .reveal > .overlay.overlay-help .viewport .viewport-inner table {
  1262. border: 1px solid #fff;
  1263. border-collapse: collapse;
  1264. font-size: 16px; }
  1265. .reveal > .overlay.overlay-help .viewport .viewport-inner table th,
  1266. .reveal > .overlay.overlay-help .viewport .viewport-inner table td {
  1267. width: 200px;
  1268. padding: 14px;
  1269. border: 1px solid #fff;
  1270. vertical-align: middle; }
  1271. .reveal > .overlay.overlay-help .viewport .viewport-inner table th {
  1272. padding-top: 20px;
  1273. padding-bottom: 20px; }
  1274. /*********************************************
  1275. * PLAYBACK COMPONENT
  1276. *********************************************/
  1277. .reveal .playback {
  1278. position: absolute;
  1279. left: 15px;
  1280. bottom: 20px;
  1281. z-index: 30;
  1282. cursor: pointer;
  1283. transition: all 400ms ease;
  1284. -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
  1285. .reveal.overview .playback {
  1286. opacity: 0;
  1287. visibility: hidden; }
  1288. /*********************************************
  1289. * CODE HIGHLGIHTING
  1290. *********************************************/
  1291. .reveal .hljs table {
  1292. margin: initial; }
  1293. .reveal .hljs-ln-code,
  1294. .reveal .hljs-ln-numbers {
  1295. padding: 0;
  1296. border: 0; }
  1297. .reveal .hljs-ln-numbers {
  1298. opacity: 0.6;
  1299. padding-right: 0.75em;
  1300. text-align: right;
  1301. vertical-align: top; }
  1302. .reveal .hljs[data-line-numbers]:not([data-line-numbers=""]) tr:not(.highlight-line) {
  1303. opacity: 0.4; }
  1304. /*********************************************
  1305. * ROLLING LINKS
  1306. *********************************************/
  1307. .reveal .roll {
  1308. display: inline-block;
  1309. line-height: 1.2;
  1310. overflow: hidden;
  1311. vertical-align: top;
  1312. -webkit-perspective: 400px;
  1313. perspective: 400px;
  1314. -webkit-perspective-origin: 50% 50%;
  1315. perspective-origin: 50% 50%; }
  1316. .reveal .roll:hover {
  1317. background: none;
  1318. text-shadow: none; }
  1319. .reveal .roll span {
  1320. display: block;
  1321. position: relative;
  1322. padding: 0 2px;
  1323. pointer-events: none;
  1324. transition: all 400ms ease;
  1325. -webkit-transform-origin: 50% 0%;
  1326. transform-origin: 50% 0%;
  1327. -webkit-transform-style: preserve-3d;
  1328. transform-style: preserve-3d;
  1329. -webkit-backface-visibility: hidden;
  1330. backface-visibility: hidden; }
  1331. .reveal .roll:hover span {
  1332. background: rgba(0, 0, 0, 0.5);
  1333. -webkit-transform: translate3d(0px, 0px, -45px) rotateX(90deg);
  1334. transform: translate3d(0px, 0px, -45px) rotateX(90deg); }
  1335. .reveal .roll span:after {
  1336. content: attr(data-title);
  1337. display: block;
  1338. position: absolute;
  1339. left: 0;
  1340. top: 0;
  1341. padding: 0 2px;
  1342. -webkit-backface-visibility: hidden;
  1343. backface-visibility: hidden;
  1344. -webkit-transform-origin: 50% 0%;
  1345. transform-origin: 50% 0%;
  1346. -webkit-transform: translate3d(0px, 110%, 0px) rotateX(-90deg);
  1347. transform: translate3d(0px, 110%, 0px) rotateX(-90deg); }
  1348. /*********************************************
  1349. * SPEAKER NOTES
  1350. *********************************************/
  1351. .reveal aside.notes {
  1352. display: none; }
  1353. .reveal .speaker-notes {
  1354. display: none;
  1355. position: absolute;
  1356. width: 33.3333333333%;
  1357. height: 100%;
  1358. top: 0;
  1359. left: 100%;
  1360. padding: 14px 18px 14px 18px;
  1361. z-index: 1;
  1362. font-size: 18px;
  1363. line-height: 1.4;
  1364. border: 1px solid rgba(0, 0, 0, 0.05);
  1365. color: #222;
  1366. background-color: #f5f5f5;
  1367. overflow: auto;
  1368. box-sizing: border-box;
  1369. text-align: left;
  1370. font-family: Helvetica, sans-serif;
  1371. -webkit-overflow-scrolling: touch; }
  1372. .reveal .speaker-notes .notes-placeholder {
  1373. color: #ccc;
  1374. font-style: italic; }
  1375. .reveal .speaker-notes:focus {
  1376. outline: none; }
  1377. .reveal .speaker-notes:before {
  1378. content: 'Speaker notes';
  1379. display: block;
  1380. margin-bottom: 10px;
  1381. opacity: 0.5; }
  1382. .reveal.show-notes {
  1383. max-width: 75%;
  1384. overflow: visible; }
  1385. .reveal.show-notes .speaker-notes {
  1386. display: block; }
  1387. @media screen and (min-width: 1600px) {
  1388. .reveal .speaker-notes {
  1389. font-size: 20px; } }
  1390. @media screen and (max-width: 1024px) {
  1391. .reveal.show-notes {
  1392. border-left: 0;
  1393. max-width: none;
  1394. max-height: 70%;
  1395. max-height: 70vh;
  1396. overflow: visible; }
  1397. .reveal.show-notes .speaker-notes {
  1398. top: 100%;
  1399. left: 0;
  1400. width: 100%;
  1401. height: 42.8571428571%;
  1402. height: 30vh;
  1403. border: 0; } }
  1404. @media screen and (max-width: 600px) {
  1405. .reveal.show-notes {
  1406. max-height: 60%;
  1407. max-height: 60vh; }
  1408. .reveal.show-notes .speaker-notes {
  1409. top: 100%;
  1410. height: 66.6666666667%;
  1411. height: 40vh; }
  1412. .reveal .speaker-notes {
  1413. font-size: 14px; } }
  1414. /*********************************************
  1415. * ZOOM PLUGIN
  1416. *********************************************/
  1417. .zoomed .reveal *,
  1418. .zoomed .reveal *:before,
  1419. .zoomed .reveal *:after {
  1420. -webkit-backface-visibility: visible !important;
  1421. backface-visibility: visible !important; }
  1422. .zoomed .reveal .progress,
  1423. .zoomed .reveal .controls {
  1424. opacity: 0; }
  1425. .zoomed .reveal .roll span {
  1426. background: none; }
  1427. .zoomed .reveal .roll span:after {
  1428. visibility: hidden; }
  1429. /**
  1430. * White theme for reveal.js. This is the opposite of the 'black' theme.
  1431. *
  1432. * By Hakim El Hattab, http://hakim.se
  1433. */
  1434. /*@import url(../../lib/font/source-sans-pro/source-sans-pro.css);*/
  1435. section.has-dark-background, section.has-dark-background h1, section.has-dark-background h2, section.has-dark-background h3, section.has-dark-background h4, section.has-dark-background h5, section.has-dark-background h6 {
  1436. color: #fff; }
  1437. /*********************************************
  1438. * GLOBAL STYLES
  1439. *********************************************/
  1440. body {
  1441. background: #fff;
  1442. background-color: #fff; }
  1443. .reveal {
  1444. font-family: "Source Sans Pro", Helvetica, sans-serif;
  1445. font-size: 42px;
  1446. font-weight: normal;
  1447. color: #222; }
  1448. ::selection {
  1449. color: #fff;
  1450. background: #98bdef;
  1451. text-shadow: none; }
  1452. ::-moz-selection {
  1453. color: #fff;
  1454. background: #98bdef;
  1455. text-shadow: none; }
  1456. .reveal .slides section,
  1457. .reveal .slides section > section {
  1458. line-height: 1.3;
  1459. font-weight: inherit; }
  1460. /*********************************************
  1461. * HEADERS
  1462. *********************************************/
  1463. .reveal h1,
  1464. .reveal h2,
  1465. .reveal h3,
  1466. .reveal h4,
  1467. .reveal h5,
  1468. .reveal h6 {
  1469. margin: 0 0 20px 0;
  1470. color: #222;
  1471. font-family: "Source Sans Pro", Helvetica, sans-serif;
  1472. font-weight: 600;
  1473. line-height: 1.2;
  1474. letter-spacing: normal;
  1475. text-transform: uppercase;
  1476. text-shadow: none;
  1477. word-wrap: break-word; }
  1478. .reveal h1 {
  1479. font-size: 2.5em; }
  1480. .reveal h2 {
  1481. font-size: 1.6em; }
  1482. .reveal h3 {
  1483. font-size: 1.3em; }
  1484. .reveal h4 {
  1485. font-size: 1em; }
  1486. .reveal h1 {
  1487. text-shadow: none; }
  1488. /*********************************************
  1489. * OTHER
  1490. *********************************************/
  1491. .reveal p {
  1492. margin: 20px 0;
  1493. line-height: 1.3; }
  1494. /* Ensure certain elements are never larger than the slide itself */
  1495. .reveal img,
  1496. .reveal video,
  1497. .reveal iframe {
  1498. max-width: 95%;
  1499. max-height: 95%; }
  1500. .reveal strong,
  1501. .reveal b {
  1502. font-weight: bold; }
  1503. .reveal em {
  1504. font-style: italic; }
  1505. .reveal ol,
  1506. .reveal dl,
  1507. .reveal ul {
  1508. display: inline-block;
  1509. text-align: left;
  1510. margin: 0 0 0 1em; }
  1511. .reveal ol {
  1512. list-style-type: decimal; }
  1513. .reveal ul {
  1514. list-style-type: disc; }
  1515. .reveal ul ul {
  1516. list-style-type: square; }
  1517. .reveal ul ul ul {
  1518. list-style-type: circle; }
  1519. .reveal ul ul,
  1520. .reveal ul ol,
  1521. .reveal ol ol,
  1522. .reveal ol ul {
  1523. display: block;
  1524. margin-left: 40px; }
  1525. .reveal dt {
  1526. font-weight: bold; }
  1527. .reveal dd {
  1528. margin-left: 40px; }
  1529. .reveal blockquote {
  1530. display: block;
  1531. position: relative;
  1532. width: 70%;
  1533. margin: 20px auto;
  1534. padding: 5px;
  1535. font-style: italic;
  1536. background: rgba(255, 255, 255, 0.05);
  1537. box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); }
  1538. .reveal blockquote p:first-child,
  1539. .reveal blockquote p:last-child {
  1540. display: inline-block; }
  1541. .reveal q {
  1542. font-style: italic; }
  1543. .reveal pre {
  1544. display: block;
  1545. position: relative;
  1546. width: 90%;
  1547. margin: 20px auto;
  1548. text-align: left;
  1549. font-size: 0.55em;
  1550. font-family: monospace;
  1551. line-height: 1.2em;
  1552. word-wrap: break-word;
  1553. box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.15); }
  1554. .reveal code {
  1555. font-family: monospace;
  1556. text-transform: none; }
  1557. .reveal pre code {
  1558. display: block;
  1559. padding: 5px;
  1560. overflow: auto;
  1561. max-height: 400px;
  1562. word-wrap: normal; }
  1563. .reveal table {
  1564. margin: auto;
  1565. border-collapse: collapse;
  1566. border-spacing: 0; }
  1567. .reveal table th {
  1568. font-weight: bold; }
  1569. .reveal table th,
  1570. .reveal table td {
  1571. text-align: left;
  1572. padding: 0.2em 0.5em 0.2em 0.5em;
  1573. border-bottom: 1px solid; }
  1574. .reveal table th[align="center"],
  1575. .reveal table td[align="center"] {
  1576. text-align: center; }
  1577. .reveal table th[align="right"],
  1578. .reveal table td[align="right"] {
  1579. text-align: right; }
  1580. .reveal table tbody tr:last-child th,
  1581. .reveal table tbody tr:last-child td {
  1582. border-bottom: none; }
  1583. .reveal sup {
  1584. vertical-align: super;
  1585. font-size: smaller; }
  1586. .reveal sub {
  1587. vertical-align: sub;
  1588. font-size: smaller; }
  1589. .reveal small {
  1590. display: inline-block;
  1591. font-size: 0.6em;
  1592. line-height: 1.2em;
  1593. vertical-align: top; }
  1594. .reveal small * {
  1595. vertical-align: top; }
  1596. /*********************************************
  1597. * LINKS
  1598. *********************************************/
  1599. .reveal a {
  1600. color: #2a76dd;
  1601. text-decoration: none;
  1602. -webkit-transition: color .15s ease;
  1603. -moz-transition: color .15s ease;
  1604. transition: color .15s ease; }
  1605. .reveal a:hover {
  1606. color: #6ca0e8;
  1607. text-shadow: none;
  1608. border: none; }
  1609. .reveal .roll span:after {
  1610. color: #fff;
  1611. background: #1a53a1; }
  1612. /*********************************************
  1613. * IMAGES
  1614. *********************************************/
  1615. .reveal section img {
  1616. margin: 15px 0px;
  1617. background: rgba(255, 255, 255, 0.12);
  1618. border: 4px solid #222;
  1619. box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }
  1620. .reveal section img.plain {
  1621. border: 0;
  1622. box-shadow: none; }
  1623. .reveal a img {
  1624. -webkit-transition: all .15s linear;
  1625. -moz-transition: all .15s linear;
  1626. transition: all .15s linear; }
  1627. .reveal a:hover img {
  1628. background: rgba(255, 255, 255, 0.2);
  1629. border-color: #2a76dd;
  1630. box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
  1631. /*********************************************
  1632. * NAVIGATION CONTROLS
  1633. *********************************************/
  1634. .reveal .controls {
  1635. color: #2a76dd; }
  1636. /*********************************************
  1637. * PROGRESS BAR
  1638. *********************************************/
  1639. .reveal .progress {
  1640. background: rgba(0, 0, 0, 0.2);
  1641. color: #2a76dd; }
  1642. .reveal .progress span {
  1643. -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
  1644. -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
  1645. transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
  1646. /*********************************************
  1647. * PRINT BACKGROUND
  1648. *********************************************/
  1649. @media print {
  1650. .backgrounds {
  1651. background-color: #fff; } }
  1652. </style>
  1653. <title>Обучение детей программированию</title>
  1654. </head>
  1655. <body>
  1656. <div class="reveal">
  1657. <div class="slides">
  1658. <section data-markdown data-background-image="bg-01.png" data-background-opacity="0.2"><textarea data-template>
  1659. ## Обучение детей программированию
  1660. Капелько Михаил
  1661. 2019
  1662. </textarea></section>
  1663. <section data-markdown data-background-image="myself.png" data-background-opacity="0.3" data-background-size="30%" data-background-position="left"><textarea data-template>
  1664. О себе
  1665. </textarea></section>
  1666. <section data-markdown data-background-image="bg-03.jpg" data-background-opacity="0.2"><textarea data-template>
  1667. Социальная ответственность
  1668. </textarea></section>
  1669. <section data-markdown data-background-image="bg-04.png" data-background-opacity="0.2"><textarea data-template>
  1670. Группы
  1671. </textarea></section>
  1672. <section data-markdown data-background-image="bg-05.jpg" data-background-opacity="0.2"><textarea data-template>
  1673. По субботам
  1674. </textarea></section>
  1675. <section data-markdown data-background-image="bg-06.jpg" data-background-opacity="0.2"><textarea data-template>
  1676. Первый раз
  1677. </textarea></section>
  1678. <section data-markdown data-background-image="bg-07.jpg" data-background-opacity="0.2"><textarea data-template>
  1679. Второй раз
  1680. </textarea></section>
  1681. <section data-markdown data-background-image="bg-08.jpg" data-background-opacity="0.2"><textarea data-template>
  1682. За 1 час
  1683. </textarea></section>
  1684. <section data-markdown data-background-image="game-01.png" data-background-opacity="0.2"><textarea data-template>
  1685. 16 карт
  1686. </textarea></section>
  1687. </div>
  1688. </div>
  1689. <script>
  1690. /*!
  1691. * reveal.js
  1692. * http://revealjs.com
  1693. * MIT licensed
  1694. *
  1695. * Copyright (C) 2019 Hakim El Hattab, http://hakim.se
  1696. */
  1697. (function( root, factory ) {
  1698. if( typeof define === 'function' && define.amd ) {
  1699. // AMD. Register as an anonymous module.
  1700. define( function() {
  1701. root.Reveal = factory();
  1702. return root.Reveal;
  1703. } );
  1704. } else if( typeof exports === 'object' ) {
  1705. // Node. Does not work with strict CommonJS.
  1706. module.exports = factory();
  1707. } else {
  1708. // Browser globals.
  1709. root.Reveal = factory();
  1710. }
  1711. }( this, function() {
  1712. 'use strict';
  1713. var Reveal;
  1714. // The reveal.js version
  1715. var VERSION = '3.8.0';
  1716. var SLIDES_SELECTOR = '.slides section',
  1717. HORIZONTAL_SLIDES_SELECTOR = '.slides>section',
  1718. VERTICAL_SLIDES_SELECTOR = '.slides>section.present>section',
  1719. HOME_SLIDE_SELECTOR = '.slides>section:first-of-type',
  1720. UA = navigator.userAgent,
  1721. // Configuration defaults, can be overridden at initialization time
  1722. config = {
  1723. // The "normal" size of the presentation, aspect ratio will be preserved
  1724. // when the presentation is scaled to fit different resolutions
  1725. width: 960,
  1726. height: 700,
  1727. // Factor of the display size that should remain empty around the content
  1728. margin: 0.04,
  1729. // Bounds for smallest/largest possible scale to apply to content
  1730. minScale: 0.2,
  1731. maxScale: 2.0,
  1732. // Display presentation control arrows
  1733. controls: true,
  1734. // Help the user learn the controls by providing hints, for example by
  1735. // bouncing the down arrow when they first encounter a vertical slide
  1736. controlsTutorial: true,
  1737. // Determines where controls appear, "edges" or "bottom-right"
  1738. controlsLayout: 'bottom-right',
  1739. // Visibility rule for backwards navigation arrows; "faded", "hidden"
  1740. // or "visible"
  1741. controlsBackArrows: 'faded',
  1742. // Display a presentation progress bar
  1743. progress: true,
  1744. // Display the page number of the current slide
  1745. // - true: Show slide number
  1746. // - false: Hide slide number
  1747. //
  1748. // Can optionally be set as a string that specifies the number formatting:
  1749. // - "h.v": Horizontal . vertical slide number (default)
  1750. // - "h/v": Horizontal / vertical slide number
  1751. // - "c": Flattened slide number
  1752. // - "c/t": Flattened slide number / total slides
  1753. //
  1754. // Alternatively, you can provide a function that returns the slide
  1755. // number for the current slide. The function needs to return an array
  1756. // with one string [slideNumber] or three strings [n1,delimiter,n2].
  1757. // See #formatSlideNumber().
  1758. slideNumber: false,
  1759. // Can be used to limit the contexts in which the slide number appears
  1760. // - "all": Always show the slide number
  1761. // - "print": Only when printing to PDF
  1762. // - "speaker": Only in the speaker view
  1763. showSlideNumber: 'all',
  1764. // Use 1 based indexing for # links to match slide number (default is zero
  1765. // based)
  1766. hashOneBasedIndex: false,
  1767. // Add the current slide number to the URL hash so that reloading the
  1768. // page/copying the URL will return you to the same slide
  1769. hash: false,
  1770. // Push each slide change to the browser history. Implies `hash: true`
  1771. history: false,
  1772. // Enable keyboard shortcuts for navigation
  1773. keyboard: true,
  1774. // Optional function that blocks keyboard events when retuning false
  1775. keyboardCondition: null,
  1776. // Enable the slide overview mode
  1777. overview: true,
  1778. // Disables the default reveal.js slide layout so that you can use
  1779. // custom CSS layout
  1780. disableLayout: false,
  1781. // Vertical centering of slides
  1782. center: true,
  1783. // Enables touch navigation on devices with touch input
  1784. touch: true,
  1785. // Loop the presentation
  1786. loop: false,
  1787. // Change the presentation direction to be RTL
  1788. rtl: false,
  1789. // Changes the behavior of our navigation directions.
  1790. //
  1791. // "default"
  1792. // Left/right arrow keys step between horizontal slides, up/down
  1793. // arrow keys step between vertical slides. Space key steps through
  1794. // all slides (both horizontal and vertical).
  1795. //
  1796. // "linear"
  1797. // Removes the up/down arrows. Left/right arrows step through all
  1798. // slides (both horizontal and vertical).
  1799. //
  1800. // "grid"
  1801. // When this is enabled, stepping left/right from a vertical stack
  1802. // to an adjacent vertical stack will land you at the same vertical
  1803. // index.
  1804. //
  1805. // Consider a deck with six slides ordered in two vertical stacks:
  1806. // 1.1 2.1
  1807. // 1.2 2.2
  1808. // 1.3 2.3
  1809. //
  1810. // If you're on slide 1.3 and navigate right, you will normally move
  1811. // from 1.3 -> 2.1. If "grid" is used, the same navigation takes you
  1812. // from 1.3 -> 2.3.
  1813. navigationMode: 'default',
  1814. // Randomizes the order of slides each time the presentation loads
  1815. shuffle: false,
  1816. // Turns fragments on and off globally
  1817. fragments: true,
  1818. // Flags whether to include the current fragment in the URL,
  1819. // so that reloading brings you to the same fragment position
  1820. fragmentInURL: false,
  1821. // Flags if the presentation is running in an embedded mode,
  1822. // i.e. contained within a limited portion of the screen
  1823. embedded: false,
  1824. // Flags if we should show a help overlay when the question-mark
  1825. // key is pressed
  1826. help: true,
  1827. // Flags if it should be possible to pause the presentation (blackout)
  1828. pause: true,
  1829. // Flags if speaker notes should be visible to all viewers
  1830. showNotes: false,
  1831. // Global override for autolaying embedded media (video/audio/iframe)
  1832. // - null: Media will only autoplay if data-autoplay is present
  1833. // - true: All media will autoplay, regardless of individual setting
  1834. // - false: No media will autoplay, regardless of individual setting
  1835. autoPlayMedia: null,
  1836. // Global override for preloading lazy-loaded iframes
  1837. // - null: Iframes with data-src AND data-preload will be loaded when within
  1838. // the viewDistance, iframes with only data-src will be loaded when visible
  1839. // - true: All iframes with data-src will be loaded when within the viewDistance
  1840. // - false: All iframes with data-src will be loaded only when visible
  1841. preloadIframes: null,
  1842. // Controls automatic progression to the next slide
  1843. // - 0: Auto-sliding only happens if the data-autoslide HTML attribute
  1844. // is present on the current slide or fragment
  1845. // - 1+: All slides will progress automatically at the given interval
  1846. // - false: No auto-sliding, even if data-autoslide is present
  1847. autoSlide: 0,
  1848. // Stop auto-sliding after user input
  1849. autoSlideStoppable: true,
  1850. // Use this method for navigation when auto-sliding (defaults to navigateNext)
  1851. autoSlideMethod: null,
  1852. // Specify the average time in seconds that you think you will spend
  1853. // presenting each slide. This is used to show a pacing timer in the
  1854. // speaker view
  1855. defaultTiming: null,
  1856. // Enable slide navigation via mouse wheel
  1857. mouseWheel: false,
  1858. // Apply a 3D roll to links on hover
  1859. rollingLinks: false,
  1860. // Hides the address bar on mobile devices
  1861. hideAddressBar: true,
  1862. // Opens links in an iframe preview overlay
  1863. // Add `data-preview-link` and `data-preview-link="false"` to customise each link
  1864. // individually
  1865. previewLinks: false,
  1866. // Exposes the reveal.js API through window.postMessage
  1867. postMessage: true,
  1868. // Dispatches all reveal.js events to the parent window through postMessage
  1869. postMessageEvents: false,
  1870. // Focuses body when page changes visibility to ensure keyboard shortcuts work
  1871. focusBodyOnPageVisibilityChange: true,
  1872. // Transition style
  1873. transition: 'slide', // none/fade/slide/convex/concave/zoom
  1874. // Transition speed
  1875. transitionSpeed: 'default', // default/fast/slow
  1876. // Transition style for full page slide backgrounds
  1877. backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom
  1878. // Parallax background image
  1879. parallaxBackgroundImage: '', // CSS syntax, e.g. "a.jpg"
  1880. // Parallax background size
  1881. parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px"
  1882. // Parallax background repeat
  1883. parallaxBackgroundRepeat: '', // repeat/repeat-x/repeat-y/no-repeat/initial/inherit
  1884. // Parallax background position
  1885. parallaxBackgroundPosition: '', // CSS syntax, e.g. "top left"
  1886. // Amount of pixels to move the parallax background per slide step
  1887. parallaxBackgroundHorizontal: null,
  1888. parallaxBackgroundVertical: null,
  1889. // The maximum number of pages a single slide can expand onto when printing
  1890. // to PDF, unlimited by default
  1891. pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
  1892. // Prints each fragment on a separate slide
  1893. pdfSeparateFragments: true,
  1894. // Offset used to reduce the height of content within exported PDF pages.
  1895. // This exists to account for environment differences based on how you
  1896. // print to PDF. CLI printing options, like phantomjs and wkpdf, can end
  1897. // on precisely the total height of the document whereas in-browser
  1898. // printing has to end one pixel before.
  1899. pdfPageHeightOffset: -1,
  1900. // Number of slides away from the current that are visible
  1901. viewDistance: 3,
  1902. // The display mode that will be used to show slides
  1903. display: 'block',
  1904. // Hide cursor if inactive
  1905. hideInactiveCursor: true,
  1906. // Time before the cursor is hidden (in ms)
  1907. hideCursorTime: 5000,
  1908. // Script dependencies to load
  1909. dependencies: []
  1910. },
  1911. // Flags if Reveal.initialize() has been called
  1912. initialized = false,
  1913. // Flags if reveal.js is loaded (has dispatched the 'ready' event)
  1914. loaded = false,
  1915. // Flags if the overview mode is currently active
  1916. overview = false,
  1917. // Holds the dimensions of our overview slides, including margins
  1918. overviewSlideWidth = null,
  1919. overviewSlideHeight = null,
  1920. // The horizontal and vertical index of the currently active slide
  1921. indexh,
  1922. indexv,
  1923. // The previous and current slide HTML elements
  1924. previousSlide,
  1925. currentSlide,
  1926. previousBackground,
  1927. // Remember which directions that the user has navigated towards
  1928. hasNavigatedRight = false,
  1929. hasNavigatedDown = false,
  1930. // Slides may hold a data-state attribute which we pick up and apply
  1931. // as a class to the body. This list contains the combined state of
  1932. // all current slides.
  1933. state = [],
  1934. // The current scale of the presentation (see width/height config)
  1935. scale = 1,
  1936. // CSS transform that is currently applied to the slides container,
  1937. // split into two groups
  1938. slidesTransform = { layout: '', overview: '' },
  1939. // Cached references to DOM elements
  1940. dom = {},
  1941. // A list of registered reveal.js plugins
  1942. plugins = {},
  1943. // List of asynchronously loaded reveal.js dependencies
  1944. asyncDependencies = [],
  1945. // Features supported by the browser, see #checkCapabilities()
  1946. features = {},
  1947. // Client is a mobile device, see #checkCapabilities()
  1948. isMobileDevice,
  1949. // Client is a desktop Chrome, see #checkCapabilities()
  1950. isChrome,
  1951. // Throttles mouse wheel navigation
  1952. lastMouseWheelStep = 0,
  1953. // Delays updates to the URL due to a Chrome thumbnailer bug
  1954. writeURLTimeout = 0,
  1955. // Is the mouse pointer currently hidden from view
  1956. cursorHidden = false,
  1957. // Timeout used to determine when the cursor is inactive
  1958. cursorInactiveTimeout = 0,
  1959. // Flags if the interaction event listeners are bound
  1960. eventsAreBound = false,
  1961. // The current auto-slide duration
  1962. autoSlide = 0,
  1963. // Auto slide properties
  1964. autoSlidePlayer,
  1965. autoSlideTimeout = 0,
  1966. autoSlideStartTime = -1,
  1967. autoSlidePaused = false,
  1968. // Holds information about the currently ongoing touch input
  1969. touch = {
  1970. startX: 0,
  1971. startY: 0,
  1972. startCount: 0,
  1973. captured: false,
  1974. threshold: 40
  1975. },
  1976. // A key:value map of shortcut keyboard keys and descriptions of
  1977. // the actions they trigger, generated in #configure()
  1978. keyboardShortcuts = {},
  1979. // Holds custom key code mappings
  1980. registeredKeyBindings = {};
  1981. /**
  1982. * Starts up the presentation if the client is capable.
  1983. */
  1984. function initialize( options ) {
  1985. // Make sure we only initialize once
  1986. if( initialized === true ) return;
  1987. initialized = true;
  1988. checkCapabilities();
  1989. if( !features.transforms2d && !features.transforms3d ) {
  1990. document.body.setAttribute( 'class', 'no-transforms' );
  1991. // Since JS won't be running any further, we load all lazy
  1992. // loading elements upfront
  1993. var images = toArray( document.getElementsByTagName( 'img' ) ),
  1994. iframes = toArray( document.getElementsByTagName( 'iframe' ) );
  1995. var lazyLoadable = images.concat( iframes );
  1996. for( var i = 0, len = lazyLoadable.length; i < len; i++ ) {
  1997. var element = lazyLoadable[i];
  1998. if( element.getAttribute( 'data-src' ) ) {
  1999. element.setAttribute( 'src', element.getAttribute( 'data-src' ) );
  2000. element.removeAttribute( 'data-src' );
  2001. }
  2002. }
  2003. // If the browser doesn't support core features we won't be
  2004. // using JavaScript to control the presentation
  2005. return;
  2006. }
  2007. // Cache references to key DOM elements
  2008. dom.wrapper = document.querySelector( '.reveal' );
  2009. dom.slides = document.querySelector( '.reveal .slides' );
  2010. // Force a layout when the whole page, incl fonts, has loaded
  2011. window.addEventListener( 'load', layout, false );
  2012. var query = Reveal.getQueryHash();
  2013. // Do not accept new dependencies via query config to avoid
  2014. // the potential of malicious script injection
  2015. if( typeof query['dependencies'] !== 'undefined' ) delete query['dependencies'];
  2016. // Copy options over to our config object
  2017. extend( config, options );
  2018. extend( config, query );
  2019. // Hide the address bar in mobile browsers
  2020. hideAddressBar();
  2021. // Loads dependencies and continues to #start() once done
  2022. load();
  2023. }
  2024. /**
  2025. * Inspect the client to see what it's capable of, this
  2026. * should only happens once per runtime.
  2027. */
  2028. function checkCapabilities() {
  2029. isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( UA );
  2030. isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA );
  2031. var testElement = document.createElement( 'div' );
  2032. features.transforms3d = 'WebkitPerspective' in testElement.style ||
  2033. 'MozPerspective' in testElement.style ||
  2034. 'msPerspective' in testElement.style ||
  2035. 'OPerspective' in testElement.style ||
  2036. 'perspective' in testElement.style;
  2037. features.transforms2d = 'WebkitTransform' in testElement.style ||
  2038. 'MozTransform' in testElement.style ||
  2039. 'msTransform' in testElement.style ||
  2040. 'OTransform' in testElement.style ||
  2041. 'transform' in testElement.style;
  2042. features.requestAnimationFrameMethod = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
  2043. features.requestAnimationFrame = typeof features.requestAnimationFrameMethod === 'function';
  2044. features.canvas = !!document.createElement( 'canvas' ).getContext;
  2045. // Transitions in the overview are disabled in desktop and
  2046. // Safari due to lag
  2047. features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( UA );
  2048. // Flags if we should use zoom instead of transform to scale
  2049. // up slides. Zoom produces crisper results but has a lot of
  2050. // xbrowser quirks so we only use it in whitelsited browsers.
  2051. features.zoom = 'zoom' in testElement.style && !isMobileDevice &&
  2052. ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );
  2053. }
  2054. /**
  2055. * Loads the dependencies of reveal.js. Dependencies are
  2056. * defined via the configuration option 'dependencies'
  2057. * and will be loaded prior to starting/binding reveal.js.
  2058. * Some dependencies may have an 'async' flag, if so they
  2059. * will load after reveal.js has been started up.
  2060. */
  2061. function load() {
  2062. var scripts = [],
  2063. scriptsToLoad = 0;
  2064. config.dependencies.forEach( function( s ) {
  2065. // Load if there's no condition or the condition is truthy
  2066. if( !s.condition || s.condition() ) {
  2067. if( s.async ) {
  2068. asyncDependencies.push( s );
  2069. }
  2070. else {
  2071. scripts.push( s );
  2072. }
  2073. }
  2074. } );
  2075. if( scripts.length ) {
  2076. scriptsToLoad = scripts.length;
  2077. // Load synchronous scripts
  2078. scripts.forEach( function( s ) {
  2079. loadScript( s.src, function() {
  2080. if( typeof s.callback === 'function' ) s.callback();
  2081. if( --scriptsToLoad === 0 ) {
  2082. initPlugins();
  2083. }
  2084. } );
  2085. } );
  2086. }
  2087. else {
  2088. initPlugins();
  2089. }
  2090. }
  2091. /**
  2092. * Initializes our plugins and waits for them to be ready
  2093. * before proceeding.
  2094. */
  2095. function initPlugins() {
  2096. var pluginsToInitialize = Object.keys( plugins ).length;
  2097. // If there are no plugins, skip this step
  2098. if( pluginsToInitialize === 0 ) {
  2099. loadAsyncDependencies();
  2100. }
  2101. // ... otherwise initialize plugins
  2102. else {
  2103. var afterPlugInitialized = function() {
  2104. if( --pluginsToInitialize === 0 ) {
  2105. loadAsyncDependencies();
  2106. }
  2107. };
  2108. for( var i in plugins ) {
  2109. var plugin = plugins[i];
  2110. // If the plugin has an 'init' method, invoke it
  2111. if( typeof plugin.init === 'function' ) {
  2112. var callback = plugin.init();
  2113. // If the plugin returned a Promise, wait for it
  2114. if( callback && typeof callback.then === 'function' ) {
  2115. callback.then( afterPlugInitialized );
  2116. }
  2117. else {
  2118. afterPlugInitialized();
  2119. }
  2120. }
  2121. else {
  2122. afterPlugInitialized();
  2123. }
  2124. }
  2125. }
  2126. }
  2127. /**
  2128. * Loads all async reveal.js dependencies.
  2129. */
  2130. function loadAsyncDependencies() {
  2131. if( asyncDependencies.length ) {
  2132. asyncDependencies.forEach( function( s ) {
  2133. loadScript( s.src, s.callback );
  2134. } );
  2135. }
  2136. start();
  2137. }
  2138. /**
  2139. * Loads a JavaScript file from the given URL and executes it.
  2140. *
  2141. * @param {string} url Address of the .js file to load
  2142. * @param {function} callback Method to invoke when the script
  2143. * has loaded and executed
  2144. */
  2145. function loadScript( url, callback ) {
  2146. var script = document.createElement( 'script' );
  2147. script.type = 'text/javascript';
  2148. script.async = false;
  2149. script.defer = false;
  2150. script.src = url;
  2151. if( callback ) {
  2152. // Success callback
  2153. script.onload = script.onreadystatechange = function( event ) {
  2154. if( event.type === "load" || (/loaded|complete/.test( script.readyState ) ) ) {
  2155. // Kill event listeners
  2156. script.onload = script.onreadystatechange = script.onerror = null;
  2157. callback();
  2158. }
  2159. };
  2160. // Error callback
  2161. script.onerror = function( err ) {
  2162. // Kill event listeners
  2163. script.onload = script.onreadystatechange = script.onerror = null;
  2164. callback( new Error( 'Failed loading script: ' + script.src + '\n' + err) );
  2165. };
  2166. }
  2167. // Append the script at the end of <head>
  2168. var head = document.querySelector( 'head' );
  2169. head.insertBefore( script, head.lastChild );
  2170. }
  2171. /**
  2172. * Starts up reveal.js by binding input events and navigating
  2173. * to the current URL deeplink if there is one.
  2174. */
  2175. function start() {
  2176. loaded = true;
  2177. // Make sure we've got all the DOM elements we need
  2178. setupDOM();
  2179. // Listen to messages posted to this window
  2180. setupPostMessage();
  2181. // Prevent the slides from being scrolled out of view
  2182. setupScrollPrevention();
  2183. // Resets all vertical slides so that only the first is visible
  2184. resetVerticalSlides();
  2185. // Updates the presentation to match the current configuration values
  2186. configure();
  2187. // Read the initial hash
  2188. readURL();
  2189. // Update all backgrounds
  2190. updateBackground( true );
  2191. // Notify listeners that the presentation is ready but use a 1ms
  2192. // timeout to ensure it's not fired synchronously after #initialize()
  2193. setTimeout( function() {
  2194. // Enable transitions now that we're loaded
  2195. dom.slides.classList.remove( 'no-transition' );
  2196. dom.wrapper.classList.add( 'ready' );
  2197. dispatchEvent( 'ready', {
  2198. 'indexh': indexh,
  2199. 'indexv': indexv,
  2200. 'currentSlide': currentSlide
  2201. } );
  2202. }, 1 );
  2203. // Special setup and config is required when printing to PDF
  2204. if( isPrintingPDF() ) {
  2205. removeEventListeners();
  2206. // The document needs to have loaded for the PDF layout
  2207. // measurements to be accurate
  2208. if( document.readyState === 'complete' ) {
  2209. setupPDF();
  2210. }
  2211. else {
  2212. window.addEventListener( 'load', setupPDF );
  2213. }
  2214. }
  2215. }
  2216. /**
  2217. * Finds and stores references to DOM elements which are
  2218. * required by the presentation. If a required element is
  2219. * not found, it is created.
  2220. */
  2221. function setupDOM() {
  2222. // Prevent transitions while we're loading
  2223. dom.slides.classList.add( 'no-transition' );
  2224. if( isMobileDevice ) {
  2225. dom.wrapper.classList.add( 'no-hover' );
  2226. }
  2227. else {
  2228. dom.wrapper.classList.remove( 'no-hover' );
  2229. }
  2230. if( /iphone/gi.test( UA ) ) {
  2231. dom.wrapper.classList.add( 'ua-iphone' );
  2232. }
  2233. else {
  2234. dom.wrapper.classList.remove( 'ua-iphone' );
  2235. }
  2236. // Background element
  2237. dom.background = createSingletonNode( dom.wrapper, 'div', 'backgrounds', null );
  2238. // Progress bar
  2239. dom.progress = createSingletonNode( dom.wrapper, 'div', 'progress', '<span></span>' );
  2240. dom.progressbar = dom.progress.querySelector( 'span' );
  2241. // Arrow controls
  2242. dom.controls = createSingletonNode( dom.wrapper, 'aside', 'controls',
  2243. '<button class="navigate-left" aria-label="previous slide"><div class="controls-arrow"></div></button>' +
  2244. '<button class="navigate-right" aria-label="next slide"><div class="controls-arrow"></div></button>' +
  2245. '<button class="navigate-up" aria-label="above slide"><div class="controls-arrow"></div></button>' +
  2246. '<button class="navigate-down" aria-label="below slide"><div class="controls-arrow"></div></button>' );
  2247. // Slide number
  2248. dom.slideNumber = createSingletonNode( dom.wrapper, 'div', 'slide-number', '' );
  2249. // Element containing notes that are visible to the audience
  2250. dom.speakerNotes = createSingletonNode( dom.wrapper, 'div', 'speaker-notes', null );
  2251. dom.speakerNotes.setAttribute( 'data-prevent-swipe', '' );
  2252. dom.speakerNotes.setAttribute( 'tabindex', '0' );
  2253. // Overlay graphic which is displayed during the paused mode
  2254. dom.pauseOverlay = createSingletonNode( dom.wrapper, 'div', 'pause-overlay', config.controls ? '<button class="resume-button">Resume presentation</button>' : null );
  2255. dom.wrapper.setAttribute( 'role', 'application' );
  2256. // There can be multiple instances of controls throughout the page
  2257. dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) );
  2258. dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) );
  2259. dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) );
  2260. dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) );
  2261. dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) );
  2262. dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) );
  2263. // The right and down arrows in the standard reveal.js controls
  2264. dom.controlsRightArrow = dom.controls.querySelector( '.navigate-right' );
  2265. dom.controlsDownArrow = dom.controls.querySelector( '.navigate-down' );
  2266. dom.statusDiv = createStatusDiv();
  2267. }
  2268. /**
  2269. * Creates a hidden div with role aria-live to announce the
  2270. * current slide content. Hide the div off-screen to make it
  2271. * available only to Assistive Technologies.
  2272. *
  2273. * @return {HTMLElement}
  2274. */
  2275. function createStatusDiv() {
  2276. var statusDiv = document.getElementById( 'aria-status-div' );
  2277. if( !statusDiv ) {
  2278. statusDiv = document.createElement( 'div' );
  2279. statusDiv.style.position = 'absolute';
  2280. statusDiv.style.height = '1px';
  2281. statusDiv.style.width = '1px';
  2282. statusDiv.style.overflow = 'hidden';
  2283. statusDiv.style.clip = 'rect( 1px, 1px, 1px, 1px )';
  2284. statusDiv.setAttribute( 'id', 'aria-status-div' );
  2285. statusDiv.setAttribute( 'aria-live', 'polite' );
  2286. statusDiv.setAttribute( 'aria-atomic','true' );
  2287. dom.wrapper.appendChild( statusDiv );
  2288. }
  2289. return statusDiv;
  2290. }
  2291. /**
  2292. * Converts the given HTML element into a string of text
  2293. * that can be announced to a screen reader. Hidden
  2294. * elements are excluded.
  2295. */
  2296. function getStatusText( node ) {
  2297. var text = '';
  2298. // Text node
  2299. if( node.nodeType === 3 ) {
  2300. text += node.textContent;
  2301. }
  2302. // Element node
  2303. else if( node.nodeType === 1 ) {
  2304. var isAriaHidden = node.getAttribute( 'aria-hidden' );
  2305. var isDisplayHidden = window.getComputedStyle( node )['display'] === 'none';
  2306. if( isAriaHidden !== 'true' && !isDisplayHidden ) {
  2307. toArray( node.childNodes ).forEach( function( child ) {
  2308. text += getStatusText( child );
  2309. } );
  2310. }
  2311. }
  2312. return text;
  2313. }
  2314. /**
  2315. * Configures the presentation for printing to a static
  2316. * PDF.
  2317. */
  2318. function setupPDF() {
  2319. var slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight );
  2320. // Dimensions of the PDF pages
  2321. var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ),
  2322. pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) );
  2323. // Dimensions of slides within the pages
  2324. var slideWidth = slideSize.width,
  2325. slideHeight = slideSize.height;
  2326. // Let the browser know what page size we want to print
  2327. injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0px;}' );
  2328. // Limit the size of certain elements to the dimensions of the slide
  2329. injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' );
  2330. document.body.classList.add( 'print-pdf' );
  2331. document.body.style.width = pageWidth + 'px';
  2332. document.body.style.height = pageHeight + 'px';
  2333. // Make sure stretch elements fit on slide
  2334. layoutSlideContents( slideWidth, slideHeight );
  2335. // Add each slide's index as attributes on itself, we need these
  2336. // indices to generate slide numbers below
  2337. toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) {
  2338. hslide.setAttribute( 'data-index-h', h );
  2339. if( hslide.classList.contains( 'stack' ) ) {
  2340. toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) {
  2341. vslide.setAttribute( 'data-index-h', h );
  2342. vslide.setAttribute( 'data-index-v', v );
  2343. } );
  2344. }
  2345. } );
  2346. // Slide and slide background layout
  2347. toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) {
  2348. // Vertical stacks are not centred since their section
  2349. // children will be
  2350. if( slide.classList.contains( 'stack' ) === false ) {
  2351. // Center the slide inside of the page, giving the slide some margin
  2352. var left = ( pageWidth - slideWidth ) / 2,
  2353. top = ( pageHeight - slideHeight ) / 2;
  2354. var contentHeight = slide.scrollHeight;
  2355. var numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 );
  2356. // Adhere to configured pages per slide limit
  2357. numberOfPages = Math.min( numberOfPages, config.pdfMaxPagesPerSlide );
  2358. // Center slides vertically
  2359. if( numberOfPages === 1 && config.center || slide.classList.contains( 'center' ) ) {
  2360. top = Math.max( ( pageHeight - contentHeight ) / 2, 0 );
  2361. }
  2362. // Wrap the slide in a page element and hide its overflow
  2363. // so that no page ever flows onto another
  2364. var page = document.createElement( 'div' );
  2365. page.className = 'pdf-page';
  2366. page.style.height = ( ( pageHeight + config.pdfPageHeightOffset ) * numberOfPages ) + 'px';
  2367. slide.parentNode.insertBefore( page, slide );
  2368. page.appendChild( slide );
  2369. // Position the slide inside of the page
  2370. slide.style.left = left + 'px';
  2371. slide.style.top = top + 'px';
  2372. slide.style.width = slideWidth + 'px';
  2373. if( slide.slideBackgroundElement ) {
  2374. page.insertBefore( slide.slideBackgroundElement, slide );
  2375. }
  2376. // Inject notes if `showNotes` is enabled
  2377. if( config.showNotes ) {
  2378. // Are there notes for this slide?
  2379. var notes = getSlideNotes( slide );
  2380. if( notes ) {
  2381. var notesSpacing = 8;
  2382. var notesLayout = typeof config.showNotes === 'string' ? config.showNotes : 'inline';
  2383. var notesElement = document.createElement( 'div' );
  2384. notesElement.classList.add( 'speaker-notes' );
  2385. notesElement.classList.add( 'speaker-notes-pdf' );
  2386. notesElement.setAttribute( 'data-layout', notesLayout );
  2387. notesElement.innerHTML = notes;
  2388. if( notesLayout === 'separate-page' ) {
  2389. page.parentNode.insertBefore( notesElement, page.nextSibling );
  2390. }
  2391. else {
  2392. notesElement.style.left = notesSpacing + 'px';
  2393. notesElement.style.bottom = notesSpacing + 'px';
  2394. notesElement.style.width = ( pageWidth - notesSpacing*2 ) + 'px';
  2395. page.appendChild( notesElement );
  2396. }
  2397. }
  2398. }
  2399. // Inject slide numbers if `slideNumbers` are enabled
  2400. if( config.slideNumber && /all|print/i.test( config.showSlideNumber ) ) {
  2401. var slideNumberH = parseInt( slide.getAttribute( 'data-index-h' ), 10 ) + 1,
  2402. slideNumberV = parseInt( slide.getAttribute( 'data-index-v' ), 10 ) + 1;
  2403. var numberElement = document.createElement( 'div' );
  2404. numberElement.classList.add( 'slide-number' );
  2405. numberElement.classList.add( 'slide-number-pdf' );
  2406. numberElement.innerHTML = formatSlideNumber( slideNumberH, '.', slideNumberV );
  2407. page.appendChild( numberElement );
  2408. }
  2409. // Copy page and show fragments one after another
  2410. if( config.pdfSeparateFragments ) {
  2411. // Each fragment 'group' is an array containing one or more
  2412. // fragments. Multiple fragments that appear at the same time
  2413. // are part of the same group.
  2414. var fragmentGroups = sortFragments( page.querySelectorAll( '.fragment' ), true );
  2415. var previousFragmentStep;
  2416. var previousPage;
  2417. fragmentGroups.forEach( function( fragments ) {
  2418. // Remove 'current-fragment' from the previous group
  2419. if( previousFragmentStep ) {
  2420. previousFragmentStep.forEach( function( fragment ) {
  2421. fragment.classList.remove( 'current-fragment' );
  2422. } );
  2423. }
  2424. // Show the fragments for the current index
  2425. fragments.forEach( function( fragment ) {
  2426. fragment.classList.add( 'visible', 'current-fragment' );
  2427. } );
  2428. // Create a separate page for the current fragment state
  2429. var clonedPage = page.cloneNode( true );
  2430. page.parentNode.insertBefore( clonedPage, ( previousPage || page ).nextSibling );
  2431. previousFragmentStep = fragments;
  2432. previousPage = clonedPage;
  2433. } );
  2434. // Reset the first/original page so that all fragments are hidden
  2435. fragmentGroups.forEach( function( fragments ) {
  2436. fragments.forEach( function( fragment ) {
  2437. fragment.classList.remove( 'visible', 'current-fragment' );
  2438. } );
  2439. } );
  2440. }
  2441. // Show all fragments
  2442. else {
  2443. toArray( page.querySelectorAll( '.fragment:not(.fade-out)' ) ).forEach( function( fragment ) {
  2444. fragment.classList.add( 'visible' );
  2445. } );
  2446. }
  2447. }
  2448. } );
  2449. // Notify subscribers that the PDF layout is good to go
  2450. dispatchEvent( 'pdf-ready' );
  2451. }
  2452. /**
  2453. * This is an unfortunate necessity. Some actions – such as
  2454. * an input field being focused in an iframe or using the
  2455. * keyboard to expand text selection beyond the bounds of
  2456. * a slide – can trigger our content to be pushed out of view.
  2457. * This scrolling can not be prevented by hiding overflow in
  2458. * CSS (we already do) so we have to resort to repeatedly
  2459. * checking if the slides have been offset :(
  2460. */
  2461. function setupScrollPrevention() {
  2462. setInterval( function() {
  2463. if( dom.wrapper.scrollTop !== 0 || dom.wrapper.scrollLeft !== 0 ) {
  2464. dom.wrapper.scrollTop = 0;
  2465. dom.wrapper.scrollLeft = 0;
  2466. }
  2467. }, 1000 );
  2468. }
  2469. /**
  2470. * Creates an HTML element and returns a reference to it.
  2471. * If the element already exists the existing instance will
  2472. * be returned.
  2473. *
  2474. * @param {HTMLElement} container
  2475. * @param {string} tagname
  2476. * @param {string} classname
  2477. * @param {string} innerHTML
  2478. *
  2479. * @return {HTMLElement}
  2480. */
  2481. function createSingletonNode( container, tagname, classname, innerHTML ) {
  2482. // Find all nodes matching the description
  2483. var nodes = container.querySelectorAll( '.' + classname );
  2484. // Check all matches to find one which is a direct child of
  2485. // the specified container
  2486. for( var i = 0; i < nodes.length; i++ ) {
  2487. var testNode = nodes[i];
  2488. if( testNode.parentNode === container ) {
  2489. return testNode;
  2490. }
  2491. }
  2492. // If no node was found, create it now
  2493. var node = document.createElement( tagname );
  2494. node.className = classname;
  2495. if( typeof innerHTML === 'string' ) {
  2496. node.innerHTML = innerHTML;
  2497. }
  2498. container.appendChild( node );
  2499. return node;
  2500. }
  2501. /**
  2502. * Creates the slide background elements and appends them
  2503. * to the background container. One element is created per
  2504. * slide no matter if the given slide has visible background.
  2505. */
  2506. function createBackgrounds() {
  2507. var printMode = isPrintingPDF();
  2508. // Clear prior backgrounds
  2509. dom.background.innerHTML = '';
  2510. dom.background.classList.add( 'no-transition' );
  2511. // Iterate over all horizontal slides
  2512. toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( slideh ) {
  2513. var backgroundStack = createBackground( slideh, dom.background );
  2514. // Iterate over all vertical slides
  2515. toArray( slideh.querySelectorAll( 'section' ) ).forEach( function( slidev ) {
  2516. createBackground( slidev, backgroundStack );
  2517. backgroundStack.classList.add( 'stack' );
  2518. } );
  2519. } );
  2520. // Add parallax background if specified
  2521. if( config.parallaxBackgroundImage ) {
  2522. dom.background.style.backgroundImage = 'url("' + config.parallaxBackgroundImage + '")';
  2523. dom.background.style.backgroundSize = config.parallaxBackgroundSize;
  2524. dom.background.style.backgroundRepeat = config.parallaxBackgroundRepeat;
  2525. dom.background.style.backgroundPosition = config.parallaxBackgroundPosition;
  2526. // Make sure the below properties are set on the element - these properties are
  2527. // needed for proper transitions to be set on the element via CSS. To remove
  2528. // annoying background slide-in effect when the presentation starts, apply
  2529. // these properties after short time delay
  2530. setTimeout( function() {
  2531. dom.wrapper.classList.add( 'has-parallax-background' );
  2532. }, 1 );
  2533. }
  2534. else {
  2535. dom.background.style.backgroundImage = '';
  2536. dom.wrapper.classList.remove( 'has-parallax-background' );
  2537. }
  2538. }
  2539. /**
  2540. * Creates a background for the given slide.
  2541. *
  2542. * @param {HTMLElement} slide
  2543. * @param {HTMLElement} container The element that the background
  2544. * should be appended to
  2545. * @return {HTMLElement} New background div
  2546. */
  2547. function createBackground( slide, container ) {
  2548. // Main slide background element
  2549. var element = document.createElement( 'div' );
  2550. element.className = 'slide-background ' + slide.className.replace( /present|past|future/, '' );
  2551. // Inner background element that wraps images/videos/iframes
  2552. var contentElement = document.createElement( 'div' );
  2553. contentElement.className = 'slide-background-content';
  2554. element.appendChild( contentElement );
  2555. container.appendChild( element );
  2556. slide.slideBackgroundElement = element;
  2557. slide.slideBackgroundContentElement = contentElement;
  2558. // Syncs the background to reflect all current background settings
  2559. syncBackground( slide );
  2560. return element;
  2561. }
  2562. /**
  2563. * Renders all of the visual properties of a slide background
  2564. * based on the various background attributes.
  2565. *
  2566. * @param {HTMLElement} slide
  2567. */
  2568. function syncBackground( slide ) {
  2569. var element = slide.slideBackgroundElement,
  2570. contentElement = slide.slideBackgroundContentElement;
  2571. // Reset the prior background state in case this is not the
  2572. // initial sync
  2573. slide.classList.remove( 'has-dark-background' );
  2574. slide.classList.remove( 'has-light-background' );
  2575. element.removeAttribute( 'data-loaded' );
  2576. element.removeAttribute( 'data-background-hash' );
  2577. element.removeAttribute( 'data-background-size' );
  2578. element.removeAttribute( 'data-background-transition' );
  2579. element.style.backgroundColor = '';
  2580. contentElement.style.backgroundSize = '';
  2581. contentElement.style.backgroundRepeat = '';
  2582. contentElement.style.backgroundPosition = '';
  2583. contentElement.style.backgroundImage = '';
  2584. contentElement.style.opacity = '';
  2585. contentElement.innerHTML = '';
  2586. var data = {
  2587. background: slide.getAttribute( 'data-background' ),
  2588. backgroundSize: slide.getAttribute( 'data-background-size' ),
  2589. backgroundImage: slide.getAttribute( 'data-background-image' ),
  2590. backgroundVideo: slide.getAttribute( 'data-background-video' ),
  2591. backgroundIframe: slide.getAttribute( 'data-background-iframe' ),
  2592. backgroundColor: slide.getAttribute( 'data-background-color' ),
  2593. backgroundRepeat: slide.getAttribute( 'data-background-repeat' ),
  2594. backgroundPosition: slide.getAttribute( 'data-background-position' ),
  2595. backgroundTransition: slide.getAttribute( 'data-background-transition' ),
  2596. backgroundOpacity: slide.getAttribute( 'data-background-opacity' )
  2597. };
  2598. if( data.background ) {
  2599. // Auto-wrap image urls in url(...)
  2600. if( /^(http|file|\/\/)/gi.test( data.background ) || /\.(svg|png|jpg|jpeg|gif|bmp)([?#\s]|$)/gi.test( data.background ) ) {
  2601. slide.setAttribute( 'data-background-image', data.background );
  2602. }
  2603. else {
  2604. element.style.background = data.background;
  2605. }
  2606. }
  2607. // Create a hash for this combination of background settings.
  2608. // This is used to determine when two slide backgrounds are
  2609. // the same.
  2610. if( data.background || data.backgroundColor || data.backgroundImage || data.backgroundVideo || data.backgroundIframe ) {
  2611. element.setAttribute( 'data-background-hash', data.background +
  2612. data.backgroundSize +
  2613. data.backgroundImage +
  2614. data.backgroundVideo +
  2615. data.backgroundIframe +
  2616. data.backgroundColor +
  2617. data.backgroundRepeat +
  2618. data.backgroundPosition +
  2619. data.backgroundTransition +
  2620. data.backgroundOpacity );
  2621. }
  2622. // Additional and optional background properties
  2623. if( data.backgroundSize ) element.setAttribute( 'data-background-size', data.backgroundSize );
  2624. if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor;
  2625. if( data.backgroundTransition ) element.setAttribute( 'data-background-transition', data.backgroundTransition );
  2626. // Background image options are set on the content wrapper
  2627. if( data.backgroundSize ) contentElement.style.backgroundSize = data.backgroundSize;
  2628. if( data.backgroundRepeat ) contentElement.style.backgroundRepeat = data.backgroundRepeat;
  2629. if( data.backgroundPosition ) contentElement.style.backgroundPosition = data.backgroundPosition;
  2630. if( data.backgroundOpacity ) contentElement.style.opacity = data.backgroundOpacity;
  2631. // If this slide has a background color, we add a class that
  2632. // signals if it is light or dark. If the slide has no background
  2633. // color, no class will be added
  2634. var contrastColor = data.backgroundColor;
  2635. // If no bg color was found, check the computed background
  2636. if( !contrastColor ) {
  2637. var computedBackgroundStyle = window.getComputedStyle( element );
  2638. if( computedBackgroundStyle && computedBackgroundStyle.backgroundColor ) {
  2639. contrastColor = computedBackgroundStyle.backgroundColor;
  2640. }
  2641. }
  2642. if( contrastColor ) {
  2643. var rgb = colorToRgb( contrastColor );
  2644. // Ignore fully transparent backgrounds. Some browsers return
  2645. // rgba(0,0,0,0) when reading the computed background color of
  2646. // an element with no background
  2647. if( rgb && rgb.a !== 0 ) {
  2648. if( colorBrightness( contrastColor ) < 128 ) {
  2649. slide.classList.add( 'has-dark-background' );
  2650. }
  2651. else {
  2652. slide.classList.add( 'has-light-background' );
  2653. }
  2654. }
  2655. }
  2656. }
  2657. /**
  2658. * Registers a listener to postMessage events, this makes it
  2659. * possible to call all reveal.js API methods from another
  2660. * window. For example:
  2661. *
  2662. * revealWindow.postMessage( JSON.stringify({
  2663. * method: 'slide',
  2664. * args: [ 2 ]
  2665. * }), '*' );
  2666. */
  2667. function setupPostMessage() {
  2668. if( config.postMessage ) {
  2669. window.addEventListener( 'message', function ( event ) {
  2670. var data = event.data;
  2671. // Make sure we're dealing with JSON
  2672. if( typeof data === 'string' && data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) {
  2673. data = JSON.parse( data );
  2674. // Check if the requested method can be found
  2675. if( data.method && typeof Reveal[data.method] === 'function' ) {
  2676. Reveal[data.method].apply( Reveal, data.args );
  2677. }
  2678. }
  2679. }, false );
  2680. }
  2681. }
  2682. /**
  2683. * Applies the configuration settings from the config
  2684. * object. May be called multiple times.
  2685. *
  2686. * @param {object} options
  2687. */
  2688. function configure( options ) {
  2689. var oldTransition = config.transition;
  2690. // New config options may be passed when this method
  2691. // is invoked through the API after initialization
  2692. if( typeof options === 'object' ) extend( config, options );
  2693. // Abort if reveal.js hasn't finished loading, config
  2694. // changes will be applied automatically once loading
  2695. // finishes
  2696. if( loaded === false ) return;
  2697. var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length;
  2698. // Remove the previously configured transition class
  2699. dom.wrapper.classList.remove( oldTransition );
  2700. // Force linear transition based on browser capabilities
  2701. if( features.transforms3d === false ) config.transition = 'linear';
  2702. dom.wrapper.classList.add( config.transition );
  2703. dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed );
  2704. dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition );
  2705. dom.controls.style.display = config.controls ? 'block' : 'none';
  2706. dom.progress.style.display = config.progress ? 'block' : 'none';
  2707. dom.controls.setAttribute( 'data-controls-layout', config.controlsLayout );
  2708. dom.controls.setAttribute( 'data-controls-back-arrows', config.controlsBackArrows );
  2709. if( config.shuffle ) {
  2710. shuffle();
  2711. }
  2712. if( config.rtl ) {
  2713. dom.wrapper.classList.add( 'rtl' );
  2714. }
  2715. else {
  2716. dom.wrapper.classList.remove( 'rtl' );
  2717. }
  2718. if( config.center ) {
  2719. dom.wrapper.classList.add( 'center' );
  2720. }
  2721. else {
  2722. dom.wrapper.classList.remove( 'center' );
  2723. }
  2724. // Exit the paused mode if it was configured off
  2725. if( config.pause === false ) {
  2726. resume();
  2727. }
  2728. if( config.showNotes ) {
  2729. dom.speakerNotes.setAttribute( 'data-layout', typeof config.showNotes === 'string' ? config.showNotes : 'inline' );
  2730. }
  2731. if( config.mouseWheel ) {
  2732. document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF
  2733. document.addEventListener( 'mousewheel', onDocumentMouseScroll, false );
  2734. }
  2735. else {
  2736. document.removeEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF
  2737. document.removeEventListener( 'mousewheel', onDocumentMouseScroll, false );
  2738. }
  2739. // Rolling 3D links
  2740. if( config.rollingLinks ) {
  2741. enableRollingLinks();
  2742. }
  2743. else {
  2744. disableRollingLinks();
  2745. }
  2746. // Auto-hide the mouse pointer when its inactive
  2747. if( config.hideInactiveCursor ) {
  2748. document.addEventListener( 'mousemove', onDocumentCursorActive, false );
  2749. document.addEventListener( 'mousedown', onDocumentCursorActive, false );
  2750. }
  2751. else {
  2752. showCursor();
  2753. document.removeEventListener( 'mousemove', onDocumentCursorActive, false );
  2754. document.removeEventListener( 'mousedown', onDocumentCursorActive, false );
  2755. }
  2756. // Iframe link previews
  2757. if( config.previewLinks ) {
  2758. enablePreviewLinks();
  2759. disablePreviewLinks( '[data-preview-link=false]' );
  2760. }
  2761. else {
  2762. disablePreviewLinks();
  2763. enablePreviewLinks( '[data-preview-link]:not([data-preview-link=false])' );
  2764. }
  2765. // Remove existing auto-slide controls
  2766. if( autoSlidePlayer ) {
  2767. autoSlidePlayer.destroy();
  2768. autoSlidePlayer = null;
  2769. }
  2770. // Generate auto-slide controls if needed
  2771. if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.requestAnimationFrame ) {
  2772. autoSlidePlayer = new Playback( dom.wrapper, function() {
  2773. return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 );
  2774. } );
  2775. autoSlidePlayer.on( 'click', onAutoSlidePlayerClick );
  2776. autoSlidePaused = false;
  2777. }
  2778. // When fragments are turned off they should be visible
  2779. if( config.fragments === false ) {
  2780. toArray( dom.slides.querySelectorAll( '.fragment' ) ).forEach( function( element ) {
  2781. element.classList.add( 'visible' );
  2782. element.classList.remove( 'current-fragment' );
  2783. } );
  2784. }
  2785. // Slide numbers
  2786. var slideNumberDisplay = 'none';
  2787. if( config.slideNumber && !isPrintingPDF() ) {
  2788. if( config.showSlideNumber === 'all' ) {
  2789. slideNumberDisplay = 'block';
  2790. }
  2791. else if( config.showSlideNumber === 'speaker' && isSpeakerNotes() ) {
  2792. slideNumberDisplay = 'block';
  2793. }
  2794. }
  2795. dom.slideNumber.style.display = slideNumberDisplay;
  2796. // Add the navigation mode to the DOM so we can adjust styling
  2797. if( config.navigationMode !== 'default' ) {
  2798. dom.wrapper.setAttribute( 'data-navigation-mode', config.navigationMode );
  2799. }
  2800. else {
  2801. dom.wrapper.removeAttribute( 'data-navigation-mode' );
  2802. }
  2803. // Define our contextual list of keyboard shortcuts
  2804. if( config.navigationMode === 'linear' ) {
  2805. keyboardShortcuts['&#8594; , &#8595; , SPACE , N , L , J'] = 'Next slide';
  2806. keyboardShortcuts['&#8592; , &#8593; , P , H , K'] = 'Previous slide';
  2807. }
  2808. else {
  2809. keyboardShortcuts['N , SPACE'] = 'Next slide';
  2810. keyboardShortcuts['P'] = 'Previous slide';
  2811. keyboardShortcuts['&#8592; , H'] = 'Navigate left';
  2812. keyboardShortcuts['&#8594; , L'] = 'Navigate right';
  2813. keyboardShortcuts['&#8593; , K'] = 'Navigate up';
  2814. keyboardShortcuts['&#8595; , J'] = 'Navigate down';
  2815. }
  2816. keyboardShortcuts['Home , &#8984;/CTRL &#8592;'] = 'First slide';
  2817. keyboardShortcuts['End , &#8984;/CTRL &#8594;'] = 'Last slide';
  2818. keyboardShortcuts['B , .'] = 'Pause';
  2819. keyboardShortcuts['F'] = 'Fullscreen';
  2820. keyboardShortcuts['ESC, O'] = 'Slide overview';
  2821. sync();
  2822. }
  2823. /**
  2824. * Binds all event listeners.
  2825. */
  2826. function addEventListeners() {
  2827. eventsAreBound = true;
  2828. window.addEventListener( 'hashchange', onWindowHashChange, false );
  2829. window.addEventListener( 'resize', onWindowResize, false );
  2830. if( config.touch ) {
  2831. if( 'onpointerdown' in window ) {
  2832. // Use W3C pointer events
  2833. dom.wrapper.addEventListener( 'pointerdown', onPointerDown, false );
  2834. dom.wrapper.addEventListener( 'pointermove', onPointerMove, false );
  2835. dom.wrapper.addEventListener( 'pointerup', onPointerUp, false );
  2836. }
  2837. else if( window.navigator.msPointerEnabled ) {
  2838. // IE 10 uses prefixed version of pointer events
  2839. dom.wrapper.addEventListener( 'MSPointerDown', onPointerDown, false );
  2840. dom.wrapper.addEventListener( 'MSPointerMove', onPointerMove, false );
  2841. dom.wrapper.addEventListener( 'MSPointerUp', onPointerUp, false );
  2842. }
  2843. else {
  2844. // Fall back to touch events
  2845. dom.wrapper.addEventListener( 'touchstart', onTouchStart, false );
  2846. dom.wrapper.addEventListener( 'touchmove', onTouchMove, false );
  2847. dom.wrapper.addEventListener( 'touchend', onTouchEnd, false );
  2848. }
  2849. }
  2850. if( config.keyboard ) {
  2851. document.addEventListener( 'keydown', onDocumentKeyDown, false );
  2852. document.addEventListener( 'keypress', onDocumentKeyPress, false );
  2853. }
  2854. if( config.progress && dom.progress ) {
  2855. dom.progress.addEventListener( 'click', onProgressClicked, false );
  2856. }
  2857. dom.pauseOverlay.addEventListener( 'click', resume, false );
  2858. if( config.focusBodyOnPageVisibilityChange ) {
  2859. var visibilityChange;
  2860. if( 'hidden' in document ) {
  2861. visibilityChange = 'visibilitychange';
  2862. }
  2863. else if( 'msHidden' in document ) {
  2864. visibilityChange = 'msvisibilitychange';
  2865. }
  2866. else if( 'webkitHidden' in document ) {
  2867. visibilityChange = 'webkitvisibilitychange';
  2868. }
  2869. if( visibilityChange ) {
  2870. document.addEventListener( visibilityChange, onPageVisibilityChange, false );
  2871. }
  2872. }
  2873. // Listen to both touch and click events, in case the device
  2874. // supports both
  2875. var pointerEvents = [ 'touchstart', 'click' ];
  2876. // Only support touch for Android, fixes double navigations in
  2877. // stock browser
  2878. if( UA.match( /android/gi ) ) {
  2879. pointerEvents = [ 'touchstart' ];
  2880. }
  2881. pointerEvents.forEach( function( eventName ) {
  2882. dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } );
  2883. dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } );
  2884. dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } );
  2885. dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } );
  2886. dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } );
  2887. dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } );
  2888. } );
  2889. }
  2890. /**
  2891. * Unbinds all event listeners.
  2892. */
  2893. function removeEventListeners() {
  2894. eventsAreBound = false;
  2895. document.removeEventListener( 'keydown', onDocumentKeyDown, false );
  2896. document.removeEventListener( 'keypress', onDocumentKeyPress, false );
  2897. window.removeEventListener( 'hashchange', onWindowHashChange, false );
  2898. window.removeEventListener( 'resize', onWindowResize, false );
  2899. dom.wrapper.removeEventListener( 'pointerdown', onPointerDown, false );
  2900. dom.wrapper.removeEventListener( 'pointermove', onPointerMove, false );
  2901. dom.wrapper.removeEventListener( 'pointerup', onPointerUp, false );
  2902. dom.wrapper.removeEventListener( 'MSPointerDown', onPointerDown, false );
  2903. dom.wrapper.removeEventListener( 'MSPointerMove', onPointerMove, false );
  2904. dom.wrapper.removeEventListener( 'MSPointerUp', onPointerUp, false );
  2905. dom.wrapper.removeEventListener( 'touchstart', onTouchStart, false );
  2906. dom.wrapper.removeEventListener( 'touchmove', onTouchMove, false );
  2907. dom.wrapper.removeEventListener( 'touchend', onTouchEnd, false );
  2908. dom.pauseOverlay.removeEventListener( 'click', resume, false );
  2909. if ( config.progress && dom.progress ) {
  2910. dom.progress.removeEventListener( 'click', onProgressClicked, false );
  2911. }
  2912. [ 'touchstart', 'click' ].forEach( function( eventName ) {
  2913. dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } );
  2914. dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } );
  2915. dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } );
  2916. dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } );
  2917. dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } );
  2918. dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } );
  2919. } );
  2920. }
  2921. /**
  2922. * Registers a new plugin with this reveal.js instance.
  2923. *
  2924. * reveal.js waits for all regisered plugins to initialize
  2925. * before considering itself ready, as long as the plugin
  2926. * is registered before calling `Reveal.initialize()`.
  2927. */
  2928. function registerPlugin( id, plugin ) {
  2929. if( plugins[id] === undefined ) {
  2930. plugins[id] = plugin;
  2931. // If a plugin is registered after reveal.js is loaded,
  2932. // initialize it right away
  2933. if( loaded && typeof plugin.init === 'function' ) {
  2934. plugin.init();
  2935. }
  2936. }
  2937. else {
  2938. console.warn( 'reveal.js: "'+ id +'" plugin has already been registered' );
  2939. }
  2940. }
  2941. /**
  2942. * Checks if a specific plugin has been registered.
  2943. *
  2944. * @param {String} id Unique plugin identifier
  2945. */
  2946. function hasPlugin( id ) {
  2947. return !!plugins[id];
  2948. }
  2949. /**
  2950. * Returns the specific plugin instance, if a plugin
  2951. * with the given ID has been registered.
  2952. *
  2953. * @param {String} id Unique plugin identifier
  2954. */
  2955. function getPlugin( id ) {
  2956. return plugins[id];
  2957. }
  2958. /**
  2959. * Add a custom key binding with optional description to
  2960. * be added to the help screen.
  2961. */
  2962. function addKeyBinding( binding, callback ) {
  2963. if( typeof binding === 'object' && binding.keyCode ) {
  2964. registeredKeyBindings[binding.keyCode] = {
  2965. callback: callback,
  2966. key: binding.key,
  2967. description: binding.description
  2968. };
  2969. }
  2970. else {
  2971. registeredKeyBindings[binding] = {
  2972. callback: callback,
  2973. key: null,
  2974. description: null
  2975. };
  2976. }
  2977. }
  2978. /**
  2979. * Removes the specified custom key binding.
  2980. */
  2981. function removeKeyBinding( keyCode ) {
  2982. delete registeredKeyBindings[keyCode];
  2983. }
  2984. /**
  2985. * Extend object a with the properties of object b.
  2986. * If there's a conflict, object b takes precedence.
  2987. *
  2988. * @param {object} a
  2989. * @param {object} b
  2990. */
  2991. function extend( a, b ) {
  2992. for( var i in b ) {
  2993. a[ i ] = b[ i ];
  2994. }
  2995. return a;
  2996. }
  2997. /**
  2998. * Converts the target object to an array.
  2999. *
  3000. * @param {object} o
  3001. * @return {object[]}
  3002. */
  3003. function toArray( o ) {
  3004. return Array.prototype.slice.call( o );
  3005. }
  3006. /**
  3007. * Utility for deserializing a value.
  3008. *
  3009. * @param {*} value
  3010. * @return {*}
  3011. */
  3012. function deserialize( value ) {
  3013. if( typeof value === 'string' ) {
  3014. if( value === 'null' ) return null;
  3015. else if( value === 'true' ) return true;
  3016. else if( value === 'false' ) return false;
  3017. else if( value.match( /^-?[\d\.]+$/ ) ) return parseFloat( value );
  3018. }
  3019. return value;
  3020. }
  3021. /**
  3022. * Measures the distance in pixels between point a
  3023. * and point b.
  3024. *
  3025. * @param {object} a point with x/y properties
  3026. * @param {object} b point with x/y properties
  3027. *
  3028. * @return {number}
  3029. */
  3030. function distanceBetween( a, b ) {
  3031. var dx = a.x - b.x,
  3032. dy = a.y - b.y;
  3033. return Math.sqrt( dx*dx + dy*dy );
  3034. }
  3035. /**
  3036. * Applies a CSS transform to the target element.
  3037. *
  3038. * @param {HTMLElement} element
  3039. * @param {string} transform
  3040. */
  3041. function transformElement( element, transform ) {
  3042. element.style.WebkitTransform = transform;
  3043. element.style.MozTransform = transform;
  3044. element.style.msTransform = transform;
  3045. element.style.transform = transform;
  3046. }
  3047. /**
  3048. * Applies CSS transforms to the slides container. The container
  3049. * is transformed from two separate sources: layout and the overview
  3050. * mode.
  3051. *
  3052. * @param {object} transforms
  3053. */
  3054. function transformSlides( transforms ) {
  3055. // Pick up new transforms from arguments
  3056. if( typeof transforms.layout === 'string' ) slidesTransform.layout = transforms.layout;
  3057. if( typeof transforms.overview === 'string' ) slidesTransform.overview = transforms.overview;
  3058. // Apply the transforms to the slides container
  3059. if( slidesTransform.layout ) {
  3060. transformElement( dom.slides, slidesTransform.layout + ' ' + slidesTransform.overview );
  3061. }
  3062. else {
  3063. transformElement( dom.slides, slidesTransform.overview );
  3064. }
  3065. }
  3066. /**
  3067. * Injects the given CSS styles into the DOM.
  3068. *
  3069. * @param {string} value
  3070. */
  3071. function injectStyleSheet( value ) {
  3072. var tag = document.createElement( 'style' );
  3073. tag.type = 'text/css';
  3074. if( tag.styleSheet ) {
  3075. tag.styleSheet.cssText = value;
  3076. }
  3077. else {
  3078. tag.appendChild( document.createTextNode( value ) );
  3079. }
  3080. document.getElementsByTagName( 'head' )[0].appendChild( tag );
  3081. }
  3082. /**
  3083. * Find the closest parent that matches the given
  3084. * selector.
  3085. *
  3086. * @param {HTMLElement} target The child element
  3087. * @param {String} selector The CSS selector to match
  3088. * the parents against
  3089. *
  3090. * @return {HTMLElement} The matched parent or null
  3091. * if no matching parent was found
  3092. */
  3093. function closestParent( target, selector ) {
  3094. var parent = target.parentNode;
  3095. while( parent ) {
  3096. // There's some overhead doing this each time, we don't
  3097. // want to rewrite the element prototype but should still
  3098. // be enough to feature detect once at startup...
  3099. var matchesMethod = parent.matches || parent.matchesSelector || parent.msMatchesSelector;
  3100. // If we find a match, we're all set
  3101. if( matchesMethod && matchesMethod.call( parent, selector ) ) {
  3102. return parent;
  3103. }
  3104. // Keep searching
  3105. parent = parent.parentNode;
  3106. }
  3107. return null;
  3108. }
  3109. /**
  3110. * Converts various color input formats to an {r:0,g:0,b:0} object.
  3111. *
  3112. * @param {string} color The string representation of a color
  3113. * @example
  3114. * colorToRgb('#000');
  3115. * @example
  3116. * colorToRgb('#000000');
  3117. * @example
  3118. * colorToRgb('rgb(0,0,0)');
  3119. * @example
  3120. * colorToRgb('rgba(0,0,0)');
  3121. *
  3122. * @return {{r: number, g: number, b: number, [a]: number}|null}
  3123. */
  3124. function colorToRgb( color ) {
  3125. var hex3 = color.match( /^#([0-9a-f]{3})$/i );
  3126. if( hex3 && hex3[1] ) {
  3127. hex3 = hex3[1];
  3128. return {
  3129. r: parseInt( hex3.charAt( 0 ), 16 ) * 0x11,
  3130. g: parseInt( hex3.charAt( 1 ), 16 ) * 0x11,
  3131. b: parseInt( hex3.charAt( 2 ), 16 ) * 0x11
  3132. };
  3133. }
  3134. var hex6 = color.match( /^#([0-9a-f]{6})$/i );
  3135. if( hex6 && hex6[1] ) {
  3136. hex6 = hex6[1];
  3137. return {
  3138. r: parseInt( hex6.substr( 0, 2 ), 16 ),
  3139. g: parseInt( hex6.substr( 2, 2 ), 16 ),
  3140. b: parseInt( hex6.substr( 4, 2 ), 16 )
  3141. };
  3142. }
  3143. var rgb = color.match( /^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i );
  3144. if( rgb ) {
  3145. return {
  3146. r: parseInt( rgb[1], 10 ),
  3147. g: parseInt( rgb[2], 10 ),
  3148. b: parseInt( rgb[3], 10 )
  3149. };
  3150. }
  3151. var rgba = color.match( /^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i );
  3152. if( rgba ) {
  3153. return {
  3154. r: parseInt( rgba[1], 10 ),
  3155. g: parseInt( rgba[2], 10 ),
  3156. b: parseInt( rgba[3], 10 ),
  3157. a: parseFloat( rgba[4] )
  3158. };
  3159. }
  3160. return null;
  3161. }
  3162. /**
  3163. * Calculates brightness on a scale of 0-255.
  3164. *
  3165. * @param {string} color See colorToRgb for supported formats.
  3166. * @see {@link colorToRgb}
  3167. */
  3168. function colorBrightness( color ) {
  3169. if( typeof color === 'string' ) color = colorToRgb( color );
  3170. if( color ) {
  3171. return ( color.r * 299 + color.g * 587 + color.b * 114 ) / 1000;
  3172. }
  3173. return null;
  3174. }
  3175. /**
  3176. * Returns the remaining height within the parent of the
  3177. * target element.
  3178. *
  3179. * remaining height = [ configured parent height ] - [ current parent height ]
  3180. *
  3181. * @param {HTMLElement} element
  3182. * @param {number} [height]
  3183. */
  3184. function getRemainingHeight( element, height ) {
  3185. height = height || 0;
  3186. if( element ) {
  3187. var newHeight, oldHeight = element.style.height;
  3188. // Change the .stretch element height to 0 in order find the height of all
  3189. // the other elements
  3190. element.style.height = '0px';
  3191. // In Overview mode, the parent (.slide) height is set of 700px.
  3192. // Restore it temporarily to its natural height.
  3193. element.parentNode.style.height = 'auto';
  3194. newHeight = height - element.parentNode.offsetHeight;
  3195. // Restore the old height, just in case
  3196. element.style.height = oldHeight + 'px';
  3197. // Clear the parent (.slide) height. .removeProperty works in IE9+
  3198. element.parentNode.style.removeProperty('height');
  3199. return newHeight;
  3200. }
  3201. return height;
  3202. }
  3203. /**
  3204. * Checks if this instance is being used to print a PDF.
  3205. */
  3206. function isPrintingPDF() {
  3207. return ( /print-pdf/gi ).test( window.location.search );
  3208. }
  3209. /**
  3210. * Hides the address bar if we're on a mobile device.
  3211. */
  3212. function hideAddressBar() {
  3213. if( config.hideAddressBar && isMobileDevice ) {
  3214. // Events that should trigger the address bar to hide
  3215. window.addEventListener( 'load', removeAddressBar, false );
  3216. window.addEventListener( 'orientationchange', removeAddressBar, false );
  3217. }
  3218. }
  3219. /**
  3220. * Causes the address bar to hide on mobile devices,
  3221. * more vertical space ftw.
  3222. */
  3223. function removeAddressBar() {
  3224. setTimeout( function() {
  3225. window.scrollTo( 0, 1 );
  3226. }, 10 );
  3227. }
  3228. /**
  3229. * Dispatches an event of the specified type from the
  3230. * reveal DOM element.
  3231. */
  3232. function dispatchEvent( type, args ) {
  3233. var event = document.createEvent( 'HTMLEvents', 1, 2 );
  3234. event.initEvent( type, true, true );
  3235. extend( event, args );
  3236. dom.wrapper.dispatchEvent( event );
  3237. // If we're in an iframe, post each reveal.js event to the
  3238. // parent window. Used by the notes plugin
  3239. if( config.postMessageEvents && window.parent !== window.self ) {
  3240. window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' );
  3241. }
  3242. }
  3243. /**
  3244. * Wrap all links in 3D goodness.
  3245. */
  3246. function enableRollingLinks() {
  3247. if( features.transforms3d && !( 'msPerspective' in document.body.style ) ) {
  3248. var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a' );
  3249. for( var i = 0, len = anchors.length; i < len; i++ ) {
  3250. var anchor = anchors[i];
  3251. if( anchor.textContent && !anchor.querySelector( '*' ) && ( !anchor.className || !anchor.classList.contains( anchor, 'roll' ) ) ) {
  3252. var span = document.createElement('span');
  3253. span.setAttribute('data-title', anchor.text);
  3254. span.innerHTML = anchor.innerHTML;
  3255. anchor.classList.add( 'roll' );
  3256. anchor.innerHTML = '';
  3257. anchor.appendChild(span);
  3258. }
  3259. }
  3260. }
  3261. }
  3262. /**
  3263. * Unwrap all 3D links.
  3264. */
  3265. function disableRollingLinks() {
  3266. var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a.roll' );
  3267. for( var i = 0, len = anchors.length; i < len; i++ ) {
  3268. var anchor = anchors[i];
  3269. var span = anchor.querySelector( 'span' );
  3270. if( span ) {
  3271. anchor.classList.remove( 'roll' );
  3272. anchor.innerHTML = span.innerHTML;
  3273. }
  3274. }
  3275. }
  3276. /**
  3277. * Bind preview frame links.
  3278. *
  3279. * @param {string} [selector=a] - selector for anchors
  3280. */
  3281. function enablePreviewLinks( selector ) {
  3282. var anchors = toArray( document.querySelectorAll( selector ? selector : 'a' ) );
  3283. anchors.forEach( function( element ) {
  3284. if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
  3285. element.addEventListener( 'click', onPreviewLinkClicked, false );
  3286. }
  3287. } );
  3288. }
  3289. /**
  3290. * Unbind preview frame links.
  3291. */
  3292. function disablePreviewLinks( selector ) {
  3293. var anchors = toArray( document.querySelectorAll( selector ? selector : 'a' ) );
  3294. anchors.forEach( function( element ) {
  3295. if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
  3296. element.removeEventListener( 'click', onPreviewLinkClicked, false );
  3297. }
  3298. } );
  3299. }
  3300. /**
  3301. * Opens a preview window for the target URL.
  3302. *
  3303. * @param {string} url - url for preview iframe src
  3304. */
  3305. function showPreview( url ) {
  3306. closeOverlay();
  3307. dom.overlay = document.createElement( 'div' );
  3308. dom.overlay.classList.add( 'overlay' );
  3309. dom.overlay.classList.add( 'overlay-preview' );
  3310. dom.wrapper.appendChild( dom.overlay );
  3311. dom.overlay.innerHTML = [
  3312. '<header>',
  3313. '<a class="close" href="#"><span class="icon"></span></a>',
  3314. '<a class="external" href="'+ url +'" target="_blank"><span class="icon"></span></a>',
  3315. '</header>',
  3316. '<div class="spinner"></div>',
  3317. '<div class="viewport">',
  3318. '<iframe src="'+ url +'"></iframe>',
  3319. '<small class="viewport-inner">',
  3320. '<span class="x-frame-error">Unable to load iframe. This is likely due to the site\'s policy (x-frame-options).</span>',
  3321. '</small>',
  3322. '</div>'
  3323. ].join('');
  3324. dom.overlay.querySelector( 'iframe' ).addEventListener( 'load', function( event ) {
  3325. dom.overlay.classList.add( 'loaded' );
  3326. }, false );
  3327. dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) {
  3328. closeOverlay();
  3329. event.preventDefault();
  3330. }, false );
  3331. dom.overlay.querySelector( '.external' ).addEventListener( 'click', function( event ) {
  3332. closeOverlay();
  3333. }, false );
  3334. setTimeout( function() {
  3335. dom.overlay.classList.add( 'visible' );
  3336. }, 1 );
  3337. }
  3338. /**
  3339. * Open or close help overlay window.
  3340. *
  3341. * @param {Boolean} [override] Flag which overrides the
  3342. * toggle logic and forcibly sets the desired state. True means
  3343. * help is open, false means it's closed.
  3344. */
  3345. function toggleHelp( override ){
  3346. if( typeof override === 'boolean' ) {
  3347. override ? showHelp() : closeOverlay();
  3348. }
  3349. else {
  3350. if( dom.overlay ) {
  3351. closeOverlay();
  3352. }
  3353. else {
  3354. showHelp();
  3355. }
  3356. }
  3357. }
  3358. /**
  3359. * Opens an overlay window with help material.
  3360. */
  3361. function showHelp() {
  3362. if( config.help ) {
  3363. closeOverlay();
  3364. dom.overlay = document.createElement( 'div' );
  3365. dom.overlay.classList.add( 'overlay' );
  3366. dom.overlay.classList.add( 'overlay-help' );
  3367. dom.wrapper.appendChild( dom.overlay );
  3368. var html = '<p class="title">Keyboard Shortcuts</p><br/>';
  3369. html += '<table><th>KEY</th><th>ACTION</th>';
  3370. for( var key in keyboardShortcuts ) {
  3371. html += '<tr><td>' + key + '</td><td>' + keyboardShortcuts[ key ] + '</td></tr>';
  3372. }
  3373. // Add custom key bindings that have associated descriptions
  3374. for( var binding in registeredKeyBindings ) {
  3375. if( registeredKeyBindings[binding].key && registeredKeyBindings[binding].description ) {
  3376. html += '<tr><td>' + registeredKeyBindings[binding].key + '</td><td>' + registeredKeyBindings[binding].description + '</td></tr>';
  3377. }
  3378. }
  3379. html += '</table>';
  3380. dom.overlay.innerHTML = [
  3381. '<header>',
  3382. '<a class="close" href="#"><span class="icon"></span></a>',
  3383. '</header>',
  3384. '<div class="viewport">',
  3385. '<div class="viewport-inner">'+ html +'</div>',
  3386. '</div>'
  3387. ].join('');
  3388. dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) {
  3389. closeOverlay();
  3390. event.preventDefault();
  3391. }, false );
  3392. setTimeout( function() {
  3393. dom.overlay.classList.add( 'visible' );
  3394. }, 1 );
  3395. }
  3396. }
  3397. /**
  3398. * Closes any currently open overlay.
  3399. */
  3400. function closeOverlay() {
  3401. if( dom.overlay ) {
  3402. dom.overlay.parentNode.removeChild( dom.overlay );
  3403. dom.overlay = null;
  3404. }
  3405. }
  3406. /**
  3407. * Applies JavaScript-controlled layout rules to the
  3408. * presentation.
  3409. */
  3410. function layout() {
  3411. if( dom.wrapper && !isPrintingPDF() ) {
  3412. if( !config.disableLayout ) {
  3413. // On some mobile devices '100vh' is taller than the visible
  3414. // viewport which leads to part of the presentation being
  3415. // cut off. To work around this we define our own '--vh' custom
  3416. // property where 100x adds up to the correct height.
  3417. //
  3418. // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
  3419. if( isMobileDevice ) {
  3420. document.documentElement.style.setProperty( '--vh', ( window.innerHeight * 0.01 ) + 'px' );
  3421. }
  3422. var size = getComputedSlideSize();
  3423. var oldScale = scale;
  3424. // Layout the contents of the slides
  3425. layoutSlideContents( config.width, config.height );
  3426. dom.slides.style.width = size.width + 'px';
  3427. dom.slides.style.height = size.height + 'px';
  3428. // Determine scale of content to fit within available space
  3429. scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height );
  3430. // Respect max/min scale settings
  3431. scale = Math.max( scale, config.minScale );
  3432. scale = Math.min( scale, config.maxScale );
  3433. // Don't apply any scaling styles if scale is 1
  3434. if( scale === 1 ) {
  3435. dom.slides.style.zoom = '';
  3436. dom.slides.style.left = '';
  3437. dom.slides.style.top = '';
  3438. dom.slides.style.bottom = '';
  3439. dom.slides.style.right = '';
  3440. transformSlides( { layout: '' } );
  3441. }
  3442. else {
  3443. // Prefer zoom for scaling up so that content remains crisp.
  3444. // Don't use zoom to scale down since that can lead to shifts
  3445. // in text layout/line breaks.
  3446. if( scale > 1 && features.zoom ) {
  3447. dom.slides.style.zoom = scale;
  3448. dom.slides.style.left = '';
  3449. dom.slides.style.top = '';
  3450. dom.slides.style.bottom = '';
  3451. dom.slides.style.right = '';
  3452. transformSlides( { layout: '' } );
  3453. }
  3454. // Apply scale transform as a fallback
  3455. else {
  3456. dom.slides.style.zoom = '';
  3457. dom.slides.style.left = '50%';
  3458. dom.slides.style.top = '50%';
  3459. dom.slides.style.bottom = 'auto';
  3460. dom.slides.style.right = 'auto';
  3461. transformSlides( { layout: 'translate(-50%, -50%) scale('+ scale +')' } );
  3462. }
  3463. }
  3464. // Select all slides, vertical and horizontal
  3465. var slides = toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) );
  3466. for( var i = 0, len = slides.length; i < len; i++ ) {
  3467. var slide = slides[ i ];
  3468. // Don't bother updating invisible slides
  3469. if( slide.style.display === 'none' ) {
  3470. continue;
  3471. }
  3472. if( config.center || slide.classList.contains( 'center' ) ) {
  3473. // Vertical stacks are not centred since their section
  3474. // children will be
  3475. if( slide.classList.contains( 'stack' ) ) {
  3476. slide.style.top = 0;
  3477. }
  3478. else {
  3479. slide.style.top = Math.max( ( size.height - slide.scrollHeight ) / 2, 0 ) + 'px';
  3480. }
  3481. }
  3482. else {
  3483. slide.style.top = '';
  3484. }
  3485. }
  3486. if( oldScale !== scale ) {
  3487. dispatchEvent( 'resize', {
  3488. 'oldScale': oldScale,
  3489. 'scale': scale,
  3490. 'size': size
  3491. } );
  3492. }
  3493. }
  3494. updateProgress();
  3495. updateParallax();
  3496. if( isOverview() ) {
  3497. updateOverview();
  3498. }
  3499. }
  3500. }
  3501. /**
  3502. * Applies layout logic to the contents of all slides in
  3503. * the presentation.
  3504. *
  3505. * @param {string|number} width
  3506. * @param {string|number} height
  3507. */
  3508. function layoutSlideContents( width, height ) {
  3509. // Handle sizing of elements with the 'stretch' class
  3510. toArray( dom.slides.querySelectorAll( 'section > .stretch' ) ).forEach( function( element ) {
  3511. // Determine how much vertical space we can use
  3512. var remainingHeight = getRemainingHeight( element, height );
  3513. // Consider the aspect ratio of media elements
  3514. if( /(img|video)/gi.test( element.nodeName ) ) {
  3515. var nw = element.naturalWidth || element.videoWidth,
  3516. nh = element.naturalHeight || element.videoHeight;
  3517. var es = Math.min( width / nw, remainingHeight / nh );
  3518. element.style.width = ( nw * es ) + 'px';
  3519. element.style.height = ( nh * es ) + 'px';
  3520. }
  3521. else {
  3522. element.style.width = width + 'px';
  3523. element.style.height = remainingHeight + 'px';
  3524. }
  3525. } );
  3526. }
  3527. /**
  3528. * Calculates the computed pixel size of our slides. These
  3529. * values are based on the width and height configuration
  3530. * options.
  3531. *
  3532. * @param {number} [presentationWidth=dom.wrapper.offsetWidth]
  3533. * @param {number} [presentationHeight=dom.wrapper.offsetHeight]
  3534. */
  3535. function getComputedSlideSize( presentationWidth, presentationHeight ) {
  3536. var size = {
  3537. // Slide size
  3538. width: config.width,
  3539. height: config.height,
  3540. // Presentation size
  3541. presentationWidth: presentationWidth || dom.wrapper.offsetWidth,
  3542. presentationHeight: presentationHeight || dom.wrapper.offsetHeight
  3543. };
  3544. // Reduce available space by margin
  3545. size.presentationWidth -= ( size.presentationWidth * config.margin );
  3546. size.presentationHeight -= ( size.presentationHeight * config.margin );
  3547. // Slide width may be a percentage of available width
  3548. if( typeof size.width === 'string' && /%$/.test( size.width ) ) {
  3549. size.width = parseInt( size.width, 10 ) / 100 * size.presentationWidth;
  3550. }
  3551. // Slide height may be a percentage of available height
  3552. if( typeof size.height === 'string' && /%$/.test( size.height ) ) {
  3553. size.height = parseInt( size.height, 10 ) / 100 * size.presentationHeight;
  3554. }
  3555. return size;
  3556. }
  3557. /**
  3558. * Stores the vertical index of a stack so that the same
  3559. * vertical slide can be selected when navigating to and
  3560. * from the stack.
  3561. *
  3562. * @param {HTMLElement} stack The vertical stack element
  3563. * @param {string|number} [v=0] Index to memorize
  3564. */
  3565. function setPreviousVerticalIndex( stack, v ) {
  3566. if( typeof stack === 'object' && typeof stack.setAttribute === 'function' ) {
  3567. stack.setAttribute( 'data-previous-indexv', v || 0 );
  3568. }
  3569. }
  3570. /**
  3571. * Retrieves the vertical index which was stored using
  3572. * #setPreviousVerticalIndex() or 0 if no previous index
  3573. * exists.
  3574. *
  3575. * @param {HTMLElement} stack The vertical stack element
  3576. */
  3577. function getPreviousVerticalIndex( stack ) {
  3578. if( typeof stack === 'object' && typeof stack.setAttribute === 'function' && stack.classList.contains( 'stack' ) ) {
  3579. // Prefer manually defined start-indexv
  3580. var attributeName = stack.hasAttribute( 'data-start-indexv' ) ? 'data-start-indexv' : 'data-previous-indexv';
  3581. return parseInt( stack.getAttribute( attributeName ) || 0, 10 );
  3582. }
  3583. return 0;
  3584. }
  3585. /**
  3586. * Displays the overview of slides (quick nav) by scaling
  3587. * down and arranging all slide elements.
  3588. */
  3589. function activateOverview() {
  3590. // Only proceed if enabled in config
  3591. if( config.overview && !isOverview() ) {
  3592. overview = true;
  3593. dom.wrapper.classList.add( 'overview' );
  3594. dom.wrapper.classList.remove( 'overview-deactivating' );
  3595. if( features.overviewTransitions ) {
  3596. setTimeout( function() {
  3597. dom.wrapper.classList.add( 'overview-animated' );
  3598. }, 1 );
  3599. }
  3600. // Don't auto-slide while in overview mode
  3601. cancelAutoSlide();
  3602. // Move the backgrounds element into the slide container to
  3603. // that the same scaling is applied
  3604. dom.slides.appendChild( dom.background );
  3605. // Clicking on an overview slide navigates to it
  3606. toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) {
  3607. if( !slide.classList.contains( 'stack' ) ) {
  3608. slide.addEventListener( 'click', onOverviewSlideClicked, true );
  3609. }
  3610. } );
  3611. // Calculate slide sizes
  3612. var margin = 70;
  3613. var slideSize = getComputedSlideSize();
  3614. overviewSlideWidth = slideSize.width + margin;
  3615. overviewSlideHeight = slideSize.height + margin;
  3616. // Reverse in RTL mode
  3617. if( config.rtl ) {
  3618. overviewSlideWidth = -overviewSlideWidth;
  3619. }
  3620. updateSlidesVisibility();
  3621. layoutOverview();
  3622. updateOverview();
  3623. layout();
  3624. // Notify observers of the overview showing
  3625. dispatchEvent( 'overviewshown', {
  3626. 'indexh': indexh,
  3627. 'indexv': indexv,
  3628. 'currentSlide': currentSlide
  3629. } );
  3630. }
  3631. }
  3632. /**
  3633. * Uses CSS transforms to position all slides in a grid for
  3634. * display inside of the overview mode.
  3635. */
  3636. function layoutOverview() {
  3637. // Layout slides
  3638. toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) {
  3639. hslide.setAttribute( 'data-index-h', h );
  3640. transformElement( hslide, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' );
  3641. if( hslide.classList.contains( 'stack' ) ) {
  3642. toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) {
  3643. vslide.setAttribute( 'data-index-h', h );
  3644. vslide.setAttribute( 'data-index-v', v );
  3645. transformElement( vslide, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' );
  3646. } );
  3647. }
  3648. } );
  3649. // Layout slide backgrounds
  3650. toArray( dom.background.childNodes ).forEach( function( hbackground, h ) {
  3651. transformElement( hbackground, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' );
  3652. toArray( hbackground.querySelectorAll( '.slide-background' ) ).forEach( function( vbackground, v ) {
  3653. transformElement( vbackground, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' );
  3654. } );
  3655. } );
  3656. }
  3657. /**
  3658. * Moves the overview viewport to the current slides.
  3659. * Called each time the current slide changes.
  3660. */
  3661. function updateOverview() {
  3662. var vmin = Math.min( window.innerWidth, window.innerHeight );
  3663. var scale = Math.max( vmin / 5, 150 ) / vmin;
  3664. transformSlides( {
  3665. overview: [
  3666. 'scale('+ scale +')',
  3667. 'translateX('+ ( -indexh * overviewSlideWidth ) +'px)',
  3668. 'translateY('+ ( -indexv * overviewSlideHeight ) +'px)'
  3669. ].join( ' ' )
  3670. } );
  3671. }
  3672. /**
  3673. * Exits the slide overview and enters the currently
  3674. * active slide.
  3675. */
  3676. function deactivateOverview() {
  3677. // Only proceed if enabled in config
  3678. if( config.overview ) {
  3679. overview = false;
  3680. dom.wrapper.classList.remove( 'overview' );
  3681. dom.wrapper.classList.remove( 'overview-animated' );
  3682. // Temporarily add a class so that transitions can do different things
  3683. // depending on whether they are exiting/entering overview, or just
  3684. // moving from slide to slide
  3685. dom.wrapper.classList.add( 'overview-deactivating' );
  3686. setTimeout( function () {
  3687. dom.wrapper.classList.remove( 'overview-deactivating' );
  3688. }, 1 );
  3689. // Move the background element back out
  3690. dom.wrapper.appendChild( dom.background );
  3691. // Clean up changes made to slides
  3692. toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) {
  3693. transformElement( slide, '' );
  3694. slide.removeEventListener( 'click', onOverviewSlideClicked, true );
  3695. } );
  3696. // Clean up changes made to backgrounds
  3697. toArray( dom.background.querySelectorAll( '.slide-background' ) ).forEach( function( background ) {
  3698. transformElement( background, '' );
  3699. } );
  3700. transformSlides( { overview: '' } );
  3701. slide( indexh, indexv );
  3702. layout();
  3703. cueAutoSlide();
  3704. // Notify observers of the overview hiding
  3705. dispatchEvent( 'overviewhidden', {
  3706. 'indexh': indexh,
  3707. 'indexv': indexv,
  3708. 'currentSlide': currentSlide
  3709. } );
  3710. }
  3711. }
  3712. /**
  3713. * Toggles the slide overview mode on and off.
  3714. *
  3715. * @param {Boolean} [override] Flag which overrides the
  3716. * toggle logic and forcibly sets the desired state. True means
  3717. * overview is open, false means it's closed.
  3718. */
  3719. function toggleOverview( override ) {
  3720. if( typeof override === 'boolean' ) {
  3721. override ? activateOverview() : deactivateOverview();
  3722. }
  3723. else {
  3724. isOverview() ? deactivateOverview() : activateOverview();
  3725. }
  3726. }
  3727. /**
  3728. * Checks if the overview is currently active.
  3729. *
  3730. * @return {Boolean} true if the overview is active,
  3731. * false otherwise
  3732. */
  3733. function isOverview() {
  3734. return overview;
  3735. }
  3736. /**
  3737. * Return a hash URL that will resolve to the current slide location.
  3738. */
  3739. function locationHash() {
  3740. var url = '/';
  3741. // Attempt to create a named link based on the slide's ID
  3742. var id = currentSlide ? currentSlide.getAttribute( 'id' ) : null;
  3743. if( id ) {
  3744. id = encodeURIComponent( id );
  3745. }
  3746. var indexf;
  3747. if( config.fragmentInURL ) {
  3748. indexf = getIndices().f;
  3749. }
  3750. // If the current slide has an ID, use that as a named link,
  3751. // but we don't support named links with a fragment index
  3752. if( typeof id === 'string' && id.length && indexf === undefined ) {
  3753. url = '/' + id;
  3754. }
  3755. // Otherwise use the /h/v index
  3756. else {
  3757. var hashIndexBase = config.hashOneBasedIndex ? 1 : 0;
  3758. if( indexh > 0 || indexv > 0 || indexf !== undefined ) url += indexh + hashIndexBase;
  3759. if( indexv > 0 || indexf !== undefined ) url += '/' + (indexv + hashIndexBase );
  3760. if( indexf !== undefined ) url += '/' + indexf;
  3761. }
  3762. return url;
  3763. }
  3764. /**
  3765. * Checks if the current or specified slide is vertical
  3766. * (nested within another slide).
  3767. *
  3768. * @param {HTMLElement} [slide=currentSlide] The slide to check
  3769. * orientation of
  3770. * @return {Boolean}
  3771. */
  3772. function isVerticalSlide( slide ) {
  3773. // Prefer slide argument, otherwise use current slide
  3774. slide = slide ? slide : currentSlide;
  3775. return slide && slide.parentNode && !!slide.parentNode.nodeName.match( /section/i );
  3776. }
  3777. /**
  3778. * Handling the fullscreen functionality via the fullscreen API
  3779. *
  3780. * @see http://fullscreen.spec.whatwg.org/
  3781. * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode
  3782. */
  3783. function enterFullscreen() {
  3784. var element = document.documentElement;
  3785. // Check which implementation is available
  3786. var requestMethod = element.requestFullscreen ||
  3787. element.webkitRequestFullscreen ||
  3788. element.webkitRequestFullScreen ||
  3789. element.mozRequestFullScreen ||
  3790. element.msRequestFullscreen;
  3791. if( requestMethod ) {
  3792. requestMethod.apply( element );
  3793. }
  3794. }
  3795. /**
  3796. * Shows the mouse pointer after it has been hidden with
  3797. * #hideCursor.
  3798. */
  3799. function showCursor() {
  3800. if( cursorHidden ) {
  3801. cursorHidden = false;
  3802. dom.wrapper.style.cursor = '';
  3803. }
  3804. }
  3805. /**
  3806. * Hides the mouse pointer when it's on top of the .reveal
  3807. * container.
  3808. */
  3809. function hideCursor() {
  3810. if( cursorHidden === false ) {
  3811. cursorHidden = true;
  3812. dom.wrapper.style.cursor = 'none';
  3813. }
  3814. }
  3815. /**
  3816. * Enters the paused mode which fades everything on screen to
  3817. * black.
  3818. */
  3819. function pause() {
  3820. if( config.pause ) {
  3821. var wasPaused = dom.wrapper.classList.contains( 'paused' );
  3822. cancelAutoSlide();
  3823. dom.wrapper.classList.add( 'paused' );
  3824. if( wasPaused === false ) {
  3825. dispatchEvent( 'paused' );
  3826. }
  3827. }
  3828. }
  3829. /**
  3830. * Exits from the paused mode.
  3831. */
  3832. function resume() {
  3833. var wasPaused = dom.wrapper.classList.contains( 'paused' );
  3834. dom.wrapper.classList.remove( 'paused' );
  3835. cueAutoSlide();
  3836. if( wasPaused ) {
  3837. dispatchEvent( 'resumed' );
  3838. }
  3839. }
  3840. /**
  3841. * Toggles the paused mode on and off.
  3842. */
  3843. function togglePause( override ) {
  3844. if( typeof override === 'boolean' ) {
  3845. override ? pause() : resume();
  3846. }
  3847. else {
  3848. isPaused() ? resume() : pause();
  3849. }
  3850. }
  3851. /**
  3852. * Checks if we are currently in the paused mode.
  3853. *
  3854. * @return {Boolean}
  3855. */
  3856. function isPaused() {
  3857. return dom.wrapper.classList.contains( 'paused' );
  3858. }
  3859. /**
  3860. * Toggles the auto slide mode on and off.
  3861. *
  3862. * @param {Boolean} [override] Flag which sets the desired state.
  3863. * True means autoplay starts, false means it stops.
  3864. */
  3865. function toggleAutoSlide( override ) {
  3866. if( typeof override === 'boolean' ) {
  3867. override ? resumeAutoSlide() : pauseAutoSlide();
  3868. }
  3869. else {
  3870. autoSlidePaused ? resumeAutoSlide() : pauseAutoSlide();
  3871. }
  3872. }
  3873. /**
  3874. * Checks if the auto slide mode is currently on.
  3875. *
  3876. * @return {Boolean}
  3877. */
  3878. function isAutoSliding() {
  3879. return !!( autoSlide && !autoSlidePaused );
  3880. }
  3881. /**
  3882. * Steps from the current point in the presentation to the
  3883. * slide which matches the specified horizontal and vertical
  3884. * indices.
  3885. *
  3886. * @param {number} [h=indexh] Horizontal index of the target slide
  3887. * @param {number} [v=indexv] Vertical index of the target slide
  3888. * @param {number} [f] Index of a fragment within the
  3889. * target slide to activate
  3890. * @param {number} [o] Origin for use in multimaster environments
  3891. */
  3892. function slide( h, v, f, o ) {
  3893. // Remember where we were at before
  3894. previousSlide = currentSlide;
  3895. // Query all horizontal slides in the deck
  3896. var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR );
  3897. // Abort if there are no slides
  3898. if( horizontalSlides.length === 0 ) return;
  3899. // If no vertical index is specified and the upcoming slide is a
  3900. // stack, resume at its previous vertical index
  3901. if( v === undefined && !isOverview() ) {
  3902. v = getPreviousVerticalIndex( horizontalSlides[ h ] );
  3903. }
  3904. // If we were on a vertical stack, remember what vertical index
  3905. // it was on so we can resume at the same position when returning
  3906. if( previousSlide && previousSlide.parentNode && previousSlide.parentNode.classList.contains( 'stack' ) ) {
  3907. setPreviousVerticalIndex( previousSlide.parentNode, indexv );
  3908. }
  3909. // Remember the state before this slide
  3910. var stateBefore = state.concat();
  3911. // Reset the state array
  3912. state.length = 0;
  3913. var indexhBefore = indexh || 0,
  3914. indexvBefore = indexv || 0;
  3915. // Activate and transition to the new slide
  3916. indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h );
  3917. indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v );
  3918. // Update the visibility of slides now that the indices have changed
  3919. updateSlidesVisibility();
  3920. layout();
  3921. // Update the overview if it's currently active
  3922. if( isOverview() ) {
  3923. updateOverview();
  3924. }
  3925. // Find the current horizontal slide and any possible vertical slides
  3926. // within it
  3927. var currentHorizontalSlide = horizontalSlides[ indexh ],
  3928. currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' );
  3929. // Store references to the previous and current slides
  3930. currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
  3931. // Show fragment, if specified
  3932. if( typeof f !== 'undefined' ) {
  3933. navigateFragment( f );
  3934. }
  3935. // Dispatch an event if the slide changed
  3936. var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
  3937. if (!slideChanged) {
  3938. // Ensure that the previous slide is never the same as the current
  3939. previousSlide = null;
  3940. }
  3941. // Solves an edge case where the previous slide maintains the
  3942. // 'present' class when navigating between adjacent vertical
  3943. // stacks
  3944. if( previousSlide && previousSlide !== currentSlide ) {
  3945. previousSlide.classList.remove( 'present' );
  3946. previousSlide.setAttribute( 'aria-hidden', 'true' );
  3947. // Reset all slides upon navigate to home
  3948. // Issue: #285
  3949. if ( dom.wrapper.querySelector( HOME_SLIDE_SELECTOR ).classList.contains( 'present' ) ) {
  3950. // Launch async task
  3951. setTimeout( function () {
  3952. var slides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.stack') ), i;
  3953. for( i in slides ) {
  3954. if( slides[i] ) {
  3955. // Reset stack
  3956. setPreviousVerticalIndex( slides[i], 0 );
  3957. }
  3958. }
  3959. }, 0 );
  3960. }
  3961. }
  3962. // Apply the new state
  3963. stateLoop: for( var i = 0, len = state.length; i < len; i++ ) {
  3964. // Check if this state existed on the previous slide. If it
  3965. // did, we will avoid adding it repeatedly
  3966. for( var j = 0; j < stateBefore.length; j++ ) {
  3967. if( stateBefore[j] === state[i] ) {
  3968. stateBefore.splice( j, 1 );
  3969. continue stateLoop;
  3970. }
  3971. }
  3972. document.documentElement.classList.add( state[i] );
  3973. // Dispatch custom event matching the state's name
  3974. dispatchEvent( state[i] );
  3975. }
  3976. // Clean up the remains of the previous state
  3977. while( stateBefore.length ) {
  3978. document.documentElement.classList.remove( stateBefore.pop() );
  3979. }
  3980. if( slideChanged ) {
  3981. dispatchEvent( 'slidechanged', {
  3982. 'indexh': indexh,
  3983. 'indexv': indexv,
  3984. 'previousSlide': previousSlide,
  3985. 'currentSlide': currentSlide,
  3986. 'origin': o
  3987. } );
  3988. }
  3989. // Handle embedded content
  3990. if( slideChanged || !previousSlide ) {
  3991. stopEmbeddedContent( previousSlide );
  3992. startEmbeddedContent( currentSlide );
  3993. }
  3994. // Announce the current slide contents, for screen readers
  3995. dom.statusDiv.textContent = getStatusText( currentSlide );
  3996. updateControls();
  3997. updateProgress();
  3998. updateBackground();
  3999. updateParallax();
  4000. updateSlideNumber();
  4001. updateNotes();
  4002. updateFragments();
  4003. // Update the URL hash
  4004. writeURL();
  4005. cueAutoSlide();
  4006. }
  4007. /**
  4008. * Syncs the presentation with the current DOM. Useful
  4009. * when new slides or control elements are added or when
  4010. * the configuration has changed.
  4011. */
  4012. function sync() {
  4013. // Subscribe to input
  4014. removeEventListeners();
  4015. addEventListeners();
  4016. // Force a layout to make sure the current config is accounted for
  4017. layout();
  4018. // Reflect the current autoSlide value
  4019. autoSlide = config.autoSlide;
  4020. // Start auto-sliding if it's enabled
  4021. cueAutoSlide();
  4022. // Re-create the slide backgrounds
  4023. createBackgrounds();
  4024. // Write the current hash to the URL
  4025. writeURL();
  4026. sortAllFragments();
  4027. updateControls();
  4028. updateProgress();
  4029. updateSlideNumber();
  4030. updateSlidesVisibility();
  4031. updateBackground( true );
  4032. updateNotesVisibility();
  4033. updateNotes();
  4034. formatEmbeddedContent();
  4035. // Start or stop embedded content depending on global config
  4036. if( config.autoPlayMedia === false ) {
  4037. stopEmbeddedContent( currentSlide, { unloadIframes: false } );
  4038. }
  4039. else {
  4040. startEmbeddedContent( currentSlide );
  4041. }
  4042. if( isOverview() ) {
  4043. layoutOverview();
  4044. }
  4045. }
  4046. /**
  4047. * Updates reveal.js to keep in sync with new slide attributes. For
  4048. * example, if you add a new `data-background-image` you can call
  4049. * this to have reveal.js render the new background image.
  4050. *
  4051. * Similar to #sync() but more efficient when you only need to
  4052. * refresh a specific slide.
  4053. *
  4054. * @param {HTMLElement} slide
  4055. */
  4056. function syncSlide( slide ) {
  4057. // Default to the current slide
  4058. slide = slide || currentSlide;
  4059. syncBackground( slide );
  4060. syncFragments( slide );
  4061. updateBackground();
  4062. updateNotes();
  4063. loadSlide( slide );
  4064. }
  4065. /**
  4066. * Formats the fragments on the given slide so that they have
  4067. * valid indices. Call this if fragments are changed in the DOM
  4068. * after reveal.js has already initialized.
  4069. *
  4070. * @param {HTMLElement} slide
  4071. * @return {Array} a list of the HTML fragments that were synced
  4072. */
  4073. function syncFragments( slide ) {
  4074. // Default to the current slide
  4075. slide = slide || currentSlide;
  4076. return sortFragments( slide.querySelectorAll( '.fragment' ) );
  4077. }
  4078. /**
  4079. * Resets all vertical slides so that only the first
  4080. * is visible.
  4081. */
  4082. function resetVerticalSlides() {
  4083. var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
  4084. horizontalSlides.forEach( function( horizontalSlide ) {
  4085. var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) );
  4086. verticalSlides.forEach( function( verticalSlide, y ) {
  4087. if( y > 0 ) {
  4088. verticalSlide.classList.remove( 'present' );
  4089. verticalSlide.classList.remove( 'past' );
  4090. verticalSlide.classList.add( 'future' );
  4091. verticalSlide.setAttribute( 'aria-hidden', 'true' );
  4092. }
  4093. } );
  4094. } );
  4095. }
  4096. /**
  4097. * Sorts and formats all of fragments in the
  4098. * presentation.
  4099. */
  4100. function sortAllFragments() {
  4101. var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
  4102. horizontalSlides.forEach( function( horizontalSlide ) {
  4103. var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) );
  4104. verticalSlides.forEach( function( verticalSlide, y ) {
  4105. sortFragments( verticalSlide.querySelectorAll( '.fragment' ) );
  4106. } );
  4107. if( verticalSlides.length === 0 ) sortFragments( horizontalSlide.querySelectorAll( '.fragment' ) );
  4108. } );
  4109. }
  4110. /**
  4111. * Randomly shuffles all slides in the deck.
  4112. */
  4113. function shuffle() {
  4114. var slides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
  4115. slides.forEach( function( slide ) {
  4116. // Insert this slide next to another random slide. This may
  4117. // cause the slide to insert before itself but that's fine.
  4118. dom.slides.insertBefore( slide, slides[ Math.floor( Math.random() * slides.length ) ] );
  4119. } );
  4120. }
  4121. /**
  4122. * Updates one dimension of slides by showing the slide
  4123. * with the specified index.
  4124. *
  4125. * @param {string} selector A CSS selector that will fetch
  4126. * the group of slides we are working with
  4127. * @param {number} index The index of the slide that should be
  4128. * shown
  4129. *
  4130. * @return {number} The index of the slide that is now shown,
  4131. * might differ from the passed in index if it was out of
  4132. * bounds.
  4133. */
  4134. function updateSlides( selector, index ) {
  4135. // Select all slides and convert the NodeList result to
  4136. // an array
  4137. var slides = toArray( dom.wrapper.querySelectorAll( selector ) ),
  4138. slidesLength = slides.length;
  4139. var printMode = isPrintingPDF();
  4140. if( slidesLength ) {
  4141. // Should the index loop?
  4142. if( config.loop ) {
  4143. index %= slidesLength;
  4144. if( index < 0 ) {
  4145. index = slidesLength + index;
  4146. }
  4147. }
  4148. // Enforce max and minimum index bounds
  4149. index = Math.max( Math.min( index, slidesLength - 1 ), 0 );
  4150. for( var i = 0; i < slidesLength; i++ ) {
  4151. var element = slides[i];
  4152. var reverse = config.rtl && !isVerticalSlide( element );
  4153. element.classList.remove( 'past' );
  4154. element.classList.remove( 'present' );
  4155. element.classList.remove( 'future' );
  4156. // http://www.w3.org/html/wg/drafts/html/master/editing.html#the-hidden-attribute
  4157. element.setAttribute( 'hidden', '' );
  4158. element.setAttribute( 'aria-hidden', 'true' );
  4159. // If this element contains vertical slides
  4160. if( element.querySelector( 'section' ) ) {
  4161. element.classList.add( 'stack' );
  4162. }
  4163. // If we're printing static slides, all slides are "present"
  4164. if( printMode ) {
  4165. element.classList.add( 'present' );
  4166. continue;
  4167. }
  4168. if( i < index ) {
  4169. // Any element previous to index is given the 'past' class
  4170. element.classList.add( reverse ? 'future' : 'past' );
  4171. if( config.fragments ) {
  4172. // Show all fragments in prior slides
  4173. toArray( element.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
  4174. fragment.classList.add( 'visible' );
  4175. fragment.classList.remove( 'current-fragment' );
  4176. } );
  4177. }
  4178. }
  4179. else if( i > index ) {
  4180. // Any element subsequent to index is given the 'future' class
  4181. element.classList.add( reverse ? 'past' : 'future' );
  4182. if( config.fragments ) {
  4183. // Hide all fragments in future slides
  4184. toArray( element.querySelectorAll( '.fragment.visible' ) ).forEach( function( fragment ) {
  4185. fragment.classList.remove( 'visible' );
  4186. fragment.classList.remove( 'current-fragment' );
  4187. } );
  4188. }
  4189. }
  4190. }
  4191. // Mark the current slide as present
  4192. slides[index].classList.add( 'present' );
  4193. slides[index].removeAttribute( 'hidden' );
  4194. slides[index].removeAttribute( 'aria-hidden' );
  4195. // If this slide has a state associated with it, add it
  4196. // onto the current state of the deck
  4197. var slideState = slides[index].getAttribute( 'data-state' );
  4198. if( slideState ) {
  4199. state = state.concat( slideState.split( ' ' ) );
  4200. }
  4201. }
  4202. else {
  4203. // Since there are no slides we can't be anywhere beyond the
  4204. // zeroth index
  4205. index = 0;
  4206. }
  4207. return index;
  4208. }
  4209. /**
  4210. * Optimization method; hide all slides that are far away
  4211. * from the present slide.
  4212. */
  4213. function updateSlidesVisibility() {
  4214. // Select all slides and convert the NodeList result to
  4215. // an array
  4216. var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ),
  4217. horizontalSlidesLength = horizontalSlides.length,
  4218. distanceX,
  4219. distanceY;
  4220. if( horizontalSlidesLength && typeof indexh !== 'undefined' ) {
  4221. // The number of steps away from the present slide that will
  4222. // be visible
  4223. var viewDistance = isOverview() ? 10 : config.viewDistance;
  4224. // Limit view distance on weaker devices
  4225. if( isMobileDevice ) {
  4226. viewDistance = isOverview() ? 6 : 2;
  4227. }
  4228. // All slides need to be visible when exporting to PDF
  4229. if( isPrintingPDF() ) {
  4230. viewDistance = Number.MAX_VALUE;
  4231. }
  4232. for( var x = 0; x < horizontalSlidesLength; x++ ) {
  4233. var horizontalSlide = horizontalSlides[x];
  4234. var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ),
  4235. verticalSlidesLength = verticalSlides.length;
  4236. // Determine how far away this slide is from the present
  4237. distanceX = Math.abs( ( indexh || 0 ) - x ) || 0;
  4238. // If the presentation is looped, distance should measure
  4239. // 1 between the first and last slides
  4240. if( config.loop ) {
  4241. distanceX = Math.abs( ( ( indexh || 0 ) - x ) % ( horizontalSlidesLength - viewDistance ) ) || 0;
  4242. }
  4243. // Show the horizontal slide if it's within the view distance
  4244. if( distanceX < viewDistance ) {
  4245. loadSlide( horizontalSlide );
  4246. }
  4247. else {
  4248. unloadSlide( horizontalSlide );
  4249. }
  4250. if( verticalSlidesLength ) {
  4251. var oy = getPreviousVerticalIndex( horizontalSlide );
  4252. for( var y = 0; y < verticalSlidesLength; y++ ) {
  4253. var verticalSlide = verticalSlides[y];
  4254. distanceY = x === ( indexh || 0 ) ? Math.abs( ( indexv || 0 ) - y ) : Math.abs( y - oy );
  4255. if( distanceX + distanceY < viewDistance ) {
  4256. loadSlide( verticalSlide );
  4257. }
  4258. else {
  4259. unloadSlide( verticalSlide );
  4260. }
  4261. }
  4262. }
  4263. }
  4264. // Flag if there are ANY vertical slides, anywhere in the deck
  4265. if( dom.wrapper.querySelectorAll( '.slides>section>section' ).length ) {
  4266. dom.wrapper.classList.add( 'has-vertical-slides' );
  4267. }
  4268. else {
  4269. dom.wrapper.classList.remove( 'has-vertical-slides' );
  4270. }
  4271. // Flag if there are ANY horizontal slides, anywhere in the deck
  4272. if( dom.wrapper.querySelectorAll( '.slides>section' ).length > 1 ) {
  4273. dom.wrapper.classList.add( 'has-horizontal-slides' );
  4274. }
  4275. else {
  4276. dom.wrapper.classList.remove( 'has-horizontal-slides' );
  4277. }
  4278. }
  4279. }
  4280. /**
  4281. * Pick up notes from the current slide and display them
  4282. * to the viewer.
  4283. *
  4284. * @see {@link config.showNotes}
  4285. */
  4286. function updateNotes() {
  4287. if( config.showNotes && dom.speakerNotes && currentSlide && !isPrintingPDF() ) {
  4288. dom.speakerNotes.innerHTML = getSlideNotes() || '<span class="notes-placeholder">No notes on this slide.</span>';
  4289. }
  4290. }
  4291. /**
  4292. * Updates the visibility of the speaker notes sidebar that
  4293. * is used to share annotated slides. The notes sidebar is
  4294. * only visible if showNotes is true and there are notes on
  4295. * one or more slides in the deck.
  4296. */
  4297. function updateNotesVisibility() {
  4298. if( config.showNotes && hasNotes() ) {
  4299. dom.wrapper.classList.add( 'show-notes' );
  4300. }
  4301. else {
  4302. dom.wrapper.classList.remove( 'show-notes' );
  4303. }
  4304. }
  4305. /**
  4306. * Checks if there are speaker notes for ANY slide in the
  4307. * presentation.
  4308. */
  4309. function hasNotes() {
  4310. return dom.slides.querySelectorAll( '[data-notes], aside.notes' ).length > 0;
  4311. }
  4312. /**
  4313. * Updates the progress bar to reflect the current slide.
  4314. */
  4315. function updateProgress() {
  4316. // Update progress if enabled
  4317. if( config.progress && dom.progressbar ) {
  4318. dom.progressbar.style.width = getProgress() * dom.wrapper.offsetWidth + 'px';
  4319. }
  4320. }
  4321. /**
  4322. * Updates the slide number to match the current slide.
  4323. */
  4324. function updateSlideNumber() {
  4325. // Update slide number if enabled
  4326. if( config.slideNumber && dom.slideNumber ) {
  4327. var value;
  4328. var format = 'h.v';
  4329. if( typeof config.slideNumber === 'function' ) {
  4330. value = config.slideNumber();
  4331. }
  4332. else {
  4333. // Check if a custom number format is available
  4334. if( typeof config.slideNumber === 'string' ) {
  4335. format = config.slideNumber;
  4336. }
  4337. // If there are ONLY vertical slides in this deck, always use
  4338. // a flattened slide number
  4339. if( !/c/.test( format ) && dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ).length === 1 ) {
  4340. format = 'c';
  4341. }
  4342. value = [];
  4343. switch( format ) {
  4344. case 'c':
  4345. value.push( getSlidePastCount() + 1 );
  4346. break;
  4347. case 'c/t':
  4348. value.push( getSlidePastCount() + 1, '/', getTotalSlides() );
  4349. break;
  4350. case 'h/v':
  4351. value.push( indexh + 1 );
  4352. if( isVerticalSlide() ) value.push( '/', indexv + 1 );
  4353. break;
  4354. default:
  4355. value.push( indexh + 1 );
  4356. if( isVerticalSlide() ) value.push( '.', indexv + 1 );
  4357. }
  4358. }
  4359. dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] );
  4360. }
  4361. }
  4362. /**
  4363. * Applies HTML formatting to a slide number before it's
  4364. * written to the DOM.
  4365. *
  4366. * @param {number} a Current slide
  4367. * @param {string} delimiter Character to separate slide numbers
  4368. * @param {(number|*)} b Total slides
  4369. * @return {string} HTML string fragment
  4370. */
  4371. function formatSlideNumber( a, delimiter, b ) {
  4372. var url = '#' + locationHash();
  4373. if( typeof b === 'number' && !isNaN( b ) ) {
  4374. return '<a href="' + url + '">' +
  4375. '<span class="slide-number-a">'+ a +'</span>' +
  4376. '<span class="slide-number-delimiter">'+ delimiter +'</span>' +
  4377. '<span class="slide-number-b">'+ b +'</span>' +
  4378. '</a>';
  4379. }
  4380. else {
  4381. return '<a href="' + url + '">' +
  4382. '<span class="slide-number-a">'+ a +'</span>' +
  4383. '</a>';
  4384. }
  4385. }
  4386. /**
  4387. * Updates the state of all control/navigation arrows.
  4388. */
  4389. function updateControls() {
  4390. var routes = availableRoutes();
  4391. var fragments = availableFragments();
  4392. // Remove the 'enabled' class from all directions
  4393. dom.controlsLeft.concat( dom.controlsRight )
  4394. .concat( dom.controlsUp )
  4395. .concat( dom.controlsDown )
  4396. .concat( dom.controlsPrev )
  4397. .concat( dom.controlsNext ).forEach( function( node ) {
  4398. node.classList.remove( 'enabled' );
  4399. node.classList.remove( 'fragmented' );
  4400. // Set 'disabled' attribute on all directions
  4401. node.setAttribute( 'disabled', 'disabled' );
  4402. } );
  4403. // Add the 'enabled' class to the available routes; remove 'disabled' attribute to enable buttons
  4404. if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4405. if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4406. if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4407. if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4408. // Prev/next buttons
  4409. if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4410. if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4411. // Highlight fragment directions
  4412. if( currentSlide ) {
  4413. // Always apply fragment decorator to prev/next buttons
  4414. if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4415. if( fragments.next ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4416. // Apply fragment decorators to directional buttons based on
  4417. // what slide axis they are in
  4418. if( isVerticalSlide( currentSlide ) ) {
  4419. if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4420. if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4421. }
  4422. else {
  4423. if( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4424. if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
  4425. }
  4426. }
  4427. if( config.controlsTutorial ) {
  4428. // Highlight control arrows with an animation to ensure
  4429. // that the viewer knows how to navigate
  4430. if( !hasNavigatedDown && routes.down ) {
  4431. dom.controlsDownArrow.classList.add( 'highlight' );
  4432. }
  4433. else {
  4434. dom.controlsDownArrow.classList.remove( 'highlight' );
  4435. if( !hasNavigatedRight && routes.right && indexv === 0 ) {
  4436. dom.controlsRightArrow.classList.add( 'highlight' );
  4437. }
  4438. else {
  4439. dom.controlsRightArrow.classList.remove( 'highlight' );
  4440. }
  4441. }
  4442. }
  4443. }
  4444. /**
  4445. * Updates the background elements to reflect the current
  4446. * slide.
  4447. *
  4448. * @param {boolean} includeAll If true, the backgrounds of
  4449. * all vertical slides (not just the present) will be updated.
  4450. */
  4451. function updateBackground( includeAll ) {
  4452. var currentBackground = null;
  4453. // Reverse past/future classes when in RTL mode
  4454. var horizontalPast = config.rtl ? 'future' : 'past',
  4455. horizontalFuture = config.rtl ? 'past' : 'future';
  4456. // Update the classes of all backgrounds to match the
  4457. // states of their slides (past/present/future)
  4458. toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) {
  4459. backgroundh.classList.remove( 'past' );
  4460. backgroundh.classList.remove( 'present' );
  4461. backgroundh.classList.remove( 'future' );
  4462. if( h < indexh ) {
  4463. backgroundh.classList.add( horizontalPast );
  4464. }
  4465. else if ( h > indexh ) {
  4466. backgroundh.classList.add( horizontalFuture );
  4467. }
  4468. else {
  4469. backgroundh.classList.add( 'present' );
  4470. // Store a reference to the current background element
  4471. currentBackground = backgroundh;
  4472. }
  4473. if( includeAll || h === indexh ) {
  4474. toArray( backgroundh.querySelectorAll( '.slide-background' ) ).forEach( function( backgroundv, v ) {
  4475. backgroundv.classList.remove( 'past' );
  4476. backgroundv.classList.remove( 'present' );
  4477. backgroundv.classList.remove( 'future' );
  4478. if( v < indexv ) {
  4479. backgroundv.classList.add( 'past' );
  4480. }
  4481. else if ( v > indexv ) {
  4482. backgroundv.classList.add( 'future' );
  4483. }
  4484. else {
  4485. backgroundv.classList.add( 'present' );
  4486. // Only if this is the present horizontal and vertical slide
  4487. if( h === indexh ) currentBackground = backgroundv;
  4488. }
  4489. } );
  4490. }
  4491. } );
  4492. // Stop content inside of previous backgrounds
  4493. if( previousBackground ) {
  4494. stopEmbeddedContent( previousBackground );
  4495. }
  4496. // Start content in the current background
  4497. if( currentBackground ) {
  4498. startEmbeddedContent( currentBackground );
  4499. var currentBackgroundContent = currentBackground.querySelector( '.slide-background-content' );
  4500. if( currentBackgroundContent ) {
  4501. var backgroundImageURL = currentBackgroundContent.style.backgroundImage || '';
  4502. // Restart GIFs (doesn't work in Firefox)
  4503. if( /\.gif/i.test( backgroundImageURL ) ) {
  4504. currentBackgroundContent.style.backgroundImage = '';
  4505. window.getComputedStyle( currentBackgroundContent ).opacity;
  4506. currentBackgroundContent.style.backgroundImage = backgroundImageURL;
  4507. }
  4508. }
  4509. // Don't transition between identical backgrounds. This
  4510. // prevents unwanted flicker.
  4511. var previousBackgroundHash = previousBackground ? previousBackground.getAttribute( 'data-background-hash' ) : null;
  4512. var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' );
  4513. if( currentBackgroundHash && currentBackgroundHash === previousBackgroundHash && currentBackground !== previousBackground ) {
  4514. dom.background.classList.add( 'no-transition' );
  4515. }
  4516. previousBackground = currentBackground;
  4517. }
  4518. // If there's a background brightness flag for this slide,
  4519. // bubble it to the .reveal container
  4520. if( currentSlide ) {
  4521. [ 'has-light-background', 'has-dark-background' ].forEach( function( classToBubble ) {
  4522. if( currentSlide.classList.contains( classToBubble ) ) {
  4523. dom.wrapper.classList.add( classToBubble );
  4524. }
  4525. else {
  4526. dom.wrapper.classList.remove( classToBubble );
  4527. }
  4528. } );
  4529. }
  4530. // Allow the first background to apply without transition
  4531. setTimeout( function() {
  4532. dom.background.classList.remove( 'no-transition' );
  4533. }, 1 );
  4534. }
  4535. /**
  4536. * Updates the position of the parallax background based
  4537. * on the current slide index.
  4538. */
  4539. function updateParallax() {
  4540. if( config.parallaxBackgroundImage ) {
  4541. var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ),
  4542. verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR );
  4543. var backgroundSize = dom.background.style.backgroundSize.split( ' ' ),
  4544. backgroundWidth, backgroundHeight;
  4545. if( backgroundSize.length === 1 ) {
  4546. backgroundWidth = backgroundHeight = parseInt( backgroundSize[0], 10 );
  4547. }
  4548. else {
  4549. backgroundWidth = parseInt( backgroundSize[0], 10 );
  4550. backgroundHeight = parseInt( backgroundSize[1], 10 );
  4551. }
  4552. var slideWidth = dom.background.offsetWidth,
  4553. horizontalSlideCount = horizontalSlides.length,
  4554. horizontalOffsetMultiplier,
  4555. horizontalOffset;
  4556. if( typeof config.parallaxBackgroundHorizontal === 'number' ) {
  4557. horizontalOffsetMultiplier = config.parallaxBackgroundHorizontal;
  4558. }
  4559. else {
  4560. horizontalOffsetMultiplier = horizontalSlideCount > 1 ? ( backgroundWidth - slideWidth ) / ( horizontalSlideCount-1 ) : 0;
  4561. }
  4562. horizontalOffset = horizontalOffsetMultiplier * indexh * -1;
  4563. var slideHeight = dom.background.offsetHeight,
  4564. verticalSlideCount = verticalSlides.length,
  4565. verticalOffsetMultiplier,
  4566. verticalOffset;
  4567. if( typeof config.parallaxBackgroundVertical === 'number' ) {
  4568. verticalOffsetMultiplier = config.parallaxBackgroundVertical;
  4569. }
  4570. else {
  4571. verticalOffsetMultiplier = ( backgroundHeight - slideHeight ) / ( verticalSlideCount-1 );
  4572. }
  4573. verticalOffset = verticalSlideCount > 0 ? verticalOffsetMultiplier * indexv : 0;
  4574. dom.background.style.backgroundPosition = horizontalOffset + 'px ' + -verticalOffset + 'px';
  4575. }
  4576. }
  4577. /**
  4578. * Should the given element be preloaded?
  4579. * Decides based on local element attributes and global config.
  4580. *
  4581. * @param {HTMLElement} element
  4582. */
  4583. function shouldPreload( element ) {
  4584. // Prefer an explicit global preload setting
  4585. var preload = config.preloadIframes;
  4586. // If no global setting is available, fall back on the element's
  4587. // own preload setting
  4588. if( typeof preload !== 'boolean' ) {
  4589. preload = element.hasAttribute( 'data-preload' );
  4590. }
  4591. return preload;
  4592. }
  4593. /**
  4594. * Called when the given slide is within the configured view
  4595. * distance. Shows the slide element and loads any content
  4596. * that is set to load lazily (data-src).
  4597. *
  4598. * @param {HTMLElement} slide Slide to show
  4599. */
  4600. function loadSlide( slide, options ) {
  4601. options = options || {};
  4602. // Show the slide element
  4603. slide.style.display = config.display;
  4604. // Media elements with data-src attributes
  4605. toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src], iframe[data-src]' ) ).forEach( function( element ) {
  4606. if( element.tagName !== 'IFRAME' || shouldPreload( element ) ) {
  4607. element.setAttribute( 'src', element.getAttribute( 'data-src' ) );
  4608. element.setAttribute( 'data-lazy-loaded', '' );
  4609. element.removeAttribute( 'data-src' );
  4610. }
  4611. } );
  4612. // Media elements with <source> children
  4613. toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( media ) {
  4614. var sources = 0;
  4615. toArray( media.querySelectorAll( 'source[data-src]' ) ).forEach( function( source ) {
  4616. source.setAttribute( 'src', source.getAttribute( 'data-src' ) );
  4617. source.removeAttribute( 'data-src' );
  4618. source.setAttribute( 'data-lazy-loaded', '' );
  4619. sources += 1;
  4620. } );
  4621. // If we rewrote sources for this video/audio element, we need
  4622. // to manually tell it to load from its new origin
  4623. if( sources > 0 ) {
  4624. media.load();
  4625. }
  4626. } );
  4627. // Show the corresponding background element
  4628. var background = slide.slideBackgroundElement;
  4629. if( background ) {
  4630. background.style.display = 'block';
  4631. var backgroundContent = slide.slideBackgroundContentElement;
  4632. // If the background contains media, load it
  4633. if( background.hasAttribute( 'data-loaded' ) === false ) {
  4634. background.setAttribute( 'data-loaded', 'true' );
  4635. var backgroundImage = slide.getAttribute( 'data-background-image' ),
  4636. backgroundVideo = slide.getAttribute( 'data-background-video' ),
  4637. backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ),
  4638. backgroundVideoMuted = slide.hasAttribute( 'data-background-video-muted' ),
  4639. backgroundIframe = slide.getAttribute( 'data-background-iframe' );
  4640. // Images
  4641. if( backgroundImage ) {
  4642. backgroundContent.style.backgroundImage = 'url('+ encodeURI( backgroundImage ) +')';
  4643. }
  4644. // Videos
  4645. else if ( backgroundVideo && !isSpeakerNotes() ) {
  4646. var video = document.createElement( 'video' );
  4647. if( backgroundVideoLoop ) {
  4648. video.setAttribute( 'loop', '' );
  4649. }
  4650. if( backgroundVideoMuted ) {
  4651. video.muted = true;
  4652. }
  4653. // Inline video playback works (at least in Mobile Safari) as
  4654. // long as the video is muted and the `playsinline` attribute is
  4655. // present
  4656. if( isMobileDevice ) {
  4657. video.muted = true;
  4658. video.autoplay = true;
  4659. video.setAttribute( 'playsinline', '' );
  4660. }
  4661. // Support comma separated lists of video sources
  4662. backgroundVideo.split( ',' ).forEach( function( source ) {
  4663. video.innerHTML += '<source src="'+ source +'">';
  4664. } );
  4665. backgroundContent.appendChild( video );
  4666. }
  4667. // Iframes
  4668. else if( backgroundIframe && options.excludeIframes !== true ) {
  4669. var iframe = document.createElement( 'iframe' );
  4670. iframe.setAttribute( 'allowfullscreen', '' );
  4671. iframe.setAttribute( 'mozallowfullscreen', '' );
  4672. iframe.setAttribute( 'webkitallowfullscreen', '' );
  4673. // Only load autoplaying content when the slide is shown to
  4674. // avoid having it play in the background
  4675. if( /autoplay=(1|true|yes)/gi.test( backgroundIframe ) ) {
  4676. iframe.setAttribute( 'data-src', backgroundIframe );
  4677. }
  4678. else {
  4679. iframe.setAttribute( 'src', backgroundIframe );
  4680. }
  4681. iframe.style.width = '100%';
  4682. iframe.style.height = '100%';
  4683. iframe.style.maxHeight = '100%';
  4684. iframe.style.maxWidth = '100%';
  4685. backgroundContent.appendChild( iframe );
  4686. }
  4687. }
  4688. }
  4689. }
  4690. /**
  4691. * Unloads and hides the given slide. This is called when the
  4692. * slide is moved outside of the configured view distance.
  4693. *
  4694. * @param {HTMLElement} slide
  4695. */
  4696. function unloadSlide( slide ) {
  4697. // Hide the slide element
  4698. slide.style.display = 'none';
  4699. // Hide the corresponding background element
  4700. var background = getSlideBackground( slide );
  4701. if( background ) {
  4702. background.style.display = 'none';
  4703. }
  4704. // Reset lazy-loaded media elements with src attributes
  4705. toArray( slide.querySelectorAll( 'video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]' ) ).forEach( function( element ) {
  4706. element.setAttribute( 'data-src', element.getAttribute( 'src' ) );
  4707. element.removeAttribute( 'src' );
  4708. } );
  4709. // Reset lazy-loaded media elements with <source> children
  4710. toArray( slide.querySelectorAll( 'video[data-lazy-loaded] source[src], audio source[src]' ) ).forEach( function( source ) {
  4711. source.setAttribute( 'data-src', source.getAttribute( 'src' ) );
  4712. source.removeAttribute( 'src' );
  4713. } );
  4714. }
  4715. /**
  4716. * Determine what available routes there are for navigation.
  4717. *
  4718. * @return {{left: boolean, right: boolean, up: boolean, down: boolean}}
  4719. */
  4720. function availableRoutes() {
  4721. var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ),
  4722. verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR );
  4723. var routes = {
  4724. left: indexh > 0,
  4725. right: indexh < horizontalSlides.length - 1,
  4726. up: indexv > 0,
  4727. down: indexv < verticalSlides.length - 1
  4728. };
  4729. // Looped presentations can always be navigated as long as
  4730. // there are slides available
  4731. if( config.loop ) {
  4732. if( horizontalSlides.length > 1 ) {
  4733. routes.left = true;
  4734. routes.right = true;
  4735. }
  4736. if( verticalSlides.length > 1 ) {
  4737. routes.up = true;
  4738. routes.down = true;
  4739. }
  4740. }
  4741. // Reverse horizontal controls for rtl
  4742. if( config.rtl ) {
  4743. var left = routes.left;
  4744. routes.left = routes.right;
  4745. routes.right = left;
  4746. }
  4747. return routes;
  4748. }
  4749. /**
  4750. * Returns an object describing the available fragment
  4751. * directions.
  4752. *
  4753. * @return {{prev: boolean, next: boolean}}
  4754. */
  4755. function availableFragments() {
  4756. if( currentSlide && config.fragments ) {
  4757. var fragments = currentSlide.querySelectorAll( '.fragment' );
  4758. var hiddenFragments = currentSlide.querySelectorAll( '.fragment:not(.visible)' );
  4759. return {
  4760. prev: fragments.length - hiddenFragments.length > 0,
  4761. next: !!hiddenFragments.length
  4762. };
  4763. }
  4764. else {
  4765. return { prev: false, next: false };
  4766. }
  4767. }
  4768. /**
  4769. * Enforces origin-specific format rules for embedded media.
  4770. */
  4771. function formatEmbeddedContent() {
  4772. var _appendParamToIframeSource = function( sourceAttribute, sourceURL, param ) {
  4773. toArray( dom.slides.querySelectorAll( 'iframe['+ sourceAttribute +'*="'+ sourceURL +'"]' ) ).forEach( function( el ) {
  4774. var src = el.getAttribute( sourceAttribute );
  4775. if( src && src.indexOf( param ) === -1 ) {
  4776. el.setAttribute( sourceAttribute, src + ( !/\?/.test( src ) ? '?' : '&' ) + param );
  4777. }
  4778. });
  4779. };
  4780. // YouTube frames must include "?enablejsapi=1"
  4781. _appendParamToIframeSource( 'src', 'youtube.com/embed/', 'enablejsapi=1' );
  4782. _appendParamToIframeSource( 'data-src', 'youtube.com/embed/', 'enablejsapi=1' );
  4783. // Vimeo frames must include "?api=1"
  4784. _appendParamToIframeSource( 'src', 'player.vimeo.com/', 'api=1' );
  4785. _appendParamToIframeSource( 'data-src', 'player.vimeo.com/', 'api=1' );
  4786. }
  4787. /**
  4788. * Start playback of any embedded content inside of
  4789. * the given element.
  4790. *
  4791. * @param {HTMLElement} element
  4792. */
  4793. function startEmbeddedContent( element ) {
  4794. if( element && !isSpeakerNotes() ) {
  4795. // Restart GIFs
  4796. toArray( element.querySelectorAll( 'img[src$=".gif"]' ) ).forEach( function( el ) {
  4797. // Setting the same unchanged source like this was confirmed
  4798. // to work in Chrome, FF & Safari
  4799. el.setAttribute( 'src', el.getAttribute( 'src' ) );
  4800. } );
  4801. // HTML5 media elements
  4802. toArray( element.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
  4803. if( closestParent( el, '.fragment' ) && !closestParent( el, '.fragment.visible' ) ) {
  4804. return;
  4805. }
  4806. // Prefer an explicit global autoplay setting
  4807. var autoplay = config.autoPlayMedia;
  4808. // If no global setting is available, fall back on the element's
  4809. // own autoplay setting
  4810. if( typeof autoplay !== 'boolean' ) {
  4811. autoplay = el.hasAttribute( 'data-autoplay' ) || !!closestParent( el, '.slide-background' );
  4812. }
  4813. if( autoplay && typeof el.play === 'function' ) {
  4814. // If the media is ready, start playback
  4815. if( el.readyState > 1 ) {
  4816. startEmbeddedMedia( { target: el } );
  4817. }
  4818. // Mobile devices never fire a loaded event so instead
  4819. // of waiting, we initiate playback
  4820. else if( isMobileDevice ) {
  4821. var promise = el.play();
  4822. // If autoplay does not work, ensure that the controls are visible so
  4823. // that the viewer can start the media on their own
  4824. if( promise && typeof promise.catch === 'function' && el.controls === false ) {
  4825. promise.catch( function() {
  4826. el.controls = true;
  4827. // Once the video does start playing, hide the controls again
  4828. el.addEventListener( 'play', function() {
  4829. el.controls = false;
  4830. } );
  4831. } );
  4832. }
  4833. }
  4834. // If the media isn't loaded, wait before playing
  4835. else {
  4836. el.removeEventListener( 'loadeddata', startEmbeddedMedia ); // remove first to avoid dupes
  4837. el.addEventListener( 'loadeddata', startEmbeddedMedia );
  4838. }
  4839. }
  4840. } );
  4841. // Normal iframes
  4842. toArray( element.querySelectorAll( 'iframe[src]' ) ).forEach( function( el ) {
  4843. if( closestParent( el, '.fragment' ) && !closestParent( el, '.fragment.visible' ) ) {
  4844. return;
  4845. }
  4846. startEmbeddedIframe( { target: el } );
  4847. } );
  4848. // Lazy loading iframes
  4849. toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) {
  4850. if( closestParent( el, '.fragment' ) && !closestParent( el, '.fragment.visible' ) ) {
  4851. return;
  4852. }
  4853. if( el.getAttribute( 'src' ) !== el.getAttribute( 'data-src' ) ) {
  4854. el.removeEventListener( 'load', startEmbeddedIframe ); // remove first to avoid dupes
  4855. el.addEventListener( 'load', startEmbeddedIframe );
  4856. el.setAttribute( 'src', el.getAttribute( 'data-src' ) );
  4857. }
  4858. } );
  4859. }
  4860. }
  4861. /**
  4862. * Starts playing an embedded video/audio element after
  4863. * it has finished loading.
  4864. *
  4865. * @param {object} event
  4866. */
  4867. function startEmbeddedMedia( event ) {
  4868. var isAttachedToDOM = !!closestParent( event.target, 'html' ),
  4869. isVisible = !!closestParent( event.target, '.present' );
  4870. if( isAttachedToDOM && isVisible ) {
  4871. event.target.currentTime = 0;
  4872. event.target.play();
  4873. }
  4874. event.target.removeEventListener( 'loadeddata', startEmbeddedMedia );
  4875. }
  4876. /**
  4877. * "Starts" the content of an embedded iframe using the
  4878. * postMessage API.
  4879. *
  4880. * @param {object} event
  4881. */
  4882. function startEmbeddedIframe( event ) {
  4883. var iframe = event.target;
  4884. if( iframe && iframe.contentWindow ) {
  4885. var isAttachedToDOM = !!closestParent( event.target, 'html' ),
  4886. isVisible = !!closestParent( event.target, '.present' );
  4887. if( isAttachedToDOM && isVisible ) {
  4888. // Prefer an explicit global autoplay setting
  4889. var autoplay = config.autoPlayMedia;
  4890. // If no global setting is available, fall back on the element's
  4891. // own autoplay setting
  4892. if( typeof autoplay !== 'boolean' ) {
  4893. autoplay = iframe.hasAttribute( 'data-autoplay' ) || !!closestParent( iframe, '.slide-background' );
  4894. }
  4895. // YouTube postMessage API
  4896. if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && autoplay ) {
  4897. iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' );
  4898. }
  4899. // Vimeo postMessage API
  4900. else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && autoplay ) {
  4901. iframe.contentWindow.postMessage( '{"method":"play"}', '*' );
  4902. }
  4903. // Generic postMessage API
  4904. else {
  4905. iframe.contentWindow.postMessage( 'slide:start', '*' );
  4906. }
  4907. }
  4908. }
  4909. }
  4910. /**
  4911. * Stop playback of any embedded content inside of
  4912. * the targeted slide.
  4913. *
  4914. * @param {HTMLElement} element
  4915. */
  4916. function stopEmbeddedContent( element, options ) {
  4917. options = extend( {
  4918. // Defaults
  4919. unloadIframes: true
  4920. }, options || {} );
  4921. if( element && element.parentNode ) {
  4922. // HTML5 media elements
  4923. toArray( element.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
  4924. if( !el.hasAttribute( 'data-ignore' ) && typeof el.pause === 'function' ) {
  4925. el.setAttribute('data-paused-by-reveal', '');
  4926. el.pause();
  4927. }
  4928. } );
  4929. // Generic postMessage API for non-lazy loaded iframes
  4930. toArray( element.querySelectorAll( 'iframe' ) ).forEach( function( el ) {
  4931. if( el.contentWindow ) el.contentWindow.postMessage( 'slide:stop', '*' );
  4932. el.removeEventListener( 'load', startEmbeddedIframe );
  4933. });
  4934. // YouTube postMessage API
  4935. toArray( element.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
  4936. if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
  4937. el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' );
  4938. }
  4939. });
  4940. // Vimeo postMessage API
  4941. toArray( element.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) {
  4942. if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
  4943. el.contentWindow.postMessage( '{"method":"pause"}', '*' );
  4944. }
  4945. });
  4946. if( options.unloadIframes === true ) {
  4947. // Unload lazy-loaded iframes
  4948. toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) {
  4949. // Only removing the src doesn't actually unload the frame
  4950. // in all browsers (Firefox) so we set it to blank first
  4951. el.setAttribute( 'src', 'about:blank' );
  4952. el.removeAttribute( 'src' );
  4953. } );
  4954. }
  4955. }
  4956. }
  4957. /**
  4958. * Returns the number of past slides. This can be used as a global
  4959. * flattened index for slides.
  4960. *
  4961. * @return {number} Past slide count
  4962. */
  4963. function getSlidePastCount() {
  4964. var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
  4965. // The number of past slides
  4966. var pastCount = 0;
  4967. // Step through all slides and count the past ones
  4968. mainLoop: for( var i = 0; i < horizontalSlides.length; i++ ) {
  4969. var horizontalSlide = horizontalSlides[i];
  4970. var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) );
  4971. for( var j = 0; j < verticalSlides.length; j++ ) {
  4972. // Stop as soon as we arrive at the present
  4973. if( verticalSlides[j].classList.contains( 'present' ) ) {
  4974. break mainLoop;
  4975. }
  4976. pastCount++;
  4977. }
  4978. // Stop as soon as we arrive at the present
  4979. if( horizontalSlide.classList.contains( 'present' ) ) {
  4980. break;
  4981. }
  4982. // Don't count the wrapping section for vertical slides
  4983. if( horizontalSlide.classList.contains( 'stack' ) === false ) {
  4984. pastCount++;
  4985. }
  4986. }
  4987. return pastCount;
  4988. }
  4989. /**
  4990. * Returns a value ranging from 0-1 that represents
  4991. * how far into the presentation we have navigated.
  4992. *
  4993. * @return {number}
  4994. */
  4995. function getProgress() {
  4996. // The number of past and total slides
  4997. var totalCount = getTotalSlides();
  4998. var pastCount = getSlidePastCount();
  4999. if( currentSlide ) {
  5000. var allFragments = currentSlide.querySelectorAll( '.fragment' );
  5001. // If there are fragments in the current slide those should be
  5002. // accounted for in the progress.
  5003. if( allFragments.length > 0 ) {
  5004. var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' );
  5005. // This value represents how big a portion of the slide progress
  5006. // that is made up by its fragments (0-1)
  5007. var fragmentWeight = 0.9;
  5008. // Add fragment progress to the past slide count
  5009. pastCount += ( visibleFragments.length / allFragments.length ) * fragmentWeight;
  5010. }
  5011. }
  5012. return Math.min( pastCount / ( totalCount - 1 ), 1 );
  5013. }
  5014. /**
  5015. * Checks if this presentation is running inside of the
  5016. * speaker notes window.
  5017. *
  5018. * @return {boolean}
  5019. */
  5020. function isSpeakerNotes() {
  5021. return !!window.location.search.match( /receiver/gi );
  5022. }
  5023. /**
  5024. * Reads the current URL (hash) and navigates accordingly.
  5025. */
  5026. function readURL() {
  5027. var hash = window.location.hash;
  5028. // Attempt to parse the hash as either an index or name
  5029. var bits = hash.slice( 2 ).split( '/' ),
  5030. name = hash.replace( /#|\//gi, '' );
  5031. // If the first bit is not fully numeric and there is a name we
  5032. // can assume that this is a named link
  5033. if( !/^[0-9]*$/.test( bits[0] ) && name.length ) {
  5034. var element;
  5035. // Ensure the named link is a valid HTML ID attribute
  5036. try {
  5037. element = document.getElementById( decodeURIComponent( name ) );
  5038. }
  5039. catch ( error ) { }
  5040. // Ensure that we're not already on a slide with the same name
  5041. var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false;
  5042. if( element ) {
  5043. // If the slide exists and is not the current slide...
  5044. if ( !isSameNameAsCurrentSlide ) {
  5045. // ...find the position of the named slide and navigate to it
  5046. var indices = Reveal.getIndices(element);
  5047. slide(indices.h, indices.v);
  5048. }
  5049. }
  5050. // If the slide doesn't exist, navigate to the current slide
  5051. else {
  5052. slide( indexh || 0, indexv || 0 );
  5053. }
  5054. }
  5055. else {
  5056. var hashIndexBase = config.hashOneBasedIndex ? 1 : 0;
  5057. // Read the index components of the hash
  5058. var h = ( parseInt( bits[0], 10 ) - hashIndexBase ) || 0,
  5059. v = ( parseInt( bits[1], 10 ) - hashIndexBase ) || 0,
  5060. f;
  5061. if( config.fragmentInURL ) {
  5062. f = parseInt( bits[2], 10 );
  5063. if( isNaN( f ) ) {
  5064. f = undefined;
  5065. }
  5066. }
  5067. if( h !== indexh || v !== indexv || f !== undefined ) {
  5068. slide( h, v, f );
  5069. }
  5070. }
  5071. }
  5072. /**
  5073. * Updates the page URL (hash) to reflect the current
  5074. * state.
  5075. *
  5076. * @param {number} delay The time in ms to wait before
  5077. * writing the hash
  5078. */
  5079. function writeURL( delay ) {
  5080. // Make sure there's never more than one timeout running
  5081. clearTimeout( writeURLTimeout );
  5082. // If a delay is specified, timeout this call
  5083. if( typeof delay === 'number' ) {
  5084. writeURLTimeout = setTimeout( writeURL, delay );
  5085. }
  5086. else if( currentSlide ) {
  5087. // If we're configured to push to history OR the history
  5088. // API is not avaialble.
  5089. if( config.history || !window.history ) {
  5090. window.location.hash = locationHash();
  5091. }
  5092. // If we're configured to reflect the current slide in the
  5093. // URL without pushing to history.
  5094. else if( config.hash ) {
  5095. window.history.replaceState( null, null, '#' + locationHash() );
  5096. }
  5097. // If history and hash are both disabled, a hash may still
  5098. // be added to the URL by clicking on a href with a hash
  5099. // target. Counter this by always removing the hash.
  5100. else {
  5101. window.history.replaceState( null, null, window.location.pathname + window.location.search );
  5102. }
  5103. }
  5104. }
  5105. /**
  5106. * Retrieves the h/v location and fragment of the current,
  5107. * or specified, slide.
  5108. *
  5109. * @param {HTMLElement} [slide] If specified, the returned
  5110. * index will be for this slide rather than the currently
  5111. * active one
  5112. *
  5113. * @return {{h: number, v: number, f: number}}
  5114. */
  5115. function getIndices( slide ) {
  5116. // By default, return the current indices
  5117. var h = indexh,
  5118. v = indexv,
  5119. f;
  5120. // If a slide is specified, return the indices of that slide
  5121. if( slide ) {
  5122. var isVertical = isVerticalSlide( slide );
  5123. var slideh = isVertical ? slide.parentNode : slide;
  5124. // Select all horizontal slides
  5125. var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
  5126. // Now that we know which the horizontal slide is, get its index
  5127. h = Math.max( horizontalSlides.indexOf( slideh ), 0 );
  5128. // Assume we're not vertical
  5129. v = undefined;
  5130. // If this is a vertical slide, grab the vertical index
  5131. if( isVertical ) {
  5132. v = Math.max( toArray( slide.parentNode.querySelectorAll( 'section' ) ).indexOf( slide ), 0 );
  5133. }
  5134. }
  5135. if( !slide && currentSlide ) {
  5136. var hasFragments = currentSlide.querySelectorAll( '.fragment' ).length > 0;
  5137. if( hasFragments ) {
  5138. var currentFragment = currentSlide.querySelector( '.current-fragment' );
  5139. if( currentFragment && currentFragment.hasAttribute( 'data-fragment-index' ) ) {
  5140. f = parseInt( currentFragment.getAttribute( 'data-fragment-index' ), 10 );
  5141. }
  5142. else {
  5143. f = currentSlide.querySelectorAll( '.fragment.visible' ).length - 1;
  5144. }
  5145. }
  5146. }
  5147. return { h: h, v: v, f: f };
  5148. }
  5149. /**
  5150. * Retrieves all slides in this presentation.
  5151. */
  5152. function getSlides() {
  5153. return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ));
  5154. }
  5155. /**
  5156. * Returns an array of objects where each object represents the
  5157. * attributes on its respective slide.
  5158. */
  5159. function getSlidesAttributes() {
  5160. return getSlides().map( function( slide ) {
  5161. var attributes = {};
  5162. for( var i = 0; i < slide.attributes.length; i++ ) {
  5163. var attribute = slide.attributes[ i ];
  5164. attributes[ attribute.name ] = attribute.value;
  5165. }
  5166. return attributes;
  5167. } );
  5168. }
  5169. /**
  5170. * Retrieves the total number of slides in this presentation.
  5171. *
  5172. * @return {number}
  5173. */
  5174. function getTotalSlides() {
  5175. return getSlides().length;
  5176. }
  5177. /**
  5178. * Returns the slide element matching the specified index.
  5179. *
  5180. * @return {HTMLElement}
  5181. */
  5182. function getSlide( x, y ) {
  5183. var horizontalSlide = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ];
  5184. var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' );
  5185. if( verticalSlides && verticalSlides.length && typeof y === 'number' ) {
  5186. return verticalSlides ? verticalSlides[ y ] : undefined;
  5187. }
  5188. return horizontalSlide;
  5189. }
  5190. /**
  5191. * Returns the background element for the given slide.
  5192. * All slides, even the ones with no background properties
  5193. * defined, have a background element so as long as the
  5194. * index is valid an element will be returned.
  5195. *
  5196. * @param {mixed} x Horizontal background index OR a slide
  5197. * HTML element
  5198. * @param {number} y Vertical background index
  5199. * @return {(HTMLElement[]|*)}
  5200. */
  5201. function getSlideBackground( x, y ) {
  5202. var slide = typeof x === 'number' ? getSlide( x, y ) : x;
  5203. if( slide ) {
  5204. return slide.slideBackgroundElement;
  5205. }
  5206. return undefined;
  5207. }
  5208. /**
  5209. * Retrieves the speaker notes from a slide. Notes can be
  5210. * defined in two ways:
  5211. * 1. As a data-notes attribute on the slide <section>
  5212. * 2. As an <aside class="notes"> inside of the slide
  5213. *
  5214. * @param {HTMLElement} [slide=currentSlide]
  5215. * @return {(string|null)}
  5216. */
  5217. function getSlideNotes( slide ) {
  5218. // Default to the current slide
  5219. slide = slide || currentSlide;
  5220. // Notes can be specified via the data-notes attribute...
  5221. if( slide.hasAttribute( 'data-notes' ) ) {
  5222. return slide.getAttribute( 'data-notes' );
  5223. }
  5224. // ... or using an <aside class="notes"> element
  5225. var notesElement = slide.querySelector( 'aside.notes' );
  5226. if( notesElement ) {
  5227. return notesElement.innerHTML;
  5228. }
  5229. return null;
  5230. }
  5231. /**
  5232. * Retrieves the current state of the presentation as
  5233. * an object. This state can then be restored at any
  5234. * time.
  5235. *
  5236. * @return {{indexh: number, indexv: number, indexf: number, paused: boolean, overview: boolean}}
  5237. */
  5238. function getState() {
  5239. var indices = getIndices();
  5240. return {
  5241. indexh: indices.h,
  5242. indexv: indices.v,
  5243. indexf: indices.f,
  5244. paused: isPaused(),
  5245. overview: isOverview()
  5246. };
  5247. }
  5248. /**
  5249. * Restores the presentation to the given state.
  5250. *
  5251. * @param {object} state As generated by getState()
  5252. * @see {@link getState} generates the parameter `state`
  5253. */
  5254. function setState( state ) {
  5255. if( typeof state === 'object' ) {
  5256. slide( deserialize( state.indexh ), deserialize( state.indexv ), deserialize( state.indexf ) );
  5257. var pausedFlag = deserialize( state.paused ),
  5258. overviewFlag = deserialize( state.overview );
  5259. if( typeof pausedFlag === 'boolean' && pausedFlag !== isPaused() ) {
  5260. togglePause( pausedFlag );
  5261. }
  5262. if( typeof overviewFlag === 'boolean' && overviewFlag !== isOverview() ) {
  5263. toggleOverview( overviewFlag );
  5264. }
  5265. }
  5266. }
  5267. /**
  5268. * Return a sorted fragments list, ordered by an increasing
  5269. * "data-fragment-index" attribute.
  5270. *
  5271. * Fragments will be revealed in the order that they are returned by
  5272. * this function, so you can use the index attributes to control the
  5273. * order of fragment appearance.
  5274. *
  5275. * To maintain a sensible default fragment order, fragments are presumed
  5276. * to be passed in document order. This function adds a "fragment-index"
  5277. * attribute to each node if such an attribute is not already present,
  5278. * and sets that attribute to an integer value which is the position of
  5279. * the fragment within the fragments list.
  5280. *
  5281. * @param {object[]|*} fragments
  5282. * @param {boolean} grouped If true the returned array will contain
  5283. * nested arrays for all fragments with the same index
  5284. * @return {object[]} sorted Sorted array of fragments
  5285. */
  5286. function sortFragments( fragments, grouped ) {
  5287. fragments = toArray( fragments );
  5288. var ordered = [],
  5289. unordered = [],
  5290. sorted = [];
  5291. // Group ordered and unordered elements
  5292. fragments.forEach( function( fragment, i ) {
  5293. if( fragment.hasAttribute( 'data-fragment-index' ) ) {
  5294. var index = parseInt( fragment.getAttribute( 'data-fragment-index' ), 10 );
  5295. if( !ordered[index] ) {
  5296. ordered[index] = [];
  5297. }
  5298. ordered[index].push( fragment );
  5299. }
  5300. else {
  5301. unordered.push( [ fragment ] );
  5302. }
  5303. } );
  5304. // Append fragments without explicit indices in their
  5305. // DOM order
  5306. ordered = ordered.concat( unordered );
  5307. // Manually count the index up per group to ensure there
  5308. // are no gaps
  5309. var index = 0;
  5310. // Push all fragments in their sorted order to an array,
  5311. // this flattens the groups
  5312. ordered.forEach( function( group ) {
  5313. group.forEach( function( fragment ) {
  5314. sorted.push( fragment );
  5315. fragment.setAttribute( 'data-fragment-index', index );
  5316. } );
  5317. index ++;
  5318. } );
  5319. return grouped === true ? ordered : sorted;
  5320. }
  5321. /**
  5322. * Refreshes the fragments on the current slide so that they
  5323. * have the appropriate classes (.visible + .current-fragment).
  5324. *
  5325. * @param {number} [index] The index of the current fragment
  5326. * @param {array} [fragments] Array containing all fragments
  5327. * in the current slide
  5328. *
  5329. * @return {{shown: array, hidden: array}}
  5330. */
  5331. function updateFragments( index, fragments ) {
  5332. var changedFragments = {
  5333. shown: [],
  5334. hidden: []
  5335. };
  5336. if( currentSlide && config.fragments ) {
  5337. fragments = fragments || sortFragments( currentSlide.querySelectorAll( '.fragment' ) );
  5338. if( fragments.length ) {
  5339. if( typeof index !== 'number' ) {
  5340. var currentFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
  5341. if( currentFragment ) {
  5342. index = parseInt( currentFragment.getAttribute( 'data-fragment-index' ) || 0, 10 );
  5343. }
  5344. }
  5345. toArray( fragments ).forEach( function( el, i ) {
  5346. if( el.hasAttribute( 'data-fragment-index' ) ) {
  5347. i = parseInt( el.getAttribute( 'data-fragment-index' ), 10 );
  5348. }
  5349. // Visible fragments
  5350. if( i <= index ) {
  5351. if( !el.classList.contains( 'visible' ) ) changedFragments.shown.push( el );
  5352. el.classList.add( 'visible' );
  5353. el.classList.remove( 'current-fragment' );
  5354. // Announce the fragments one by one to the Screen Reader
  5355. dom.statusDiv.textContent = getStatusText( el );
  5356. if( i === index ) {
  5357. el.classList.add( 'current-fragment' );
  5358. startEmbeddedContent( el );
  5359. }
  5360. }
  5361. // Hidden fragments
  5362. else {
  5363. if( el.classList.contains( 'visible' ) ) changedFragments.hidden.push( el );
  5364. el.classList.remove( 'visible' );
  5365. el.classList.remove( 'current-fragment' );
  5366. }
  5367. } );
  5368. }
  5369. }
  5370. return changedFragments;
  5371. }
  5372. /**
  5373. * Navigate to the specified slide fragment.
  5374. *
  5375. * @param {?number} index The index of the fragment that
  5376. * should be shown, -1 means all are invisible
  5377. * @param {number} offset Integer offset to apply to the
  5378. * fragment index
  5379. *
  5380. * @return {boolean} true if a change was made in any
  5381. * fragments visibility as part of this call
  5382. */
  5383. function navigateFragment( index, offset ) {
  5384. if( currentSlide && config.fragments ) {
  5385. var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) );
  5386. if( fragments.length ) {
  5387. // If no index is specified, find the current
  5388. if( typeof index !== 'number' ) {
  5389. var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
  5390. if( lastVisibleFragment ) {
  5391. index = parseInt( lastVisibleFragment.getAttribute( 'data-fragment-index' ) || 0, 10 );
  5392. }
  5393. else {
  5394. index = -1;
  5395. }
  5396. }
  5397. // If an offset is specified, apply it to the index
  5398. if( typeof offset === 'number' ) {
  5399. index += offset;
  5400. }
  5401. var changedFragments = updateFragments( index, fragments );
  5402. if( changedFragments.hidden.length ) {
  5403. dispatchEvent( 'fragmenthidden', { fragment: changedFragments.hidden[0], fragments: changedFragments.hidden } );
  5404. }
  5405. if( changedFragments.shown.length ) {
  5406. dispatchEvent( 'fragmentshown', { fragment: changedFragments.shown[0], fragments: changedFragments.shown } );
  5407. }
  5408. updateControls();
  5409. updateProgress();
  5410. if( config.fragmentInURL ) {
  5411. writeURL();
  5412. }
  5413. return !!( changedFragments.shown.length || changedFragments.hidden.length );
  5414. }
  5415. }
  5416. return false;
  5417. }
  5418. /**
  5419. * Navigate to the next slide fragment.
  5420. *
  5421. * @return {boolean} true if there was a next fragment,
  5422. * false otherwise
  5423. */
  5424. function nextFragment() {
  5425. return navigateFragment( null, 1 );
  5426. }
  5427. /**
  5428. * Navigate to the previous slide fragment.
  5429. *
  5430. * @return {boolean} true if there was a previous fragment,
  5431. * false otherwise
  5432. */
  5433. function previousFragment() {
  5434. return navigateFragment( null, -1 );
  5435. }
  5436. /**
  5437. * Cues a new automated slide if enabled in the config.
  5438. */
  5439. function cueAutoSlide() {
  5440. cancelAutoSlide();
  5441. if( currentSlide && config.autoSlide !== false ) {
  5442. var fragment = currentSlide.querySelector( '.current-fragment' );
  5443. // When the slide first appears there is no "current" fragment so
  5444. // we look for a data-autoslide timing on the first fragment
  5445. if( !fragment ) fragment = currentSlide.querySelector( '.fragment' );
  5446. var fragmentAutoSlide = fragment ? fragment.getAttribute( 'data-autoslide' ) : null;
  5447. var parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null;
  5448. var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' );
  5449. // Pick value in the following priority order:
  5450. // 1. Current fragment's data-autoslide
  5451. // 2. Current slide's data-autoslide
  5452. // 3. Parent slide's data-autoslide
  5453. // 4. Global autoSlide setting
  5454. if( fragmentAutoSlide ) {
  5455. autoSlide = parseInt( fragmentAutoSlide, 10 );
  5456. }
  5457. else if( slideAutoSlide ) {
  5458. autoSlide = parseInt( slideAutoSlide, 10 );
  5459. }
  5460. else if( parentAutoSlide ) {
  5461. autoSlide = parseInt( parentAutoSlide, 10 );
  5462. }
  5463. else {
  5464. autoSlide = config.autoSlide;
  5465. }
  5466. // If there are media elements with data-autoplay,
  5467. // automatically set the autoSlide duration to the
  5468. // length of that media. Not applicable if the slide
  5469. // is divided up into fragments.
  5470. // playbackRate is accounted for in the duration.
  5471. if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) {
  5472. toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
  5473. if( el.hasAttribute( 'data-autoplay' ) ) {
  5474. if( autoSlide && (el.duration * 1000 / el.playbackRate ) > autoSlide ) {
  5475. autoSlide = ( el.duration * 1000 / el.playbackRate ) + 1000;
  5476. }
  5477. }
  5478. } );
  5479. }
  5480. // Cue the next auto-slide if:
  5481. // - There is an autoSlide value
  5482. // - Auto-sliding isn't paused by the user
  5483. // - The presentation isn't paused
  5484. // - The overview isn't active
  5485. // - The presentation isn't over
  5486. if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || availableFragments().next || config.loop === true ) ) {
  5487. autoSlideTimeout = setTimeout( function() {
  5488. typeof config.autoSlideMethod === 'function' ? config.autoSlideMethod() : navigateNext();
  5489. cueAutoSlide();
  5490. }, autoSlide );
  5491. autoSlideStartTime = Date.now();
  5492. }
  5493. if( autoSlidePlayer ) {
  5494. autoSlidePlayer.setPlaying( autoSlideTimeout !== -1 );
  5495. }
  5496. }
  5497. }
  5498. /**
  5499. * Cancels any ongoing request to auto-slide.
  5500. */
  5501. function cancelAutoSlide() {
  5502. clearTimeout( autoSlideTimeout );
  5503. autoSlideTimeout = -1;
  5504. }
  5505. function pauseAutoSlide() {
  5506. if( autoSlide && !autoSlidePaused ) {
  5507. autoSlidePaused = true;
  5508. dispatchEvent( 'autoslidepaused' );
  5509. clearTimeout( autoSlideTimeout );
  5510. if( autoSlidePlayer ) {
  5511. autoSlidePlayer.setPlaying( false );
  5512. }
  5513. }
  5514. }
  5515. function resumeAutoSlide() {
  5516. if( autoSlide && autoSlidePaused ) {
  5517. autoSlidePaused = false;
  5518. dispatchEvent( 'autoslideresumed' );
  5519. cueAutoSlide();
  5520. }
  5521. }
  5522. function navigateLeft() {
  5523. // Reverse for RTL
  5524. if( config.rtl ) {
  5525. if( ( isOverview() || nextFragment() === false ) && availableRoutes().left ) {
  5526. slide( indexh + 1, config.navigationMode === 'grid' ? indexv : undefined );
  5527. }
  5528. }
  5529. // Normal navigation
  5530. else if( ( isOverview() || previousFragment() === false ) && availableRoutes().left ) {
  5531. slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined );
  5532. }
  5533. }
  5534. function navigateRight() {
  5535. hasNavigatedRight = true;
  5536. // Reverse for RTL
  5537. if( config.rtl ) {
  5538. if( ( isOverview() || previousFragment() === false ) && availableRoutes().right ) {
  5539. slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined );
  5540. }
  5541. }
  5542. // Normal navigation
  5543. else if( ( isOverview() || nextFragment() === false ) && availableRoutes().right ) {
  5544. slide( indexh + 1, config.navigationMode === 'grid' ? indexv : undefined );
  5545. }
  5546. }
  5547. function navigateUp() {
  5548. // Prioritize hiding fragments
  5549. if( ( isOverview() || previousFragment() === false ) && availableRoutes().up ) {
  5550. slide( indexh, indexv - 1 );
  5551. }
  5552. }
  5553. function navigateDown() {
  5554. hasNavigatedDown = true;
  5555. // Prioritize revealing fragments
  5556. if( ( isOverview() || nextFragment() === false ) && availableRoutes().down ) {
  5557. slide( indexh, indexv + 1 );
  5558. }
  5559. }
  5560. /**
  5561. * Navigates backwards, prioritized in the following order:
  5562. * 1) Previous fragment
  5563. * 2) Previous vertical slide
  5564. * 3) Previous horizontal slide
  5565. */
  5566. function navigatePrev() {
  5567. // Prioritize revealing fragments
  5568. if( previousFragment() === false ) {
  5569. if( availableRoutes().up ) {
  5570. navigateUp();
  5571. }
  5572. else {
  5573. // Fetch the previous horizontal slide, if there is one
  5574. var previousSlide;
  5575. if( config.rtl ) {
  5576. previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.future' ) ).pop();
  5577. }
  5578. else {
  5579. previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.past' ) ).pop();
  5580. }
  5581. if( previousSlide ) {
  5582. var v = ( previousSlide.querySelectorAll( 'section' ).length - 1 ) || undefined;
  5583. var h = indexh - 1;
  5584. slide( h, v );
  5585. }
  5586. }
  5587. }
  5588. }
  5589. /**
  5590. * The reverse of #navigatePrev().
  5591. */
  5592. function navigateNext() {
  5593. hasNavigatedRight = true;
  5594. hasNavigatedDown = true;
  5595. // Prioritize revealing fragments
  5596. if( nextFragment() === false ) {
  5597. var routes = availableRoutes();
  5598. // When looping is enabled `routes.down` is always available
  5599. // so we need a separate check for when we've reached the
  5600. // end of a stack and should move horizontally
  5601. if( routes.down && routes.right && config.loop && Reveal.isLastVerticalSlide( currentSlide ) ) {
  5602. routes.down = false;
  5603. }
  5604. if( routes.down ) {
  5605. navigateDown();
  5606. }
  5607. else if( config.rtl ) {
  5608. navigateLeft();
  5609. }
  5610. else {
  5611. navigateRight();
  5612. }
  5613. }
  5614. }
  5615. /**
  5616. * Checks if the target element prevents the triggering of
  5617. * swipe navigation.
  5618. */
  5619. function isSwipePrevented( target ) {
  5620. while( target && typeof target.hasAttribute === 'function' ) {
  5621. if( target.hasAttribute( 'data-prevent-swipe' ) ) return true;
  5622. target = target.parentNode;
  5623. }
  5624. return false;
  5625. }
  5626. // --------------------------------------------------------------------//
  5627. // ----------------------------- EVENTS -------------------------------//
  5628. // --------------------------------------------------------------------//
  5629. /**
  5630. * Called by all event handlers that are based on user
  5631. * input.
  5632. *
  5633. * @param {object} [event]
  5634. */
  5635. function onUserInput( event ) {
  5636. if( config.autoSlideStoppable ) {
  5637. pauseAutoSlide();
  5638. }
  5639. }
  5640. /**
  5641. * Called whenever there is mouse input at the document level
  5642. * to determine if the cursor is active or not.
  5643. *
  5644. * @param {object} event
  5645. */
  5646. function onDocumentCursorActive( event ) {
  5647. showCursor();
  5648. clearTimeout( cursorInactiveTimeout );
  5649. cursorInactiveTimeout = setTimeout( hideCursor, config.hideCursorTime );
  5650. }
  5651. /**
  5652. * Handler for the document level 'keypress' event.
  5653. *
  5654. * @param {object} event
  5655. */
  5656. function onDocumentKeyPress( event ) {
  5657. // Check if the pressed key is question mark
  5658. if( event.shiftKey && event.charCode === 63 ) {
  5659. toggleHelp();
  5660. }
  5661. }
  5662. /**
  5663. * Handler for the document level 'keydown' event.
  5664. *
  5665. * @param {object} event
  5666. */
  5667. function onDocumentKeyDown( event ) {
  5668. // If there's a condition specified and it returns false,
  5669. // ignore this event
  5670. if( typeof config.keyboardCondition === 'function' && config.keyboardCondition(event) === false ) {
  5671. return true;
  5672. }
  5673. // Shorthand
  5674. var keyCode = event.keyCode;
  5675. // Remember if auto-sliding was paused so we can toggle it
  5676. var autoSlideWasPaused = autoSlidePaused;
  5677. onUserInput( event );
  5678. // Is there a focused element that could be using the keyboard?
  5679. var activeElementIsCE = document.activeElement && document.activeElement.contentEditable !== 'inherit';
  5680. var activeElementIsInput = document.activeElement && document.activeElement.tagName && /input|textarea/i.test( document.activeElement.tagName );
  5681. var activeElementIsNotes = document.activeElement && document.activeElement.className && /speaker-notes/i.test( document.activeElement.className);
  5682. // Whitelist specific modified + keycode combinations
  5683. var prevSlideShortcut = event.shiftKey && event.keyCode === 32;
  5684. var firstSlideShortcut = ( event.metaKey || event.ctrlKey ) && keyCode === 37;
  5685. var lastSlideShortcut = ( event.metaKey || event.ctrlKey ) && keyCode === 39;
  5686. // Prevent all other events when a modifier is pressed
  5687. var unusedModifier = !prevSlideShortcut && !firstSlideShortcut && !lastSlideShortcut &&
  5688. ( event.shiftKey || event.altKey || event.ctrlKey || event.metaKey );
  5689. // Disregard the event if there's a focused element or a
  5690. // keyboard modifier key is present
  5691. if( activeElementIsCE || activeElementIsInput || activeElementIsNotes || unusedModifier ) return;
  5692. // While paused only allow resume keyboard events; 'b', 'v', '.'
  5693. var resumeKeyCodes = [66,86,190,191];
  5694. var key;
  5695. // Custom key bindings for togglePause should be able to resume
  5696. if( typeof config.keyboard === 'object' ) {
  5697. for( key in config.keyboard ) {
  5698. if( config.keyboard[key] === 'togglePause' ) {
  5699. resumeKeyCodes.push( parseInt( key, 10 ) );
  5700. }
  5701. }
  5702. }
  5703. if( isPaused() && resumeKeyCodes.indexOf( keyCode ) === -1 ) {
  5704. return false;
  5705. }
  5706. var triggered = false;
  5707. // 1. User defined key bindings
  5708. if( typeof config.keyboard === 'object' ) {
  5709. for( key in config.keyboard ) {
  5710. // Check if this binding matches the pressed key
  5711. if( parseInt( key, 10 ) === keyCode ) {
  5712. var value = config.keyboard[ key ];
  5713. // Callback function
  5714. if( typeof value === 'function' ) {
  5715. value.apply( null, [ event ] );
  5716. }
  5717. // String shortcuts to reveal.js API
  5718. else if( typeof value === 'string' && typeof Reveal[ value ] === 'function' ) {
  5719. Reveal[ value ].call();
  5720. }
  5721. triggered = true;
  5722. }
  5723. }
  5724. }
  5725. // 2. Registered custom key bindings
  5726. if( triggered === false ) {
  5727. for( key in registeredKeyBindings ) {
  5728. // Check if this binding matches the pressed key
  5729. if( parseInt( key, 10 ) === keyCode ) {
  5730. var action = registeredKeyBindings[ key ].callback;
  5731. // Callback function
  5732. if( typeof action === 'function' ) {
  5733. action.apply( null, [ event ] );
  5734. }
  5735. // String shortcuts to reveal.js API
  5736. else if( typeof action === 'string' && typeof Reveal[ action ] === 'function' ) {
  5737. Reveal[ action ].call();
  5738. }
  5739. triggered = true;
  5740. }
  5741. }
  5742. }
  5743. // 3. System defined key bindings
  5744. if( triggered === false ) {
  5745. // Assume true and try to prove false
  5746. triggered = true;
  5747. // P, PAGE UP
  5748. if( keyCode === 80 || keyCode === 33 ) {
  5749. navigatePrev();
  5750. }
  5751. // N, PAGE DOWN
  5752. else if( keyCode === 78 || keyCode === 34 ) {
  5753. navigateNext();
  5754. }
  5755. // H, LEFT
  5756. else if( keyCode === 72 || keyCode === 37 ) {
  5757. if( firstSlideShortcut ) {
  5758. slide( 0 );
  5759. }
  5760. else if( !isOverview() && config.navigationMode === 'linear' ) {
  5761. navigatePrev();
  5762. }
  5763. else {
  5764. navigateLeft();
  5765. }
  5766. }
  5767. // L, RIGHT
  5768. else if( keyCode === 76 || keyCode === 39 ) {
  5769. if( lastSlideShortcut ) {
  5770. slide( Number.MAX_VALUE );
  5771. }
  5772. else if( !isOverview() && config.navigationMode === 'linear' ) {
  5773. navigateNext();
  5774. }
  5775. else {
  5776. navigateRight();
  5777. }
  5778. }
  5779. // K, UP
  5780. else if( keyCode === 75 || keyCode === 38 ) {
  5781. if( !isOverview() && config.navigationMode === 'linear' ) {
  5782. navigatePrev();
  5783. }
  5784. else {
  5785. navigateUp();
  5786. }
  5787. }
  5788. // J, DOWN
  5789. else if( keyCode === 74 || keyCode === 40 ) {
  5790. if( !isOverview() && config.navigationMode === 'linear' ) {
  5791. navigateNext();
  5792. }
  5793. else {
  5794. navigateDown();
  5795. }
  5796. }
  5797. // HOME
  5798. else if( keyCode === 36 ) {
  5799. slide( 0 );
  5800. }
  5801. // END
  5802. else if( keyCode === 35 ) {
  5803. slide( Number.MAX_VALUE );
  5804. }
  5805. // SPACE
  5806. else if( keyCode === 32 ) {
  5807. if( isOverview() ) {
  5808. deactivateOverview();
  5809. }
  5810. if( event.shiftKey ) {
  5811. navigatePrev();
  5812. }
  5813. else {
  5814. navigateNext();
  5815. }
  5816. }
  5817. // TWO-SPOT, SEMICOLON, B, V, PERIOD, LOGITECH PRESENTER TOOLS "BLACK SCREEN" BUTTON
  5818. else if( keyCode === 58 || keyCode === 59 || keyCode === 66 || keyCode === 86 || keyCode === 190 || keyCode === 191 ) {
  5819. togglePause();
  5820. }
  5821. // F
  5822. else if( keyCode === 70 ) {
  5823. enterFullscreen();
  5824. }
  5825. // A
  5826. else if( keyCode === 65 ) {
  5827. if ( config.autoSlideStoppable ) {
  5828. toggleAutoSlide( autoSlideWasPaused );
  5829. }
  5830. }
  5831. else {
  5832. triggered = false;
  5833. }
  5834. }
  5835. // If the input resulted in a triggered action we should prevent
  5836. // the browsers default behavior
  5837. if( triggered ) {
  5838. event.preventDefault && event.preventDefault();
  5839. }
  5840. // ESC or O key
  5841. else if ( ( keyCode === 27 || keyCode === 79 ) && features.transforms3d ) {
  5842. if( dom.overlay ) {
  5843. closeOverlay();
  5844. }
  5845. else {
  5846. toggleOverview();
  5847. }
  5848. event.preventDefault && event.preventDefault();
  5849. }
  5850. // If auto-sliding is enabled we need to cue up
  5851. // another timeout
  5852. cueAutoSlide();
  5853. }
  5854. /**
  5855. * Handler for the 'touchstart' event, enables support for
  5856. * swipe and pinch gestures.
  5857. *
  5858. * @param {object} event
  5859. */
  5860. function onTouchStart( event ) {
  5861. if( isSwipePrevented( event.target ) ) return true;
  5862. touch.startX = event.touches[0].clientX;
  5863. touch.startY = event.touches[0].clientY;
  5864. touch.startCount = event.touches.length;
  5865. }
  5866. /**
  5867. * Handler for the 'touchmove' event.
  5868. *
  5869. * @param {object} event
  5870. */
  5871. function onTouchMove( event ) {
  5872. if( isSwipePrevented( event.target ) ) return true;
  5873. // Each touch should only trigger one action
  5874. if( !touch.captured ) {
  5875. onUserInput( event );
  5876. var currentX = event.touches[0].clientX;
  5877. var currentY = event.touches[0].clientY;
  5878. // There was only one touch point, look for a swipe
  5879. if( event.touches.length === 1 && touch.startCount !== 2 ) {
  5880. var deltaX = currentX - touch.startX,
  5881. deltaY = currentY - touch.startY;
  5882. if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
  5883. touch.captured = true;
  5884. navigateLeft();
  5885. }
  5886. else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
  5887. touch.captured = true;
  5888. navigateRight();
  5889. }
  5890. else if( deltaY > touch.threshold ) {
  5891. touch.captured = true;
  5892. navigateUp();
  5893. }
  5894. else if( deltaY < -touch.threshold ) {
  5895. touch.captured = true;
  5896. navigateDown();
  5897. }
  5898. // If we're embedded, only block touch events if they have
  5899. // triggered an action
  5900. if( config.embedded ) {
  5901. if( touch.captured || isVerticalSlide( currentSlide ) ) {
  5902. event.preventDefault();
  5903. }
  5904. }
  5905. // Not embedded? Block them all to avoid needless tossing
  5906. // around of the viewport in iOS
  5907. else {
  5908. event.preventDefault();
  5909. }
  5910. }
  5911. }
  5912. // There's a bug with swiping on some Android devices unless
  5913. // the default action is always prevented
  5914. else if( UA.match( /android/gi ) ) {
  5915. event.preventDefault();
  5916. }
  5917. }
  5918. /**
  5919. * Handler for the 'touchend' event.
  5920. *
  5921. * @param {object} event
  5922. */
  5923. function onTouchEnd( event ) {
  5924. touch.captured = false;
  5925. }
  5926. /**
  5927. * Convert pointer down to touch start.
  5928. *
  5929. * @param {object} event
  5930. */
  5931. function onPointerDown( event ) {
  5932. if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) {
  5933. event.touches = [{ clientX: event.clientX, clientY: event.clientY }];
  5934. onTouchStart( event );
  5935. }
  5936. }
  5937. /**
  5938. * Convert pointer move to touch move.
  5939. *
  5940. * @param {object} event
  5941. */
  5942. function onPointerMove( event ) {
  5943. if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) {
  5944. event.touches = [{ clientX: event.clientX, clientY: event.clientY }];
  5945. onTouchMove( event );
  5946. }
  5947. }
  5948. /**
  5949. * Convert pointer up to touch end.
  5950. *
  5951. * @param {object} event
  5952. */
  5953. function onPointerUp( event ) {
  5954. if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) {
  5955. event.touches = [{ clientX: event.clientX, clientY: event.clientY }];
  5956. onTouchEnd( event );
  5957. }
  5958. }
  5959. /**
  5960. * Handles mouse wheel scrolling, throttled to avoid skipping
  5961. * multiple slides.
  5962. *
  5963. * @param {object} event
  5964. */
  5965. function onDocumentMouseScroll( event ) {
  5966. if( Date.now() - lastMouseWheelStep > 600 ) {
  5967. lastMouseWheelStep = Date.now();
  5968. var delta = event.detail || -event.wheelDelta;
  5969. if( delta > 0 ) {
  5970. navigateNext();
  5971. }
  5972. else if( delta < 0 ) {
  5973. navigatePrev();
  5974. }
  5975. }
  5976. }
  5977. /**
  5978. * Clicking on the progress bar results in a navigation to the
  5979. * closest approximate horizontal slide using this equation:
  5980. *
  5981. * ( clickX / presentationWidth ) * numberOfSlides
  5982. *
  5983. * @param {object} event
  5984. */
  5985. function onProgressClicked( event ) {
  5986. onUserInput( event );
  5987. event.preventDefault();
  5988. var slidesTotal = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).length;
  5989. var slideIndex = Math.floor( ( event.clientX / dom.wrapper.offsetWidth ) * slidesTotal );
  5990. if( config.rtl ) {
  5991. slideIndex = slidesTotal - slideIndex;
  5992. }
  5993. slide( slideIndex );
  5994. }
  5995. /**
  5996. * Event handler for navigation control buttons.
  5997. */
  5998. function onNavigateLeftClicked( event ) { event.preventDefault(); onUserInput(); config.navigationMode === 'linear' ? navigatePrev() : navigateLeft(); }
  5999. function onNavigateRightClicked( event ) { event.preventDefault(); onUserInput(); config.navigationMode === 'linear' ? navigateNext() : navigateRight(); }
  6000. function onNavigateUpClicked( event ) { event.preventDefault(); onUserInput(); navigateUp(); }
  6001. function onNavigateDownClicked( event ) { event.preventDefault(); onUserInput(); navigateDown(); }
  6002. function onNavigatePrevClicked( event ) { event.preventDefault(); onUserInput(); navigatePrev(); }
  6003. function onNavigateNextClicked( event ) { event.preventDefault(); onUserInput(); navigateNext(); }
  6004. /**
  6005. * Handler for the window level 'hashchange' event.
  6006. *
  6007. * @param {object} [event]
  6008. */
  6009. function onWindowHashChange( event ) {
  6010. readURL();
  6011. }
  6012. /**
  6013. * Handler for the window level 'resize' event.
  6014. *
  6015. * @param {object} [event]
  6016. */
  6017. function onWindowResize( event ) {
  6018. layout();
  6019. }
  6020. /**
  6021. * Handle for the window level 'visibilitychange' event.
  6022. *
  6023. * @param {object} [event]
  6024. */
  6025. function onPageVisibilityChange( event ) {
  6026. var isHidden = document.webkitHidden ||
  6027. document.msHidden ||
  6028. document.hidden;
  6029. // If, after clicking a link or similar and we're coming back,
  6030. // focus the document.body to ensure we can use keyboard shortcuts
  6031. if( isHidden === false && document.activeElement !== document.body ) {
  6032. // Not all elements support .blur() - SVGs among them.
  6033. if( typeof document.activeElement.blur === 'function' ) {
  6034. document.activeElement.blur();
  6035. }
  6036. document.body.focus();
  6037. }
  6038. }
  6039. /**
  6040. * Invoked when a slide is and we're in the overview.
  6041. *
  6042. * @param {object} event
  6043. */
  6044. function onOverviewSlideClicked( event ) {
  6045. // TODO There's a bug here where the event listeners are not
  6046. // removed after deactivating the overview.
  6047. if( eventsAreBound && isOverview() ) {
  6048. event.preventDefault();
  6049. var element = event.target;
  6050. while( element && !element.nodeName.match( /section/gi ) ) {
  6051. element = element.parentNode;
  6052. }
  6053. if( element && !element.classList.contains( 'disabled' ) ) {
  6054. deactivateOverview();
  6055. if( element.nodeName.match( /section/gi ) ) {
  6056. var h = parseInt( element.getAttribute( 'data-index-h' ), 10 ),
  6057. v = parseInt( element.getAttribute( 'data-index-v' ), 10 );
  6058. slide( h, v );
  6059. }
  6060. }
  6061. }
  6062. }
  6063. /**
  6064. * Handles clicks on links that are set to preview in the
  6065. * iframe overlay.
  6066. *
  6067. * @param {object} event
  6068. */
  6069. function onPreviewLinkClicked( event ) {
  6070. if( event.currentTarget && event.currentTarget.hasAttribute( 'href' ) ) {
  6071. var url = event.currentTarget.getAttribute( 'href' );
  6072. if( url ) {
  6073. showPreview( url );
  6074. event.preventDefault();
  6075. }
  6076. }
  6077. }
  6078. /**
  6079. * Handles click on the auto-sliding controls element.
  6080. *
  6081. * @param {object} [event]
  6082. */
  6083. function onAutoSlidePlayerClick( event ) {
  6084. // Replay
  6085. if( Reveal.isLastSlide() && config.loop === false ) {
  6086. slide( 0, 0 );
  6087. resumeAutoSlide();
  6088. }
  6089. // Resume
  6090. else if( autoSlidePaused ) {
  6091. resumeAutoSlide();
  6092. }
  6093. // Pause
  6094. else {
  6095. pauseAutoSlide();
  6096. }
  6097. }
  6098. // --------------------------------------------------------------------//
  6099. // ------------------------ PLAYBACK COMPONENT ------------------------//
  6100. // --------------------------------------------------------------------//
  6101. /**
  6102. * Constructor for the playback component, which displays
  6103. * play/pause/progress controls.
  6104. *
  6105. * @param {HTMLElement} container The component will append
  6106. * itself to this
  6107. * @param {function} progressCheck A method which will be
  6108. * called frequently to get the current progress on a range
  6109. * of 0-1
  6110. */
  6111. function Playback( container, progressCheck ) {
  6112. // Cosmetics
  6113. this.diameter = 100;
  6114. this.diameter2 = this.diameter/2;
  6115. this.thickness = 6;
  6116. // Flags if we are currently playing
  6117. this.playing = false;
  6118. // Current progress on a 0-1 range
  6119. this.progress = 0;
  6120. // Used to loop the animation smoothly
  6121. this.progressOffset = 1;
  6122. this.container = container;
  6123. this.progressCheck = progressCheck;
  6124. this.canvas = document.createElement( 'canvas' );
  6125. this.canvas.className = 'playback';
  6126. this.canvas.width = this.diameter;
  6127. this.canvas.height = this.diameter;
  6128. this.canvas.style.width = this.diameter2 + 'px';
  6129. this.canvas.style.height = this.diameter2 + 'px';
  6130. this.context = this.canvas.getContext( '2d' );
  6131. this.container.appendChild( this.canvas );
  6132. this.render();
  6133. }
  6134. /**
  6135. * @param value
  6136. */
  6137. Playback.prototype.setPlaying = function( value ) {
  6138. var wasPlaying = this.playing;
  6139. this.playing = value;
  6140. // Start repainting if we weren't already
  6141. if( !wasPlaying && this.playing ) {
  6142. this.animate();
  6143. }
  6144. else {
  6145. this.render();
  6146. }
  6147. };
  6148. Playback.prototype.animate = function() {
  6149. var progressBefore = this.progress;
  6150. this.progress = this.progressCheck();
  6151. // When we loop, offset the progress so that it eases
  6152. // smoothly rather than immediately resetting
  6153. if( progressBefore > 0.8 && this.progress < 0.2 ) {
  6154. this.progressOffset = this.progress;
  6155. }
  6156. this.render();
  6157. if( this.playing ) {
  6158. features.requestAnimationFrameMethod.call( window, this.animate.bind( this ) );
  6159. }
  6160. };
  6161. /**
  6162. * Renders the current progress and playback state.
  6163. */
  6164. Playback.prototype.render = function() {
  6165. var progress = this.playing ? this.progress : 0,
  6166. radius = ( this.diameter2 ) - this.thickness,
  6167. x = this.diameter2,
  6168. y = this.diameter2,
  6169. iconSize = 28;
  6170. // Ease towards 1
  6171. this.progressOffset += ( 1 - this.progressOffset ) * 0.1;
  6172. var endAngle = ( - Math.PI / 2 ) + ( progress * ( Math.PI * 2 ) );
  6173. var startAngle = ( - Math.PI / 2 ) + ( this.progressOffset * ( Math.PI * 2 ) );
  6174. this.context.save();
  6175. this.context.clearRect( 0, 0, this.diameter, this.diameter );
  6176. // Solid background color
  6177. this.context.beginPath();
  6178. this.context.arc( x, y, radius + 4, 0, Math.PI * 2, false );
  6179. this.context.fillStyle = 'rgba( 0, 0, 0, 0.4 )';
  6180. this.context.fill();
  6181. // Draw progress track
  6182. this.context.beginPath();
  6183. this.context.arc( x, y, radius, 0, Math.PI * 2, false );
  6184. this.context.lineWidth = this.thickness;
  6185. this.context.strokeStyle = 'rgba( 255, 255, 255, 0.2 )';
  6186. this.context.stroke();
  6187. if( this.playing ) {
  6188. // Draw progress on top of track
  6189. this.context.beginPath();
  6190. this.context.arc( x, y, radius, startAngle, endAngle, false );
  6191. this.context.lineWidth = this.thickness;
  6192. this.context.strokeStyle = '#fff';
  6193. this.context.stroke();
  6194. }
  6195. this.context.translate( x - ( iconSize / 2 ), y - ( iconSize / 2 ) );
  6196. // Draw play/pause icons
  6197. if( this.playing ) {
  6198. this.context.fillStyle = '#fff';
  6199. this.context.fillRect( 0, 0, iconSize / 2 - 4, iconSize );
  6200. this.context.fillRect( iconSize / 2 + 4, 0, iconSize / 2 - 4, iconSize );
  6201. }
  6202. else {
  6203. this.context.beginPath();
  6204. this.context.translate( 4, 0 );
  6205. this.context.moveTo( 0, 0 );
  6206. this.context.lineTo( iconSize - 4, iconSize / 2 );
  6207. this.context.lineTo( 0, iconSize );
  6208. this.context.fillStyle = '#fff';
  6209. this.context.fill();
  6210. }
  6211. this.context.restore();
  6212. };
  6213. Playback.prototype.on = function( type, listener ) {
  6214. this.canvas.addEventListener( type, listener, false );
  6215. };
  6216. Playback.prototype.off = function( type, listener ) {
  6217. this.canvas.removeEventListener( type, listener, false );
  6218. };
  6219. Playback.prototype.destroy = function() {
  6220. this.playing = false;
  6221. if( this.canvas.parentNode ) {
  6222. this.container.removeChild( this.canvas );
  6223. }
  6224. };
  6225. // --------------------------------------------------------------------//
  6226. // ------------------------------- API --------------------------------//
  6227. // --------------------------------------------------------------------//
  6228. Reveal = {
  6229. VERSION: VERSION,
  6230. initialize: initialize,
  6231. configure: configure,
  6232. sync: sync,
  6233. syncSlide: syncSlide,
  6234. syncFragments: syncFragments,
  6235. // Navigation methods
  6236. slide: slide,
  6237. left: navigateLeft,
  6238. right: navigateRight,
  6239. up: navigateUp,
  6240. down: navigateDown,
  6241. prev: navigatePrev,
  6242. next: navigateNext,
  6243. // Fragment methods
  6244. navigateFragment: navigateFragment,
  6245. prevFragment: previousFragment,
  6246. nextFragment: nextFragment,
  6247. // Deprecated aliases
  6248. navigateTo: slide,
  6249. navigateLeft: navigateLeft,
  6250. navigateRight: navigateRight,
  6251. navigateUp: navigateUp,
  6252. navigateDown: navigateDown,
  6253. navigatePrev: navigatePrev,
  6254. navigateNext: navigateNext,
  6255. // Forces an update in slide layout
  6256. layout: layout,
  6257. // Randomizes the order of slides
  6258. shuffle: shuffle,
  6259. // Returns an object with the available routes as booleans (left/right/top/bottom)
  6260. availableRoutes: availableRoutes,
  6261. // Returns an object with the available fragments as booleans (prev/next)
  6262. availableFragments: availableFragments,
  6263. // Toggles a help overlay with keyboard shortcuts
  6264. toggleHelp: toggleHelp,
  6265. // Toggles the overview mode on/off
  6266. toggleOverview: toggleOverview,
  6267. // Toggles the "black screen" mode on/off
  6268. togglePause: togglePause,
  6269. // Toggles the auto slide mode on/off
  6270. toggleAutoSlide: toggleAutoSlide,
  6271. // State checks
  6272. isOverview: isOverview,
  6273. isPaused: isPaused,
  6274. isAutoSliding: isAutoSliding,
  6275. isSpeakerNotes: isSpeakerNotes,
  6276. // Slide preloading
  6277. loadSlide: loadSlide,
  6278. unloadSlide: unloadSlide,
  6279. // Adds or removes all internal event listeners (such as keyboard)
  6280. addEventListeners: addEventListeners,
  6281. removeEventListeners: removeEventListeners,
  6282. // Facility for persisting and restoring the presentation state
  6283. getState: getState,
  6284. setState: setState,
  6285. // Presentation progress
  6286. getSlidePastCount: getSlidePastCount,
  6287. // Presentation progress on range of 0-1
  6288. getProgress: getProgress,
  6289. // Returns the indices of the current, or specified, slide
  6290. getIndices: getIndices,
  6291. // Returns an Array of all slides
  6292. getSlides: getSlides,
  6293. // Returns an Array of objects representing the attributes on
  6294. // the slides
  6295. getSlidesAttributes: getSlidesAttributes,
  6296. // Returns the total number of slides
  6297. getTotalSlides: getTotalSlides,
  6298. // Returns the slide element at the specified index
  6299. getSlide: getSlide,
  6300. // Returns the slide background element at the specified index
  6301. getSlideBackground: getSlideBackground,
  6302. // Returns the speaker notes string for a slide, or null
  6303. getSlideNotes: getSlideNotes,
  6304. // Returns the previous slide element, may be null
  6305. getPreviousSlide: function() {
  6306. return previousSlide;
  6307. },
  6308. // Returns the current slide element
  6309. getCurrentSlide: function() {
  6310. return currentSlide;
  6311. },
  6312. // Returns the current scale of the presentation content
  6313. getScale: function() {
  6314. return scale;
  6315. },
  6316. // Returns the current configuration object
  6317. getConfig: function() {
  6318. return config;
  6319. },
  6320. // Helper method, retrieves query string as a key/value hash
  6321. getQueryHash: function() {
  6322. var query = {};
  6323. location.search.replace( /[A-Z0-9]+?=([\w\.%-]*)/gi, function(a) {
  6324. query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
  6325. } );
  6326. // Basic deserialization
  6327. for( var i in query ) {
  6328. var value = query[ i ];
  6329. query[ i ] = deserialize( unescape( value ) );
  6330. }
  6331. return query;
  6332. },
  6333. // Returns the top-level DOM element
  6334. getRevealElement: function() {
  6335. return dom.wrapper || document.querySelector( '.reveal' );
  6336. },
  6337. // Returns a hash with all registered plugins
  6338. getPlugins: function() {
  6339. return plugins;
  6340. },
  6341. // Returns true if we're currently on the first slide
  6342. isFirstSlide: function() {
  6343. return ( indexh === 0 && indexv === 0 );
  6344. },
  6345. // Returns true if we're currently on the last slide
  6346. isLastSlide: function() {
  6347. if( currentSlide ) {
  6348. // Does this slide have a next sibling?
  6349. if( currentSlide.nextElementSibling ) return false;
  6350. // If it's vertical, does its parent have a next sibling?
  6351. if( isVerticalSlide( currentSlide ) && currentSlide.parentNode.nextElementSibling ) return false;
  6352. return true;
  6353. }
  6354. return false;
  6355. },
  6356. // Returns true if we're on the last slide in the current
  6357. // vertical stack
  6358. isLastVerticalSlide: function() {
  6359. if( currentSlide && isVerticalSlide( currentSlide ) ) {
  6360. // Does this slide have a next sibling?
  6361. if( currentSlide.nextElementSibling ) return false;
  6362. return true;
  6363. }
  6364. return false;
  6365. },
  6366. // Checks if reveal.js has been loaded and is ready for use
  6367. isReady: function() {
  6368. return loaded;
  6369. },
  6370. // Forward event binding to the reveal DOM element
  6371. addEventListener: function( type, listener, useCapture ) {
  6372. if( 'addEventListener' in window ) {
  6373. Reveal.getRevealElement().addEventListener( type, listener, useCapture );
  6374. }
  6375. },
  6376. removeEventListener: function( type, listener, useCapture ) {
  6377. if( 'addEventListener' in window ) {
  6378. Reveal.getRevealElement().removeEventListener( type, listener, useCapture );
  6379. }
  6380. },
  6381. // Adds/removes a custom key binding
  6382. addKeyBinding: addKeyBinding,
  6383. removeKeyBinding: removeKeyBinding,
  6384. // API for registering and retrieving plugins
  6385. registerPlugin: registerPlugin,
  6386. hasPlugin: hasPlugin,
  6387. getPlugin: getPlugin,
  6388. // Programmatically triggers a keyboard event
  6389. triggerKey: function( keyCode ) {
  6390. onDocumentKeyDown( { keyCode: keyCode } );
  6391. },
  6392. // Registers a new shortcut to include in the help overlay
  6393. registerKeyboardShortcut: function( key, value ) {
  6394. keyboardShortcuts[key] = value;
  6395. }
  6396. };
  6397. return Reveal;
  6398. }));
  6399. Reveal.initialize({
  6400. dependencies: [
  6401. { src: 'marked.js' },
  6402. { src: 'markdown.js' },
  6403. ]
  6404. });
  6405. </script>
  6406. </body>
  6407. </html>