Implement a new control panel.
[hacks/simpleWebSlides.git] / doc / demo.xhtml
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
4 >
5 <html xmlns="http://www.w3.org/1999/xhtml" >
6   <head>
7     <title>SimpleWebSlides</title>
8
9     <meta http-equiv="Content-Type"
10           content="text/html; charset=utf-8" />
11     <meta name="copyright"
12           content="Copyright &#169; 2013 Kim Nguyễn" />
13
14     <!-- Load jQuery -->
15     <script src="../jquery-1.9.1.min.js" type="text/javascript" ></script>
16     <!-- Load the library -->
17     <script src="../simpleWebSlides.js" type="text/javascript" ></script>
18
19     <link rel="stylesheet" href="../simpleWebSlides.css" type="text/css"
20           media="all" />
21     <!-- Load a custom Theme, the class-element marks this style-sheet
22       a "theme" that can be swtiched dynamicaly -->
23     <link class="sws-theme" rel="stylesheet"  title="Web 2.0"
24           href="../themes/webTwoPointO.css" type="text/css" />
25     <link class="sws-theme" rel="alternate stylesheet"  title="Default style"
26           href="../themes/default.css" type="text/css" />
27
28     <!-- Customize some templates and initialize -->
29
30     <script type="text/x-mathjax-config">
31       MathJax.Hub.Config({
32       tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
33       });
34     </script>
35
36     <script type="text/javascript"
37             src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
38     </script>
39
40     <script type="text/javascript">
41 /*
42       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeVerticalSlide;
43       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeHorizontalSlide; */
44       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
45       SWS.Config['sws-object-deactivate'] =  SWS.Effects.objectDeactivateFadeOut;
46       SWS.Config['sws-object-activate'] = SWS.Effects.objectActivateFadeIn;
47
48       //Ensures that we load SWS at the very end, after MathJax has
49       //been initialized
50       MathJax.Hub.Queue(function () {
51              SWS.Presentation.init();
52       });
53
54 // Some utility functions:
55 function set_color(o,c) {
56 var style = o.attr("style");
57 var a = style.split(";");
58 for(var i = 0; i &lt; a.length; i++){
59 if (a[i].indexOf("fill:") &gt;= 0){
60 a[i] = "fill: " + c;
61 break;
62 };
63 };
64 o.attr("style",a.join(";"));
65
66 };
67
68     </script>
69
70     <style type="text/css">
71       #css {
72       display:inline-block;
73       font-size: larger;
74       font-weight: bolder;
75       -webkit-transform: rotate(-20deg);
76       -moz-transform: rotate(-20deg);
77       }
78     </style>
79   </head>
80   <body>
81
82     <div class="sws-slide sws-cover sws-option-nofooter">
83       <div class="centerbox">
84         <h1>SimpleWebSlides</h1>
85         <h1>An <em>HTML</em><img style="height:28pt"
86              src="HTML5_Badge.svg" alt="5"/>
87           Presentation framework</h1>
88         <a href="mailto:kim@nguyen.vg">kim@nguyen.vg</a>
89       </div>
90     </div>
91
92     <!-- H1 below is hidden, used for table of content (TODO) -->
93     <h1>Introduction</h1>
94
95     <div class="sws-slide" >
96       <h1>What is it?</h1>
97       <em>SimpleWebSlides</em> is simple tool that allows
98       you to build funky presentations:
99       <ul>
100         <li class="sws-pause" >Write your presentations in (X)HTML5!</li>
101         <li class="sws-pause" >Theme to
102         your <span style='font-size:larger'>❤</span>'s content
103         with <em id="css">C S S</em>!</li>
104         <li class="sws-pause" >Create animations using Javascript &amp; jQuery!</li>
105       </ul>
106         <script type="text/javascript">
107           var zoom_title = function (canvas) {
108           var h1 = canvas.find("h1");
109           var old_size = h1.css('font-size');
110           h1.animate({"font-size":"80pt" }, 300)
111           .animate({"font-size":old_size }, 300);
112           };
113
114           SWS.Presentation.registerCallback(3, zoom_title);
115         </script>
116     </div>
117
118     <div class="sws-slide">
119       <h1>What's wrong with Beamer/L<sub>A</sub>T<sup>E</sup>X/Tikz?</h1>
120       <ul>
121         <li class="sws-pause">Does not easily support smooth
122         animations</li>
123         <li class="sws-pause">Hard to program/script </li>
124         <li class="sws-pause">Using modern fonts and UTF-8 is a nightmare</li>
125         <li class="sws-pause">Slow compilation times</li>
126         <li class="sws-pause">Difficult to integrate several media
127           (videos, vector graphics, sounds,…)
128         </li>
129       </ul>
130       <p  class="sws-pause">But wait! I'm loosing all those nicely
131       rendered mathematical formulæ!</p>
132       <p class="sws-pause"> You mean like this one<sup>*</sup> ?
133         $$
134         F_n = \frac{1}{\sqrt{5}}\cdot\left(\frac{1+\sqrt{5}}{2}\right)^n-\frac{1}{\sqrt{5}}\cdot\left(\frac{1-\sqrt{5}}{2}\right)^n
135         $$
136       </p>
137       <p class="sws-pause">or that one<sup>*</sup> ?
138
139         $$
140         \frac{\Gamma\cup\{x\mapsto t\}\vdash e : s}{\Gamma\vdash \lambda x^{t}.e : t \rightarrow s}
141         $$
142       </p>
143       <p class="sws-pause">*: All this is done
144         using <a href="http://www.mathjax.org">MathJax!</a> and
145         written like this:<br/>
146 <pre><code>
147     \frac{
148           \Gamma\cup\{x\mapsto t\}\vdash e : s
149     }{
150           \Gamma\vdash \lambda x^{t}.e : t \rightarrow s
151     }
152 </code></pre>
153 </p>
154     </div>
155     <div class="sws-slide">
156       <h1>A simple example</h1>
157       <p class="sws-onframe-1_3">
158       A minimal slide, with no animation looks like this:
159 <pre><code>
160      &lt;div <em>class="sws-slide"</em>&gt;
161           &lt;h1&gt;Slide title&lt;/h1&gt;
162              Hello world!
163      &lt;/div&gt;
164 </code></pre>
165 </p>
166 <p class="sws-pause">
167   You can also reveal things progressively like this:
168   <pre><code>
169       &lt;p&gt; Text 1&lt;/p&gt;
170       &lt;p <em>class="sws-pause"</em>&gt;
171       Text 2 (appears afterwards)
172       &lt;/p&gt;
173   </code></pre>
174 </p>
175 <p class="sws-pause">
176   You can also set an element to appear on specific frames:
177   <pre><code>
178       &lt;p&gt; Text 1&lt;/p&gt;
179       &lt;p <em>class="sws-onframe-1-5_9"</em>&gt;
180       Appears on frame 2, 3, 4, 5, 6 and 10 of the current slide
181       (frame numbering starts at 0).
182       &lt;/p&gt;
183   </code></pre>
184 </p>
185     </div>
186 <div class="sws-slide">
187   <h1>Scripting your presentation</h1>
188   <p>
189     Of course, you can script your presentation with Javascript!<br/>
190     You just need to add the <code>script</code> element somewhere in
191     the current <code>div</code>
192     <pre><code>
193 &lt;script type="text/javascript"&gt;
194     function zoom_title (canvas) {
195         var h1 = canvas.find("h1");
196         var old_size = h1.css('font-size');
197             h1.animate({"font-size":"80pt" }, 300)
198                .animate({"font-size":old_size }, 300);
199     };
200     //Call the zoom_title function on the 4th and 7th frame
201     <em>SWS.Presentation.registerCallback("3_6", zoom_title);</em>
202 &lt;script&gt;
203 </code></pre>
204     (That's not a bug, you should keep pressing next, see how many
205     steps there are on this slide)
206   </p>
207
208 <script type="text/javascript">
209   SWS.Presentation.registerCallback("4_7", zoom_title);
210 </script>
211
212 </div>
213 <div class="sws-slide">
214   <h1>SWS API</h1>
215   You can manipulate the presentation through
216   the <em><code>SWS.Presentation</code></em> object. For instance:
217   <code><pre>
218       &lt;a onclick="SWS.Presentation.previous();"&gt;◀◀◀◀◀&lt;/a&gt;
219       &lt;a onclick="SWS.Presentation.next();"&gt;▶▶▶▶▶&lt;/a&gt;
220       &lt;a onclick="SWS.Presentation.goToSlide(1,2);"&gt;Go back in time!&lt;/a&gt;
221 </pre></code>
222   Let's try it:
223   <a onclick="SWS.Presentation.previous();SWS.Presentation.refresh();">◀◀◀◀◀</a>
224   <a onclick="SWS.Presentation.next();SWS.Presentation.refresh();">▶▶▶▶▶</a>
225   <a onclick="SWS.Presentation.goToSlide(1,2);">Go
226     back in time!</a> (to the second frame of the first slide)
227 </div>
228 <div class="sws-slide">
229   <h1>Some more fancy stuff</h1>
230 Let's put some <em>inline</em> SVG:
231 <div style="text-align:center;">
232 <svg
233    xmlns:dc="http://purl.org/dc/elements/1.1/"
234    xmlns:cc="http://creativecommons.org/ns#"
235    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
236    xmlns:svg="http://www.w3.org/2000/svg"
237    xmlns="http://www.w3.org/2000/svg"
238    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
239    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
240    width="68.160713"
241    height="170.35268"
242    id="svg2"
243    version="1.1"
244    inkscape:version="0.48.3.1 r9886"
245    sodipodi:docname="lights.svg">
246   <defs
247      id="defs4" />
248   <sodipodi:namedview
249      id="base"
250      pagecolor="#ffffff"
251      bordercolor="#666666"
252      borderopacity="1.0"
253      inkscape:pageopacity="0.0"
254      inkscape:pageshadow="2"
255      inkscape:zoom="5.6"
256      inkscape:cx="38.9935"
257      inkscape:cy="56.441072"
258      inkscape:document-units="px"
259      inkscape:current-layer="layer1"
260      showgrid="true"
261      fit-margin-top="0"
262      fit-margin-left="0"
263      fit-margin-right="0"
264      fit-margin-bottom="0"
265      inkscape:window-width="1627"
266      inkscape:window-height="1026"
267      inkscape:window-x="1077"
268      inkscape:window-y="24"
269      inkscape:window-maximized="1">
270     <inkscape:grid
271        type="xygrid"
272        id="grid2985"
273        empspacing="5"
274        visible="true"
275        enabled="true"
276        snapvisiblegridlinesonly="true"
277        originx="-82.348214px"
278        originy="-877.32807px" />
279   </sodipodi:namedview>
280   <metadata
281      id="metadata7">
282     <rdf:RDF>
283       <cc:Work
284          rdf:about="">
285         <dc:format>image/svg+xml</dc:format>
286         <dc:type
287            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
288         <dc:title />
289       </cc:Work>
290     </rdf:RDF>
291   </metadata>
292   <g
293      inkscape:label="Layer 1"
294      inkscape:groupmode="layer"
295      id="layer1"
296      transform="translate(-82.348214,-4.6814313)">
297     <g
298        id="g3014"
299        transform="matrix(1.5714286,0,0,1.5714286,-48.571431,-4.2069617)">
300       <rect
301          ry="10"
302          y="7.3621826"
303          x="85"
304          height="105"
305          width="40"
306          id="rect2989"
307          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
308       <path
309          transform="translate(132.5,-20)"
310          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
311          sodipodi:ry="12.5"
312          sodipodi:rx="12.5"
313          sodipodi:cy="44.862183"
314          sodipodi:cx="-27.5"
315          id="topdisk"
316          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
317          sodipodi:type="arc" />
318       <path
319          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
320          sodipodi:ry="12.5"
321          sodipodi:rx="12.5"
322          sodipodi:cy="44.862183"
323          sodipodi:cx="-27.5"
324          id="middledisk"
325          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
326          sodipodi:type="arc"
327          transform="translate(132.5,15)" />
328       <path
329          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
330          sodipodi:ry="12.5"
331          sodipodi:rx="12.5"
332          sodipodi:cy="44.862183"
333          sodipodi:cx="-27.5"
334          id="bottomdisk"
335          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
336          sodipodi:type="arc"
337          transform="translate(132.5,50)" />
338     </g>
339   </g>
340 </svg>
341 </div>
342 Of course we can animate it with some javascript!
343 <script type="text/javascript">
344   SWS.Presentation.registerCallback(0, function(o){
345   set_color(o.find("#topdisk"), "#000a1a");
346   });
347   SWS.Presentation.registerCallback(1, function(o){
348   set_color(o.find("#topdisk"), "#ff0000");
349   set_color(o.find("#middledisk"), "#000a1a");
350   });
351   SWS.Presentation.registerCallback(2, function(o){
352   set_color(o.find("#middledisk"), "#ffa500");
353   set_color(o.find("#bottomdisk"), "#000a1a");
354 /**/
355   SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
356   });
357   SWS.Presentation.registerCallback(3, function(o){
358   set_color(o.find("#bottomdisk"), "#00ff00");
359   SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeHorizontalSlide;
360 /* */
361   });
362 </script>
363 </div>
364 <div class="sws-slide">
365   <h1>Totally customizable</h1>
366   <p>
367     BTW did you see how I changed the transition effect for the
368     previous slide ?
369   </p>
370 </div>
371
372   </body>
373 </html>