forked from aiyanbo/md-ppt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile.html
118 lines (109 loc) · 3.6 KB
/
mobile.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Markdown PPT Mobile Player</title>
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="css/player.mobile.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="js/jquery.mobile.custom.min.js"></script>
<script src="http://spec.commonmark.org/js/commonmark.js"></script>
<script src="js/player.js"></script>
<script src="js/air.play.js"></script>
<script src="js/settings.js"></script>
</head>
<body>
<div id="header">
<div id="refresh">
<span class="btn" onclick="refresh()">
<span class="glyphicon glyphicon-refresh"></span>
</span>
</div>
<div id="status" class="btn-group">
<button class="btn btn-info" id="air_code">
<strong>^-^</strong>
</button>
<button class="btn btn-danger" id="air_status">Offline</button>
</div>
<div style="clear: both"></div>
</div>
<div id="player">
<div id="drop_zone" class="text-center">
<div id="drop_zone_header"></div>
<div id="drop_zone_content"></div>
</div>
<div id="play_zone"></div>
</div>
<!--<div class="footer">-->
<!--<div class="container">-->
<!--<span>Copyright: <a href="http://weibo.com/aiyboo">NinetyH</a> © 2014.</span>-->
<!--<span>Source: <a href="https://github.com/aiyanbo/md-ppt">https://github.com/aiyanbo/md-ppt</a></span>-->
<!--</div>-->
<!--</div>-->
</body>
<script>
var refresh = function () {
if (window.airPlay.isOnline()) {
return;
}
window.settings.set();
};
window.player = new Player({
onplay: function (event) {
window.airPlay.send({"type": "play", "data": event.data});
},
onreadend: function (event) {
var message = {};
message.type = "pull";
message.data = {
"type": "markdown",
"data": window.player.getMarkdown(),
"index": window.player.getIndex()
};
window.airPlay.send(message);
}
});
window.player.setSwipeEvent(window);
window.airPlay = new AirPlay({
onopen: function (event) {
console.log(event);
},
onpush: function (event) {
console.log("Mobile is ignore the push event.");
},
onpull: function (event) {
window.player.sync(event.data);
},
onplay: function (event) {
window.player.play(event.data);
},
onstatus: function (event) {
var message = event.data;
console.log(message);
if ("conn" === message.action) {
if (200 == message.code) {
window.player.display({title: "Waiting for sync.", content: ""});
} else if (404 == message.code) {
window.player.display({
title: "Connect failure!",
content: "Can't connect to " + window.settings.code() + ", it's maybe closed."
});
}
}
}
});
window.settings = new Settings({
onreadonly: function () {
window.player.readOnly();
},
onok: function (ws, code) {
window.airPlay.connect(ws, code);
},
onws: function (ws) {
console.log("Mobile is ignore onws event.");
}
});
window.settings.set();
</script>
</html>