diff --git a/.gitignore b/.gitignore
index b74bd0dd7..bdd63781d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-
-/node_modules
\ No newline at end of file
+/node_modules
+/.sass-cache
+/src/index.html
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 000000000..34c00bcd8
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,58 @@
+module.exports = function(grunt) {
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ jshint: {
+ // configure JSHint (documented at http://www.jshint.com/docs/)
+ options: {
+ // more options here if you want to override JSHint defaults
+ globals: {
+ console: true,
+ module: true
+ }
+ },
+ files: ['src/js/nodeppt.js']
+ },
+ compass: {
+ dist: {
+ options: {
+ config: 'config.rb'
+ }
+ }
+ },
+ concat: {
+ options: {
+ separator: ';'
+ },
+ dist: {
+ // the files to concatenate
+ src: ['src/js/*.js'],
+ // the location of the resulting JS file
+ dest: 'build/js/<%= pkg.name %>.js'
+ }
+ },
+ uglify: {
+ options: {
+ banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
+ },
+ dist: {
+ src: 'src/js/*.js',
+ dest: 'build/js/<%= pkg.name %>.js'
+ }
+ },
+ watch: {
+ files: ['src/scss/*.scss'],
+ tasks: ['compass']
+ }
+
+ });
+
+
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-compass');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-concat');
+
+ grunt.registerTask('default', ['concat', 'uglify']);
+
+};
\ No newline at end of file
diff --git a/README.md b/README.md
index 2a1fd1f00..22da491e7 100644
--- a/README.md
+++ b/README.md
@@ -1,48 +1,10 @@
-# nodePPT — 手机端控制PC端的PPT演示文档
-[nodePPT](https://github.com/ksky521/nodePPT)使用nodejs写的,可以手机端控制pc端的演示文档框架。nodePPT是在[webSlide](https://github.com/ksky521/webSlide)基础上二次开发的,使用nodejs做服务器,通过websocket来实现手机端和PC的通信,主要功能是手机端可以控制pc端PPT播放进度,并且手机端可以给每张PPT做备注。
+最新版的nodeppt
+=============
-第一次做个程序的nodejs作品,并且测试时间比较短,肯定会有很多问题和bug,希望大家一起斧正。另外页面样式css高手可以自己写,包括动画自定义都可以在css文件中直接修改添加。
+重构代码,对MixJS依赖
-## 说明
+添加postMessage支持
-因为是PPT演示文档,所以需要投影仪分辨率,所以演示页面的最佳分辨率为全屏模式下的 ``1024*768`` ,如果在自己电脑上查看,可以通过 ``ctrl + -`` 和 ``ctrl + +`` 缩放到合适的比例查看效果。
+添加按键事件同步,添加overview等多种状态
-建议浏览器chrome 16+,全屏模式(F11),以达到最佳动画效果。在Firefox下会出现拖尾现象,个人认为是Firefox 8下对CSS3动画效果渲染太慢导致,其他浏览器未测试。
-
-#### 使用说明
-> * 1、安装模块:`npm install express socket.io jade connect`
-> * 2、配置route.json
-> * 3、配置ppt的文件
-> * 4、启动node:node server.js
-> * 5、PC访问:如127.0.0.1:3000/demo.ppt
-> * 6、手机端访问:127.0.0.1:3000/ctrl
-> * 7、手机端setup,选择控制用户后,开始控制
-
-具体使用方法启动node server.js之后访问127.0.0.1:3000/index.ppt,里面有详细的介绍
-
-## 快捷键
-
-* 空格/→/↓/Tab/pageDown:下一页
-* ←/↑/pageUp:上一页
-* P:开画板
-* C:清除画板
-
-## 版本库地址
-
-支持三种访问协议:
-
-* HTTP协议: `https://ksky521@github.com/ksky521/nodePPT.git` 。
-* Git协议: `git://github.com/ksky521/nodePPT.git` 。
-* SSH协议: `ssh://git@github.com:ksky521/nodePPT.git` 。
-
-## 克隆版本库
-
-操作示例:
-
- $ git clone git://github.com/ksky521/nodePPT.git
-
-## 联系方式
-
-作者博客:[js8.in](http://js8.in)
-
-作者新浪微博:[@三水清](http://weibo.com/sanshuiqing)
\ No newline at end of file
+引用google slide template的css
diff --git a/build/js/nodePPT.js b/build/js/nodePPT.js
new file mode 100644
index 000000000..ba1f66a97
--- /dev/null
+++ b/build/js/nodePPT.js
@@ -0,0 +1,3 @@
+/*! nodePPT 2013-03-13 */
+function byId(t){return document.getElementById(t)}function smokeAnimate(){clearSmokeAnimate();var t=arguments.callee;smokeTimer=setTimeout(function(){var e=byId("smokeAnimate"),n=e.cloneNode(!0),o=e.parentNode;o.appendChild(n),e.parentNode.removeChild(e),t()},3e3)}function clearSmokeAnimate(){smokeTimer&&clearTimeout(smokeTimer)}function loadPlayer(){byId("playerIframe").src="http://4.qdemo.sinaapp.com/html5/audio/player.html"}function clearPlayer(){byId("playerIframe").src="about:blank"}function showClock(){clock(),clearClock(),clockTimer=setInterval(clock,1e3)}function clearClock(){clockTimer&&clearInterval(clockTimer)}function clock(){var t=new Date,e=byId("canvasDemoClock").getContext("2d");e.save(),e.clearRect(0,0,150,150),e.translate(75,75),e.scale(.4,.4),e.rotate(-Math.PI/2),e.strokeStyle="black",e.fillStyle="white",e.lineWidth=8,e.lineCap="round",e.save();for(var n=0;12>n;n++)e.beginPath(),e.rotate(Math.PI/6),e.moveTo(100,0),e.lineTo(120,0),e.stroke();for(e.restore(),e.save(),e.lineWidth=5,n=0;60>n;n++)0!=n%5&&(e.beginPath(),e.moveTo(117,0),e.lineTo(120,0),e.stroke()),e.rotate(Math.PI/30);e.restore();var o=t.getSeconds(),i=t.getMinutes(),r=t.getHours();r=r>=12?r-12:r,e.fillStyle="black",e.save(),e.rotate(r*(Math.PI/6)+Math.PI/360*i+Math.PI/21600*o),e.lineWidth=14,e.beginPath(),e.moveTo(-20,0),e.lineTo(80,0),e.stroke(),e.restore(),e.save(),e.rotate(Math.PI/30*i+Math.PI/1800*o),e.lineWidth=10,e.beginPath(),e.moveTo(-28,0),e.lineTo(112,0),e.stroke(),e.restore(),e.save(),e.rotate(o*Math.PI/30),e.strokeStyle="#D40000",e.fillStyle="#D40000",e.lineWidth=6,e.beginPath(),e.moveTo(-30,0),e.lineTo(83,0),e.stroke(),e.beginPath(),e.arc(0,0,10,0,2*Math.PI,!0),e.fill(),e.beginPath(),e.arc(95,0,10,0,2*Math.PI,!0),e.stroke(),e.fillStyle="#555",e.arc(0,0,3,0,2*Math.PI,!0),e.fill(),e.restore(),e.beginPath(),e.lineWidth=14,e.strokeStyle="#325FA2",e.arc(0,0,142,0,2*Math.PI,!0),e.stroke(),e.restore()}function loadWebGL(){byId("webglIframe").src="http://slides.html5rocks.com/src/webgl/san_angeles.html"}function clearWebGL(){byId("webglIframe").src="about:blank"}function loadDancer(){byId("dancerIframe").src="http://4.qdemo.sinaapp.com/dancer/index2.html"}function clearDancer(){byId("dancerIframe").src="about:blank"}function notificationsPer(){window.webkitNotifications.requestPermission()}function showNotice(t){if(0==window.webkitNotifications.checkPermission()){var e=t||byId("noticeBody").value,n=window.webkitNotifications.createNotification("http://tp4.sinaimg.cn/2037334587/50/5626160002/1","通知title","通知body:"+e);n.show(),setTimeout(function(){n.cancel()},5e3)}else alert("This page doesn't have permission to show notifications yet.")}function showNotifications(){if(0==window.webkitNotifications.checkPermission()){var t=window.webkitNotifications.createNotification("http://tp4.sinaimg.cn/2037334587/50/5626160002/1","通知title","通知body:妈妈说内容可以不多,但是一定要长!妈妈说内容可以不多,但是一定要长!妈妈说内容可以不多,但是一定要长!妈妈说内容可以不多,但是一定要长!");t.show(),setTimeout(function(){t.cancel()},3e3)}else alert("This page doesn't have permission to show notifications yet.")}function loadMap(){baiduMap=new BMap.Map("geoMap"),baiduMap.centerAndZoom("北京",15)}function geoLocation(){navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var e=t.coords.latitude,n=t.coords.longitude,o=t.coords.accuracy,i=new BMap.Point(n,e);baiduMap.centerAndZoom(i,17);var r=new BMap.Icon("http://dev.baidu.com/wiki/static/map/API/img/fox.gif",new BMap.Size(300,157)),s=new BMap.Marker(i,{icon:r}),a="
定位精度为:"+o;o>3e3&&(a+='
精度有点差%>_<%,请使用wifi来试试'),baiduMap.addOverlay(s);var c=new BMap.InfoWindow("
您所在的位置:纬度"+e+",经度"+n+a+"
");s.addEventListener("click",function(){this.openInfoWindow(c)}),s.openInfoWindow(c)},function(){alert("定位失败=>_<=")},{enableHighAccuracy:!0,maximumAge:3e4,timeout:2700}):alert("浏览器不支持 geolocation")}function rangeHandle(t,e,n){byId(t).addEventListener("change",function(){var t=this.value;byId(e).innerHTML=t,byId(n).style.borderRadius=t+"px"},!0)}function aniClass(t){var e=byId("animateTest");e.className="",e.classList.add(t)}var smokeTimer,clockTimer;!function(){function t(t){switch(t){case"image/jpeg":case"image/png":case"image/gif":case"image/bmp":case"image/jpg":return!0;default:return!1}}function e(e){e.stopPropagation(),e.preventDefault();for(var n,o=e.dataTransfer.files,i=0;n=o[i];i++){var a,c=n.type?n.type:"n/a",u=new FileReader,l=function(t,e){r.innerHTML+=""+t.name+" ("+c+") - "+t.size+" bytes"+e+"
",s.innerHTML+=e},p=t(c);p?(u.onload=function(t){return function(e){a='',l(t,a)}}(n),u.readAsDataURL(n)):(a='"o((>ω< ))o",你传进来的不是图片!!',l(n,a))}this.setAttribute("style","")}function n(){this.setAttribute("style","border-style:dashed;")}function o(){this.setAttribute("style","")}function i(t){t.stopPropagation(),t.preventDefault()}if(window.FileReader){var r=byId("fileUl"),s=byId("fileContainer");s.addEventListener("dragenter",n,!1),s.addEventListener("dragover",i,!1),s.addEventListener("drop",e,!1),s.addEventListener("dragleave",o,!1)}else byId("fileContainer").innerHTML="你的浏览器不支持啊,同学"}();var baiduMap;!function(){function t(){if(s)try{navigator.getUserMedia_({video:!0,audio:!1},n,o)}catch(t){try{navigator.getUserMedia_("video",n,o)}catch(t){throw Error(t)}}else alert("不支持web camera");return!1}function e(){s?(c.width=a.videoWidth,c.height=a.videoHeight,c.getContext("2d").drawImage(a,0,0)):alert("No native camera support available.")}function n(t){var e=window.URL||window.webkitURL;a.src=e.createObjectURL(t),a.onerror=function(){t.stop(),i()}}function o(){alert("No camera available.")}function i(){alert("Camera error.")}function r(){a.stop()}navigator.getUserMedia_=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var s=function(){return!!navigator.getUserMedia_}(),a=byId("camera"),c=byId("cameraPhoto");window.openCamera=t,window.stopCamera=r,window.snapshot=e}(),byId("rgbaRange").addEventListener("change",function(){var t=parseFloat(this.value).toFixed(1);byId("rgbaRangeVal").innerHTML=t,byId("rgbaBox").style.background="rgba(255,0,0,"+t+")"},!0),rangeHandle("radiusRange","radiusRangeVal","radiusBox"),function(t,e){function n(){j.style.width=100*((Z+1)/(H+1))+"%"}function o(t){return Y.slice.call(t)}function i(t,n){return n=n&&1===n.nodeType?n:e,n.querySelectorAll(t)}function r(t){return e.getElementById(t)}function s(){u(R[Z]),0>--Z&&(Z=0),f()}function a(){return p()?(F&&k({donext:Z}),void 0):(u(R[Z]),++Z>H&&(Z=H),f(),l(R[Z])(R[Z+1]),void 0)}function c(){var e=R[Z];!e||e&&1!==e.nodeType||e.dataset.incallback&&"function"==typeof t[e.dataset.incallback]&&N(e.dataset.incallback)}function u(e){!e||e&&1!==e.nodeType||e.dataset.outcallback&&"function"==typeof t[e.dataset.outcallback]&&N(e.dataset.outcallback)}function l(e){var n=arguments.callee;if(e&&1===e.nodeType)for(var o=i("preload",e),r=o.length;r--;){var s=o[r],a=o[r].dataset,c=a.type,u=a.url,l=t["load"+c.toUpperCase()];"function"==typeof l&&l(u,function(t){return function(){t.parentNode&&t.parentNode.removeChild(t),t=null}}(s))}return n}function p(){var t=i(".to-build",R[Z]);return t.length?(t[0].classList.remove("to-build",""),!0):!1}function d(){for(var t,e=H,n=ne.transition;t=R[--e];){for(var o,r=i(".build > *",t),s=0;o=r[s];s++){var a=o.classList;a&&a.add("to-build")}t.dataset.transition=n}}function f(e){e=e||Z,h(),n(),F&&k({slideID:e}),J&&(t.location.hash="#"+e),c(),V()}function h(){for(var t=Z,e=0,n=R.length;n>e;++e)switch(e){case t-2:m(e,"far-past");break;case t-1:m(e,"past");break;case t:m(e,"current");break;case t+1:m(e,"next");break;case t+2:m(e,"far-next");break;default:m(e)}}function m(t,e){var n=R[t];if(n){e&&n.classList.add(e);for(var o,i=["next","past","far-next","far-past","current"],r=0;o=i[r];++r)e!=o&&n.classList.remove(o)}}function y(){try{F&&(F=!1,O=io.connect(A),O.on("system",function(t){F=!0,b(t.msg),"free"===t.dowhat&&(_="bind")}),ne.isControlDevice?(O.on("server update",function(t){g(t)}),O.on("client handle",function(t){t.handleFnName&&"function"==typeof window[t.handleFnName]&&window[t.handleFnName].call({},t.args)})):(O.on("server order",function(t){g(t)}),O.on("server handle",function(t){t.handleFnName&&"function"==typeof window[t.handleFnName]&&window[t.handleFnName].apply({},t.args)}),O.on("server control message",function(t){switch(t.state){case"bind":_=t.state,b("状态转化:目前是完全同步状态");break;case"unbind":_=t.state,b("状态转化:目前是释放控制状态");break;case"bindAll":_=t.state,b("状态转化:目前是完全控制状态")}})))}catch(t){throw Error("websocket connect error!")}}function v(t){ne.isControlDevice&&ne.doWebSocket&&O&&(_=t,O.emit("server bind update",{state:t}),"bind bindAll unbind".replace(/\S+/g,function(e){r(e).classList.remove("orange"),t===e&&r(t).classList.add("orange")}))}function g(t){return F=0,t.donext&&Z===t.donext?(a(),F=1,void 0):(Z=t.slideID,f(),l(R[Z])(R[Z+1]),F=1,void 0)}function b(t){return $slideTip?($slideTip.innerHTML=t,$slideTip.style.display="block",setTimeout(function(){$slideTip.style.display="none"},3e3),void 0):(b=U,void 0)}function k(t){F&&O&&"unbind"!==_?O.emit(ne.isControlDevice?"order":"update",t):k=U}function w(t,e){F&&O&&"unbind"!==_?O.emit(ne.isControlDevice?"handle by server":"handle by client",{handleFnName:t,args:e}):w=U}function T(t){var e=t.keyCode;switch(e){case 80:I();break;case 67:V();break;case 33:case 37:case 38:(ne.isControlDevice||"bindAll"!==_)&&s();break;case 9:case 32:case 34:case 39:case 40:(ne.isControlDevice||"bindAll"!==_)&&a()}}function x(t){1==t.touches.length&&(z=0,G=0,touchStartX=t.touches[0].pageX,touchStartY=t.touches[0].pageY,B.addEventListener("touchmove",C,!0),B.addEventListener("touchend",L,!0))}function C(t){t.touches.length>1?E():(z=t.touches[0].pageX-touchStartX,G=t.touches[0].pageY-touchStartY)}function L(){var t=Math.abs(z),e=Math.abs(G);t>W&&2*t/3>e&&(z>0?s():a()),E()}function E(){B.removeEventListener("touchmove",C,!0),B.removeEventListener("touchend",L,!0)}function S(){e.addEventListener("keyup",T,!1),B.addEventListener("touchstart",x,!1),t.addEventListener("hashchange",function(){location.hash&&(J=!1,u(R[Z]),Z=0|location.hash.substr(1),f(),J=!0)},!0)}function D(){$&&($.context=$.getContext("2d"),$.context.lineWidth=3,$.context.lineCap="round",$.context.strokeStyle="red")}function I(){$&&(D(),$.style.display="",$.addEventListener("mousedown",K,!0),$.addEventListener("mouseup",te,!0),$.addEventListener("mousemove",ee,!0))}function X(){$&&($.context&&$.context.clearRect(0,0,800,600),$.style.display="none")}function N(e,n){ne.isControlDevice?F&&"unbind"!==_&&w(e,n):"function"==typeof t[e]&&t[e](n)}function M(){$slideTip=r(ne.tipID),q=r(ne.containerID),Q=ne.stepWidth,j=r(ne.progressID),R=o(i(ne.slideClass,q)),H=R.length,H--,$=r(ne.drawBoardID),$&&($.style.display="none",e.onselectstart=function(){return!1})}function P(t){t=t||{};for(var e in ne)e in t&&(ne[e]=t[e]);M(),ne.doWebSocket&&""!==ne.webSocketHost?(F=1,A=ne.webSocketHost+(ne.isControlDevice?"pptcontrol":"pptuser"),loadJS("js/socket.io.js",y)):F=0,d(),S(),location.hash&&(Z=0|location.hash.substr(1))?f():(n(),c()),l(R[Z])(R[Z+1]),B.style.opacity=1}var O,A,j,q,R,$,H,B=e.body,U=function(){},Y=[],F=!1,W=15,_="bind",J=!0,z=0,G=0,Q=800,Z=0,V=function(){$&&(X(),$.removeEventListener("mousedown",K),$.removeEventListener("mouseup",te),$.removeEventListener("mousemove",ee))},K=function(n){$.isMouseDown=!0,$.iLastX=n.layerX||n.offsetX||n.clientX-$.offsetLeft+(t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft),$.iLastY=n.layerY||n.offsetY||n.clientY-$.offsetTop+(t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop)},te=function(){$.isMouseDown=!1,$.iLastX=-1,$.iLastY=-1},ee=function(n){if($.isMouseDown){var o=n.layerX||n.offsetX||n.clientX-$.offsetLeft+(t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft),i=n.layerY||n.offsetY||n.clientY-$.offsetTop+(t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop);$.context.beginPath(),$.context.moveTo($.iLastX,$.iLastY),$.context.lineTo(o,i),$.context.stroke(),$.iLastX=o,$.iLastY=i}},ne={containerID:"container",isControlDevice:!1,doWebSocket:!0,drawBroadID:"drawBoard",slideClass:".slide",buildClass:".build",progressID:"progress",transition:"",tipID:"tip",webSocketHost:"",stepWidth:800};t.slide={init:P,next:a,prev:s,sendState:v,sendOrder:w},t.proxyFn=N}(window,document),!function(t,e){function n(t,n,i,s){"boolean"!=typeof s&&(s=/\.css(?:\?|$)/i.test(t));var a=e.createElement(s?"link":"script");"function"==typeof n&&o(a,n),t=r(t),s?(a.rel="stylesheet",a.href=t,p.appendChild(a)):(a.async="async",a.src=t,i=i||"UTF-8",a.type="text/javascript",a.charset=i,p.insertBefore(a,p.firstChild))}function o(t,e){function n(){n.isCalled||(n.isCalled=!0,clearTimeout(o),e())}"SCRIPT"===t.nodeName?s(t,n):a(t,n);var o=setTimeout(function(){n()},2e4)}function i(t){if(t=t.replace(/([^:\/])\/+/g,"$1/"),-1===t.indexOf("."))return t;for(var e,n=t.split("/"),o=[],i=0,r=n.length;r>i;i++)if(e=n[i],".."===e){if(0===o.length)throw Error("realpath: url为空");o.pop()}else"."!==e&&o.push(e);return o.join("/")}function r(t){return t=i(t),/#$/.test(t)?t=t.slice(0,-1):-1!==t.indexOf("?")||/\.(?:css|js)$/.test(t)||(t+=".js"),t}function s(t,e){t.onload=t.onerror=t.onreadystatechange=function(){if(/loaded|complete|undefined/.test(t.readyState)){if(t.onload=t.onerror=t.onreadystatechange=null,t.parentNode){try{if(t.clearAttributes)t.clearAttributes();else for(var n in t)delete t[n]}catch(o){}p.removeChild(t)}t=void 0,e()}}}function a(t,e){t.attachEvent?t.attachEvent("onload",e):setTimeout(function(){c(t,e)},0)}function c(t,e){if(!e.isCalled){var n;if(l)t.sheet&&(n=!0);else if(t.sheet)try{t.sheet.cssRules&&(n=!0)}catch(o){1e3===o.code&&(n=!0)}setTimeout(function(){n?e():c(t,e)},1)}}var u=navigator.userAgent,l=~u.indexOf("AppleWebKit"),p=e.head||e.getElementsByTagName("head")[0]||e.documentElement;t.loadJS=function(t,e,o){n(t,e,o)},t.loadCSS=function(t,e){n(t,e,"utf-8",!0)},t.load=n}(window,document),isControlDevice="undefined"==typeof isControlDevice?!1:isControlDevice,!function(t,e){function n(){Y.style.width=100*((U+1)/(_+1))+"%"}function o(t){return[].slice.call(t)}function i(t,n){return n=n&&1===n.nodeType?n:e,n.querySelectorAll(t)}function r(t){return e.getElementById(t)}function s(t){var e=t.keyCode;switch(e){case 80:I();break;case 67:z();break;case 33:case 37:case 38:(isControlDevice||"bindAll"!==q)&&a();break;case 9:case 32:case 34:case 39:case 40:(isControlDevice||"bindAll"!==q)&&c()}}function a(){l(W[U]),0>--U&&(U=0),h()}function c(){return d()?(P&&b({donext:U}),void 0):(l(W[U]),++U>_&&(U=_),h(),p(W[U])(W[U+1]),void 0)}function u(){var t=W[U];!t||t&&1!==t.nodeType||t.dataset.incallback&&"function"==typeof window[t.dataset.incallback]&&N(t.dataset.incallback)}function l(t){!t||t&&1!==t.nodeType||t.dataset.outcallback&&"function"==typeof window[t.dataset.outcallback]&&N(t.dataset.outcallback)}function p(e){var n=arguments.callee;if(e&&1===e.nodeType)for(var o=i("preload",e),r=o.length;r--;){var s=o[r],a=o[r].dataset,c=a.type,u=a.url,l=t["load"+c.toUpperCase()];"function"==typeof l&&l(u,function(t){return function(){t.parentNode&&t.parentNode.removeChild(t),t=null}}(s))}return n}function d(){var t=i(".to-build",W[U]);return t.length?(t[0].classList.remove("to-build",""),!0):!1}function f(){for(var t,e=_;t=W[--e];)for(var n,o=i(".build > *",t),r=0;n=o[r];r++)n.classList&&n.classList.add("to-build")}function h(e){e=e||U,F.style.marginLeft=-(e*B)+"px",n(),P&&b({slideID:e}),R&&(t.location.hash="#"+e),u(),z()}function m(){try{P&&(P=!1,M=io.connect(O),M.on("system",function(t){P=!0,g(t.msg),"free"===t.dowhat&&(q="bind")}),isControlDevice?(M.on("server update",function(t){v(t)}),M.on("client handle",function(t){t.handleFnName&&"function"==typeof window[t.handleFnName]&&window[t.handleFnName].call({},t.args)})):(M.on("server order",function(t){v(t)}),M.on("server handle",function(t){t.handleFnName&&"function"==typeof window[t.handleFnName]&&window[t.handleFnName].apply({},t.args)}),M.on("server control message",function(t){switch(t.state){case"bind":q=t.state,g("状态转化:目前是完全同步状态");break;case"unbind":q=t.state,g("状态转化:目前是释放控制状态");break;case"bindAll":q=t.state,g("状态转化:目前是完全控制状态")}})))}catch(t){throw Error("websocket connect error!")}}function y(t){isControlDevice&&P&&M&&(q=t,M.emit("server bind update",{state:t}),"bind bindAll unbind".replace(/\S+/g,function(e){r(e).classList.remove("orange"),t===e&&r(t).classList.add("orange")}))}function v(t){return P=0,t.donext&&U===t.donext?(c(),P=1,void 0):(U=t.slideID,h(),p(W[U])(W[U+1]),P=1,void 0)}function g(t){r("slideTip").innerHTML=t,r("slideTip").style.display="block",setTimeout(function(){r("slideTip").style.display="none"},3e3)}function b(t){P&&M&&"unbind"!==q&&M.emit(isControlDevice?"order":"update",t)}function k(t,e){P&&M&&"unbind"!==q&&M.emit(isControlDevice?"handle by server":"handle by client",{handleFnName:t,args:e})}function w(){e.addEventListener("keyup",s,!1),j.addEventListener("touchstart",C,!1),!isControlDevice&&T(),t.addEventListener("hashchange",function(){location.hash&&(R=!1,l(W[U]),U=0|location.hash.substr(1),h(),R=!0)},!0)}function T(){var t=i(".helpBtn",r("helpContainer"));t[0]&&(t[0].addEventListener("click",function(){var t=r("helpContainer").style;t.marginLeft=0>parseInt(t.marginLeft,10)?0:"-570px"},!0),r("helpContainer").style.marginLeft="-570px")}function x(){P&&loadJS("js/socket.io.js",m),f(),w(),location.hash&&(U=0|location.hash.substr(1))?h():(n(),u()),p(W[U])(W[U+1])}function C(t){1==t.touches.length&&($=0,H=0,touchStartX=t.touches[0].pageX,touchStartY=t.touches[0].pageY,j.addEventListener("touchmove",L,!0),j.addEventListener("touchend",E,!0))}function L(t){t.touches.length>1?S():($=t.touches[0].pageX-touchStartX,H=t.touches[0].pageY-touchStartY)}function E(){var t=Math.abs($),e=Math.abs(H);t>A&&2*t/3>e&&($>0?a():c()),S()}function S(){j.removeEventListener("touchmove",L,!0),j.removeEventListener("touchend",E,!0)}function D(){J&&(J.context=J.getContext("2d"),J.context.lineWidth=3,J.context.lineCap="round",J.context.strokeStyle="red")}function I(){J&&(D(),J.style.display="",J.addEventListener("mousedown",G,!0),J.addEventListener("mouseup",Q,!0),J.addEventListener("mousemove",Z,!0))}function X(){J&&(J.context&&J.context.clearRect(0,0,800,600),J.style.display="none")}function N(t,e){isControlDevice?P&&"unbind"!==q&&k(t,e):"function"==typeof window[t]&&window[t](e)}var M,P=!1,O="http://123.254.106.78:3000/"+(isControlDevice?"pptcontrol":"pptuser"),A=15,j=e.body,q="bind",R=!0,$=0,H=0,B=800,U=0,Y=r("progress"),F=r("container"),W=o(i(".slide",F)),_=W.length;F.style.width=_*B+"px",_--,r("canvasTop");var J=r("drawCanvas");J&&(J.style.display="none")&&(e.onselectstart=function(){return!1});var z=function(){J&&(X(),J.removeEventListener("mousedown",G),J.removeEventListener("mouseup",Q),J.removeEventListener("mousemove",Z))},G=function(n){J.isMouseDown=!0,J.iLastX=n.layerX||n.offsetX||n.clientX-J.offsetLeft+(t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft),J.iLastY=n.layerY||n.offsetY||n.clientY-J.offsetTop+(t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop)},Q=function(){J.isMouseDown=!1,J.iLastX=-1,J.iLastY=-1},Z=function(n){if(J.isMouseDown){var o=n.layerX||n.offsetX||n.clientX-J.offsetLeft+(t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft),i=n.layerY||n.offsetY||n.clientY-J.offsetTop+(t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop);J.context.beginPath(),J.context.moveTo(J.iLastX,J.iLastY),J.context.lineTo(o,i),J.context.stroke(),J.iLastX=o,J.iLastY=i}};x(),t.slide={nextSlide:c,prevSlide:a,sendControlState:y,sendWebSoketOrder:k},t.proxyFn=N}(window,document),function(t,e){var n=t;n.version="0.9.6",n.protocol=1,n.transports=[],n.j=[],n.sockets={},n.connect=function(t,o){var i,r,s=n.util.parseUri(t);e&&e.location&&(s.protocol=s.protocol||e.location.protocol.slice(0,-1),s.host=s.host||(e.document?e.document.domain:e.location.hostname),s.port=s.port||e.location.port),i=n.util.uniqueUri(s);var a={host:s.host,secure:"https"==s.protocol,port:s.port||("https"==s.protocol?443:80),query:s.query||""};return n.util.merge(a,o),(a["force new connection"]||!n.sockets[i])&&(r=new n.Socket(a)),!a["force new connection"]&&r&&(n.sockets[i]=r),r=r||n.sockets[i],r.of(s.path.length>1?s.path:"")}}("object"==typeof module?module.exports:this.io={},this),function(t,e){var n=t.util={},o=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];n.parseUri=function(t){for(var e=o.exec(t||""),n={},r=14;r--;)n[i[r]]=e[r]||"";return n},n.uniqueUri=function(t){var n=t.protocol,o=t.host,i=t.port;return"document"in e?(o=o||document.domain,i=i||("https"==n&&"https:"!==document.location.protocol?443:document.location.port)):(o=o||"localhost",i||"https"!=n||(i=443)),(n||"http")+"://"+o+":"+(i||80)},n.query=function(t,e){var o=n.chunkQuery(t||""),i=[];n.merge(o,n.chunkQuery(e||""));for(var r in o)o.hasOwnProperty(r)&&i.push(r+"="+o[r]);return i.length?"?"+i.join("&"):""},n.chunkQuery=function(t){for(var e,n={},o=t.split("&"),i=0,r=o.length;r>i;++i)e=o[i].split("="),e[0]&&(n[e[0]]=e[1]);return n};var r=!1;n.load=function(t){return"document"in e&&"complete"===document.readyState||r?t():(n.on(e,"load",t,!1),void 0)},n.on=function(t,e,n,o){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener&&t.addEventListener(e,n,o)},n.request=function(t){if(t&&"undefined"!=typeof XDomainRequest)return new XDomainRequest;if("undefined"!=typeof XMLHttpRequest&&(!t||n.ua.hasCORS))return new XMLHttpRequest;if(!t)try{return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}return null},"undefined"!=typeof window&&n.load(function(){r=!0}),n.defer=function(t){return n.ua.webkit&&"undefined"==typeof importScripts?(n.load(function(){setTimeout(t,100)}),void 0):t()},n.merge=function(t,e,o,i){var r,s=i||[],a=o===void 0?2:o;for(r in e)e.hasOwnProperty(r)&&0>n.indexOf(s,r)&&("object"==typeof t[r]&&a?n.merge(t[r],e[r],a-1,s):(t[r]=e[r],s.push(e[r])));return t},n.mixin=function(t,e){n.merge(t.prototype,e.prototype)},n.inherit=function(t,e){function n(){}n.prototype=e.prototype,t.prototype=new n},n.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},n.intersect=function(t,e){for(var o=[],i=t.length>e.length?t:e,r=t.length>e.length?e:t,s=0,a=r.length;a>s;s++)~n.indexOf(i,r[s])&&o.push(r[s]);return o},n.indexOf=function(t,e,n){for(var o=t.length,n=0>n?0>n+o?0:n+o:n||0;o>n&&t[n]!==e;n++);return n>=o?-1:n},n.toArray=function(t){for(var e=[],n=0,o=t.length;o>n;n++)e.push(t[n]);return e},n.ua={},n.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var t=new XMLHttpRequest}catch(e){return!1}return void 0!=t.withCredentials}(),n.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(t,e){function n(){}t.EventEmitter=n,n.prototype.on=function(t,n){return this.$events||(this.$events={}),this.$events[t]?e.util.isArray(this.$events[t])?this.$events[t].push(n):this.$events[t]=[this.$events[t],n]:this.$events[t]=n,this},n.prototype.addListener=n.prototype.on,n.prototype.once=function(t,e){function n(){o.removeListener(t,n),e.apply(this,arguments)}var o=this;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,n){if(this.$events&&this.$events[t]){var o=this.$events[t];if(e.util.isArray(o)){for(var i=-1,r=0,s=o.length;s>r;r++)if(o[r]===n||o[r].listener&&o[r].listener===n){i=r;break}if(0>i)return this;o.splice(i,1),o.length||delete this.$events[t]}else(o===n||o.listener&&o.listener===n)&&delete this.$events[t]}return this},n.prototype.removeAllListeners=function(t){return this.$events&&this.$events[t]&&(this.$events[t]=null),this},n.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),e.util.isArray(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},n.prototype.emit=function(t){if(!this.$events)return!1;var n=this.$events[t];if(!n)return!1;var o=Array.prototype.slice.call(arguments,1);if("function"==typeof n)n.apply(this,o);else{if(!e.util.isArray(n))return!1;for(var i=n.slice(),r=0,s=i.length;s>r;r++)i[r].apply(this,o)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){"use strict";function f(t){return 10>t?"0"+t:t}function date(t){return isFinite(t.valueOf())?t.getUTCFullYear()+"-"+f(t.getUTCMonth()+1)+"-"+f(t.getUTCDate())+"T"+f(t.getUTCHours())+":"+f(t.getUTCMinutes())+":"+f(t.getUTCSeconds())+"Z":null}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var n,o,i,r,s,a=gap,c=e[t];switch(c instanceof Date&&(c=date(t)),"function"==typeof rep&&(c=rep.call(e,t,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?c+"":"null";case"boolean":case"null":return c+"";case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(r=c.length,n=0;r>n;n+=1)s[n]=str(n,c)||"null";return i=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,i}if(rep&&"object"==typeof rep)for(r=rep.length,n=0;r>n;n+=1)"string"==typeof rep[n]&&(o=rep[n],i=str(o,c),i&&s.push(quote(o)+(gap?": ":":")+i));else for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(i=str(o,c),i&&s.push(quote(o)+(gap?": ":":")+i));return i=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,i}}if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(t,e,n){var o;if(gap="",indent="","number"==typeof n)for(o=0;n>o;o+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw Error("JSON.stringify");return str("",{"":t})},JSON.parse=function(text,reviver){function walk(t,e){var n,o,i=t[e];if(i&&"object"==typeof i)for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(o=walk(i,n),void 0!==o?i[n]=o:delete i[n]);return reviver.call(t,e,i)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof JSON?JSON:void 0),function(t,e){var n=t.parser={},o=n.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],i=n.reasons=["transport not supported","client not handshaken","unauthorized"],r=n.advice=["reconnect"],s=e.JSON,a=e.util.indexOf;n.encodePacket=function(t){var e=a(o,t.type),n=t.id||"",c=t.endpoint||"",u=t.ack,l=null;switch(t.type){case"error":var p=t.reason?a(i,t.reason):"",d=t.advice?a(r,t.advice):"";(""!==p||""!==d)&&(l=p+(""!==d?"+"+d:""));break;case"message":""!==t.data&&(l=t.data);break;case"event":var f={name:t.name};t.args&&t.args.length&&(f.args=t.args),l=s.stringify(f);break;case"json":l=s.stringify(t.data);break;case"connect":t.qs&&(l=t.qs);break;case"ack":l=t.ackId+(t.args&&t.args.length?"+"+s.stringify(t.args):"")}var h=[e,n+("data"==u?"+":""),c];return null!==l&&void 0!==l&&h.push(l),h.join(":")},n.encodePayload=function(t){var e="";if(1==t.length)return t[0];for(var n=0,o=t.length;o>n;n++){var i=t[n];e+="�"+i.length+"�"+t[n]}return e};var c=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;n.decodePacket=function(t){var e=t.match(c);if(!e)return{};var n=e[2]||"",t=e[5]||"",a={type:o[e[1]],endpoint:e[4]||""};switch(n&&(a.id=n,a.ack=e[3]?"data":!0),a.type){case"error":var e=t.split("+");a.reason=i[e[0]]||"",a.advice=r[e[1]]||"";break;case"message":a.data=t||"";break;case"event":try{var u=s.parse(t);a.name=u.name,a.args=u.args}catch(l){}a.args=a.args||[];break;case"json":try{a.data=s.parse(t)}catch(l){}break;case"connect":a.qs=t||"";break;case"ack":var e=t.match(/^([0-9]+)(\+)?(.*)/);if(e&&(a.ackId=e[1],a.args=[],e[3]))try{a.args=e[3]?s.parse(e[3]):[]}catch(l){}break;case"disconnect":case"heartbeat":}return a},n.decodePayload=function(t){if("�"==t.charAt(0)){for(var e=[],o=1,i="";t.length>o;o++)"�"==t.charAt(o)?(e.push(n.decodePacket(t.substr(o+1).substr(0,i))),o+=Number(i)+1,i=""):i+=t.charAt(o);return e}return[n.decodePacket(t)]}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e){function n(t,e){this.socket=t,this.sessid=e}t.Transport=n,e.util.mixin(n,e.EventEmitter),n.prototype.onData=function(t){if(this.clearCloseTimeout(),(this.socket.connected||this.socket.connecting||this.socket.reconnecting)&&this.setCloseTimeout(),""!==t){var n=e.parser.decodePayload(t);if(n&&n.length)for(var o=0,i=n.length;i>o;o++)this.onPacket(n[o])}return this},n.prototype.onPacket=function(t){return this.socket.setHeartbeatTimeout(),"heartbeat"==t.type?this.onHeartbeat():("connect"==t.type&&""==t.endpoint&&this.onConnect(),"error"==t.type&&"reconnect"==t.advice&&(this.open=!1),this.socket.onPacket(t),this)},n.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var t=this;this.closeTimeout=setTimeout(function(){t.onDisconnect()},this.socket.closeTimeout)}},n.prototype.onDisconnect=function(){return this.close&&this.open&&this.close(),this.clearTimeouts(),this.socket.onDisconnect(),this},n.prototype.onConnect=function(){return this.socket.onConnect(),this},n.prototype.clearCloseTimeout=function(){this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null)},n.prototype.clearTimeouts=function(){this.clearCloseTimeout(),this.reopenTimeout&&clearTimeout(this.reopenTimeout)},n.prototype.packet=function(t){this.send(e.parser.encodePacket(t))},n.prototype.onHeartbeat=function(){this.packet({type:"heartbeat"})},n.prototype.onOpen=function(){this.open=!0,this.clearCloseTimeout(),this.socket.onOpen()},n.prototype.onClose=function(){this.open=!1,this.socket.onClose(),this.onDisconnect()},n.prototype.prepareUrl=function(){var t=this.socket.options;return this.scheme()+"://"+t.host+":"+t.port+"/"+t.resource+"/"+e.protocol+"/"+this.name+"/"+this.sessid},n.prototype.ready=function(t,e){e.call(this)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,n){function o(t){if(this.options={port:80,secure:!1,document:"document"in n?document:!1,resource:"socket.io",transports:e.transports,"connect timeout":1e4,"try multiple transports":!0,reconnect:!0,"reconnection delay":500,"reconnection limit":1/0,"reopen delay":3e3,"max reconnection attempts":10,"sync disconnect on unload":!0,"auto connect":!0,"flash policy port":10843},e.util.merge(this.options,t),this.connected=!1,this.open=!1,this.connecting=!1,this.reconnecting=!1,this.namespaces={},this.buffer=[],this.doBuffer=!1,this.options["sync disconnect on unload"]&&(!this.isXDomain()||e.util.ua.hasCORS)){var o=this;e.util.on(n,"unload",function(){o.disconnectSync()},!1)}this.options["auto connect"]&&this.connect()
+}function i(){}t.Socket=o,e.util.mixin(o,e.EventEmitter),o.prototype.of=function(t){return this.namespaces[t]||(this.namespaces[t]=new e.SocketNamespace(this,t),""!==t&&this.namespaces[t].packet({type:"connect"})),this.namespaces[t]},o.prototype.publish=function(){this.emit.apply(this,arguments);var t;for(var e in this.namespaces)this.namespaces.hasOwnProperty(e)&&(t=this.of(e),t.$emit.apply(t,arguments))},o.prototype.handshake=function(t){function n(e){e instanceof Error?o.onError(e.message):t.apply(null,e.split(":"))}var o=this,r=this.options,s=["http"+(r.secure?"s":"")+":/",r.host+":"+r.port,r.resource,e.protocol,e.util.query(this.options.query,"t="+ +new Date)].join("/");if(this.isXDomain()&&!e.util.ua.hasCORS){var a=document.getElementsByTagName("script")[0],c=document.createElement("script");c.src=s+"&jsonp="+e.j.length,a.parentNode.insertBefore(c,a),e.j.push(function(t){n(t),c.parentNode.removeChild(c)})}else{var u=e.util.request();u.open("GET",s,!0),u.withCredentials=!0,u.onreadystatechange=function(){4==u.readyState&&(u.onreadystatechange=i,200==u.status?n(u.responseText):!o.reconnecting&&o.onError(u.responseText))},u.send(null)}},o.prototype.getTransport=function(t){for(var n,o=t||this.transports,i=0;n=o[i];i++)if(e.Transport[n]&&e.Transport[n].check(this)&&(!this.isXDomain()||e.Transport[n].xdomainCheck()))return new e.Transport[n](this,this.sessionid);return null},o.prototype.connect=function(t){if(this.connecting)return this;var n=this;return this.handshake(function(o,i,r,s){function a(t){return n.transport&&n.transport.clearTimeouts(),n.transport=n.getTransport(t),n.transport?(n.transport.ready(n,function(){n.connecting=!0,n.publish("connecting",n.transport.name),n.transport.open(),n.options["connect timeout"]&&(n.connectTimeoutTimer=setTimeout(function(){if(!n.connected&&(n.connecting=!1,n.options["try multiple transports"])){n.remainingTransports||(n.remainingTransports=n.transports.slice(0));for(var t=n.remainingTransports;t.length>0&&t.splice(0,1)[0]!=n.transport.name;);t.length?a(t):n.publish("connect_failed")}},n.options["connect timeout"]))}),void 0):n.publish("connect_failed")}n.sessionid=o,n.closeTimeout=1e3*r,n.heartbeatTimeout=1e3*i,n.transports=s?e.util.intersect(s.split(","),n.options.transports):n.options.transports,n.setHeartbeatTimeout(),a(n.transports),n.once("connect",function(){clearTimeout(n.connectTimeoutTimer),t&&"function"==typeof t&&t()})}),this},o.prototype.setHeartbeatTimeout=function(){clearTimeout(this.heartbeatTimeoutTimer);var t=this;this.heartbeatTimeoutTimer=setTimeout(function(){t.transport.onClose()},this.heartbeatTimeout)},o.prototype.packet=function(t){return this.connected&&!this.doBuffer?this.transport.packet(t):this.buffer.push(t),this},o.prototype.setBuffer=function(t){this.doBuffer=t,!t&&this.connected&&this.buffer.length&&(this.transport.payload(this.buffer),this.buffer=[])},o.prototype.disconnect=function(){return(this.connected||this.connecting)&&(this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted")),this},o.prototype.disconnectSync=function(){var t=e.util.request(),n=this.resource+"/"+e.protocol+"/"+this.sessionid;t.open("GET",n,!0),this.onDisconnect("booted")},o.prototype.isXDomain=function(){var t=n.location.port||("https:"==n.location.protocol?443:80);return this.options.host!==n.location.hostname||this.options.port!=t},o.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},o.prototype.onOpen=function(){this.open=!0},o.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},o.prototype.onPacket=function(t){this.of(t.endpoint).onPacket(t)},o.prototype.onError=function(t){t&&t.advice&&"reconnect"===t.advice&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",t&&t.reason?t.reason:t)},o.prototype.onDisconnect=function(t){var e=this.connected,n=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1,(e||n)&&(this.transport.close(),this.transport.clearTimeouts(),e&&(this.publish("disconnect",t),"booted"!=t&&this.options.reconnect&&!this.reconnecting&&this.reconnect()))},o.prototype.reconnect=function(){function t(){if(n.connected){for(var t in n.namespaces)n.namespaces.hasOwnProperty(t)&&""!==t&&n.namespaces[t].packet({type:"connect"});n.publish("reconnect",n.transport.name,n.reconnectionAttempts)}clearTimeout(n.reconnectionTimer),n.removeListener("connect_failed",e),n.removeListener("connect",e),n.reconnecting=!1,delete n.reconnectionAttempts,delete n.reconnectionDelay,delete n.reconnectionTimer,delete n.redoTransports,n.options["try multiple transports"]=i}function e(){return n.reconnecting?n.connected?t():n.connecting&&n.reconnecting?n.reconnectionTimer=setTimeout(e,1e3):(n.reconnectionAttempts++>=o?n.redoTransports?(n.publish("reconnect_failed"),t()):(n.on("connect_failed",e),n.options["try multiple transports"]=!0,n.transport=n.getTransport(),n.redoTransports=!0,n.connect()):(r>n.reconnectionDelay&&(n.reconnectionDelay*=2),n.connect(),n.publish("reconnecting",n.reconnectionDelay,n.reconnectionAttempts),n.reconnectionTimer=setTimeout(e,n.reconnectionDelay)),void 0):void 0}this.reconnecting=!0,this.reconnectionAttempts=0,this.reconnectionDelay=this.options["reconnection delay"];var n=this,o=this.options["max reconnection attempts"],i=this.options["try multiple transports"],r=this.options["reconnection limit"];this.options["try multiple transports"]=!1,this.reconnectionTimer=setTimeout(e,this.reconnectionDelay),this.on("connect",e)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e){function n(t,e){this.socket=t,this.name=e||"",this.flags={},this.json=new o(this,"json"),this.ackPackets=0,this.acks={}}function o(t,e){this.namespace=t,this.name=e}t.SocketNamespace=n,e.util.mixin(n,e.EventEmitter),n.prototype.$emit=e.EventEmitter.prototype.emit,n.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)},n.prototype.packet=function(t){return t.endpoint=this.name,this.socket.packet(t),this.flags={},this},n.prototype.send=function(t,e){var n={type:this.flags.json?"json":"message",data:t};return"function"==typeof e&&(n.id=++this.ackPackets,n.ack=!0,this.acks[n.id]=e),this.packet(n)},n.prototype.emit=function(t){var e=Array.prototype.slice.call(arguments,1),n=e[e.length-1],o={type:"event",name:t};return"function"==typeof n&&(o.id=++this.ackPackets,o.ack="data",this.acks[o.id]=n,e=e.slice(0,e.length-1)),o.args=e,this.packet(o)},n.prototype.disconnect=function(){return""===this.name?this.socket.disconnect():(this.packet({type:"disconnect"}),this.$emit("disconnect")),this},n.prototype.onPacket=function(t){function n(){o.packet({type:"ack",args:e.util.toArray(arguments),ackId:t.id})}var o=this;switch(t.type){case"connect":this.$emit("connect");break;case"disconnect":""===this.name?this.socket.onDisconnect(t.reason||"booted"):this.$emit("disconnect",t.reason);break;case"message":case"json":var i=["message",t.data];"data"==t.ack?i.push(n):t.ack&&this.packet({type:"ack",ackId:t.id}),this.$emit.apply(this,i);break;case"event":var i=[t.name].concat(t.args);"data"==t.ack&&i.push(n),this.$emit.apply(this,i);break;case"ack":this.acks[t.ackId]&&(this.acks[t.ackId].apply(this,t.args),delete this.acks[t.ackId]);break;case"error":t.advice?this.socket.onError(t):"unauthorized"==t.reason?this.$emit("connect_failed",t.reason):this.$emit("error",t.reason)}},o.prototype.send=function(){this.namespace.flags[this.name]=!0,this.namespace.send.apply(this.namespace,arguments)},o.prototype.emit=function(){this.namespace.flags[this.name]=!0,this.namespace.emit.apply(this.namespace,arguments)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,n){function o(){e.Transport.apply(this,arguments)}t.websocket=o,e.util.inherit(o,e.Transport),o.prototype.name="websocket",o.prototype.open=function(){var t,o=e.util.query(this.socket.options.query),i=this;return t||(t=n.MozWebSocket||n.WebSocket),this.websocket=new t(this.prepareUrl()+o),this.websocket.onopen=function(){i.onOpen(),i.socket.setBuffer(!1)},this.websocket.onmessage=function(t){i.onData(t.data)},this.websocket.onclose=function(){i.onClose(),i.socket.setBuffer(!0)},this.websocket.onerror=function(t){i.onError(t)},this},o.prototype.send=function(t){return this.websocket.send(t),this},o.prototype.payload=function(t){for(var e=0,n=t.length;n>e;e++)this.packet(t[e]);return this},o.prototype.close=function(){return this.websocket.close(),this},o.prototype.onError=function(t){this.socket.onError(t)},o.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"},o.check=function(){return"WebSocket"in n&&!("__addTask"in WebSocket)||"MozWebSocket"in n},o.xdomainCheck=function(){return!0},e.transports.push("websocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e,n){function o(t){t&&(e.Transport.apply(this,arguments),this.sendBuffer=[])}function i(){}t.XHR=o,e.util.inherit(o,e.Transport),o.prototype.open=function(){return this.socket.setBuffer(!1),this.onOpen(),this.get(),this.setCloseTimeout(),this},o.prototype.payload=function(t){for(var n=[],o=0,i=t.length;i>o;o++)n.push(e.parser.encodePacket(t[o]));this.send(e.parser.encodePayload(n))},o.prototype.send=function(t){return this.post(t),this},o.prototype.post=function(t){function e(){4==this.readyState&&(this.onreadystatechange=i,r.posting=!1,200==this.status?r.socket.setBuffer(!1):r.onClose())}function o(){this.onload=i,r.socket.setBuffer(!1)}var r=this;this.socket.setBuffer(!0),this.sendXHR=this.request("POST"),n.XDomainRequest&&this.sendXHR instanceof XDomainRequest?this.sendXHR.onload=this.sendXHR.onerror=o:this.sendXHR.onreadystatechange=e,this.sendXHR.send(t)},o.prototype.close=function(){return this.onClose(),this},o.prototype.request=function(t){var n=e.util.request(this.socket.isXDomain()),o=e.util.query(this.socket.options.query,"t="+ +new Date);if(n.open(t||"GET",this.prepareUrl()+o,!0),"POST"==t)try{n.setRequestHeader?n.setRequestHeader("Content-type","text/plain;charset=UTF-8"):n.contentType="text/plain"}catch(i){}return n},o.prototype.scheme=function(){return this.socket.options.secure?"https":"http"},o.check=function(t,o){try{var i=e.util.request(o),r=n.XDomainRequest&&i instanceof XDomainRequest,s=t&&t.options&&t.options.secure?"https:":"http:",a=s!=n.location.protocol;if(i&&(!r||!a))return!0}catch(c){}return!1},o.xdomainCheck=function(){return o.check(null,!0)}}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e){function n(){e.Transport.XHR.apply(this,arguments)}t.htmlfile=n,e.util.inherit(n,e.Transport.XHR),n.prototype.name="htmlfile",n.prototype.get=function(){this.doc=new(window[["Active"].concat("Object").join("X")])("htmlfile"),this.doc.open(),this.doc.write(""),this.doc.close(),this.doc.parentWindow.s=this;var t=this.doc.createElement("div");t.className="socketio",this.doc.body.appendChild(t),this.iframe=this.doc.createElement("iframe"),t.appendChild(this.iframe);var n=this,o=e.util.query(this.socket.options.query,"t="+ +new Date);this.iframe.src=this.prepareUrl()+o,e.util.on(window,"unload",function(){n.destroy()})},n.prototype._=function(t,e){this.onData(t);try{var n=e.getElementsByTagName("script")[0];n.parentNode.removeChild(n)}catch(o){}},n.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(t){}this.doc=null,this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,CollectGarbage()}},n.prototype.close=function(){return this.destroy(),e.Transport.XHR.prototype.close.call(this)},n.check=function(){if("undefined"!=typeof window&&["Active"].concat("Object").join("X")in window)try{var t=new(window[["Active"].concat("Object").join("X")])("htmlfile");return t&&e.Transport.XHR.check()}catch(n){}return!1},n.xdomainCheck=function(){return!1},e.transports.push("htmlfile")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,n){function o(){e.Transport.XHR.apply(this,arguments)}function i(){}t["xhr-polling"]=o,e.util.inherit(o,e.Transport.XHR),e.util.merge(o,e.Transport.XHR),o.prototype.name="xhr-polling",o.prototype.open=function(){var t=this;return e.Transport.XHR.prototype.open.call(t),!1},o.prototype.get=function(){function t(){4==this.readyState&&(this.onreadystatechange=i,200==this.status?(r.onData(this.responseText),r.get()):r.onClose())}function e(){this.onload=i,this.onerror=i,r.onData(this.responseText),r.get()}function o(){r.onClose()}if(this.open){var r=this;this.xhr=this.request(),n.XDomainRequest&&this.xhr instanceof XDomainRequest?(this.xhr.onload=e,this.xhr.onerror=o):this.xhr.onreadystatechange=t,this.xhr.send(null)}},o.prototype.onClose=function(){if(e.Transport.XHR.prototype.onClose.call(this),this.xhr){this.xhr.onreadystatechange=this.xhr.onload=this.xhr.onerror=i;try{this.xhr.abort()}catch(t){}this.xhr=null}},o.prototype.ready=function(t,n){var o=this;e.util.defer(function(){n.call(o)})},e.transports.push("xhr-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e,n){function o(){e.Transport["xhr-polling"].apply(this,arguments),this.index=e.j.length;var t=this;e.j.push(function(e){t._(e)})}var i=n.document&&"MozAppearance"in n.document.documentElement.style;t["jsonp-polling"]=o,e.util.inherit(o,e.Transport["xhr-polling"]),o.prototype.name="jsonp-polling",o.prototype.post=function(t){function n(){o(),i.socket.setBuffer(!1)}function o(){i.iframe&&i.form.removeChild(i.iframe);try{s=document.createElement('