Skip to content

Commit

Permalink
添加按钮,
Browse files Browse the repository at this point in the history
添加画板同步功能
  • Loading branch information
ksky521 committed Oct 26, 2014
1 parent e111d26 commit ff2c6bf
Show file tree
Hide file tree
Showing 16 changed files with 775 additions and 31 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ nodePPT - 让你爱上做分享!
* 支持[18种转场动画](#transition),可以设置单页动画
* 支持单页背景图片
* 多种模式:overview模式,[双屏模式](#postmessage)[socket远程控制](#socket),摇一摇换页,使用ipad控制做分享更酷哦~
* 可以使用画板,可以使用note做备注
* 可以使用画板,双屏同步画板内容!可以使用note做备注
* 支持语法高亮,自由选择[highlight样式](https://highlightjs.org/)
* 可以单页ppt内部动画,单步动画
* [支持进入/退出回调](#callback),做在线demo很方便

## 0.9.0新功能
* 添加画板多端同步
* 添加按钮控制进度
* 修复一些bug

## demo
* http://qdemo.sinaapp.com/
* 双屏控制:http://qdemo.sinaapp.com/?_multiscreen=1 记得允许弹窗哦~
Expand Down
5 changes: 5 additions & 0 deletions assets/css/font-awesome.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/nodeppt2.0.css

Large diffs are not rendered by default.

Binary file added assets/fonts/FontAwesome.otf
Binary file not shown.
Binary file added assets/fonts/fontawesome-webfont.eot
Binary file not shown.
520 changes: 520 additions & 0 deletions assets/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added assets/fonts/fontawesome-webfont.woff
Binary file not shown.
17 changes: 16 additions & 1 deletion assets/js/nodeppt.control.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
t.sendUpdateItem(slideID, buildItem);
}).on('slide event keyup', function(e) {
t.sendKeyEvent(e.keyCode);
}).on('overview', function(e) {
t.sendKeyEvent(79);
}).on('show paint', function(e){
t.sendKeyEvent(80);
}).on('remove paint', function(){
t.sendKeyEvent(67);
}).on('paint points', function(points) {
var data = {
points: points,
screen: {
width: $doc.body.offsetWidth,
height: $doc.body.offsetHeight
}
};
t.send_('broadcast', ['paint points', data]);
})
//监听控制来的广播
.on('from control order', function(json) {
Expand All @@ -59,7 +74,7 @@
doItem(json.id, json.item);
}).on('from control key event', function(json) {
t.createKeyEvent_(json.keyCode);
});
})
},
createKeyEvent_: function(keyCode) {
var evt = document.createEvent('Event');
Expand Down
10 changes: 10 additions & 0 deletions assets/js/nodeppt.control.postMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Slide.Control.add('postMessage', function(S, broadcast) {
var postWin, popup, timer;
var postMSG = {
role: '', //角色
broadcast: function(evtName, data) {
if (postWin) {
window.opener.postMessage({
action: evtName,
data: data
}, '*');
}
},
update: function(id) {
if (postWin) {
window.opener.postMessage({
Expand Down Expand Up @@ -65,6 +73,8 @@ Slide.Control.add('postMessage', function(S, broadcast) {
} catch (e) {}
Slide.proxyFn(fnName, args);
break;
default:
broadcast.fire('from control '+data.action, data.data);
}

},
Expand Down
24 changes: 20 additions & 4 deletions assets/js/nodeppt.control.socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Slide.Control.add('socket', function(S, broadcast) {
$body.appendChild($layer);
var $container = document.getElementById('container');

showQrcode = function (e) {
showQrcode = function(e) {
if (showQrcode.isShow) {
// $container.style.display = 'block';
$layer.style.display = 'none';
Expand Down Expand Up @@ -54,8 +54,13 @@ Slide.Control.add('socket', function(S, broadcast) {
} catch (e) {}
Slide.proxyFn(fnName, args);
break;
default:
case 'from control updateItem':
case 'from control update':
case 'from control key event':
broadcast.fire(action, data);
break;
default:
broadcast.fire(action, data.data);
}
});

Expand All @@ -79,8 +84,13 @@ Slide.Control.add('socket', function(S, broadcast) {

webSocket.on('data from another client', function(data) {
var action = data.action;
if (action.indexOf('client') !== -1) {
return;
}
action = action.replace('client', 'control');

broadcast.fire(action, data);

// switch (action) {
// case 'from client update':
// broadcast.fire('from control update', data);
Expand Down Expand Up @@ -113,13 +123,19 @@ Slide.Control.add('socket', function(S, broadcast) {
});
webSocket.on('system', function(data) {
// console.log(data);
if(showQrcode && showQrcode.isShow){
if (showQrcode && showQrcode.isShow) {
showQrcode();
}
});

this[this.role + 'Connect']();
},
broadcast: function(evtName, data) {
webSocket.emit('repost data', {
action: 'from control ' + evtName,
data: data
});
},
update: function(id) {
webSocket.emit('repost data', {
action: 'from ' + Socket.role + ' update',
Expand Down Expand Up @@ -175,7 +191,7 @@ Slide.Control.add('socket', function(S, broadcast) {
//添加shake
MixJS.loadJS(Slide.dir + 'shake.js', function() {
var lastTime = Date.now();
window.addEventListener('shake', function(){
window.addEventListener('shake', function() {
var now = Date.now();
if (now - lastTime > 3000) {
lastTime = now;
Expand Down
Loading

0 comments on commit ff2c6bf

Please sign in to comment.