reveal-jekyll 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +94 -0
- data/_includes/basements.html +7 -0
- data/_includes/head.html +39 -0
- data/_includes/reveal.html +25 -0
- data/_layouts/presentation.html +26 -0
- data/_layouts/raw.html +20 -0
- data/assets/css/print/paper.css +203 -0
- data/assets/css/print/pdf.css +164 -0
- data/assets/css/reset.css +30 -0
- data/assets/css/reveal.css +1598 -0
- data/assets/css/reveal.scss +1768 -0
- data/assets/css/rouge-highlight/monokai.css +210 -0
- data/assets/css/theme/README.md +21 -0
- data/assets/css/theme/beige.css +277 -0
- data/assets/css/theme/black.css +273 -0
- data/assets/css/theme/blood.css +296 -0
- data/assets/css/theme/league.css +279 -0
- data/assets/css/theme/moon.css +277 -0
- data/assets/css/theme/night.css +271 -0
- data/assets/css/theme/serif.css +273 -0
- data/assets/css/theme/simple.css +276 -0
- data/assets/css/theme/sky.css +280 -0
- data/assets/css/theme/solarized.css +277 -0
- data/assets/css/theme/source/beige.scss +39 -0
- data/assets/css/theme/source/black.scss +49 -0
- data/assets/css/theme/source/blood.scss +78 -0
- data/assets/css/theme/source/league.scss +34 -0
- data/assets/css/theme/source/moon.scss +57 -0
- data/assets/css/theme/source/night.scss +34 -0
- data/assets/css/theme/source/serif.scss +35 -0
- data/assets/css/theme/source/simple.scss +43 -0
- data/assets/css/theme/source/sky.scss +46 -0
- data/assets/css/theme/source/solarized.scss +63 -0
- data/assets/css/theme/source/white.scss +49 -0
- data/assets/css/theme/template/mixins.scss +29 -0
- data/assets/css/theme/template/settings.scss +45 -0
- data/assets/css/theme/template/theme.scss +325 -0
- data/assets/css/theme/white.css +273 -0
- data/assets/js/reveal.js +6028 -0
- data/assets/lib/css/monokai.css +71 -0
- data/assets/lib/css/zenburn.css +80 -0
- data/assets/lib/font/Pacifico/Pacifico.eot +0 -0
- data/assets/lib/font/Pacifico/Pacifico.svg +10833 -0
- data/assets/lib/font/Pacifico/Pacifico.ttf +0 -0
- data/assets/lib/font/Pacifico/Pacifico.woff +0 -0
- data/assets/lib/font/Pacifico/Pacifico.woff2 +0 -0
- data/assets/lib/font/Pacifico/original-pacifico-regular.ttf +0 -0
- data/assets/lib/font/fontawesome/FontAwesome.otf +0 -0
- data/assets/lib/font/fontawesome/fontawesome-webfont.eot +0 -0
- data/assets/lib/font/fontawesome/fontawesome-webfont.svg +2671 -0
- data/assets/lib/font/fontawesome/fontawesome-webfont.ttf +0 -0
- data/assets/lib/font/fontawesome/fontawesome-webfont.woff +0 -0
- data/assets/lib/font/fontawesome/fontawesome-webfont.woff2 +0 -0
- data/assets/lib/font/league-gothic/LICENSE +2 -0
- data/assets/lib/font/league-gothic/league-gothic.css +10 -0
- data/assets/lib/font/league-gothic/league-gothic.eot +0 -0
- data/assets/lib/font/league-gothic/league-gothic.ttf +0 -0
- data/assets/lib/font/league-gothic/league-gothic.woff +0 -0
- data/assets/lib/font/source-sans-pro/LICENSE +45 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-italic.ttf +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-regular.ttf +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibold.ttf +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff +0 -0
- data/assets/lib/font/source-sans-pro/source-sans-pro.css +39 -0
- data/assets/lib/js/html5shiv.js +7 -0
- data/assets/lib/js/promise.js +2 -0
- data/assets/plugin/highlight/highlight.js +168 -0
- data/assets/plugin/markdown/example.html +134 -0
- data/assets/plugin/markdown/example.md +36 -0
- data/assets/plugin/markdown/markdown.js +446 -0
- data/assets/plugin/markdown/marked.js +6 -0
- data/assets/plugin/math/math.js +92 -0
- data/assets/plugin/multiplex/client.js +13 -0
- data/assets/plugin/multiplex/index.js +64 -0
- data/assets/plugin/multiplex/master.js +34 -0
- data/assets/plugin/multiplex/package.json +19 -0
- data/assets/plugin/notes-server/client.js +65 -0
- data/assets/plugin/notes-server/index.js +69 -0
- data/assets/plugin/notes-server/notes.html +585 -0
- data/assets/plugin/notes/notes.html +834 -0
- data/assets/plugin/notes/notes.js +178 -0
- data/assets/plugin/print-pdf/print-pdf.js +67 -0
- data/assets/plugin/search/search.js +206 -0
- data/assets/plugin/zoom-js/zoom.js +277 -0
- metadata +180 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* marked - a markdown parser
|
3
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
|
4
|
+
* https://github.com/markedjs/marked
|
5
|
+
*/
|
6
|
+
!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||m.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=i(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}\.)/,k.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,k.item=i(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=i(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=/<!--(?!-?>)[\s\S]*?-->/,k.html=i(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=i(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=i(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=d({},k),k.gfm=d({},k.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=i(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=d({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=d({},k.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1<s[0].length&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:y(s,"\n")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if(t&&(s=this.rules.nptable.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),c=0;c<o.align.length;c++)/^ *-+: *$/.test(o.align[c])?o.align[c]="right":/^ *:-+: *$/.test(o.align[c])?o.align[c]="center":/^ *:-+ *$/.test(o.align[c])?o.align[c]="left":o.align[c]=null;for(c=0;c<o.cells.length;c++)o.cells[c]=x(o.cells[c],o.header.length);this.tokens.push(o)}else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"hr"});else if(s=this.rules.blockquote.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c<f;c++)u=(o=s[c]).length,~(o=o.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(u-=o.length,o=this.options.pedantic?o.replace(/^ {1,4}/gm,""):o.replace(new RegExp("^ {1,"+u+"}","gm"),"")),c!==f-1&&(l=k.bullet.exec(s[c+1])[0],(1<i.length?1===l.length:1<l.length||this.options.smartLists&&l!==i)&&(e=s.slice(c+1).join("\n")+e,c=f-1)),r=n||/\n\n(?!\s*$)/.test(o),c!==f-1&&(n="\n"===o.charAt(o.length-1),r||(r=n)),r&&(a.loose=!0),b=void 0,(m=/^\[[ xX]\] /.test(o))&&(b=" "!==o[1],o=o.replace(/^\[[ xX]\] +/,"")),p={type:"list_item_start",task:m,checked:b,loose:r},h.push(p),this.tokens.push(p),this.token(o,!1),this.tokens.push({type:"list_item_end"});if(a.loose)for(f=h.length,c=0;c<f;c++)h[c].loose=!0;this.tokens.push({type:"list_end"})}else if(s=this.rules.html.exec(e))e=e.substring(s[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(t&&(s=this.rules.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),g=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[g]||(this.tokens.links[g]={href:s[2],title:s[3]});else if(t&&(s=this.rules.table.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),c=0;c<o.align.length;c++)/^ *-+: *$/.test(o.align[c])?o.align[c]="right":/^ *:-+: *$/.test(o.align[c])?o.align[c]="center":/^ *:-+ *$/.test(o.align[c])?o.align[c]="left":o.align[c]=null;for(c=0;c<o.cells.length;c++)o.cells[c]=x(o.cells[c].replace(/^ *\| *| *\| *$/g,""),o.header.length);this.tokens.push(o)}else if(s=this.rules.lheading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(t&&(s=this.rules.paragraph.exec(e)))e=e.substring(s[0].length),this.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var n={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:f,text:/^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function h(e,t){if(this.options=t||m.defaults,this.links=e,this.rules=n.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=n.pedantic:this.options.gfm&&(this.options.breaks?this.rules=n.breaks:this.rules=n.gfm)}function r(e){this.options=e||m.defaults}function s(){}function p(e){this.tokens=[],this.token=null,this.options=e||m.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options,this.slugger=new t}function t(){this.seen={}}function u(e,t){if(t){if(u.escapeTest.test(e))return e.replace(u.escapeReplace,function(e){return u.replacements[e]})}else if(u.escapeTestNoEncode.test(e))return e.replace(u.escapeReplaceNoEncode,function(e){return u.replacements[e]});return e}function c(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function i(n,e){return n=n.source||n,e=e||"",{replace:function(e,t){return t=(t=t.source||t).replace(/(^|[^\[])\^/g,"$1"),n=n.replace(e,t),this},getRegex:function(){return new RegExp(n,e)}}}function l(e,t,n){if(e){try{var r=decodeURIComponent(c(n)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!g.test(n)&&(n=function(e,t){o[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?o[" "+e]=e+"/":o[" "+e]=y(e,"/",!0));return e=o[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}n._punctuation="!\"#$%&'()*+,\\-./:;<=>?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",k._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=d({},n),n.pedantic=d({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=d({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:i(n.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),n.gfm.url=i(n.gfm.url,"i").replace("email",n.gfm._extended_email).getRegex(),n.breaks=d({},n.gfm,{br:i(n.br).replace("{2,}","*").getRegex(),text:i(n.gfm.text).replace("{2,}","*").getRegex()}),h.rules=n,h.output=function(e,t,n){return new h(t,n).output(e)},h.prototype.output=function(e){for(var t,n,r,s,i,l,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=u(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,r=i[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],s=t[3]):s="":s=i[3]?i[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(i,{href:h.escapes(r),title:h.escapes(s)}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(u(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=u(this.mangle(i[1]))):n=u(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(u(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=u(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=u(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},h.escapes=function(e){return e?e.replace(h.rules._escapes,"$1"):e},h.prototype.outputLink=function(e,t){var n=t.href,r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},h.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},h.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s<r;s++)t=e.charCodeAt(s),.5<Math.random()&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'<pre><code class="'+this.options.langPrefix+u(r,!0)+'">'+(n?e:u(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:u(e,!0))+"</code></pre>"},r.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},r.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},r.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},r.prototype.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},r.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},r.prototype.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},r.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},r.prototype.strong=function(e){return"<strong>"+e+"</strong>"},r.prototype.em=function(e){return"<em>"+e+"</em>"},r.prototype.codespan=function(e){return"<code>"+e+"</code>"},r.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},r.prototype.del=function(e){return"<del>"+e+"</del>"},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<a href="'+u(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},p.parse=function(e,t){return new p(t).parse(e)},p.prototype.parse=function(e){this.inline=new h(e.links,this.options),this.inlineText=new h(e.links,d({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},p.prototype.next=function(){return this.token=this.tokens.pop()},p.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},p.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},p.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e<this.token.header.length;e++)n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(s+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});i+=this.renderer.tablerow(n)}return this.renderer.table(s,i);case"blockquote_start":for(i="";"blockquote_end"!==this.next().type;)i+=this.tok();return this.renderer.blockquote(i);case"list_start":i="";for(var l=this.token.ordered,o=this.token.start;"list_end"!==this.next().type;)i+=this.tok();return this.renderer.list(i,l,o);case"list_item_start":i="";var a=this.token.loose;for(this.token.task&&(i+=this.renderer.checkbox(this.token.checked));"list_item_end"!==this.next().type;)i+=a||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(i);case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText());default:var h='Token with "'+this.token.type+'" type was not found.';if(!this.options.silent)throw new Error(h);console.log(h)}},t.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},u.escapeTest=/[&<>"']/,u.escapeReplace=/[&<>"']/g,u.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},u.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,u.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(){}function d(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function x(e,t){var n=e.replace(/\|/g,function(e,t,n){for(var r=!1,s=t;0<=--s&&"\\"===n[s];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function y(e,t,n){if(0===e.length)return"";for(var r=0;r<e.length;){var s=e.charAt(e.length-r-1);if(s!==t||n){if(s===t||!n)break;r++}else r++}return e.substr(0,e.length-r)}function m(e,n,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(r||"function"==typeof n){r||(r=n,n=null);var s,i,l=(n=d({},m.defaults,n||{})).highlight,t=0;try{s=a.lex(e,n)}catch(e){return r(e)}i=s.length;var o=function(t){if(t)return n.highlight=l,r(t);var e;try{e=p.parse(s,n)}catch(e){t=e}return n.highlight=l,t?r(t):r(null,e)};if(!l||l.length<3)return o();if(delete n.highlight,!i)return o();for(;t<s.length;t++)!function(n){"code"!==n.type?--i||o():l(n.text,n.lang,function(e,t){return e?o(e):null==t||t===n.text?--i||o():(n.text=t,n.escaped=!0,void(--i||o()))})}(s[t])}else try{return n&&(n=d({},m.defaults,n)),p.parse(a.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||m.defaults).silent)return"<p>An error occurred:</p><pre>"+u(e.message+"",!0)+"</pre>";throw e}}f.exec=f,m.options=m.setOptions=function(e){return d(m.defaults,e),m},m.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},m.defaults=m.getDefaults(),m.Parser=p,m.parser=p.parse,m.Renderer=r,m.TextRenderer=s,m.Lexer=a,m.lexer=a.lex,m.InlineLexer=h,m.inlineLexer=h.output,m.Slugger=t,m.parse=m,"undefined"!=typeof module&&"object"==typeof exports?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):e.marked=m}(this||("undefined"!=typeof window?window:global));
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/**
|
2
|
+
* A plugin which enables rendering of math equations inside
|
3
|
+
* of reveal.js slides. Essentially a thin wrapper for MathJax.
|
4
|
+
*
|
5
|
+
* @author Hakim El Hattab
|
6
|
+
*/
|
7
|
+
var RevealMath = window.RevealMath || (function(){
|
8
|
+
|
9
|
+
var options = Reveal.getConfig().math || {};
|
10
|
+
var mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
11
|
+
var config = options.config || 'TeX-AMS_HTML-full';
|
12
|
+
var url = mathjax + '?config=' + config;
|
13
|
+
|
14
|
+
var defaultOptions = {
|
15
|
+
messageStyle: 'none',
|
16
|
+
tex2jax: {
|
17
|
+
inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ],
|
18
|
+
skipTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ]
|
19
|
+
},
|
20
|
+
skipStartupTypeset: true
|
21
|
+
};
|
22
|
+
|
23
|
+
function defaults( options, defaultOptions ) {
|
24
|
+
|
25
|
+
for ( var i in defaultOptions ) {
|
26
|
+
if ( !options.hasOwnProperty( i ) ) {
|
27
|
+
options[i] = defaultOptions[i];
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
function loadScript( url, callback ) {
|
34
|
+
|
35
|
+
var head = document.querySelector( 'head' );
|
36
|
+
var script = document.createElement( 'script' );
|
37
|
+
script.type = 'text/javascript';
|
38
|
+
script.src = url;
|
39
|
+
|
40
|
+
// Wrapper for callback to make sure it only fires once
|
41
|
+
var finish = function() {
|
42
|
+
if( typeof callback === 'function' ) {
|
43
|
+
callback.call();
|
44
|
+
callback = null;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
script.onload = finish;
|
49
|
+
|
50
|
+
// IE
|
51
|
+
script.onreadystatechange = function() {
|
52
|
+
if ( this.readyState === 'loaded' ) {
|
53
|
+
finish();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
// Normal browsers
|
58
|
+
head.appendChild( script );
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
return {
|
63
|
+
init: function() {
|
64
|
+
|
65
|
+
defaults( options, defaultOptions );
|
66
|
+
defaults( options.tex2jax, defaultOptions.tex2jax );
|
67
|
+
options.mathjax = options.config = null;
|
68
|
+
|
69
|
+
loadScript( url, function() {
|
70
|
+
|
71
|
+
MathJax.Hub.Config( options );
|
72
|
+
|
73
|
+
// Typeset followed by an immediate reveal.js layout since
|
74
|
+
// the typesetting process could affect slide height
|
75
|
+
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
|
76
|
+
MathJax.Hub.Queue( Reveal.layout );
|
77
|
+
|
78
|
+
// Reprocess equations in slides when they turn visible
|
79
|
+
Reveal.addEventListener( 'slidechanged', function( event ) {
|
80
|
+
|
81
|
+
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
|
82
|
+
|
83
|
+
} );
|
84
|
+
|
85
|
+
} );
|
86
|
+
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
})();
|
91
|
+
|
92
|
+
Reveal.registerPlugin( 'math', RevealMath );
|
@@ -0,0 +1,13 @@
|
|
1
|
+
(function() {
|
2
|
+
var multiplex = Reveal.getConfig().multiplex;
|
3
|
+
var socketId = multiplex.id;
|
4
|
+
var socket = io.connect(multiplex.url);
|
5
|
+
|
6
|
+
socket.on(multiplex.id, function(data) {
|
7
|
+
// ignore data from sockets that aren't ours
|
8
|
+
if (data.socketId !== socketId) { return; }
|
9
|
+
if( window.location.host === 'localhost:1947' ) return;
|
10
|
+
|
11
|
+
Reveal.setState(data.state);
|
12
|
+
});
|
13
|
+
}());
|
@@ -0,0 +1,64 @@
|
|
1
|
+
var http = require('http');
|
2
|
+
var express = require('express');
|
3
|
+
var fs = require('fs');
|
4
|
+
var io = require('socket.io');
|
5
|
+
var crypto = require('crypto');
|
6
|
+
|
7
|
+
var app = express();
|
8
|
+
var staticDir = express.static;
|
9
|
+
var server = http.createServer(app);
|
10
|
+
|
11
|
+
io = io(server);
|
12
|
+
|
13
|
+
var opts = {
|
14
|
+
port: process.env.PORT || 1948,
|
15
|
+
baseDir : __dirname + '/../../'
|
16
|
+
};
|
17
|
+
|
18
|
+
io.on( 'connection', function( socket ) {
|
19
|
+
socket.on('multiplex-statechanged', function(data) {
|
20
|
+
if (typeof data.secret == 'undefined' || data.secret == null || data.secret === '') return;
|
21
|
+
if (createHash(data.secret) === data.socketId) {
|
22
|
+
data.secret = null;
|
23
|
+
socket.broadcast.emit(data.socketId, data);
|
24
|
+
};
|
25
|
+
});
|
26
|
+
});
|
27
|
+
|
28
|
+
[ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) {
|
29
|
+
app.use('/' + dir, staticDir(opts.baseDir + dir));
|
30
|
+
});
|
31
|
+
|
32
|
+
app.get("/", function(req, res) {
|
33
|
+
res.writeHead(200, {'Content-Type': 'text/html'});
|
34
|
+
|
35
|
+
var stream = fs.createReadStream(opts.baseDir + '/index.html');
|
36
|
+
stream.on('error', function( error ) {
|
37
|
+
res.write('<style>body{font-family: sans-serif;}</style><h2>reveal.js multiplex server.</h2><a href="/token">Generate token</a>');
|
38
|
+
res.end();
|
39
|
+
});
|
40
|
+
stream.on('readable', function() {
|
41
|
+
stream.pipe(res);
|
42
|
+
});
|
43
|
+
});
|
44
|
+
|
45
|
+
app.get("/token", function(req,res) {
|
46
|
+
var ts = new Date().getTime();
|
47
|
+
var rand = Math.floor(Math.random()*9999999);
|
48
|
+
var secret = ts.toString() + rand.toString();
|
49
|
+
res.send({secret: secret, socketId: createHash(secret)});
|
50
|
+
});
|
51
|
+
|
52
|
+
var createHash = function(secret) {
|
53
|
+
var cipher = crypto.createCipher('blowfish', secret);
|
54
|
+
return(cipher.final('hex'));
|
55
|
+
};
|
56
|
+
|
57
|
+
// Actually listen
|
58
|
+
server.listen( opts.port || null );
|
59
|
+
|
60
|
+
var brown = '\033[33m',
|
61
|
+
green = '\033[32m',
|
62
|
+
reset = '\033[0m';
|
63
|
+
|
64
|
+
console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset );
|
@@ -0,0 +1,34 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
// Don't emit events from inside of notes windows
|
4
|
+
if ( window.location.search.match( /receiver/gi ) ) { return; }
|
5
|
+
|
6
|
+
var multiplex = Reveal.getConfig().multiplex;
|
7
|
+
|
8
|
+
var socket = io.connect( multiplex.url );
|
9
|
+
|
10
|
+
function post() {
|
11
|
+
|
12
|
+
var messageData = {
|
13
|
+
state: Reveal.getState(),
|
14
|
+
secret: multiplex.secret,
|
15
|
+
socketId: multiplex.id
|
16
|
+
};
|
17
|
+
|
18
|
+
socket.emit( 'multiplex-statechanged', messageData );
|
19
|
+
|
20
|
+
};
|
21
|
+
|
22
|
+
// post once the page is loaded, so the client follows also on "open URL".
|
23
|
+
window.addEventListener( 'load', post );
|
24
|
+
|
25
|
+
// Monitor events that trigger a change in state
|
26
|
+
Reveal.addEventListener( 'slidechanged', post );
|
27
|
+
Reveal.addEventListener( 'fragmentshown', post );
|
28
|
+
Reveal.addEventListener( 'fragmenthidden', post );
|
29
|
+
Reveal.addEventListener( 'overviewhidden', post );
|
30
|
+
Reveal.addEventListener( 'overviewshown', post );
|
31
|
+
Reveal.addEventListener( 'paused', post );
|
32
|
+
Reveal.addEventListener( 'resumed', post );
|
33
|
+
|
34
|
+
}());
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"name": "reveal-js-multiplex",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "reveal.js multiplex server",
|
5
|
+
"homepage": "http://revealjs.com",
|
6
|
+
"scripts": {
|
7
|
+
"start": "node index.js"
|
8
|
+
},
|
9
|
+
"engines": {
|
10
|
+
"node": "~4.1.1"
|
11
|
+
},
|
12
|
+
"dependencies": {
|
13
|
+
"express": "~4.13.3",
|
14
|
+
"grunt-cli": "~0.1.13",
|
15
|
+
"mustache": "~2.2.1",
|
16
|
+
"socket.io": "~1.3.7"
|
17
|
+
},
|
18
|
+
"license": "MIT"
|
19
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
// don't emit events from inside the previews themselves
|
4
|
+
if( window.location.search.match( /receiver/gi ) ) { return; }
|
5
|
+
|
6
|
+
var socket = io.connect( window.location.origin ),
|
7
|
+
socketId = Math.random().toString().slice( 2 );
|
8
|
+
|
9
|
+
console.log( 'View slide notes at ' + window.location.origin + '/notes/' + socketId );
|
10
|
+
|
11
|
+
window.open( window.location.origin + '/notes/' + socketId, 'notes-' + socketId );
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Posts the current slide data to the notes window
|
15
|
+
*/
|
16
|
+
function post() {
|
17
|
+
|
18
|
+
var slideElement = Reveal.getCurrentSlide(),
|
19
|
+
notesElement = slideElement.querySelector( 'aside.notes' );
|
20
|
+
|
21
|
+
var messageData = {
|
22
|
+
notes: '',
|
23
|
+
markdown: false,
|
24
|
+
socketId: socketId,
|
25
|
+
state: Reveal.getState()
|
26
|
+
};
|
27
|
+
|
28
|
+
// Look for notes defined in a slide attribute
|
29
|
+
if( slideElement.hasAttribute( 'data-notes' ) ) {
|
30
|
+
messageData.notes = slideElement.getAttribute( 'data-notes' );
|
31
|
+
}
|
32
|
+
|
33
|
+
// Look for notes defined in an aside element
|
34
|
+
if( notesElement ) {
|
35
|
+
messageData.notes = notesElement.innerHTML;
|
36
|
+
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
|
37
|
+
}
|
38
|
+
|
39
|
+
socket.emit( 'statechanged', messageData );
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
// When a new notes window connects, post our current state
|
44
|
+
socket.on( 'new-subscriber', function( data ) {
|
45
|
+
post();
|
46
|
+
} );
|
47
|
+
|
48
|
+
// When the state changes from inside of the speaker view
|
49
|
+
socket.on( 'statechanged-speaker', function( data ) {
|
50
|
+
Reveal.setState( data.state );
|
51
|
+
} );
|
52
|
+
|
53
|
+
// Monitor events that trigger a change in state
|
54
|
+
Reveal.addEventListener( 'slidechanged', post );
|
55
|
+
Reveal.addEventListener( 'fragmentshown', post );
|
56
|
+
Reveal.addEventListener( 'fragmenthidden', post );
|
57
|
+
Reveal.addEventListener( 'overviewhidden', post );
|
58
|
+
Reveal.addEventListener( 'overviewshown', post );
|
59
|
+
Reveal.addEventListener( 'paused', post );
|
60
|
+
Reveal.addEventListener( 'resumed', post );
|
61
|
+
|
62
|
+
// Post the initial state
|
63
|
+
post();
|
64
|
+
|
65
|
+
}());
|
@@ -0,0 +1,69 @@
|
|
1
|
+
var http = require('http');
|
2
|
+
var express = require('express');
|
3
|
+
var fs = require('fs');
|
4
|
+
var io = require('socket.io');
|
5
|
+
var Mustache = require('mustache');
|
6
|
+
|
7
|
+
var app = express();
|
8
|
+
var staticDir = express.static;
|
9
|
+
var server = http.createServer(app);
|
10
|
+
|
11
|
+
io = io(server);
|
12
|
+
|
13
|
+
var opts = {
|
14
|
+
port : 1947,
|
15
|
+
baseDir : __dirname + '/../../'
|
16
|
+
};
|
17
|
+
|
18
|
+
io.on( 'connection', function( socket ) {
|
19
|
+
|
20
|
+
socket.on( 'new-subscriber', function( data ) {
|
21
|
+
socket.broadcast.emit( 'new-subscriber', data );
|
22
|
+
});
|
23
|
+
|
24
|
+
socket.on( 'statechanged', function( data ) {
|
25
|
+
delete data.state.overview;
|
26
|
+
socket.broadcast.emit( 'statechanged', data );
|
27
|
+
});
|
28
|
+
|
29
|
+
socket.on( 'statechanged-speaker', function( data ) {
|
30
|
+
delete data.state.overview;
|
31
|
+
socket.broadcast.emit( 'statechanged-speaker', data );
|
32
|
+
});
|
33
|
+
|
34
|
+
});
|
35
|
+
|
36
|
+
[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
|
37
|
+
app.use( '/' + dir, staticDir( opts.baseDir + dir ) );
|
38
|
+
});
|
39
|
+
|
40
|
+
app.get('/', function( req, res ) {
|
41
|
+
|
42
|
+
res.writeHead( 200, { 'Content-Type': 'text/html' } );
|
43
|
+
fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res );
|
44
|
+
|
45
|
+
});
|
46
|
+
|
47
|
+
app.get( '/notes/:socketId', function( req, res ) {
|
48
|
+
|
49
|
+
fs.readFile( opts.baseDir + 'plugin/notes-server/notes.html', function( err, data ) {
|
50
|
+
res.send( Mustache.to_html( data.toString(), {
|
51
|
+
socketId : req.params.socketId
|
52
|
+
}));
|
53
|
+
});
|
54
|
+
|
55
|
+
});
|
56
|
+
|
57
|
+
// Actually listen
|
58
|
+
server.listen( opts.port || null );
|
59
|
+
|
60
|
+
var brown = '\033[33m',
|
61
|
+
green = '\033[32m',
|
62
|
+
reset = '\033[0m';
|
63
|
+
|
64
|
+
var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : '' );
|
65
|
+
|
66
|
+
console.log( brown + 'reveal.js - Speaker Notes' + reset );
|
67
|
+
console.log( '1. Open the slides at ' + green + slidesLocation + reset );
|
68
|
+
console.log( '2. Click on the link in your JS console to go to the notes page' );
|
69
|
+
console.log( '3. Advance through your slides and your notes will advance automatically' );
|
@@ -0,0 +1,585 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
|
6
|
+
<title>reveal.js - Slide Notes</title>
|
7
|
+
|
8
|
+
<style>
|
9
|
+
body {
|
10
|
+
font-family: Helvetica;
|
11
|
+
font-size: 18px;
|
12
|
+
}
|
13
|
+
|
14
|
+
#current-slide,
|
15
|
+
#upcoming-slide,
|
16
|
+
#speaker-controls {
|
17
|
+
padding: 6px;
|
18
|
+
box-sizing: border-box;
|
19
|
+
-moz-box-sizing: border-box;
|
20
|
+
}
|
21
|
+
|
22
|
+
#current-slide iframe,
|
23
|
+
#upcoming-slide iframe {
|
24
|
+
width: 100%;
|
25
|
+
height: 100%;
|
26
|
+
border: 1px solid #ddd;
|
27
|
+
}
|
28
|
+
|
29
|
+
#current-slide .label,
|
30
|
+
#upcoming-slide .label {
|
31
|
+
position: absolute;
|
32
|
+
top: 10px;
|
33
|
+
left: 10px;
|
34
|
+
z-index: 2;
|
35
|
+
}
|
36
|
+
|
37
|
+
.overlay-element {
|
38
|
+
height: 34px;
|
39
|
+
line-height: 34px;
|
40
|
+
padding: 0 10px;
|
41
|
+
text-shadow: none;
|
42
|
+
background: rgba( 220, 220, 220, 0.8 );
|
43
|
+
color: #222;
|
44
|
+
font-size: 14px;
|
45
|
+
}
|
46
|
+
|
47
|
+
.overlay-element.interactive:hover {
|
48
|
+
background: rgba( 220, 220, 220, 1 );
|
49
|
+
}
|
50
|
+
|
51
|
+
#current-slide {
|
52
|
+
position: absolute;
|
53
|
+
width: 60%;
|
54
|
+
height: 100%;
|
55
|
+
top: 0;
|
56
|
+
left: 0;
|
57
|
+
padding-right: 0;
|
58
|
+
}
|
59
|
+
|
60
|
+
#upcoming-slide {
|
61
|
+
position: absolute;
|
62
|
+
width: 40%;
|
63
|
+
height: 40%;
|
64
|
+
right: 0;
|
65
|
+
top: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
/* Speaker controls */
|
69
|
+
#speaker-controls {
|
70
|
+
position: absolute;
|
71
|
+
top: 40%;
|
72
|
+
right: 0;
|
73
|
+
width: 40%;
|
74
|
+
height: 60%;
|
75
|
+
overflow: auto;
|
76
|
+
font-size: 18px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.speaker-controls-time.hidden,
|
80
|
+
.speaker-controls-notes.hidden {
|
81
|
+
display: none;
|
82
|
+
}
|
83
|
+
|
84
|
+
.speaker-controls-time .label,
|
85
|
+
.speaker-controls-notes .label {
|
86
|
+
text-transform: uppercase;
|
87
|
+
font-weight: normal;
|
88
|
+
font-size: 0.66em;
|
89
|
+
color: #666;
|
90
|
+
margin: 0;
|
91
|
+
}
|
92
|
+
|
93
|
+
.speaker-controls-time {
|
94
|
+
border-bottom: 1px solid rgba( 200, 200, 200, 0.5 );
|
95
|
+
margin-bottom: 10px;
|
96
|
+
padding: 10px 16px;
|
97
|
+
padding-bottom: 20px;
|
98
|
+
cursor: pointer;
|
99
|
+
}
|
100
|
+
|
101
|
+
.speaker-controls-time .reset-button {
|
102
|
+
opacity: 0;
|
103
|
+
float: right;
|
104
|
+
color: #666;
|
105
|
+
text-decoration: none;
|
106
|
+
}
|
107
|
+
.speaker-controls-time:hover .reset-button {
|
108
|
+
opacity: 1;
|
109
|
+
}
|
110
|
+
|
111
|
+
.speaker-controls-time .timer,
|
112
|
+
.speaker-controls-time .clock {
|
113
|
+
width: 50%;
|
114
|
+
font-size: 1.9em;
|
115
|
+
}
|
116
|
+
|
117
|
+
.speaker-controls-time .timer {
|
118
|
+
float: left;
|
119
|
+
}
|
120
|
+
|
121
|
+
.speaker-controls-time .clock {
|
122
|
+
float: right;
|
123
|
+
text-align: right;
|
124
|
+
}
|
125
|
+
|
126
|
+
.speaker-controls-time span.mute {
|
127
|
+
color: #bbb;
|
128
|
+
}
|
129
|
+
|
130
|
+
.speaker-controls-notes {
|
131
|
+
padding: 10px 16px;
|
132
|
+
}
|
133
|
+
|
134
|
+
.speaker-controls-notes .value {
|
135
|
+
margin-top: 5px;
|
136
|
+
line-height: 1.4;
|
137
|
+
font-size: 1.2em;
|
138
|
+
}
|
139
|
+
|
140
|
+
/* Layout selector */
|
141
|
+
#speaker-layout {
|
142
|
+
position: absolute;
|
143
|
+
top: 10px;
|
144
|
+
right: 10px;
|
145
|
+
color: #222;
|
146
|
+
z-index: 10;
|
147
|
+
}
|
148
|
+
#speaker-layout select {
|
149
|
+
position: absolute;
|
150
|
+
width: 100%;
|
151
|
+
height: 100%;
|
152
|
+
top: 0;
|
153
|
+
left: 0;
|
154
|
+
border: 0;
|
155
|
+
box-shadow: 0;
|
156
|
+
cursor: pointer;
|
157
|
+
opacity: 0;
|
158
|
+
|
159
|
+
font-size: 1em;
|
160
|
+
background-color: transparent;
|
161
|
+
|
162
|
+
-moz-appearance: none;
|
163
|
+
-webkit-appearance: none;
|
164
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
165
|
+
}
|
166
|
+
|
167
|
+
#speaker-layout select:focus {
|
168
|
+
outline: none;
|
169
|
+
box-shadow: none;
|
170
|
+
}
|
171
|
+
|
172
|
+
.clear {
|
173
|
+
clear: both;
|
174
|
+
}
|
175
|
+
|
176
|
+
/* Speaker layout: Wide */
|
177
|
+
body[data-speaker-layout="wide"] #current-slide,
|
178
|
+
body[data-speaker-layout="wide"] #upcoming-slide {
|
179
|
+
width: 50%;
|
180
|
+
height: 45%;
|
181
|
+
padding: 6px;
|
182
|
+
}
|
183
|
+
|
184
|
+
body[data-speaker-layout="wide"] #current-slide {
|
185
|
+
top: 0;
|
186
|
+
left: 0;
|
187
|
+
}
|
188
|
+
|
189
|
+
body[data-speaker-layout="wide"] #upcoming-slide {
|
190
|
+
top: 0;
|
191
|
+
left: 50%;
|
192
|
+
}
|
193
|
+
|
194
|
+
body[data-speaker-layout="wide"] #speaker-controls {
|
195
|
+
top: 45%;
|
196
|
+
left: 0;
|
197
|
+
width: 100%;
|
198
|
+
height: 50%;
|
199
|
+
font-size: 1.25em;
|
200
|
+
}
|
201
|
+
|
202
|
+
/* Speaker layout: Tall */
|
203
|
+
body[data-speaker-layout="tall"] #current-slide,
|
204
|
+
body[data-speaker-layout="tall"] #upcoming-slide {
|
205
|
+
width: 45%;
|
206
|
+
height: 50%;
|
207
|
+
padding: 6px;
|
208
|
+
}
|
209
|
+
|
210
|
+
body[data-speaker-layout="tall"] #current-slide {
|
211
|
+
top: 0;
|
212
|
+
left: 0;
|
213
|
+
}
|
214
|
+
|
215
|
+
body[data-speaker-layout="tall"] #upcoming-slide {
|
216
|
+
top: 50%;
|
217
|
+
left: 0;
|
218
|
+
}
|
219
|
+
|
220
|
+
body[data-speaker-layout="tall"] #speaker-controls {
|
221
|
+
padding-top: 40px;
|
222
|
+
top: 0;
|
223
|
+
left: 45%;
|
224
|
+
width: 55%;
|
225
|
+
height: 100%;
|
226
|
+
font-size: 1.25em;
|
227
|
+
}
|
228
|
+
|
229
|
+
/* Speaker layout: Notes only */
|
230
|
+
body[data-speaker-layout="notes-only"] #current-slide,
|
231
|
+
body[data-speaker-layout="notes-only"] #upcoming-slide {
|
232
|
+
display: none;
|
233
|
+
}
|
234
|
+
|
235
|
+
body[data-speaker-layout="notes-only"] #speaker-controls {
|
236
|
+
padding-top: 40px;
|
237
|
+
top: 0;
|
238
|
+
left: 0;
|
239
|
+
width: 100%;
|
240
|
+
height: 100%;
|
241
|
+
font-size: 1.25em;
|
242
|
+
}
|
243
|
+
|
244
|
+
</style>
|
245
|
+
</head>
|
246
|
+
|
247
|
+
<body>
|
248
|
+
|
249
|
+
<div id="current-slide"></div>
|
250
|
+
<div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
|
251
|
+
<div id="speaker-controls">
|
252
|
+
<div class="speaker-controls-time">
|
253
|
+
<h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
|
254
|
+
<div class="clock">
|
255
|
+
<span class="clock-value">0:00 AM</span>
|
256
|
+
</div>
|
257
|
+
<div class="timer">
|
258
|
+
<span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
|
259
|
+
</div>
|
260
|
+
<div class="clear"></div>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div class="speaker-controls-notes hidden">
|
264
|
+
<h4 class="label">Notes</h4>
|
265
|
+
<div class="value"></div>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
<div id="speaker-layout" class="overlay-element interactive">
|
269
|
+
<span class="speaker-layout-label"></span>
|
270
|
+
<select class="speaker-layout-dropdown"></select>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<script src="/socket.io/socket.io.js"></script>
|
274
|
+
<script src="/plugin/markdown/marked.js"></script>
|
275
|
+
|
276
|
+
<script>
|
277
|
+
(function() {
|
278
|
+
|
279
|
+
var notes,
|
280
|
+
notesValue,
|
281
|
+
currentState,
|
282
|
+
currentSlide,
|
283
|
+
upcomingSlide,
|
284
|
+
layoutLabel,
|
285
|
+
layoutDropdown,
|
286
|
+
connected = false;
|
287
|
+
|
288
|
+
var socket = io.connect( window.location.origin ),
|
289
|
+
socketId = '{{socketId}}';
|
290
|
+
|
291
|
+
var SPEAKER_LAYOUTS = {
|
292
|
+
'default': 'Default',
|
293
|
+
'wide': 'Wide',
|
294
|
+
'tall': 'Tall',
|
295
|
+
'notes-only': 'Notes only'
|
296
|
+
};
|
297
|
+
|
298
|
+
socket.on( 'statechanged', function( data ) {
|
299
|
+
|
300
|
+
// ignore data from sockets that aren't ours
|
301
|
+
if( data.socketId !== socketId ) { return; }
|
302
|
+
|
303
|
+
if( connected === false ) {
|
304
|
+
connected = true;
|
305
|
+
|
306
|
+
setupKeyboard();
|
307
|
+
setupNotes();
|
308
|
+
setupTimer();
|
309
|
+
|
310
|
+
}
|
311
|
+
|
312
|
+
handleStateMessage( data );
|
313
|
+
|
314
|
+
} );
|
315
|
+
|
316
|
+
setupLayout();
|
317
|
+
|
318
|
+
// Load our presentation iframes
|
319
|
+
setupIframes();
|
320
|
+
|
321
|
+
// Once the iframes have loaded, emit a signal saying there's
|
322
|
+
// a new subscriber which will trigger a 'statechanged'
|
323
|
+
// message to be sent back
|
324
|
+
window.addEventListener( 'message', function( event ) {
|
325
|
+
|
326
|
+
var data = JSON.parse( event.data );
|
327
|
+
|
328
|
+
if( data && data.namespace === 'reveal' ) {
|
329
|
+
if( /ready/.test( data.eventName ) ) {
|
330
|
+
socket.emit( 'new-subscriber', { socketId: socketId } );
|
331
|
+
}
|
332
|
+
}
|
333
|
+
|
334
|
+
// Messages sent by reveal.js inside of the current slide preview
|
335
|
+
if( data && data.namespace === 'reveal' ) {
|
336
|
+
if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
|
337
|
+
socket.emit( 'statechanged-speaker', { state: data.state } );
|
338
|
+
}
|
339
|
+
}
|
340
|
+
|
341
|
+
} );
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Called when the main window sends an updated state.
|
345
|
+
*/
|
346
|
+
function handleStateMessage( data ) {
|
347
|
+
|
348
|
+
// Store the most recently set state to avoid circular loops
|
349
|
+
// applying the same state
|
350
|
+
currentState = JSON.stringify( data.state );
|
351
|
+
|
352
|
+
// No need for updating the notes in case of fragment changes
|
353
|
+
if ( data.notes ) {
|
354
|
+
notes.classList.remove( 'hidden' );
|
355
|
+
if( data.markdown ) {
|
356
|
+
notesValue.innerHTML = marked( data.notes );
|
357
|
+
}
|
358
|
+
else {
|
359
|
+
notesValue.innerHTML = data.notes;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
else {
|
363
|
+
notes.classList.add( 'hidden' );
|
364
|
+
}
|
365
|
+
|
366
|
+
// Update the note slides
|
367
|
+
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
368
|
+
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
369
|
+
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
|
370
|
+
|
371
|
+
}
|
372
|
+
|
373
|
+
// Limit to max one state update per X ms
|
374
|
+
handleStateMessage = debounce( handleStateMessage, 200 );
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Forward keyboard events to the current slide window.
|
378
|
+
* This enables keyboard events to work even if focus
|
379
|
+
* isn't set on the current slide iframe.
|
380
|
+
*/
|
381
|
+
function setupKeyboard() {
|
382
|
+
|
383
|
+
document.addEventListener( 'keydown', function( event ) {
|
384
|
+
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
|
385
|
+
} );
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
/**
|
390
|
+
* Creates the preview iframes.
|
391
|
+
*/
|
392
|
+
function setupIframes() {
|
393
|
+
|
394
|
+
var params = [
|
395
|
+
'receiver',
|
396
|
+
'progress=false',
|
397
|
+
'history=false',
|
398
|
+
'transition=none',
|
399
|
+
'backgroundTransition=none'
|
400
|
+
].join( '&' );
|
401
|
+
|
402
|
+
var currentURL = '/?' + params + '&postMessageEvents=true';
|
403
|
+
var upcomingURL = '/?' + params + '&controls=false';
|
404
|
+
|
405
|
+
currentSlide = document.createElement( 'iframe' );
|
406
|
+
currentSlide.setAttribute( 'width', 1280 );
|
407
|
+
currentSlide.setAttribute( 'height', 1024 );
|
408
|
+
currentSlide.setAttribute( 'src', currentURL );
|
409
|
+
document.querySelector( '#current-slide' ).appendChild( currentSlide );
|
410
|
+
|
411
|
+
upcomingSlide = document.createElement( 'iframe' );
|
412
|
+
upcomingSlide.setAttribute( 'width', 640 );
|
413
|
+
upcomingSlide.setAttribute( 'height', 512 );
|
414
|
+
upcomingSlide.setAttribute( 'src', upcomingURL );
|
415
|
+
document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
|
416
|
+
|
417
|
+
}
|
418
|
+
|
419
|
+
/**
|
420
|
+
* Setup the notes UI.
|
421
|
+
*/
|
422
|
+
function setupNotes() {
|
423
|
+
|
424
|
+
notes = document.querySelector( '.speaker-controls-notes' );
|
425
|
+
notesValue = document.querySelector( '.speaker-controls-notes .value' );
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Create the timer and clock and start updating them
|
431
|
+
* at an interval.
|
432
|
+
*/
|
433
|
+
function setupTimer() {
|
434
|
+
|
435
|
+
var start = new Date(),
|
436
|
+
timeEl = document.querySelector( '.speaker-controls-time' ),
|
437
|
+
clockEl = timeEl.querySelector( '.clock-value' ),
|
438
|
+
hoursEl = timeEl.querySelector( '.hours-value' ),
|
439
|
+
minutesEl = timeEl.querySelector( '.minutes-value' ),
|
440
|
+
secondsEl = timeEl.querySelector( '.seconds-value' );
|
441
|
+
|
442
|
+
function _updateTimer() {
|
443
|
+
|
444
|
+
var diff, hours, minutes, seconds,
|
445
|
+
now = new Date();
|
446
|
+
|
447
|
+
diff = now.getTime() - start.getTime();
|
448
|
+
hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
|
449
|
+
minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
|
450
|
+
seconds = Math.floor( ( diff / 1000 ) % 60 );
|
451
|
+
|
452
|
+
clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
|
453
|
+
hoursEl.innerHTML = zeroPadInteger( hours );
|
454
|
+
hoursEl.className = hours > 0 ? '' : 'mute';
|
455
|
+
minutesEl.innerHTML = ':' + zeroPadInteger( minutes );
|
456
|
+
minutesEl.className = minutes > 0 ? '' : 'mute';
|
457
|
+
secondsEl.innerHTML = ':' + zeroPadInteger( seconds );
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
// Update once directly
|
462
|
+
_updateTimer();
|
463
|
+
|
464
|
+
// Then update every second
|
465
|
+
setInterval( _updateTimer, 1000 );
|
466
|
+
|
467
|
+
timeEl.addEventListener( 'click', function() {
|
468
|
+
start = new Date();
|
469
|
+
_updateTimer();
|
470
|
+
return false;
|
471
|
+
} );
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
/**
|
476
|
+
* Sets up the speaker view layout and layout selector.
|
477
|
+
*/
|
478
|
+
function setupLayout() {
|
479
|
+
|
480
|
+
layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
|
481
|
+
layoutLabel = document.querySelector( '.speaker-layout-label' );
|
482
|
+
|
483
|
+
// Render the list of available layouts
|
484
|
+
for( var id in SPEAKER_LAYOUTS ) {
|
485
|
+
var option = document.createElement( 'option' );
|
486
|
+
option.setAttribute( 'value', id );
|
487
|
+
option.textContent = SPEAKER_LAYOUTS[ id ];
|
488
|
+
layoutDropdown.appendChild( option );
|
489
|
+
}
|
490
|
+
|
491
|
+
// Monitor the dropdown for changes
|
492
|
+
layoutDropdown.addEventListener( 'change', function( event ) {
|
493
|
+
|
494
|
+
setLayout( layoutDropdown.value );
|
495
|
+
|
496
|
+
}, false );
|
497
|
+
|
498
|
+
// Restore any currently persisted layout
|
499
|
+
setLayout( getLayout() );
|
500
|
+
|
501
|
+
}
|
502
|
+
|
503
|
+
/**
|
504
|
+
* Sets a new speaker view layout. The layout is persisted
|
505
|
+
* in local storage.
|
506
|
+
*/
|
507
|
+
function setLayout( value ) {
|
508
|
+
|
509
|
+
var title = SPEAKER_LAYOUTS[ value ];
|
510
|
+
|
511
|
+
layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
|
512
|
+
layoutDropdown.value = value;
|
513
|
+
|
514
|
+
document.body.setAttribute( 'data-speaker-layout', value );
|
515
|
+
|
516
|
+
// Persist locally
|
517
|
+
if( window.localStorage ) {
|
518
|
+
window.localStorage.setItem( 'reveal-speaker-layout', value );
|
519
|
+
}
|
520
|
+
|
521
|
+
}
|
522
|
+
|
523
|
+
/**
|
524
|
+
* Returns the ID of the most recently set speaker layout
|
525
|
+
* or our default layout if none has been set.
|
526
|
+
*/
|
527
|
+
function getLayout() {
|
528
|
+
|
529
|
+
if( window.localStorage ) {
|
530
|
+
var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
|
531
|
+
if( layout ) {
|
532
|
+
return layout;
|
533
|
+
}
|
534
|
+
}
|
535
|
+
|
536
|
+
// Default to the first record in the layouts hash
|
537
|
+
for( var id in SPEAKER_LAYOUTS ) {
|
538
|
+
return id;
|
539
|
+
}
|
540
|
+
|
541
|
+
}
|
542
|
+
|
543
|
+
function zeroPadInteger( num ) {
|
544
|
+
|
545
|
+
var str = '00' + parseInt( num );
|
546
|
+
return str.substring( str.length - 2 );
|
547
|
+
|
548
|
+
}
|
549
|
+
|
550
|
+
/**
|
551
|
+
* Limits the frequency at which a function can be called.
|
552
|
+
*/
|
553
|
+
function debounce( fn, ms ) {
|
554
|
+
|
555
|
+
var lastTime = 0,
|
556
|
+
timeout;
|
557
|
+
|
558
|
+
return function() {
|
559
|
+
|
560
|
+
var args = arguments;
|
561
|
+
var context = this;
|
562
|
+
|
563
|
+
clearTimeout( timeout );
|
564
|
+
|
565
|
+
var timeSinceLastCall = Date.now() - lastTime;
|
566
|
+
if( timeSinceLastCall > ms ) {
|
567
|
+
fn.apply( context, args );
|
568
|
+
lastTime = Date.now();
|
569
|
+
}
|
570
|
+
else {
|
571
|
+
timeout = setTimeout( function() {
|
572
|
+
fn.apply( context, args );
|
573
|
+
lastTime = Date.now();
|
574
|
+
}, ms - timeSinceLastCall );
|
575
|
+
}
|
576
|
+
|
577
|
+
}
|
578
|
+
|
579
|
+
}
|
580
|
+
|
581
|
+
})();
|
582
|
+
</script>
|
583
|
+
|
584
|
+
</body>
|
585
|
+
</html>
|