forked from MaxLaumeister/bitlisten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitlisten.min.js
5 lines (4 loc) · 43.3 KB
/
bitlisten.min.js
1
2
3
4
5
/*! BitListen Copyright (c) 2017 Maximillian Laumeister, see README.md for license info. */
function surrogateCtor(){}function extend(a,b){surrogateCtor.prototype=a.prototype,b.prototype=new surrogateCtor,b.prototype.constructor=b}function Block(a,b,c,d){if("visible"===document.visibilityState){Floatable.call(this);var e=Math.floor(c)+" DCR",f=Math.floor(d/1024)+" KB";this.width=this.height=500,this.addImage(blockImage,this.width,this.height),this.addText("Block #"+a+"<br />Number of Transactions: "+b+"<br />Transaction Volume: "+e+"<br />Block Size: "+f),this.initPosition()}Sound.playRandomSwell()}function Floatable(){this.velocity={x:0,y:-1},this.pageDiv=document.getElementById("bubbleDiv"),this.updateContainerSize(),this.div=document.createElement("div"),this.div.className="floatableDiv",this.pageDiv.appendChild(this.div),this.innerDiv=document.createElement("div"),this.div.appendChild(this.innerDiv),this.innerDiv.className="innerDiv",updateTargets.push(this)}function TransactionSocket(){}function Sound(){}function zeroPad(a,b){var c=b-a.toString().length+1;return Array(+(c>0&&c)).join("0")+a}function StatusBox(){}function Transaction(a,b,c,d){if("visible"===document.visibilityState){Floatable.call(this),this.area=100*a+3e3,this.width=this.height=2*Math.sqrt(this.area/Math.PI),this.addImage(bubbleImage,this.width,this.height);var e,f=a.toFixed(2);e="0.00"===f?"<<span class='bitcoinsymbol'>B</span>0.01":"<span class='bitcoinsymbol'>B</span>"+f,b?this.addText('<span style="color: yellow;">'+e+'</span><br /><span style="color: cyan;">Donation</span><br /><span style="color: lime;">Thanks!</span>'):this.addText(e),c&&d&&this.addText("<br />"+c.toFixed(2)+" "+d),this.initPosition();var g=1e3,h=.3,i=.7,j=a/(g/(i-h))+h;j>i&&(j=i);var k=100,l=1.0715307808111487,m=Math.min(k,Math.log(a+l)/Math.log(l));m=k-m,globalScalePitch?Sound.playPitchAtVolume(j,m):Sound.playRandomAtVolume(j),transaction_count++,5===transaction_count&&(document.getElementById("waitingForTransactions").style.opacity="0")}}var Konami=function(a){var b={addEvent:function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event,d)},a.attachEvent("on"+b,a[b+c]))},input:"",pattern:"38384040373937396665",load:function(a){this.addEvent(document,"keydown",function(c,d){if(d&&(b=d),b.input+=c?c.keyCode:event.keyCode,b.input.length>b.pattern.length&&(b.input=b.input.substr(b.input.length-b.pattern.length)),b.input==b.pattern)return b.code(a),b.input="",c.preventDefault(),!1},this),this.iphone.load(a)},code:function(a){window.location=a},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP"],code:function(a){b.code(a)},load:function(a){this.orig_keys=this.keys,b.addEvent(document,"touchmove",function(a){if(1==a.touches.length&&1==b.iphone.capture){var c=a.touches[0];b.iphone.stop_x=c.pageX,b.iphone.stop_y=c.pageY,b.iphone.tap=!1,b.iphone.capture=!1,b.iphone.check_direction()}}),b.addEvent(document,"touchend",function(c){1==b.iphone.tap&&b.iphone.check_direction(a)},!1),b.addEvent(document,"touchstart",function(a){b.iphone.start_x=a.changedTouches[0].pageX,b.iphone.start_y=a.changedTouches[0].pageY,b.iphone.tap=!0,b.iphone.capture=!0})},check_direction:function(a){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=this.start_x-this.stop_x<0?"RIGHT":"LEFT",y=this.start_y-this.stop_y<0?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(a))}}};return"string"==typeof a&&b.load(a),"function"==typeof a&&(b.code=a,b.load()),b};!function(){var a={},b=null,c=!0,d=!1;try{"undefined"!=typeof AudioContext?b=new AudioContext:"undefined"!=typeof webkitAudioContext?b=new webkitAudioContext:c=!1}catch(e){c=!1}if(!c)if("undefined"!=typeof Audio)try{new Audio}catch(e){d=!0}else d=!0;if(c){var f="undefined"==typeof b.createGain?b.createGainNode():b.createGain();f.gain.value=1,f.connect(b.destination)}var g=function(a){this._volume=1,this._muted=!1,this.usingWebAudio=c,this.ctx=b,this.noAudio=d,this._howls=[],this._codecs=a,this.iOSAutoEnable=!0};g.prototype={volume:function(a){var b=this;if(a=parseFloat(a),a>=0&&a<=1){b._volume=a,c&&(f.gain.value=a);for(var d in b._howls)if(b._howls.hasOwnProperty(d)&&b._howls[d]._webAudio===!1)for(var e=0;e<b._howls[d]._audioNode.length;e++)b._howls[d]._audioNode[e].volume=b._howls[d]._volume*b._volume;return b}return c?f.gain.value:b._volume},mute:function(){return this._setMuted(!0),this},unmute:function(){return this._setMuted(!1),this},_setMuted:function(a){var b=this;b._muted=a,c&&(f.gain.value=a?0:b._volume);for(var d in b._howls)if(b._howls.hasOwnProperty(d)&&b._howls[d]._webAudio===!1)for(var e=0;e<b._howls[d]._audioNode.length;e++)b._howls[d]._audioNode[e].muted=a},codecs:function(a){return this._codecs[a]},_enableiOSAudio:function(){var a=this;if(!b||!a._iOSEnabled&&/iPhone|iPad|iPod/i.test(navigator.userAgent)){a._iOSEnabled=!1;var c=function(){var d=b.createBuffer(1,1,22050),e=b.createBufferSource();e.buffer=d,e.connect(b.destination),"undefined"==typeof e.start?e.noteOn(0):e.start(0),setTimeout(function(){e.playbackState!==e.PLAYING_STATE&&e.playbackState!==e.FINISHED_STATE||(a._iOSEnabled=!0,a.iOSAutoEnable=!1,window.removeEventListener("touchstart",c,!1))},0)};return window.addEventListener("touchstart",c,!1),a}}};var h=null,i={};d||(h=new Audio,i={mp3:!!h.canPlayType("audio/mpeg;").replace(/^no$/,""),opus:!!h.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!h.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!h.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!h.canPlayType("audio/aac;").replace(/^no$/,""),m4a:!!(h.canPlayType("audio/x-m4a;")||h.canPlayType("audio/m4a;")||h.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(h.canPlayType("audio/x-mp4;")||h.canPlayType("audio/mp4;")||h.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!h.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")});var j=new g(i),k=function(a){var d=this;d._autoplay=a.autoplay||!1,d._buffer=a.buffer||!1,d._duration=a.duration||0,d._format=a.format||null,d._loop=a.loop||!1,d._loaded=!1,d._sprite=a.sprite||{},d._src=a.src||"",d._pos3d=a.pos3d||[0,0,-.5],d._volume=void 0!==a.volume?a.volume:1,d._urls=a.urls||[],d._rate=a.rate||1,d._model=a.model||null,d._onload=[a.onload||function(){}],d._onloaderror=[a.onloaderror||function(){}],d._onend=[a.onend||function(){}],d._onpause=[a.onpause||function(){}],d._onplay=[a.onplay||function(){}],d._onendTimer=[],d._webAudio=c&&!d._buffer,d._audioNode=[],d._webAudio&&d._setupAudioNode(),"undefined"!=typeof b&&b&&j.iOSAutoEnable&&j._enableiOSAudio(),j._howls.push(d),d.load()};if(k.prototype={load:function(){var a=this,b=null;if(d)return void a.on("loaderror");for(var c=0;c<a._urls.length;c++){var e,f;if(a._format)e=a._format;else{if(f=a._urls[c],e=/^data:audio\/([^;,]+);/i.exec(f),e||(e=/\.([^.]+)$/.exec(f.split("?",1)[0])),!e)return void a.on("loaderror");e=e[1].toLowerCase()}if(i[e]){b=a._urls[c];break}}if(!b)return void a.on("loaderror");if(a._src=b,a._webAudio)l(a,b);else{var h=new Audio;h.addEventListener("error",function(){h.error&&4===h.error.code&&(g.noAudio=!0),a.on("loaderror",{type:h.error?h.error.code:0})},!1),a._audioNode.push(h),h.src=b,h._pos=0,h.preload="auto",h.volume=j._muted?0:a._volume*j.volume();var k=function(){a._duration=Math.ceil(10*h.duration)/10,0===Object.getOwnPropertyNames(a._sprite).length&&(a._sprite={_default:[0,1e3*a._duration]}),a._loaded||(a._loaded=!0,a.on("load")),a._autoplay&&a.play(),h.removeEventListener("canplaythrough",k,!1)};h.addEventListener("canplaythrough",k,!1),h.load()}return a},urls:function(a){var b=this;return a?(b.stop(),b._urls="string"==typeof a?[a]:a,b._loaded=!1,b.load(),b):b._urls},play:function(a,c){var d=this;return"function"==typeof a&&(c=a),a&&"function"!=typeof a||(a="_default"),d._loaded?d._sprite[a]?(d._inactiveNode(function(e){e._sprite=a;var f=e._pos>0?e._pos:d._sprite[a][0]/1e3,g=0;d._webAudio?(g=d._sprite[a][1]/1e3-e._pos,e._pos>0&&(f=d._sprite[a][0]/1e3+f)):g=d._sprite[a][1]/1e3-(f-d._sprite[a][0]/1e3);var h,i=!(!d._loop&&!d._sprite[a][2]),k="string"==typeof c?c:Math.round(Date.now()*Math.random())+"";if(function(){var b={id:k,sprite:a,loop:i};h=setTimeout(function(){!d._webAudio&&i&&d.stop(b.id).play(a,b.id),d._webAudio&&!i&&(d._nodeById(b.id).paused=!0,d._nodeById(b.id)._pos=0,d._clearEndTimer(b.id)),d._webAudio||i||d.stop(b.id),d.on("end",k)},1e3*g),d._onendTimer.push({timer:h,id:b.id})}(),d._webAudio){var l=d._sprite[a][0]/1e3,m=d._sprite[a][1]/1e3;e.id=k,e.paused=!1,o(d,[i,l,m],k),d._playStart=b.currentTime,e.gain.value=d._volume,"undefined"==typeof e.bufferSource.start?e.bufferSource.noteGrainOn(0,f,g):e.bufferSource.start(0,f,g)}else{if(4!==e.readyState&&(e.readyState||!navigator.isCocoonJS))return d._clearEndTimer(k),function(){var b=d,f=a,g=c,h=e,i=function(){b.play(f,g),h.removeEventListener("canplaythrough",i,!1)};h.addEventListener("canplaythrough",i,!1)}(),d;e.readyState=4,e.id=k,e.currentTime=f,e.muted=j._muted||e.muted,e.volume=d._volume*j.volume(),setTimeout(function(){e.play()},0)}return d.on("play"),"function"==typeof c&&c(k),d}),d):("function"==typeof c&&c(),d):(d.on("load",function(){d.play(a,c)}),d)},pause:function(a){var b=this;if(!b._loaded)return b.on("play",function(){b.pause(a)}),b;b._clearEndTimer(a);var c=a?b._nodeById(a):b._activeNode();if(c)if(c._pos=b.pos(null,a),b._webAudio){if(!c.bufferSource||c.paused)return b;c.paused=!0,"undefined"==typeof c.bufferSource.stop?c.bufferSource.noteOff(0):c.bufferSource.stop(0)}else c.pause();return b.on("pause"),b},stop:function(a){var b=this;if(!b._loaded)return b.on("play",function(){b.stop(a)}),b;b._clearEndTimer(a);var c=a?b._nodeById(a):b._activeNode();if(c)if(c._pos=0,b._webAudio){if(!c.bufferSource||c.paused)return b;c.paused=!0,"undefined"==typeof c.bufferSource.stop?c.bufferSource.noteOff(0):c.bufferSource.stop(0)}else isNaN(c.duration)||(c.pause(),c.currentTime=0);return b},mute:function(a){var b=this;if(!b._loaded)return b.on("play",function(){b.mute(a)}),b;var c=a?b._nodeById(a):b._activeNode();return c&&(b._webAudio?c.gain.value=0:c.muted=!0),b},unmute:function(a){var b=this;if(!b._loaded)return b.on("play",function(){b.unmute(a)}),b;var c=a?b._nodeById(a):b._activeNode();return c&&(b._webAudio?c.gain.value=b._volume:c.muted=!1),b},volume:function(a,b){var c=this;if(a=parseFloat(a),a>=0&&a<=1){if(c._volume=a,!c._loaded)return c.on("play",function(){c.volume(a,b)}),c;var d=b?c._nodeById(b):c._activeNode();return d&&(c._webAudio?d.gain.value=a:d.volume=a*j.volume()),c}return c._volume},loop:function(a){var b=this;return"boolean"==typeof a?(b._loop=a,b):b._loop},sprite:function(a){var b=this;return"object"==typeof a?(b._sprite=a,b):b._sprite},pos:function(a,c){var d=this;if(!d._loaded)return d.on("load",function(){d.pos(a)}),"number"==typeof a?d:d._pos||0;a=parseFloat(a);var e=c?d._nodeById(c):d._activeNode();if(e)return a>=0?(d.pause(c),e._pos=a,d.play(e._sprite,c),d):d._webAudio?e._pos+(b.currentTime-d._playStart):e.currentTime;if(a>=0)return d;for(var f=0;f<d._audioNode.length;f++)if(d._audioNode[f].paused&&4===d._audioNode[f].readyState)return d._webAudio?d._audioNode[f]._pos:d._audioNode[f].currentTime},pos3d:function(a,b,c,d){var e=this;if(b="undefined"!=typeof b&&b?b:0,c="undefined"!=typeof c&&c?c:-.5,!e._loaded)return e.on("play",function(){e.pos3d(a,b,c,d)}),e;if(!(a>=0||a<0))return e._pos3d;if(e._webAudio){var f=d?e._nodeById(d):e._activeNode();f&&(e._pos3d=[a,b,c],f.panner.setPosition(a,b,c),f.panner.panningModel=e._model||"HRTF")}return e},fade:function(a,b,c,d,e){var f=this,g=Math.abs(a-b),h=a>b?"down":"up",i=g/.01,j=c/i;if(!f._loaded)return f.on("load",function(){f.fade(a,b,c,d,e)}),f;f.volume(a,e);for(var k=1;k<=i;k++)!function(){var a=f._volume+("up"===h?.01:-.01)*k,c=Math.round(1e3*a)/1e3,g=b;setTimeout(function(){f.volume(c,e),c===g&&d&&d()},j*k)}()},fadeIn:function(a,b,c){return this.volume(0).play().fade(0,a,b,c)},fadeOut:function(a,b,c,d){var e=this;return e.fade(e._volume,a,b,function(){c&&c(),e.pause(d),e.on("end")},d)},_nodeById:function(a){for(var b=this,c=b._audioNode[0],d=0;d<b._audioNode.length;d++)if(b._audioNode[d].id===a){c=b._audioNode[d];break}return c},_activeNode:function(){for(var a=this,b=null,c=0;c<a._audioNode.length;c++)if(!a._audioNode[c].paused){b=a._audioNode[c];break}return a._drainPool(),b},_inactiveNode:function(a){for(var b=this,c=null,d=0;d<b._audioNode.length;d++)if(b._audioNode[d].paused&&4===b._audioNode[d].readyState){a(b._audioNode[d]),c=!0;break}if(b._drainPool(),!c){var e;if(b._webAudio)e=b._setupAudioNode(),a(e);else{b.load(),e=b._audioNode[b._audioNode.length-1];var f=navigator.isCocoonJS?"canplaythrough":"loadedmetadata",g=function(){e.removeEventListener(f,g,!1),a(e)};e.addEventListener(f,g,!1)}}},_drainPool:function(){var a,b=this,c=0;for(a=0;a<b._audioNode.length;a++)b._audioNode[a].paused&&c++;for(a=b._audioNode.length-1;a>=0&&!(c<=5);a--)b._audioNode[a].paused&&(b._webAudio&&b._audioNode[a].disconnect(0),c--,b._audioNode.splice(a,1))},_clearEndTimer:function(a){for(var b=this,c=0,d=0;d<b._onendTimer.length;d++)if(b._onendTimer[d].id===a){c=d;break}var e=b._onendTimer[c];e&&(clearTimeout(e.timer),b._onendTimer.splice(c,1))},_setupAudioNode:function(){var a=this,c=a._audioNode,d=a._audioNode.length;return c[d]="undefined"==typeof b.createGain?b.createGainNode():b.createGain(),c[d].gain.value=a._volume,c[d].paused=!0,c[d]._pos=0,c[d].readyState=4,c[d].connect(f),c[d].panner=b.createPanner(),c[d].panner.panningModel=a._model||"equalpower",c[d].panner.setPosition(a._pos3d[0],a._pos3d[1],a._pos3d[2]),c[d].panner.connect(c[d]),c[d]},on:function(a,b){var c=this,d=c["_on"+a];if("function"==typeof b)d.push(b);else for(var e=0;e<d.length;e++)b?d[e].call(c,b):d[e].call(c);return c},off:function(a,b){var c=this,d=c["_on"+a],e=b?b.toString():null;if(e){for(var f=0;f<d.length;f++)if(e===d[f].toString()){d.splice(f,1);break}}else c["_on"+a]=[];return c},unload:function(){for(var b=this,c=b._audioNode,d=0;d<b._audioNode.length;d++)c[d].paused||(b.stop(c[d].id),b.on("end",c[d].id)),b._webAudio?c[d].disconnect(0):c[d].src="";for(d=0;d<b._onendTimer.length;d++)clearTimeout(b._onendTimer[d].timer);var e=j._howls.indexOf(b);null!==e&&e>=0&&j._howls.splice(e,1),delete a[b._src],b=null}},c)var l=function(b,c){if(c in a)return b._duration=a[c].duration,void n(b);if(/^data:[^;]+;base64,/.test(c)){for(var d=atob(c.split(",")[1]),e=new Uint8Array(d.length),f=0;f<d.length;++f)e[f]=d.charCodeAt(f);m(e.buffer,b,c)}else{var g=new XMLHttpRequest;g.open("GET",c,!0),g.responseType="arraybuffer",g.onload=function(){m(g.response,b,c)},g.onerror=function(){b._webAudio&&(b._buffer=!0,b._webAudio=!1,b._audioNode=[],delete b._gainNode,delete a[c],b.load())};try{g.send()}catch(h){g.onerror()}}},m=function(c,d,e){b.decodeAudioData(c,function(b){b&&(a[e]=b,n(d,b))},function(a){d.on("loaderror")})},n=function(a,b){a._duration=b?b.duration:a._duration,0===Object.getOwnPropertyNames(a._sprite).length&&(a._sprite={_default:[0,1e3*a._duration]}),a._loaded||(a._loaded=!0,a.on("load")),a._autoplay&&a.play()},o=function(c,d,e){var f=c._nodeById(e);f.bufferSource=b.createBufferSource(),f.bufferSource.buffer=a[c._src],f.bufferSource.connect(f.panner),f.bufferSource.loop=d[0],d[0]&&(f.bufferSource.loopStart=d[1],f.bufferSource.loopEnd=d[1]+d[2]),f.bufferSource.playbackRate.value=c._rate};"function"==typeof define&&define.amd&&define(function(){return{Howler:j,Howl:k}}),"undefined"!=typeof exports&&(exports.Howler=j,exports.Howl=k),"undefined"!=typeof window&&(window.Howler=j,window.Howl=k)}(),function(a){a.fn.qr=function(b){function c(b,c){for(var d=escape(b);d.indexOf("/")!=-1;)d=d.replace("/","%2f");var e=document.createElement("div");return $qr=a(e),$qr.css({background:"url('http://chart.apis.google.com/chart?cht=qr&chs="+c+"x"+c+"&chl="+d+"') no-repeat",width:c+"px",height:c+"px",display:"none","border-style":"solid","border-width":"1px",position:"absolute","z-index":"1000"}),a("body").append($qr),e}return this.each(function(){var d={size:"230",delay:"0"};b&&a.extend(d,b);var e=a(this);e.qr_div=c(e.attr("qrtarget"),d.size),e.mouseenter(function(b){e.qr_timeout_id=window.setTimeout(function(){a(e.qr_div).css({display:"block",top:b.pageY+5,left:b.pageX+15})},d.delay)}),e.mouseleave(function(b){null!=e.qr_timeout_id&&(window.clearTimeout(e.qr_timeout_id),e.qr_timeout_id=null),a(e.qr_div).css({display:"none"})})})}}(jQuery),function(a){"use strict";function b(a){throw new RangeError("noUiSlider: "+a)}function c(a,c,d){(a[c]||a[d])&&a[c]===a[d]&&b("(Link) '"+c+"' can't match '"+d+"'.'")}function d(a){return Math.max(Math.min(a,100),0)}function e(a,b){return Math.round(a/b)*b}function f(a,b){return 100/(b-a)}function g(a,b){return typeof a==typeof b}function h(b){return b instanceof a||a.zepto&&a.zepto.isZ(b)}function i(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function j(b){return a.isArray(b)?b:[b]}function k(a,b,c){a.addClass(b),setTimeout(function(){a.removeClass(b)},c)}function l(a,b){return 100*b/(a[1]-a[0])}function m(a,b){return l(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function n(a,b){return b*(a[1]-a[0])/100+a[0]}function o(a,b){if(b>=a.xVal.slice(-1)[0])return 100;for(var c,d,e,g,h=1;b>=a.xVal[h];)h++;return c=a.xVal[h-1],d=a.xVal[h],e=a.xPct[h-1],g=a.xPct[h],e+m([c,d],b)/f(e,g)}function p(a,b){if(b>=100)return a.xVal.slice(-1)[0];for(var c,d,e,g,h=1;b>=a.xPct[h];)h++;return c=a.xVal[h-1],d=a.xVal[h],e=a.xPct[h-1],g=a.xPct[h],n([c,d],(b-e)*f(e,g))}function q(a,b){for(var c,d,f=1;b>=a.xPct[f];)f++;return a.snap?(c=a.xPct[f-1],d=a.xPct[f],b-c>(d-c)/2?d:c):a.xSteps[f-1]?a.xPct[f-1]+e(b-a.xPct[f-1],a.xSteps[f-1]):b}function r(a){a.preventDefault();var b,c,d=0===a.type.indexOf("touch"),e=0===a.type.indexOf("mouse"),f=0===a.type.indexOf("pointer"),g=a;return 0===a.type.indexOf("MSPointer")&&(f=!0),a.originalEvent&&(a=a.originalEvent),d&&(b=a.changedTouches[0].pageX,c=a.changedTouches[0].pageY),(e||f)&&(f||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),b=a.clientX+window.pageXOffset,c=a.clientY+window.pageYOffset),g.points=[b,c],g.cursor=e,g}function s(d){void 0===d&&(d={}),"object"!=typeof d&&b("(Format) 'format' option must be an object.");var e={};a(U).each(function(a,c){void 0===d[c]?e[c]=V[a]:g(d[c],V[a])?("decimals"===c&&(d[c]<0||d[c]>7)&&b("(Format) 'format.decimals' option must be between 0 and 7."),e[c]=d[c]):b("(Format) 'format."+c+"' must be a "+typeof V[a]+".")}),c(e,"mark","thousand"),c(e,"prefix","negative"),c(e,"prefix","negativeBefore"),this.settings=e}function t(b,c){if(!(this instanceof t))throw new Error("Link: Don't use Link as a function. Use the 'new' keyword.");if(!b)throw new RangeError("Link: missing parameters.");this.formatting=b.format||{},this.update=!c;var d=this,e=b.target||function(){},f=b.method,g="string"==typeof e&&0===e.indexOf("-tooltip-"),i="string"==typeof e&&0!==e.indexOf("-"),j="function"==typeof e,k=h(e),l=k&&e.is("input, select, textarea"),m=k&&"function"==typeof f,n=k&&"string"==typeof f&&e[f];if(g)return this.method=f||"html",void(this.el=a(e.replace("-tooltip-","")||"<div/>")[0]);if(i)return this.method="val",this.el=document.createElement("input"),this.el.name=e,void(this.el.type="hidden");if(j)return this.target=!1,void(this.method=e);if(k){if(f&&(m||n))return this.target=e,void(this.method=f);if(!f&&l)return this.method="val",this.target=e,void this.target.on("change",function(b){function c(a,b,c){return[c?a:b,c?b:a]}var e=c(null,a(b.target).val(),d.N);d.obj.val(e,{link:d})});if(!f&&!l)return this.method="html",void(this.target=e)}throw new RangeError("Link: Invalid Link.")}function u(a,c){i(c)||b("'step' is not numeric."),a.xSteps[0]=c}function v(c,d){("object"!=typeof d||a.isArray(d))&&b("'range' is not an object."),a.each(d,function(d,e){var f;"number"==typeof e&&(e=[e]),a.isArray(e)||b("'range' contains invalid value."),f="min"===d?0:"max"===d?100:parseFloat(d),i(f)&&i(e[0])||b("'range' value isn't numeric."),c.xPct.push(f),c.xVal.push(e[0]),f?c.xSteps.push(!isNaN(e[1])&&e[1]):isNaN(e[1])||(c.xSteps[0]=e[1])}),a.each(c.xSteps,function(a,b){return!b||void(c.xSteps[a]=l([c.xVal[a],c.xVal[a+1]],b)/f(c.xPct[a],c.xPct[a+1]))})}function w(c,d){"number"==typeof d&&(d=[d]),(!a.isArray(d)||!d.length||d.length>2)&&b("'start' option is incorrect."),c.handles=d.length,c.start=d}function x(a,c){a.snap=c,"boolean"!=typeof c&&b("'snap' option must be a boolean.")}function y(a,c){"lower"===c&&1===a.handles?a.connect=1:"upper"===c&&1===a.handles?a.connect=2:c===!0&&2===a.handles?a.connect=3:c===!1?a.connect=0:b("'connect' option was doesn't match handle count.")}function z(a,c){switch(c){case"horizontal":a.ort=0;break;case"vertical":a.ort=1;break;default:b("'orientation' option is invalid.")}}function A(a,c){a.xPct.length>2&&b("'margin' option is only supported on linear sliders."),a.margin=l(a.xVal,c),i(c)||b("'margin' option must be numeric.")}function B(a,c){switch(c){case"ltr":a.dir=0;break;case"rtl":a.dir=1,a.connect=[0,2,1,3][a.connect];break;default:b("'direction' option was not recognized.")}}function C(a,c){"string"!=typeof c&&b("'behaviour' must be a string containing options.");var d=c.indexOf("tap")>=0,e=c.indexOf("extend")>=0,f=c.indexOf("drag")>=0,g=c.indexOf("fixed")>=0,h=c.indexOf("snap")>=0;a.events={tap:d||h,extend:e,drag:f,fixed:g,snap:h}}function D(c,d,e){c.ser=[d.lower,d.upper],c.formatting=new s(d.format),a.each(c.ser,function(c,f){a.isArray(f)||b("'serialization."+(c?"upper":"lower")+"' must be an array."),a.each(f,function(){this instanceof t||b("'serialization."+(c?"upper":"lower")+"' can only contain Link instances."),this.N=c,this.obj=e,this.scope=this.scope||e,this.formatting=new s(a.extend({},d.format,this.formatting))})}),c.dir&&c.handles>1&&c.ser.reverse()}function E(c,d){var e,f={xPct:[],xVal:[],xSteps:[!1],margin:0};return e={step:{r:!1,t:u},range:{r:!0,t:v},start:{r:!0,t:w},snap:{r:!1,t:x},connect:{r:!0,t:y},orientation:{r:!1,t:z},margin:{r:!1,t:A},direction:{r:!0,t:B},behaviour:{r:!0,t:C},serialization:{r:!0,t:D}},c=a.extend({connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},c),c.serialization=a.extend({lower:[],upper:[],format:{}},c.serialization),a.each(e,function(a,e){if(void 0===c[a]){if(!e.r)return!0;b("'"+a+"' is required.")}e.t(f,c[a],d)}),f.style=f.ort?"top":"left",f}function F(b,c){var d=a("<div><div/></div>").addClass(T[2]),e=["-lower","-upper"];return b.dir&&e.reverse(),d.children().addClass(T[3]+" "+T[3]+e[c]),d}function G(b,c){return c.el&&(c=new t({target:a(c.el).clone().appendTo(b),method:c.method,format:c.formatting},!0)),c}function H(a,b,c){var d,e=[];for(e.push(new t({format:c},!0)),d=0;d<a.length;d++)e.push(G(b,a[d]));return e}function I(a,b){var c,d=[];for(c=0;c<a.handles;c++)d[c]=H(a.ser[c],b[c].children(),a.formatting);return d}function J(a,b,c){switch(a){case 1:b.addClass(T[7]),c[0].addClass(T[6]);break;case 3:c[1].addClass(T[6]);case 2:c[0].addClass(T[7]);case 0:b.addClass(T[6])}}function K(a,b){var c,d=[];for(c=0;c<a.handles;c++)d.push(F(a,c).appendTo(b));return d}function L(b,c){return c.addClass([T[0],T[8+b.dir],T[4+b.ort]].join(" ")),a("<div/>").appendTo(c).addClass(T[1])}function M(b,c,e){function f(){return v[["width","height"][c.ort]]()}function g(a){var b,c=[y.val()];for(b=0;b<a.length;b++)y.trigger(a[b],c)}function h(b,e,f){var g=b[0]!==x[0][0]?1:0,h=z[0]+c.margin,i=z[1]-c.margin;return f&&x.length>1&&(e=g?Math.max(e,h):Math.min(e,i)),e<100&&(e=q(c,e)),e=d(parseFloat(e.toFixed(7))),e===z[g]?1!==x.length&&((e===h||e===i)&&0):(b.css(c.style,e+"%"),b.is(":first-child")&&b.toggleClass(T[17],e>50),z[g]=e,c.dir&&(e=100-e),a(w[g]).each(function(){this.write(c,e,b.children(),y)}),!0)}function i(a,b,c){var e=a+b[0],f=a+b[1];return c?(e<0&&(f+=Math.abs(e)),f>100&&(e-=f-100),[d(e),d(f)]):[e,f]}function j(a,b,c){c||k(y,T[14],300),h(a,b,!1),g(["slide","set","change"])}function l(a,b,d,e){return a=a.replace(/\s/g,Q+" ")+Q,b.on(a,function(a){var b=y.attr("disabled");return b=!(void 0===b||null===b),!y.hasClass(T[14])&&!b&&(a=r(a),a.calcPoint=a.points[c.ort],void d(a,e))})}function m(a,b){var c,d=b.handles||x,e=!1,j=100*(a.calcPoint-b.start)/f(),k=d[0][0]!==x[0][0]?1:0;c=i(j,b.positions,d.length>1),e=h(d[0],c[k],1===d.length),d.length>1&&(e=h(d[1],c[k?0:1],!1)||e),e&&g(["slide"])}function n(b){a("."+T[15]).removeClass(T[15]),b.cursor&&a("body").css("cursor","").off(Q),P.off(Q),y.removeClass(T[12]),g(["set","change"])}function p(b,c){1===c.handles.length&&c.handles[0].children().addClass(T[15]),b.stopPropagation(),l(S.move,P,m,{start:b.calcPoint,handles:c.handles,positions:[z[0],z[x.length-1]]}),l(S.end,P,n,null),b.cursor&&(a("body").css("cursor",a(b.target).css("cursor")),x.length>1&&y.addClass(T[12]),a("body").on("selectstart"+Q,!1))}function s(b){var d,e=b.calcPoint,g=0;b.stopPropagation(),a.each(x,function(){g+=this.offset()[c.style]}),g=e<g/2||1===x.length?0:1,e-=v.offset()[c.style],d=100*e/f(),j(x[g],d,c.events.snap),c.events.snap&&p(b,{handles:[x[g]]})}function t(a){var b=a.calcPoint<v.offset()[c.style],d=b?0:100;b=b?0:x.length-1,j(x[b],d,!1)}function u(a){var b,c;if(!a.fixed)for(b=0;b<x.length;b++)l(S.start,x[b].children(),p,{handles:[x[b]]});a.tap&&l(S.start,v,s,{handles:x}),a.extend&&(y.addClass(T[16]),a.tap&&l(S.start,y,t,{handles:x})),a.drag&&(c=v.find("."+T[7]).addClass(T[10]),a.fixed&&(c=c.add(v.children().not(c).children())),l(S.start,c,p,{handles:x}))}var v,w,x,y=a(b),z=[-1,-1];if(!y.is(":empty"))throw new Error("Slider was already initialized.");v=L(c,y),x=K(c,v),w=I(c,x),J(c.connect,y,x),u(c.events),b.vSet=function(b,d,e,f,i){var j,l;for(c.dir&&c.handles>1&&b.reverse(),i&&k(y,T[14],300),j=0;j<(x.length>1?3:1);j++)l=e||w[j%2][0],l=l.valueOf(b[j%2]),l!==!1&&(l=o(c,l),c.dir&&(l=100-l),h(x[j%2],l,!0)!==!0&&a(w[j%2]).each(function(){this.write(c,z[j%2],x[j%2].children(),y,f)}));return d===!0&&g(["set"]),this},b.vGet=function(){var a,b=[];for(a=0;a<c.handles;a++)b[a]=w[a][0].saved;return 1===b.length?b[0]:c.dir&&c.handles>1?b.reverse():b},b.destroy=function(){return a.each(w,function(){a.each(this,function(){this.target&&this.target.off(Q)})}),a(this).off(Q).removeClass(T.join(" ")).empty(),e},y.val(c.start)}function N(a){this.length||b("Can't initialize slider on empty selection.");var c=E(a,this);return this.each(function(){M(this,c,a)})}function O(b){return this.each(function(){var c=a(this).val(),d=this.destroy(),e=a.extend({},d,b);a(this).noUiSlider(e),d.start===e.start&&a(this).val(c)})}var P=a(document),Q=".nui",R=a.fn.val,S=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},T=["noUi-target","noUi-base","noUi-origin","noUi-handle","noUi-horizontal","noUi-vertical","noUi-background","noUi-connect","noUi-ltr","noUi-rtl","noUi-dragable","","noUi-state-drag","","noUi-state-tap","noUi-active","noUi-extended","noUi-stacking"],U=["decimals","mark","thousand","prefix","postfix","encoder","decoder","negative","negativeBefore"],V=[2,".","","","",function(a){return a},function(a){return a},"-",""];s.prototype.v=function(a){return this.settings[a]},s.prototype.to=function(a){function b(a){return a.split("").reverse().join("")}a=this.v("encoder")(a);var c="",d="",e="",f="";return a<0&&(c=this.v("negative"),d=this.v("negativeBefore")),a=Math.abs(a).toFixed(this.v("decimals")).toString(),a=a.split("."),0===parseFloat(a)&&(a[0]="0"),this.v("thousand")?(e=b(a[0]).match(/.{1,3}/g),e=b(e.join(b(this.v("thousand"))))):e=a[0],this.v("mark")&&a.length>1&&(f=this.v("mark")+a[1]),d+this.v("prefix")+c+e+f+this.v("postfix")},s.prototype.from=function(a){function b(a){return a.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")}var c;return null!==a&&void 0!==a&&(a=a.toString(),c=a.replace(new RegExp("^"+b(this.v("negativeBefore"))),""),a!==c?(a=c,c="-"):c="",a=a.replace(new RegExp("^"+b(this.v("prefix"))),""),this.v.negative&&(c="",a=a.replace(new RegExp("^"+b(this.v("negative"))),"-")),a=a.replace(new RegExp(b(this.v("postfix"))+"$"),"").replace(new RegExp(b(this.v("thousand")),"g"),"").replace(this.v("mark"),"."),a=this.v("decoder")(parseFloat(c+a)),!isNaN(a)&&a)},t.prototype.write=function(a,b,c,d,e){this.update&&e===!1||(b=p(a,b),b=this.format(b),this.saved=b,"function"==typeof this.method?this.method.call(this.target[0]||d[0],b,c,d):this.target[this.method](b,c,d))},t.prototype.format=function(a){return this.formatting.to(a)},t.prototype.valueOf=function(a){return this.formatting.from(a)},a.noUiSlider={Link:t},a.fn.noUiSlider=function(a,b){return(b?O:N).call(this,a)},a.fn.val=function(){var b,c,d,e,f=Array.prototype.slice.call(arguments,0);return f.length?("object"==typeof f[1]?(b=f[1].set,c=f[1].link,d=f[1].update,e=f[1].animate):f[1]===!0&&(b=!0),this.each(function(){a(this).hasClass(T[0])?this.vSet(j(f[0]),b,c,d,e):R.apply(a(this),f)})):this.hasClass(T[0])?this[0].vGet():R.apply(this)}}(window.jQuery||window.Zepto),window.requestAnimationFrame||(window.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){window.setTimeout(a,1e3/60)}}()),function(){window.visibly={b:null,q:document,p:void 0,prefixes:["webkit","ms"],props:["VisibilityState","visibilitychange","Hidden"],m:["focus","blur"],visibleCallbacks:[],hiddenCallbacks:[],_callbacks:[],onVisible:function(a){this.visibleCallbacks.push(a)},onHidden:function(a){this.hiddenCallbacks.push(a)},isSupported:function(){return this._supports(0)||this._supports(1)},_supports:function(a){return this.prefixes[a]+this.props[2]in this.q},runCallbacks:function(a){if(a){this._callbacks=1==a?this.visibleCallbacks:this.hiddenCallbacks;for(var b=0;b<this._callbacks.length;b++)this._callbacks[b]()}},_visible:function(){window.visibly.runCallbacks(1)},_hidden:function(){window.visibly.runCallbacks(2)},_nativeSwitch:function(){this.q[this.b+this.props[2]]===!0?this._hidden():this._visible()},listen:function(){try{this.isSupported()?(this.b=this._supports(0)==this.p?this.prefixes[1]:this.prefixes[0],this.q.addEventListener(this.b+this.props[1],function(){window.visibly._nativeSwitch.apply(window.visibly,arguments)},1)):document.addEventListener?(window.addEventListener(this.m[0],this._visible,1),window.addEventListener(this.m[1],this._hidden,1)):(this.q.attachEvent("onfocusin",this._visible),this.q.attachEvent("onfocusout",this._hidden))}catch(a){}},init:function(){this.listen()}},this.visibly.init()}(),function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c){function d(i){e=new WebSocket(b,c),f.onconnecting(),(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",b);var j=e,k=setTimeout(function(){(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",b),h=!0,j.close(),h=!1},f.timeoutInterval);e.onopen=function(c){clearTimeout(k),(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",b),f.readyState=WebSocket.OPEN,i=!1,f.reconnectAttempts=0,f.onopen(c)},e.onclose=function(c){clearTimeout(k),e=null,g?(f.readyState=WebSocket.CLOSED,f.onclose(c)):(f.readyState=WebSocket.CONNECTING,f.onconnecting(),i||h||((f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",b),f.onclose(c)),setTimeout(function(){f.reconnectAttempts++,d(!0)},f.reconnectInterval*Math.pow(f.reconnectDecay,f.reconnectAttempts)))},e.onmessage=function(c){(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",b,c.data),f.onmessage(c)},e.onerror=function(c){(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",b,c),
f.onerror(c)}}c=c||[],this.debug=!1,this.reconnectInterval=1e3,this.reconnectDecay=1.5,this.reconnectAttempts=0,this.timeoutInterval=2e3;var e,f=this,g=!1,h=!1;this.url=b,this.protocols=c,this.readyState=WebSocket.CONNECTING,this.URL=b,this.onopen=function(a){},this.onclose=function(a){},this.onconnecting=function(a){},this.onmessage=function(a){},this.onerror=function(a){},d(!1),this.send=function(c){if(e)return(f.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",b,c),e.send(c);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(){g=!0,e&&e.close()},this.refresh=function(){e&&e.close()}}return a.debugAll=!1,a}),extend(Floatable,Block),Floatable.prototype.updateContainerSize=function(){this.pageDivWidth=$(this.pageDiv).width(),this.pageDivHeight=$(this.pageDiv).height()},Floatable.prototype.update=function(a){var b=1,c=a/50;this.x+=this.velocity.x*c,this.y+=this.velocity.y*c,this.velocity.x+=(.1*Math.random()-.05)*c,this.velocity.x>b?this.velocity.x=b:this.velocity.x<-b&&(this.velocity.x=-b),this.x<0?this.velocity.x+=.005*c:this.x>this.pageDivWidth-this.width&&(this.velocity.x-=.005*c),this.updateDiv(),this.y<-this.height&&this.removeSelf()},Floatable.prototype.updateDiv=function(){this.div.style["-webkit-transform"]="translate("+this.x+"px,"+this.y+"px)",this.div.style.transform="translate("+this.x+"px,"+this.y+"px)"},Floatable.prototype.removeSelf=function(){this.pageDiv.removeChild(this.div),updateTargets.splice(updateTargets.indexOf(this),1)},Floatable.prototype.addImage=function(a,b,c){this.canvas=document.createElement("canvas"),this.image=a,this.canvas.height=c,this.canvas.width=b,this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px";var d=this.canvas.getContext("2d");d.drawImage(this.image,0,0,b-1,c-1),this.div.appendChild(this.canvas)},Floatable.prototype.addText=function(a){this.innerDiv.innerHTML+=a},Floatable.prototype.initPosition=function(){this.x=Math.random()*(this.pageDivWidth-this.width),this.y=this.pageDivHeight,this.updateDiv(),this.div.style.width=this.width+"px",this.div.style.height=this.height+"px",this.innerDiv.style.top=this.height/2-this.innerDiv.offsetHeight/2+"px"};var easterSuccess=function(){var a=new Floatable;a.width=53,a.height=48,a.image=document.createElement("img"),a.image.src="images/easteregg.gif",a.image.height=a.height,a.image.width=a.width,a.image.style.position="absolute",a.image.style.top="0px",a.image.style.left="0px",a.div.appendChild(a.image),a.initPosition(),a.update=function(b){Floatable.prototype.update.call(a,b),a.velocity.x+=.3*Math.random()-.15,a.velocity.x>.1&&$(a.image).css({"-moz-transform":"scaleX(-1)","-o-transform":"scaleX(-1)","-webkit-transform":"scaleX(-1)",transform:"scaleX(-1)"}),a.velocity.x<-.1&&$(a.image).css({"-moz-transform":"scaleX(1)","-o-transform":"scaleX(1)","-webkit-transform":"scaleX(1)",transform:"scaleX(1)"})}};new Konami(easterSuccess);var DEBUG_MODE=!1,DONATION_ADDRESS,SOUND_DONATION_ADDRESS,globalMute=!1,instanceId=0,pageDivId="pageDiv",last_update=0,updateTargets=[],transaction_count=0,bubbleImage=new Image;bubbleImage.src="images/bubble.png";var blockImage=new Image;blockImage.src="images/block.png";var debugSpawner,updateLayoutWidth=function(){$(".chartMask").css("visibility","visible")},updateLayoutHeight=function(){var a=window.innerHeight;"none"!=$("#header").css("display")&&(a-=$("#header").outerHeight()),$("#pageSplitter").height(a)};$(document).ready(function(){prevChartWidth=$("#pageSplitter").width()/2,$("#chartCell").hide(),DONATION_ADDRESS=$("#donationAddress").html(),$("#noJavascript").css("display","none"),updateLayoutHeight(),StatusBox.init(DEBUG_MODE),$(".clickSuppress").click(function(){$(".clickSuppress").parent().slideUp(300)}),debugSpawner=function(){if(Math.random()<=.1){var a,b=Math.random();a=b<.6?Math.random():b<.8?10*Math.random():b<.95?100*Math.random():1e3*Math.random(),Math.random()<.5?new Transaction(a,!1):new Transaction(a,!1,75*a,"USD")}},switchExchange("bitstamp"),$("#donationAddress").qr()});var toggleInterface=function(){0===$(".interface:hidden").length?($(".interface").fadeOut(500,updateLayoutHeight),$("#hideInterface").html("[ Show Interface ]"),$("#hideInterface").css("opacity","0.5")):($(".interface").fadeIn(500),$("#hideInterface").html("[ Hide Interface ]"),$("#hideInterface").css("opacity","1"),updateLayoutHeight())},globalUpdate=function(a){window.requestAnimationFrame(globalUpdate);var b=a-last_update;last_update=a;for(var c=0;c<updateTargets.length;c++)updateTargets[c].update(b)};$(window).bind("load",function(){DEBUG_MODE?setInterval(debugSpawner,100):($("#blockchainCheckBox").prop("checked")&&TransactionSocket.init(),$("#mtgoxCheckBox").prop("checked")&&TradeSocket.init()),window.requestAnimationFrame(globalUpdate),Sound.loadup(),Sound.init()});var endResize=function(){$(".chartMask").css("visibility","hidden");for(var a=0;a<updateTargets.length;a++)updateTargets[a].updateContainerSize()},hideChart=function(){$("#chartElement").hide(),$("#showChart").show(),prevChartWidth=$("#chartCell").width(),$("#chartCell").width(0),$("#chartCell").hide(),$("#pageSplitter").colResizable({disable:!0})},showChart=function(){$("#chartElement").show(),$("#showChart").hide(),$("#chartCell").width(prevChartWidth),$("#chartCell").show(),$(window).trigger("resize"),0===$("#bitcoinChart").length&&$("#chartHolder").html('<iframe id="bitcoinChart" scrolling="no" frameBorder="0" src="http://bitcoin.clarkmoody.com/widget/chart/zeroblock/"></iframe>'),$("#pageSplitter").colResizable({liveDrag:!0,onDrag:updateLayoutWidth,onResize:endResize})};$(window).resize(function(){updateLayoutHeight()}),window.onbeforeunload=function(a){clearInterval(globalUpdate),TransactionSocket.close(),TradeSocket.close()};var rateboxTimeout,currentExchange,ratebox_ms=3e3;rateboxGetRate=function(){},$(document).ready(function(){var a=new Pusher("de504dc5763aeef9ff52"),b=a.subscribe("live_trades");b.bind("trade",function(a){$("#rate").html(parseFloat(a.price).toFixed(2)),rateboxTimeout&&clearTimeout(rateboxTimeout)})}),switchExchange=function(a){clearTimeout(rateboxTimeout),currentExchange=a,$("#rate").html("---"),"bitstamp"==a?($("#bitstampRate").css("color","white"),$("#mtgoxRate").css("color","gray")):"mtgox"==a&&($("#mtgoxRate").css("color","white"),$("#bitstampRate").css("color","gray")),rateboxGetRate()};var satoshi=1e8,DELAY_CAP=2e4,lastBlockHeight=0,provider_name="mainnet.decred.org";TransactionSocket.init=function(){if(TransactionSocket.connection&&TransactionSocket.connection.close(),"WebSocket"in window){eventToListenTo="tx",room="inv";var a=io("https://mainnet.decred.org/");a.on("connect",function(){a.emit("subscribe",room),StatusBox.connected("blockchain")}),a.on("tx",function(a){console.log("New transaction received: "+a.txid),console.log(a);var b=!1;JSON.stringify(a).includes("DsUctHzY3a8dicGZSHSPVdF4aMHPJ7kS9PE")===!0&&(b=!0),new Transaction(a.valueOut,b)}),a.on("block",function(a){console.log("New block received!"),console.log(a);var b="https://mainnet.decred.org/api/block/".concat(a);asyncgetcallback(b,"dcrlisten",!1,function(a){var b=JSON.parse(a);new Block(b.height,b.stx.length,b.reward,b.size)})}),console.log(a)}else console.log("No websocket support."),StatusBox.nosupport("blockchain")},TransactionSocket.close=function(){TransactionSocket.connection&&TransactionSocket.connection.disconnect(),StatusBox.closed("blockchain")};var globalVolume=50,globalScalePitch,globalBank;Howler.volume(.01*globalVolume);var soundBank=[];soundBank[0]=["celesta",22],soundBank[1]=["planet",33],soundBank[2]=["wikki",13],Sound.loadup=function(){sound0=[],sound1=[],sound2=[],swells0=[],swells1=[],swells2=[]},Sound.init=function(){$("#volumeControl").click(function(){globalMute?(globalMute=!1,Howler.unmute(),$("#volumeControl").css("background-position","0 -46px")):(globalMute=!0,Howler.mute(),$("#volumeControl").css("background-position","0 0"))}),$("#volumeSlider").noUiSlider({range:{min:0,max:100},start:50,handles:1,step:1,orientation:"vertical"}).on("slide",function(){globalVolume=100-$(this).val(),Howler.volume(.01*globalVolume)}),globalScalePitch=$("#scalePitchCheckBox").attr("checked"),Sound.change(0)},Sound.change=function(a){var b,c="Donate to instrument creator: ";if(0===a){if(0===sound0.length)for(b=1;b<=22;b++)istring=zeroPad(b,3),newSound=new Howl({urls:["sounds/celesta/celesta"+istring+".ogg","sounds/celesta/celesta"+istring+".mp3"],autoplay:!1}),sound0.push(newSound);if(0===swells0.length)for(b=1;b<=3;b++)newSound=new Howl({urls:["sounds/swells0/swell"+b+".ogg","sounds/swells0/swell"+b+".mp3"],autoplay:!1}),swells0.push(newSound);currentSound=sound0,currentSwells=swells0,$("#musicianDonation").text("")}else if(1===a){if(0===sound1.length)for(b=1;b<=33;b++)istring=zeroPad(b,3),newSound=new Howl({urls:["sounds/planet/planet"+istring+".ogg","sounds/planet/planet"+istring+".mp3"],autoplay:!1}),sound1.push(newSound);if(0===swells1.length)for(b=1;b<=3;b++)newSound=new Howl({urls:["sounds/swells1/planetswell"+b+".ogg","sounds/swells1/planetswell"+b+".mp3"],autoplay:!1}),swells1.push(newSound);currentSound=sound1,currentSwells=swells1,SOUND_DONATION_ADDRESS="144b31mmaWQVDQFiUPo6HEzxc2Dm83WXrW",$("#musicianDonation").html(c+"<span>"+SOUND_DONATION_ADDRESS+"</span>")}else if(2===a){if(0===sound2.length)for(b=1;b<=13;b++)istring=zeroPad(b,3),newSound=new Howl({urls:["sounds/wikki/wikki"+istring+".ogg","sounds/wikki/wikki"+istring+".mp3"],autoplay:!1}),sound2.push(newSound);if(0===swells2.length)for(b=1;b<=3;b++)newSound=new Howl({urls:["sounds/swells2/wikkiswell"+b+".ogg","sounds/swells2/wikkiswell"+b+".mp3"],autoplay:!1}),swells2.push(newSound);currentSound=sound2,currentSwells=swells2,SOUND_DONATION_ADDRESS="1JFaYRGkDmhpSTbFKwqDWKr2ncvvrgYEAV",$("#musicianDonation").html(c+"<span>"+SOUND_DONATION_ADDRESS+"</span>")}};var currentNotes=0,noteTimeout=500;Sound.playRandomAtVolume=function(a){if(!globalMute){var b=Math.floor(100*Math.random());Sound.playPitchAtVolume(a,b)}},Sound.playPitchAtVolume=function(a,b){if(!globalMute){var c=Math.floor(b/100*currentSound.length),d=Math.floor(4*Math.random())-2;c+=d,c=Math.min(currentSound.length-1,c),c=Math.max(0,c),currentNotes<5&&(currentSound[c].volume(a),currentSound[c].play(),currentNotes++,setTimeout(function(){currentNotes--},noteTimeout))}};var lastBlockSound=-1;Sound.playRandomSwell=function(){if(!globalMute){var a;do a=Math.floor(Math.random()*currentSwells.length);while(a==lastBlockSound);lastBlockSound=a,currentSwells[a].play()}};var CONNECTED="Connected.",CONNECTING="Connecting...",NO_SUPPORT="No browser support.",CLOSED="Click to connect.",provider_name="blockchain.info";StatusBox.init=function(a){StatusBox.blockchain=$("#blockchainStatus"),StatusBox.mtgox=$("#mtgoxStatus"),a&&(StatusBox.blockchain.html(""),StatusBox.mtgox.html("Debug mode.")),$("#blockchainCheckBox").is(":checked")?StatusBox.reconnecting("blockchain"):StatusBox.closed("blockchain"),$("#mtgoxCheckBox").is(":checked")?StatusBox.reconnecting("mtgox"):StatusBox.closed("mtgox")},StatusBox.connected=function(a){"blockchain"==a&&StatusBox.blockchain.html('Transactions (mainnet.decred.org): <span style="color: green;">'+CONNECTED+"</span>"),"mtgox"==a&&StatusBox.mtgox.html('Mt.Gox Trades: <span style="color: green;">'+CONNECTED+"</span>")},StatusBox.reconnecting=function(a){"blockchain"==a&&StatusBox.blockchain.html('Transactions (mainnet.decred.org): <span style="color: yellow;">'+CONNECTING+"</span>"),"mtgox"==a&&StatusBox.mtgox.html('Mt.Gox Trades: <span style="color: yellow;">'+CONNECTING+"</span>")},StatusBox.nosupport=function(a){"blockchain"==a&&StatusBox.blockchain.html('Transactions (mainnet.decred.org): <span style="color: red;">'+NO_SUPPORT+"</span>"),"mtgox"==a&&StatusBox.mtgox.html('Mt.Gox Trades: <span style="color: red;">'+NO_SUPPORT+"</span>")},StatusBox.closed=function(a){"blockchain"==a&&StatusBox.blockchain.html('Transactions (mainnet.decred.org): <span style="color: gray;">'+CLOSED+"</span>"),"mtgox"==a&&StatusBox.mtgox.html('Mt.Gox Trades: <span style="color: gray;">'+CLOSED+"</span>")},extend(Floatable,Transaction);
//# sourceMappingURL=bitlisten.min.js.map