-
Notifications
You must be signed in to change notification settings - Fork 18
/
print.html
146 lines (139 loc) · 4.17 KB
/
print.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>分享</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="http://libs.useso.com/js/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="plugin/prism/prism.css">
<style>
html {
color: #000;
font-family: Helvetica, "Microsoft Yahei", sans-serif;
font-size: 32px;
}
#slides>section:first-child {
text-align: center;
}
#slides>section {
box-sizing: border-box;
padding: 0.5em 1em;
max-width: 800px;
margin: 3mm;
width: 180mm;
height: 125mm;
//float: left;
//border: 2px solid #555;
//border: 0.5px solid #666;
page-break-inside: avoid;
overflow: hidden;
}
#slides>section:nth-child(odd) {
//margin-left: 0;
clear: left;
}
#slides>section:nth-child(even) {
//margin-right: 0
}
#slides>section.active {
display: block
}
h1, h2, h3 {
font-family: "Microsoft JHenghei", sans-serif;
text-align: center;
}
section>h1 {
margin-top: 3em;
}
section>h2 {
margin-top: 30%;
}
ul {
padding-left: 1.5em;
}
li {
margin: 0.8em 0;
}
h3+p {
text-align: center;
}
h3:only-child {
margin-top: 30%;
text-align: center;
}
p:only-child {
text-align: center;
}
li li {
font-size: 80%;
}
img {
max-width: 100%;
max-height: 68mm;
}
img.dark {
-webkit-filter: invert(1) contrast(1.5);
-moz-filter: invert(1) contrast(1.5);
filter: invert(1) contrast(1.5);
}
a {
color: #000;
}
a:after {
content: " (" attr(href) ")";
word-wrap: break-word;
word-break: break-all;
}
table {
width: 100%!important;
font-size: 80%;
}
pre code {
white-space: wrap;
word-wrap: break-word;
font-size: 80%;
}
</style>
</head>
<body>
<div id="slides"></div>
<script src="http://libs.useso.com/js/jquery/2.1.1/jquery.min.js"></script>
<script src="plugin/markdown/marked.js"></script>
<script>
var slides = [];
var index = 0;
/**
* translate markdown
*/
function compileMarkdown(md) {
return marked(md, {gfm:true});
};
/**
* download slides
*/
function getSlides(index) {
var file = slides[index];
var url = file.indexOf('/') > -1 ? file : ('content/' + file + '.md');
$.get(url, function (md) {
var mds = md.split(/-{3,10}/g);
var html = '';
mds.forEach(function(md){
html += '<section>' + compileMarkdown(md) + '</section>';
});
$('#slides').append(html);
if (++index < slides.length) {
getSlides(index);
}
});
}
var match = /[?&]file=([\w\d-_\/~\.,]+)/.exec(location.search);
if (!match) {
alert('没有指定要演示的文档!');
} else {
var files = match[1];
slides = files.split(',');
getSlides(0);
}
</script>
</body>
</html>