作者 222 [actionscript] 2015-04-23 12:49 (点击下载)

  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="author" content="作者" />
  5. <title>标题</title>
  6. <style type="text/css">code{white-space: pre;}</style>
  7. <!--<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet'>-->
  8. <style>
  9.  
  10. html, .view body { background-color: black; counter-reset: slideidx; }
  11. body, .view section { background-color: white; border-radius: 12px }
  12.  
  13. /* A section is a slide. It's size is 800x600, and this will never change */
  14. section, .view head > title {
  15. /* The font from Google */
  16. font-family: 'Oswald', arial, serif;
  17. font-size: 30px;
  18. }
  19.  
  20. address, blockquote, dl, fieldset, form, h1, h2, h3, h4, h5, h6, hr, ol, p, pre, table, ul, dl { padding: 10px 20px 10px 20px; }
  21.  
  22. h1, h2, h3 {
  23. text-align: center;
  24. margin: 10pt 10pt 20pt 10pt;
  25. }
  26. ul, ol {
  27. margin: 10px 10px 10px 50px;
  28. }
  29. section.titleslide h1 { margin-top: 200px; }
  30. h1.title { margin-top: 150px; }
  31. h1 { font-size: 180%; }
  32. h2 { font-size: 120%; }
  33. h3 { font-size: 100%; }
  34.  
  35. q { quotes: "“" "”" "‘" "’"; }
  36.  
  37. blockquote {
  38. font-style: italic
  39. }
  40.  
  41. /* Figures are displayed full-page, with the caption on
  42. top of the image/video */
  43. figure {
  44. background-color: black;
  45. width: 100%;
  46. height: 100%;
  47. }
  48. figure > * {
  49. position: absolute;
  50. }
  51. figure > img, figure > video {
  52. width: 100%; height: 100%;
  53. }
  54. figcaption {
  55. margin: 70px;
  56. font-size: 50px;
  57. }
  58.  
  59. footer {
  60. position: absolute;
  61. bottom: 0;
  62. width: 100%;
  63. padding: 40px;
  64. text-align: right;
  65. background-color: #F3F4F8;
  66. border-top: 1px solid #CCC;
  67. }
  68.  
  69. /* Transition effect */
  70. /* Feel free to change the transition effect for original
  71. animations. See here:
  72. https://developer.mozilla.org/en/CSS/CSS_transitions
  73. How to use CSS3 Transitions: */
  74. section {
  75. -moz-transition: left 400ms linear 0s;
  76. -webkit-transition: left 400ms linear 0s;
  77. -ms-transition: left 400ms linear 0s;
  78. transition: left 400ms linear 0s;
  79. }
  80.  
  81. .view section {
  82. -moz-transition: none;
  83. -webkit-transition: none;
  84. -ms-transition: none;
  85. transition: none;
  86. }
  87.  
  88. .view section[aria-selected] {
  89. border: 5px red solid;
  90. }
  91.  
  92. /* Before */
  93. section { left: -150%; }
  94. /* Now */
  95. section[aria-selected] { left: 0; }
  96. /* After */
  97. section[aria-selected] ~ section { left: +150%; }
  98.  
  99. /* Incremental elements */
  100.  
  101. /* By default, visible */
  102. .incremental > * { opacity: 1; }
  103.  
  104. /* The current item */
  105. .incremental > *[aria-selected] { color: red; opacity: 1; }
  106.  
  107. /* The items to-be-selected */
  108. .incremental > *[aria-selected] ~ * { opacity: 0.2; }
  109.  
  110. /* The progressbar, at the bottom of the slides, show the global
  111. progress of the presentation. */
  112. #progress-bar {
  113. height: 2px;
  114. background: #AAA;
  115. }
  116. </style>
  117. </head>
  118. <body>
  119. <section class="title">
  120. <h1 class="title">标题</h1>
  121. <h2 class="author">作者</h2>
  122. <h3 class="date">时间</h3>
  123. </section>
  124. <section id="一级标题" class="titleslide slide level1"><h1>一级标题</h1></section><section id="二级标题" class="slide level2">
  125. <h1>二级标题</h1>
  126. <p>内容测试</p>
  127. </section><section class="slide level2">
  128.  
  129. <h4 id="测试四级标题">测试四级标题</h4>
  130. <p>四级标题下的正文</p>
  131. </section>
  132. <!-- {{{{ dzslides core
  133. #
  134. #
  135. # __ __ __ . __ ___ __
  136. # | / /__` | | | |__ /__`
  137. # |__/ /_ .__/ |___ | |__/ |___ .__/ core :€
  138. #
  139. #
  140. # The following block of code is not supposed to be edited.
  141. # But if you want to change the behavior of these slides,
  142. # feel free to hack it!
  143. #
  144. -->
  145.  
  146. <div id="progress-bar"></div>
  147.  
  148. <!-- Default Style -->
  149. <style>
  150. * { margin: 0; padding: 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
  151. details { display: none; }
  152. body {
  153. width: 800px; height: 600px;
  154. margin-left: -400px; margin-top: -300px;
  155. position: absolute; top: 50%; left: 50%;
  156. overflow: hidden;
  157. }
  158. section {
  159. position: absolute;
  160. pointer-events: none;
  161. width: 100%; height: 100%;
  162. }
  163. section[aria-selected] { pointer-events: auto; }
  164. html { overflow: hidden; }
  165. body { display: none; }
  166. body.loaded { display: block; }
  167. .incremental {visibility: hidden; }
  168. .incremental[active] {visibility: visible; }
  169. #progress-bar{
  170. bottom: 0;
  171. position: absolute;
  172. -moz-transition: width 400ms linear 0s;
  173. -webkit-transition: width 400ms linear 0s;
  174. -ms-transition: width 400ms linear 0s;
  175. transition: width 400ms linear 0s;
  176. }
  177. figure {
  178. width: 100%;
  179. height: 100%;
  180. }
  181. figure > * {
  182. position: absolute;
  183. }
  184. figure > img, figure > video {
  185. width: 100%; height: 100%;
  186. }
  187. </style>
  188.  
  189. <script>
  190. var Dz = {
  191. remoteWindows: [],
  192. idx: -1,
  193. step: 0,
  194. slides: null,
  195. progressBar : null,
  196. params: {
  197. autoplay: "1"
  198. }
  199. };
  200.  
  201. Dz.init = function() {
  202. document.body.className = "loaded";
  203. this.slides = $$("body > section");
  204. this.progressBar = $("#progress-bar");
  205. this.setupParams();
  206. this.onhashchange();
  207. this.setupTouchEvents();
  208. this.onresize();
  209. }
  210. Dz.setupParams = function() {
  211. var p = window.location.search.substr(1).split('&');
  212. p.forEach(function(e, i, a) {
  213. var keyVal = e.split('=');
  214. Dz.params[keyVal[0]] = decodeURIComponent(keyVal[1]);
  215. });
  216. // Specific params handling
  217. if (!+this.params.autoplay)
  218. $$.forEach($$("video"), function(v){ v.controls = true });
  219. }
  220.  
  221. Dz.onkeydown = function(aEvent) {
  222. // Don't intercept keyboard shortcuts
  223. if (aEvent.altKey
  224. || aEvent.ctrlKey
  225. || aEvent.metaKey
  226. || aEvent.shiftKey) {
  227. return;
  228. }
  229. if ( aEvent.keyCode == 37 // left arrow
  230. || aEvent.keyCode == 38 // up arrow
  231. || aEvent.keyCode == 33 // page up
  232. ) {
  233. aEvent.preventDefault();
  234. this.back();
  235. }
  236. if ( aEvent.keyCode == 39 // right arrow
  237. || aEvent.keyCode == 40 // down arrow
  238. || aEvent.keyCode == 34 // page down
  239. ) {
  240. aEvent.preventDefault();
  241. this.forward();
  242. }
  243. if (aEvent.keyCode == 35) { // end
  244. aEvent.preventDefault();
  245. this.goEnd();
  246. }
  247. if (aEvent.keyCode == 36) { // home
  248. aEvent.preventDefault();
  249. this.goStart();
  250. }
  251. if (aEvent.keyCode == 32) { // space
  252. aEvent.preventDefault();
  253. this.toggleContent();
  254. }
  255. if (aEvent.keyCode == 70) { // f
  256. aEvent.preventDefault();
  257. this.goFullscreen();
  258. }
  259. }
  260.  
  261. /* Touch Events */
  262.  
  263. Dz.setupTouchEvents = function() {
  264. var orgX, newX;
  265. var tracking = false;
  266.  
  267. var db = document.body;
  268. db.addEventListener("touchstart", start.bind(this), false);
  269. db.addEventListener("touchmove", move.bind(this), false);
  270.  
  271. function start(aEvent) {
  272. aEvent.preventDefault();
  273. tracking = true;
  274. orgX = aEvent.changedTouches[0].pageX;
  275. }
  276.  
  277. function move(aEvent) {
  278. if (!tracking) return;
  279. newX = aEvent.changedTouches[0].pageX;
  280. if (orgX - newX > 100) {
  281. tracking = false;
  282. this.forward();
  283. } else {
  284. if (orgX - newX < -100) {
  285. tracking = false;
  286. this.back();
  287. }
  288. }
  289. }
  290. }
  291.  
  292. /* Adapt the size of the slides to the window */
  293.  
  294. Dz.onresize = function() {
  295. var db = document.body;
  296. var sx = db.clientWidth / window.innerWidth;
  297. var sy = db.clientHeight / window.innerHeight;
  298. var transform = "scale(" + (1/Math.max(sx, sy)) + ")";
  299.  
  300. db.style.MozTransform = transform;
  301. db.style.WebkitTransform = transform;
  302. db.style.OTransform = transform;
  303. db.style.msTransform = transform;
  304. db.style.transform = transform;
  305. }
  306.  
  307.  
  308. Dz.getDetails = function(aIdx) {
  309. var s = $("section:nth-of-type(" + aIdx + ")");
  310. var d = s.$("details");
  311. return d ? d.innerHTML : "";
  312. }
  313.  
  314. Dz.onmessage = function(aEvent) {
  315. var argv = aEvent.data.split(" "), argc = argv.length;
  316. argv.forEach(function(e, i, a) { a[i] = decodeURIComponent(e) });
  317. var win = aEvent.source;
  318. if (argv[0] === "REGISTER" && argc === 1) {
  319. this.remoteWindows.push(win);
  320. this.postMsg(win, "REGISTERED", document.title, this.slides.length);
  321. this.postMsg(win, "CURSOR", this.idx + "." + this.step);
  322. return;
  323. }
  324. if (argv[0] === "BACK" && argc === 1)
  325. this.back();
  326. if (argv[0] === "FORWARD" && argc === 1)
  327. this.forward();
  328. if (argv[0] === "START" && argc === 1)
  329. this.goStart();
  330. if (argv[0] === "END" && argc === 1)
  331. this.goEnd();
  332. if (argv[0] === "TOGGLE_CONTENT" && argc === 1)
  333. this.toggleContent();
  334. if (argv[0] === "SET_CURSOR" && argc === 2)
  335. window.location.hash = "#" + argv[1];
  336. if (argv[0] === "GET_CURSOR" && argc === 1)
  337. this.postMsg(win, "CURSOR", this.idx + "." + this.step);
  338. if (argv[0] === "GET_NOTES" && argc === 1)
  339. this.postMsg(win, "NOTES", this.getDetails(this.idx));
  340. }
  341.  
  342. Dz.toggleContent = function() {
  343. // If a Video is present in this new slide, play it.
  344. // If a Video is present in the previous slide, stop it.
  345. var s = $("section[aria-selected]");
  346. if (s) {
  347. var video = s.$("video");
  348. if (video) {
  349. if (video.ended || video.paused) {
  350. video.play();
  351. } else {
  352. video.pause();
  353. }
  354. }
  355. }
  356. }
  357.  
  358. Dz.setCursor = function(aIdx, aStep) {
  359. // If the user change the slide number in the URL bar, jump
  360. // to this slide.
  361. aStep = (aStep != 0 && typeof aStep !== "undefined") ? "." + aStep : ".0";
  362. window.location.hash = "#" + aIdx + aStep;
  363. }
  364.  
  365. Dz.onhashchange = function() {
  366. var cursor = window.location.hash.split("#"),
  367. newidx = 1,
  368. newstep = 0;
  369. if (cursor.length == 2) {
  370. newidx = ~~cursor[1].split(".")[0];
  371. newstep = ~~cursor[1].split(".")[1];
  372. if (newstep > Dz.slides[newidx - 1].$$('.incremental > *').length) {
  373. newstep = 0;
  374. newidx++;
  375. }
  376. }
  377. this.setProgress(newidx, newstep);
  378. if (newidx != this.idx) {
  379. this.setSlide(newidx);
  380. }
  381. if (newstep != this.step) {
  382. this.setIncremental(newstep);
  383. }
  384. for (var i = 0; i < this.remoteWindows.length; i++) {
  385. this.postMsg(this.remoteWindows[i], "CURSOR", this.idx + "." + this.step);
  386. }
  387. }
  388.  
  389. Dz.back = function() {
  390. if (this.idx == 1 && this.step == 0) {
  391. return;
  392. }
  393. if (this.step == 0) {
  394. this.setCursor(this.idx - 1,
  395. this.slides[this.idx - 2].$$('.incremental > *').length);
  396. } else {
  397. this.setCursor(this.idx, this.step - 1);
  398. }
  399. }
  400.  
  401. Dz.forward = function() {
  402. if (this.idx >= this.slides.length &&
  403. this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) {
  404. return;
  405. }
  406. if (this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) {
  407. this.setCursor(this.idx + 1, 0);
  408. } else {
  409. this.setCursor(this.idx, this.step + 1);
  410. }
  411. }
  412.  
  413. Dz.goStart = function() {
  414. this.setCursor(1, 0);
  415. }
  416.  
  417. Dz.goEnd = function() {
  418. var lastIdx = this.slides.length;
  419. var lastStep = this.slides[lastIdx - 1].$$('.incremental > *').length;
  420. this.setCursor(lastIdx, lastStep);
  421. }
  422.  
  423. Dz.setSlide = function(aIdx) {
  424. this.idx = aIdx;
  425. var old = $("section[aria-selected]");
  426. var next = $("section:nth-of-type("+ this.idx +")");
  427. if (old) {
  428. old.removeAttribute("aria-selected");
  429. var video = old.$("video");
  430. if (video) {
  431. video.pause();
  432. }
  433. }
  434. if (next) {
  435. next.setAttribute("aria-selected", "true");
  436. var video = next.$("video");
  437. if (video && !!+this.params.autoplay) {
  438. video.play();
  439. }
  440. } else {
  441. // That should not happen
  442. this.idx = -1;
  443. // console.warn("Slide doesn't exist.");
  444. }
  445. }
  446.  
  447. Dz.setIncremental = function(aStep) {
  448. this.step = aStep;
  449. var old = this.slides[this.idx - 1].$('.incremental > *[aria-selected]');
  450. if (old) {
  451. old.removeAttribute('aria-selected');
  452. }
  453. var incrementals = $$('.incremental');
  454. if (this.step <= 0) {
  455. $$.forEach(incrementals, function(aNode) {
  456. aNode.removeAttribute('active');
  457. });
  458. return;
  459. }
  460. var next = this.slides[this.idx - 1].$$('.incremental > *')[this.step - 1];
  461. if (next) {
  462. next.setAttribute('aria-selected', true);
  463. next.parentNode.setAttribute('active', true);
  464. var found = false;
  465. $$.forEach(incrementals, function(aNode) {
  466. if (aNode != next.parentNode)
  467. if (found)
  468. aNode.removeAttribute('active');
  469. else
  470. aNode.setAttribute('active', true);
  471. else
  472. found = true;
  473. });
  474. } else {
  475. setCursor(this.idx, 0);
  476. }
  477. return next;
  478. }
  479.  
  480. Dz.goFullscreen = function() {
  481. var html = $('html'),
  482. requestFullscreen = html.requestFullscreen || html.requestFullScreen || html.mozRequestFullScreen || html.webkitRequestFullScreen;
  483. if (requestFullscreen) {
  484. requestFullscreen.apply(html);
  485. }
  486. }
  487. Dz.setProgress = function(aIdx, aStep) {
  488. var slide = $("section:nth-of-type("+ aIdx +")");
  489. if (!slide)
  490. return;
  491. var steps = slide.$$('.incremental > *').length + 1,
  492. slideSize = 100 / (this.slides.length - 1),
  493. stepSize = slideSize / steps;
  494. this.progressBar.style.width = ((aIdx - 1) * slideSize + aStep * stepSize) + '%';
  495. }
  496. Dz.postMsg = function(aWin, aMsg) { // [arg0, [arg1...]]
  497. aMsg = [aMsg];
  498. for (var i = 2; i < arguments.length; i++)
  499. aMsg.push(encodeURIComponent(arguments[i]));
  500. aWin.postMessage(aMsg.join(" "), "*");
  501. }
  502. function init() {
  503. Dz.init();
  504. window.onkeydown = Dz.onkeydown.bind(Dz);
  505. window.onresize = Dz.onresize.bind(Dz);
  506. window.onhashchange = Dz.onhashchange.bind(Dz);
  507. window.onmessage = Dz.onmessage.bind(Dz);
  508. }
  509.  
  510. window.onload = init;
  511. </script>
  512.  
  513.  
  514. <script> // Helpers
  515. if (!Function.prototype.bind) {
  516. Function.prototype.bind = function (oThis) {
  517.  
  518. // closest thing possible to the ECMAScript 5 internal IsCallable
  519. // function
  520. if (typeof this !== "function")
  521. throw new TypeError(
  522. "Function.prototype.bind - what is trying to be fBound is not callable"
  523. );
  524.  
  525. var aArgs = Array.prototype.slice.call(arguments, 1),
  526. fToBind = this,
  527. fNOP = function () {},
  528. fBound = function () {
  529. return fToBind.apply( this instanceof fNOP ? this : oThis || window,
  530. aArgs.concat(Array.prototype.slice.call(arguments)));
  531. };
  532.  
  533. fNOP.prototype = this.prototype;
  534. fBound.prototype = new fNOP();
  535.  
  536. return fBound;
  537. };
  538. }
  539.  
  540. var $ = (HTMLElement.prototype.$ = function(aQuery) {
  541. return this.querySelector(aQuery);
  542. }).bind(document);
  543.  
  544. var $$ = (HTMLElement.prototype.$$ = function(aQuery) {
  545. return this.querySelectorAll(aQuery);
  546. }).bind(document);
  547.  
  548. $$.forEach = function(nodeList, fun) {
  549. Array.prototype.forEach.call(nodeList, fun);
  550. }
  551.  
  552. </script>
  553. <!-- vim: set fdm=marker: }}} -->
  554. </body>
  555. </html>

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)