2017-02-22 16:22:28 -05:00
|
|
|
!function(t,e){"function"==typeof define&&define.amd?define("castrato",[],e()):"object"==typeof exports?module.exports=e:t.castrato=e}(this,function(){function t(t,e,o,s){var c=[t,o,1<o.length];if((i[e]||(i[e]=[])).push(c),r[e])for(t=0,c=[c];(o=r[e][t++])&&(n(0,0,o[0],o[1],c),!s););}function e(t,e,n){var o=0;if(toSubs=i[e])for(;e=toSubs[o++];)e[0]!==t||n&&n!==e[1]||toSubs.splice(--o,1)}function n(t,e,n,o,c){var a,u,f,d=c||i[e]||[],l=d.length,m=[];if(i["*"]&&(d=d.concat(i["*"])),u=a=d.length)for(f=o?function(t){t&&m.push(t),--a||(o(m,l),o=0)}:s;c=d[--u];)c[1](n,c[2]?f:a--,e);!a&&o&&o(m,l),t&&(r[e]||(r[e]=[])).push([n,o])}var o=0,i={},r={},s=function(){};return function(){var i=o++;return{emit:function(t,e,o,i){return!0!==t&&!1!==t&&(i=o,o=e,e=t,t=!1),n(t,e,o,i),this},on:function(e,n){return t(i,e,n),this},once:function(n,o){return t(i,n,function t(r,s){e(i,n,t),o(r,1<o.length?s:s())},!0),this},off:function(t,n){return e(i,t,n),this}}}}()),function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof define&&define.amd?define("crypto-js/core",[],e):t.CryptoJS=e()}(this,function(){var t=t||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),o={},i=o.lib={},r=i.Base=function(){return{extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=r.extend({init:function(t,n){t=this.words=t||[],n!=e?this.sigBytes=n:this.sigBytes=4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,n=t.words,o=this.sigBytes,i=t.sigBytes;if(this.clamp(),o%4)for(var r=0;r<i;r++){var s=n[r>>>2]>>>24-r%4*8&255;e[o+r>>>2]|=s<<24-(o+r)%4*8}else for(var r=0;r<i;r+=4)e[o+r>>>2]=n[r>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,o=[],i=function(e){var e=e,n=987654321,o=4294967295;return function(){n=36969*(65535&n)+(n>>16)&o,e=18e3*(65535&e)+(e>>16)&o;var i=(n<<16)+e&o;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},r=0;r<e;r+=4){var c=i(4294967296*(n||t.random()));n=987654071*c(),o.push(4294967296*c()|0)}return new s.init(o,e)}}),c=o.enc={},a=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,o=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;o.push((r>>>4).toString(16)),o.push((15&r).toString(16))}return o.join("")},parse:function(t){for(var e=t.length,n=[],o=0;o<e;o+=2)n[o>>>3]|=parseInt(t.substr(o,2),16)<<24-o%8*4;return new s.init(n,e/2)}},u=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,o=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;o.push(String.fromCharCode(r))}return o.join("")},parse:function(t){for(var e=t.length,n=[],o=0;o<e;o++)n[o>>>2]|=(255&t.charCodeAt(o))<<24-o%4*8;return new s.init(n,e)}},f=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},d=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,o=n.words,i=n.sigBytes,r=this.blockSize,c=4*r,a=i/c;a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0);var u=a*r,f=t.min(4*u,i);if(u){for(var d=0;d<u;d+=r)this._doProcessBlock(o,d);var l=o.splice(0,u);n.sigBytes-=f}return new s.init(l,f)},clone:function(){var t=r.clone.call(this);return t._data=this._data.clone(),t},_minBuffe
|
2017-02-08 15:24:58 -05:00
|
|
|
person_left:[[784.89,0,200],[523.26,0,200],[784.89,200,500],[261.63,200,500]]}),define("room",["$","castrato","settings","templates"],function(t,e,n,o){var i=!1,r=function(r){i!==!1?e.emit("console:error",t.template(o.messages.already_in_room,{room:i})):r.length>=n.room.maxLen?e.emit("console:error",t.template(o.messages.room_name_too_long)):r.length<n.room.minLen?e.emit("console:error",t.template(o.messages.room_name_too_short)):(i=r,e.emit("room:changed",i).emit("socket:emit",{data:"room:join",payload:t.SHA1(i)}))},s=function(){i!==!1?(e.emit("socket:emit",{data:"room:leave",payload:t.SHA1(i)}),i=!1):e.emit("console:error",o.messages.leave_from_nowhere)},c=function(){i?e.emit("socket:emit",{data:"room:count"}):e.emit("console:error",o.messages.not_in_room)};e.on("command:join",r),e.on("command:leave",s),e.on("command:count",c)}),define("notifications",["castrato","window","settings"],function(t,e,n){var o,i,r,s,c,a=!0,u=!1,f=function(){return performance.now()||Date.now()},d=function(){a=!0},l=function(){a=!1},m=function(){clearTimeout(r),void 0!==i&&e.setTitle(i),i=void 0,o=void 0,window_active=!0},p=function(){a?(e.getTitle()==i?e.setTitle(o):e.setTitle(i),r=setTimeout(p,s)):m()},h=function(){u&&"denied"!==Notification.permission&&Notification.requestPermission(function(t){Notification.permission=t})},g=function(t,n){s=void 0==n?1e3:n,a&&void 0===i&&(o=t,i=e.getTitle(),p())},y=function(t,e,o,i){if(a&&f()-c>n.notifications.maxOnePerMs)if(void 0===i&&(i=!1),u&&"granted"===Notification.permission){var r=new Notification(t,{body:e,icon:o});r.onshow=function(){setTimeout(function(){r.close()},3e3)},c=f()}else i&&g("Attention",1e3)};u=void 0!==window.Notification,t.on("notification:send",function(t){y(t.title,t.body,t.icon,!0)}),t.on("notification:on",function(){d()}),t.on("notification:off",function(){l()}),h(),l(),c=f(),m()}),define("queue",[],function(){var t={},e=[],n=function(){return performance.now()||Date.now()};return t.add_function_delayed=function(t,o,i){e.push({func:o,pushed:n(),delay:t,data:i})},t.get=function(){return e},t.run=function(){for(var o,i,r=0;o=e[r++];)n()-o.pushed>o.delay&&(o.func(),e.splice(r-1,1));if(e.length){for(i=n();n()-i<1;);t.run()}},t}),define("audio",["queue","castrato","templates"],function(t,e,n){var o=!1,i=!0,r=!1,s=function(e,n){if(n=void 0===n?0:n,o&&i&&n<Object.keys(e).length&&!r){var c=e[n],a=c[0],u=c[1],f=c[2],d=o.createOscillator(),l=o.createGain();d.frequency.value=a,d.connect(l),l.gain.value=.25,l.connect(o.destination),t.add_function_delayed(u,function(){d.noteOn?d.noteOn(0):d.start(0)}),t.add_function_delayed(u+f,function(){d.noteOff?d.noteOff(0):d.stop(0)}),n++,n<Object.keys(e).length?s(e,n):t.run()}},c=function(){i=!0},a=function(){i=!1},u=function(){r=!0,e.emit("console:info",n.messages.muted)},f=function(){r=!1,e.emit("console:info",n.messages.unmuted)};(window.AudioContext||window.webkitAudioContext)&&(o=new(window.AudioContext||window.webkitAudioContext)),e.on("audio:play",function(t){s(t)}),e.on("audio:on",c),e.on("audio:off",a),e.on("audio:mute",u),e.on("audio:unmute",f)}),define("console",["$","castrato","settings","templates","sounds","room","notifications","audio"],function(t,e,n,o,i){var r={chat:t("#chat"),input:t("#input"),inputWrapper:t("#input_wrapper")},s={},c={post:function(e,i,s){var a,u=o.post[e],f="msg_"+(new Date).getTime()+"_"+Math.round(1e6*Math.random()),d=Object.assign({},n,{nick:s,timestamp:(new Date).toLocaleTimeString(),id:f});d.text=t.template(i,d),a=t.template(u,d),c.showNotification(e,s,i),setTimeout(function(){var e=r.chat.first(),n=t("#"+f).first();e.removeChild(n)},n.ttl),r.chat.append(a)},torch:function(i){var i=parseInt(i);i>0&&i<3600?(e.emit("console:info",t.template(o.messages.torch_is_now,{ttl:i})),n.ttl=1e3*i):e.emit("console:error",t.template(o.messages.torch_not_set))},param:function(t){s=Object.assign({},s,t)},showNotification:function(t,n,o){var r="message"!==t?"Cryptalk":n,s="message"===t?"gfx/icon_128x128.png":"error"==t?"gfx/icon_128x128_error.png":"gfx/icon_128x128_info.png";e.emit("notification:send",{title:r.substring(0,20),
|