forked from niceaji/javascript-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
81 lines (62 loc) · 2.85 KB
/
Copy pathapp.js
File metadata and controls
81 lines (62 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function initReveal(){
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
}
$(document).ready(function(){
var query = function(s){
var str=location.search.substr(1);
var r={},t=[];
var a=str.split('&');
for(var i=0;i<a.length;i++){t=a[i].split("=");r[t[0]] = t[1];}
return r;
}();
if(!query.doc){
query.doc = 'basic';
}
$.ajax("doc/"+ query.doc +".md").done(function(md){
//md parse
var mds = md.split("***")
, tmp = []
, slides = []
, html = ''
$(mds).each(function(index, item){
// console.log(slides.replace(/(##[^(\n)]+)/g,"--"))
// console.log( slides.split(/(##[^(\n)]+)/) )
tmp = item.split(/(##[^(\n)]+)/);
slides[index] = [];
for(var i=1; i<tmp.length; i+=2){
slides[index].push( tmp[i] + tmp[i+1] );
}
});
// dom
$(slides).each(function(index, section){
section=_.map(section,function(value){
return '<section data-markdown><script type="text/template">'+value+'</script></section>';
});
html += '<section>'+section.join('')+'</section>';
});
$(".slides").append(html);
initReveal();
}).error(function(){
alert("없어요^^");
});
});