diff --git a/examples/analysis.html b/examples/analysis.html index 02188bc7..1f12bfdd 100644 --- a/examples/analysis.html +++ b/examples/analysis.html @@ -4,139 +4,56 @@ Analyser - - + + + - - - - - + - - - - -
-
Analyser
-
- Tone.Analyser - analyses the incoming audio to produce a TypedArray of either the - FFT data - or the waveform. The default returnType is "byte" which returns values - in the range 0-255. -
+ + + -
+ + Tone.FFT + returns the amplitude of the incoming signal at different frequencies. + Tone.Waveform + returns the signal value between 0-1. + - diff --git a/examples/animationSync.html b/examples/animationSync.html index 8be24141..11386be8 100644 --- a/examples/animationSync.html +++ b/examples/animationSync.html @@ -2,29 +2,23 @@ - ANIMATION SYNC + Analyser - - + + + - - - - - + - - - + + - - -
-
Synchronizing Visuals
-
+ + Audio scheduling and rendering visuals should always be kept separate. Instead of triggering visuals from within a scheduled event callback, schedule a 'deferred' callback using Tone.Draw which will be invoked on an animation frame at the exact moment of the scheduled event.

For more information see this wiki article. -
-
-
-
-
-
-
-
-
+ + +
+
+
+
+
+
+
+ +
- diff --git a/examples/audio/loop/drum_loop.png b/examples/audio/loop/drum_loop.png new file mode 100644 index 00000000..584de323 Binary files /dev/null and b/examples/audio/loop/drum_loop.png differ diff --git a/examples/bembe.html b/examples/bembe.html index 7b61cc2f..0450d680 100644 --- a/examples/bembe.html +++ b/examples/bembe.html @@ -1,41 +1,39 @@ - - CymbalSynth + + MetalSynth - - - + + + + - - - - - - - - - + -
-
Bembe
-
- Tone.MetalSynth + + + Tone.MetalSynth creates metallic, inharmonic sounds using 6 - Tone.FMOscillators + Tone.FMOscillators with a tuning based on the TR-808 Cymbal. - Tone.MembraneSynth + Tone.MembraneSynth makes kick and tom-like sounds using a frequency envelope which is triggered on notes attack. -
-
+ - diff --git a/examples/buses.html b/examples/buses.html index 75095f9f..f0a120aa 100644 --- a/examples/buses.html +++ b/examples/buses.html @@ -4,48 +4,51 @@ Buses - - - + + + + - - - - - - - - - - - + + -
-
Buses
-
+ + Buses make it easy to share effects across many instruments. send audio to a named bus from an instrument and then receive that channel on your effect. The gain values are all in decibels.

- Docs on send and - receive. -
-
-
-
- diff --git a/examples/daw.html b/examples/daw.html index d224d884..a7754276 100644 --- a/examples/daw.html +++ b/examples/daw.html @@ -2,91 +2,61 @@ - Transport Sync + DAW - - - + + + + - - - - - - - - - - - - + -
-
Transport Sync
-
+ + + + + This beat is composed of 3 independent Players each with a different loop length, synced to the Transport to start at different times and different offsets. The players stay synchronized to the position and offset of the Transport. -
-
- -
-
-
- - - -
-
+ - diff --git a/examples/envelope.html b/examples/envelope.html index 5b712f75..3abb9e52 100644 --- a/examples/envelope.html +++ b/examples/envelope.html @@ -4,61 +4,49 @@ Envelope - - - + + + + - - - - - - - - - - + -
-
Envelope
-
+ + Envelopes ramp amplitude, frequency or any other parameter over time. - Tone.Envelope and the classes that extend it + Tone.Envelope and the classes that extend it implement an ADSR envelope type which splits its ramp into four distinct phases: Attack, Decay, Sustain, Release. -
-
-
+ - diff --git a/examples/events.html b/examples/events.html index 21cd2b40..5467f395 100644 --- a/examples/events.html +++ b/examples/events.html @@ -2,42 +2,41 @@ - SCORE + Events - - + + + - - - - - - - - - - + -
-
Events
-
- Tone's Event classes (Tone.Event, - Tone.Loop, - Tone.Part and - Tone.Sequence) + + + Tone's Event classes (Tone.Event, + Tone.Loop, + Tone.Part and + Tone.Sequence) simplify scheduling events along the Transport. Each class abstracts away calls to - Transport.schedule or - scheduleRepeat + Transport.schedule or + scheduleRepeat and lets you create precise, rhythmic events which are startable, stoppable and loopable. + -
-
+ + + - diff --git a/examples/style/favicon.png b/examples/favicon.png similarity index 100% rename from examples/style/favicon.png rename to examples/favicon.png diff --git a/examples/fmSynth.html b/examples/fmSynth.html index c41fa465..7bd98c0f 100644 --- a/examples/fmSynth.html +++ b/examples/fmSynth.html @@ -4,37 +4,34 @@ FMSynth - - - + + + + - - - - - - - - - - - - + -
-
FMSynth
-
- Tone.FMSynth + + + + Tone.FMSynth is composed of two - Tone.Synths + Tone.Synths where one Tone.Synth modulates the frequency of a second Tone.Synth. -
-
+ - diff --git a/examples/funkyShape.html b/examples/funkyShape.html index 3e2a911c..5a6fdec7 100644 --- a/examples/funkyShape.html +++ b/examples/funkyShape.html @@ -3,30 +3,14 @@ VISUALIZING ENVELOPES - - - - - + + + + + - - - - - - - - - - - + + -
-
Using p5
-
- By accessing the envelope's current value, we can create responsive visuals that are directly tied to what is heard. -

- This sketch uses p5.js for visual components. -
-
- - - diff --git a/examples/grainPlayer.html b/examples/grainPlayer.html index e2678790..5a0f286c 100644 --- a/examples/grainPlayer.html +++ b/examples/grainPlayer.html @@ -2,39 +2,47 @@ - GRAINPLAYER + Grain Player - - - + + + + - - - - - - - - - - + -
-
Granular Synthesis
-
- Tone.GrainPlayer uses + + + + Tone.GrainPlayer uses granular synthesis to enable you to adjust pitch and playback rate independently. The grainSize is the amount of time each small chunk of audio is played for and the overlap is the amount of crossfading transition time between successive grains. -
-
-
- diff --git a/examples/index.html b/examples/index.html index 92e66526..7d3fc274 100644 --- a/examples/index.html +++ b/examples/index.html @@ -2,93 +2,29 @@ - EXAMPLES + Tone.js Examples - - - - - - + + - - + + + + -
- - -
- - diff --git a/examples/scripts/ExampleList.js b/examples/js/ExampleList.json similarity index 92% rename from examples/scripts/ExampleList.js rename to examples/js/ExampleList.json index aea7bd0a..fe0f7e70 100644 --- a/examples/scripts/ExampleList.js +++ b/examples/js/ExampleList.json @@ -1,4 +1,4 @@ -var ExampleList = { +{ "Basic" : { "Oscillators" : "oscillator", "Envelope" : "envelope", @@ -34,7 +34,7 @@ var ExampleList = { }, "Signals" : { "Control Voltage" : "signal", - "Ramping Values" : "rampTo", + "Ramping Values" : "rampTo" }, "Visualization" : { "Animation Sync" : "animationSync", @@ -43,7 +43,6 @@ var ExampleList = { "Meter" : "meter" }, "Misc" : { - "Module Loaders" : "require", "Offline Rendering" : "offline" - }, -}; + } +} diff --git a/examples/scripts/OrbitControls.js b/examples/js/OrbitControls.js similarity index 100% rename from examples/scripts/OrbitControls.js rename to examples/js/OrbitControls.js diff --git a/examples/scripts/THREE.Tone.js b/examples/js/THREE.Tone.js similarity index 100% rename from examples/scripts/THREE.Tone.js rename to examples/js/THREE.Tone.js diff --git a/examples/scripts/WebGLDetector.js b/examples/js/WebGLDetector.js similarity index 100% rename from examples/scripts/WebGLDetector.js rename to examples/js/WebGLDetector.js diff --git a/examples/scripts/p5.js b/examples/js/p5.js similarity index 100% rename from examples/scripts/p5.js rename to examples/js/p5.js diff --git a/examples/scripts/three.min.js b/examples/js/three.min.js similarity index 100% rename from examples/scripts/three.min.js rename to examples/js/three.min.js diff --git a/examples/js/tonejs-ui.js b/examples/js/tonejs-ui.js new file mode 100644 index 00000000..44c65736 --- /dev/null +++ b/examples/js/tonejs-ui.js @@ -0,0 +1,3120 @@ +!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=140)}([function(t,e,n){"use strict"; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const i=new WeakMap,r=t=>"function"==typeof t&&i.has(t),o=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,s=(t,e,n=null)=>{let i=e;for(;i!==n;){const e=i.nextSibling;t.removeChild(i),i=e}},a={},l=`{{lit-${String(Math.random()).slice(2)}}}`,c=`\x3c!--${l}--\x3e`,u=new RegExp(`${l}|${c}`),h="$lit$";class d{constructor(t,e){this.parts=[],this.element=e;let n=-1,i=0;const r=[],o=e=>{const s=e.content,a=document.createTreeWalker(s,133,null,!1);let c,d;for(;a.nextNode();){n++,c=d;const e=d=a.currentNode;if(1===e.nodeType){if(e.hasAttributes()){const r=e.attributes;let o=0;for(let t=0;t=0&&o++;for(;o-- >0;){const r=t.strings[i],o=v.exec(r)[2],s=o.toLowerCase()+h,a=e.getAttribute(s).split(u);this.parts.push({type:"attribute",index:n,name:o,strings:a}),e.removeAttribute(s),i+=a.length-1}}"TEMPLATE"===e.tagName&&o(e)}else if(3===e.nodeType){const t=e.nodeValue;if(t.indexOf(l)<0)continue;const o=e.parentNode,s=t.split(u),a=s.length-1;i+=a;for(let t=0;t-1!==t.index,f=()=>document.createComment(""),v=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=\/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +class b{constructor(t,e,n){this._parts=[],this.template=t,this.processor=e,this.options=n}update(t){let e=0;for(const n of this._parts)void 0!==n&&n.setValue(t[e]),e++;for(const t of this._parts)void 0!==t&&t.commit()}_clone(){const t=o?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=this.template.parts;let n=0,i=0;const r=t=>{const o=document.createTreeWalker(t,133,null,!1);let s=o.nextNode();for(;n(i=!0,e+n+h+r+l)),i||(e+=c)}return e+this.strings[t]}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}} +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +const m=t=>null===t||!("object"==typeof t||"function"==typeof t);class y{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;tthis.handleEvent(t))}setValue(t){this._pendingValue=t}commit(){for(;r(this._pendingValue);){const t=this._pendingValue;this._pendingValue=a,t(this)}if(this._pendingValue===a)return;const t=this._pendingValue,e=this.value,n=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),i=null!=t&&(null==e||n);n&&this.element.removeEventListener(this.eventName,this._boundHandleEvent,this._options),i&&(this._options=A(t),this.element.addEventListener(this.eventName,this._boundHandleEvent,this._options)),this.value=t,this._pendingValue=a}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const A=t=>t&&(k?{capture:t.capture,passive:t.passive,once:t.once}:t.capture); +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const I=new class{handleAttributeExpressions(t,e,n,i){const r=e[0];return"."===r?new S(t,e.slice(1),n).parts:"@"===r?[new M(t,e.slice(1),i.eventContext)]:"?"===r?[new w(t,e.slice(1),n)]:new y(t,e,n).parts}handleTextExpression(t){return new _(t)}}; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */function T(t){let e=N.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},N.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const i=t.strings.join(l);return void 0===(n=e.keyString.get(i))&&(n=new d(t,t.getTemplateElement()),e.keyString.set(i,n)),e.stringsArray.set(t.strings,n),n}const N=new Map,C=new WeakMap,P=(t,...e)=>new g(t,e,"html",I),O=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */function R(t,e){const{element:{content:n},parts:i}=t,r=document.createTreeWalker(n,O,null,!1);let o=$(i),s=i[o],a=-1,l=0;const c=[];let u=null;for(;r.nextNode();){a++;const t=r.currentNode;for(t.previousSibling===u&&(u=null),e.has(t)&&(c.push(t),null===u&&(u=t)),null!==u&&l++;void 0!==s&&s.index===a;)s.index=null!==u?-1:s.index-l,s=i[o=$(i,o)]}c.forEach(t=>t.parentNode.removeChild(t))}const F=t=>{let e=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?0:1;const n=document.createTreeWalker(t,O,null,!1);for(;n.nextNode();)e++;return e},$=(t,e=-1)=>{for(let n=e+1;n`${t}--${e}`;let D=!0;void 0===window.ShadyCSS?D=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected.Please update to at least @webcomponents/webcomponentsjs@2.0.2 and@webcomponents/shadycss@1.3.1."),D=!1);const L=t=>e=>{const n=z(e.type,t);let i=N.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},N.set(n,i));let r=i.stringsArray.get(e.strings);if(void 0!==r)return r;const o=e.strings.join(l);if(void 0===(r=i.keyString.get(o))){const n=e.getTemplateElement();D&&window.ShadyCSS.prepareTemplateDom(n,t),r=new d(e,n),i.keyString.set(o,r)}return i.stringsArray.set(e.strings,r),r},j=["html","svg"],q=new Set,H=(t,e,n)=>{q.add(n);const i=t.querySelectorAll("style");if(0===i.length)return;const r=document.createElement("style");for(let t=0;t{j.forEach(e=>{const n=N.get(z(e,t));void 0!==n&&n.keyString.forEach(t=>{const{element:{content:e}}=t,n=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{n.add(t)}),R(t,n)})})})(n),function(t,e,n=null){const{element:{content:i},parts:r}=t;if(null==n)return void i.appendChild(e);const o=document.createTreeWalker(i,O,null,!1);let s=$(r),a=0,l=-1;for(;o.nextNode();)for(l++,o.currentNode===n&&(a=F(e),n.parentNode.insertBefore(e,n));-1!==s&&r[s].index===l;){if(a>0){for(;-1!==s;)r[s].index+=a,s=$(r,s);return}s=$(r,s)}}(e,r,e.element.content.firstChild),window.ShadyCSS.prepareTemplateStyles(e.element,n),window.ShadyCSS.nativeShadow){const n=e.element.content.querySelector("style");t.insertBefore(n.cloneNode(!0),t.firstChild)}else{e.element.content.insertBefore(r,e.element.content.firstChild);const t=new Set;t.add(r),R(e,t)}},V=t=>null!==t,B=t=>t?"":null,G=(t,e)=>e!==t&&(e==e||t==t),U={attribute:!0,type:String,reflect:!1,hasChanged:G},W=new Promise(t=>t(!0)),Y=1,K=4,X=8;class J extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=W,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this._finalize();const t=[];for(const[e,n]of this._classProperties){const i=this._attributeNameForProperty(e,n);void 0!==i&&(this._attributeToPropertyMap.set(i,e),t.push(i))}return t}static createProperty(t,e=U){if(!this.hasOwnProperty("_classProperties")){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}if(this._classProperties.set(t,e),this.prototype.hasOwnProperty(t))return;const n="symbol"==typeof t?Symbol():`__${t}`;Object.defineProperty(this.prototype,t,{get(){return this[n]},set(i){const r=this[t];this[n]=i,this._requestPropertyUpdate(t,r,e)},configurable:!0,enumerable:!0})}static _finalize(){if(this.hasOwnProperty("_finalized")&&this._finalized)return;const t=Object.getPrototypeOf(this);"function"==typeof t._finalize&&t._finalize(),this._finalized=!0,this._attributeToPropertyMap=new Map;const e=this.properties,n=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const t of n)this.createProperty(t,e[t])}static _attributeNameForProperty(t,e){const n=void 0!==e&&e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,n=G){return n(t,e)}static _propertyValueFromAttribute(t,e){const n=e&&e.type;if(void 0===n)return t;const i=n===Boolean?V:"function"==typeof n?n:n.fromAttribute;return i?i(t):t}static _propertyValueToAttribute(t,e){if(void 0===e||void 0===e.reflect)return;return(e.type===Boolean?B:e.type&&e.type.toAttribute||String)(t)}initialize(){this.renderRoot=this.createRenderRoot(),this._saveInstanceProperties()}_saveInstanceProperties(){for(const[t]of this.constructor._classProperties)if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}_applyInstanceProperties(){for(const[t,e]of this._instanceProperties)this[t]=e;this._instanceProperties=void 0}createRenderRoot(){return this.attachShadow({mode:"open"})}connectedCallback(){this._updateState&Y?void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this):this.requestUpdate()}disconnectedCallback(){}attributeChangedCallback(t,e,n){e!==n&&this._attributeToProperty(t,n)}_propertyToAttribute(t,e,n=U){const i=this.constructor,r=i._propertyValueToAttribute(e,n);if(void 0!==r){const e=i._attributeNameForProperty(t,n);void 0!==e&&(this._updateState=this._updateState|X,null===r?this.removeAttribute(e):this.setAttribute(e,r),this._updateState=this._updateState&~X)}}_attributeToProperty(t,e){if(!(this._updateState&X)){const n=this.constructor,i=n._attributeToPropertyMap.get(t);if(void 0!==i){const t=n._classProperties.get(i);this[i]=n._propertyValueFromAttribute(e,t)}}}requestUpdate(t,e){if(void 0!==t){const n=this.constructor._classProperties.get(t)||U;return this._requestPropertyUpdate(t,e,n)}return this._invalidate()}_requestPropertyUpdate(t,e,n){return this.constructor._valueHasChanged(this[t],e,n.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0===n.reflect&&(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,n)),this._invalidate()):this.updateComplete}async _invalidate(){if(!this._hasRequestedUpdate){let t;this._updateState=this._updateState|K;const e=this._updatePromise;this._updatePromise=new Promise(e=>t=e),await e,this._validate(),t(!this._hasRequestedUpdate)}return this.updateComplete}get _hasRequestedUpdate(){return this._updateState&K}_validate(){if(this._instanceProperties&&this._applyInstanceProperties(),this.shouldUpdate(this._changedProperties)){const t=this._changedProperties;this.update(t),this._markUpdated(),this._updateState&Y||(this._updateState=this._updateState|Y,this.firstUpdated(t)),this.updated(t)}else this._markUpdated()}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~K}get updateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){if(void 0!==this._reflectingProperties&&this._reflectingProperties.size>0){for(const[t,e]of this._reflectingProperties)this._propertyToAttribute(t,this[t],e);this._reflectingProperties=void 0}}updated(t){}firstUpdated(t){}}J._attributeToPropertyMap=new Map,J._finalized=!0,J._classProperties=new Map,J.properties={}; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +Q((t,e)=>t.querySelector(e)),Q((t,e)=>t.querySelectorAll(e));function Q(t){return e=>(n,i)=>{Object.defineProperty(n,i,{get(){return t(this.renderRoot,e)},enumerable:!0,configurable:!0})}}n.d(e,"a",function(){return Z}),n.d(e,"b",function(){return P}); +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +class Z extends J{update(t){super.update(t);const e=this.render();e instanceof g&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this})}render(){}}Z.render=((t,e,n)=>{const i=n.scopeName,r=C.has(e),o=e instanceof ShadowRoot&&D&&t instanceof g,a=o&&!q.has(i),l=a?document.createDocumentFragment():e;if(((t,e,n)=>{let i=C.get(e);void 0===i&&(s(e,e.firstChild),C.set(e,i=new _(Object.assign({templateFactory:T},n))),i.appendInto(e)),i.setValue(t),i.commit()})(t,l,Object.assign({templateFactory:L(i)},n)),a){const t=C.get(l);C.delete(l),t.value instanceof b&&H(l,t.value.template,i),s(e,e.firstChild),e.appendChild(l),C.set(e,t)}!r&&o&&window.ShadyCSS.styleElement(e.host)})},function(t,e,n){var i=n(3),r=n(13),o=n(16),s=n(17),a=n(21),l=function(t,e,n){var c,u,h,d,p=t&l.F,f=t&l.G,v=t&l.S,b=t&l.P,g=t&l.B,m=f?i:v?i[e]||(i[e]={}):(i[e]||{}).prototype,y=f?r:r[e]||(r[e]={}),x=y.prototype||(y.prototype={});for(c in f&&(n=e),n)h=((u=!p&&m&&void 0!==m[c])?m:n)[c],d=g&&u?a(h,i):b&&"function"==typeof h?a(Function.call,h):h,m&&s(m,c,h,t&l.U),y[c]!=h&&o(y,c,d),b&&x[c]!=h&&(x[c]=h)};i.core=r,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,t.exports=l},function(t,e,n){var i=n(4);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var i=n(54)("wks"),r=n(39),o=n(3).Symbol,s="function"==typeof o;(t.exports=function(t){return i[t]||(i[t]=s&&o[t]||(s?o:r)("Symbol."+t))}).store=i},function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return r});var i=n(0);class r extends i.a{static get properties(){return{collapsed:{type:Boolean}}}constructor(){super(),this.collapsed=!1,this._syncTimeout=-1}setAttribute(t,e,n){e.set(n)}bind(e){Array.from(this.shadowRoot.querySelectorAll("[attribute]")).forEach(n=>{const i=n.getAttribute("attribute");this.addEventListener(i,n=>{t.Tone.isDefined(e[i])&&(t.Tone.isDefined(e[i].value)?e[i].value=n.detail:e[i]=n.detail),this.sync(e)})}),Array.from(this.shadowRoot.querySelectorAll("[component]")).forEach(t=>{const n=t.getAttribute("component");t&&t.bind(e[n])}),this.sync(e),this.addEventListener("collapse",()=>this.sync(e)),this.addEventListener("sync",()=>this.sync(e))}sync(t){Array.from(this.shadowRoot.querySelectorAll("[attribute]")).forEach(e=>{const n=e.getAttribute("attribute");void 0!==t[n]&&e.sync(t)}),Array.from(this.shadowRoot.querySelectorAll("[component]")).forEach(e=>{const n=e.getAttribute("component");void 0!==t[n]&&e.sync(t[n])}),clearTimeout(this._syncTimeout),this._syncTimeout=setTimeout(()=>{const e=Array.from(this.shadowRoot.querySelectorAll(".viz"));e.length&&e.forEach(e=>e.visualize(t))},10)}}}).call(this,n(135))},function(t,e,n){var i=n(2),r=n(100),o=n(24),s=Object.defineProperty;e.f=n(9)?Object.defineProperty:function(t,e,n){if(i(t),e=o(e,!0),i(n),r)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){t.exports=!n(5)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var i=n(26),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(25);t.exports=function(t){return Object(i(t))}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(t,e,n){var i=n(51),r=n(25);t.exports=function(t){return i(r(t))}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(8),r=n(33);t.exports=n(9)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var i=n(3),r=n(16),o=n(15),s=n(39)("src"),a=Function.toString,l=(""+a).split("toString");n(13).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var c="function"==typeof n;c&&(o(n,"name")||r(n,"name",e)),t[e]!==n&&(c&&(o(n,s)||r(n,s,t[e]?""+t[e]:l.join(String(e)))),t===i?t[e]=n:a?t[e]?t[e]=n:r(t,e,n):(delete t[e],r(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[s]||a.call(this)})},function(t,e,n){var i=n(52),r=n(33),o=n(14),s=n(24),a=n(15),l=n(100),c=Object.getOwnPropertyDescriptor;e.f=n(9)?c:function(t,e){if(t=o(t),e=s(e,!0),l)try{return c(t,e)}catch(t){}if(a(t,e))return r(!i.f.call(t,e),t[e])}},function(t,e,n){var i=n(15),r=n(11),o=n(73)("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),i(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},function(t,e,n){var i=n(1),r=n(5),o=n(25),s=/"/g,a=function(t,e,n,i){var r=String(o(t)),a="<"+e;return""!==n&&(a+=" "+n+'="'+String(i).replace(s,""")+'"'),a+">"+r+""};t.exports=function(t,e){var n={};n[t]=e(a),i(i.P+i.F*r(function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}),"String",n)}},function(t,e,n){var i=n(12);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){"use strict";var i=n(5);t.exports=function(t,e){return!!t&&i(function(){e?t.call(null,function(){},1):t.call(null)})}},function(t,e,n){var i=n(4);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e,n){var i=n(1),r=n(13),o=n(5);t.exports=function(t,e){var n=(r.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*o(function(){n(1)}),"Object",s)}},function(t,e,n){var i=n(21),r=n(51),o=n(11),s=n(10),a=n(89);t.exports=function(t,e){var n=1==t,l=2==t,c=3==t,u=4==t,h=6==t,d=5==t||h,p=e||a;return function(e,a,f){for(var v,b,g=o(e),m=r(g),y=i(a,f,3),x=s(m.length),_=0,w=n?p(e,x):l?p(e,0):void 0;x>_;_++)if((d||_ in m)&&(b=y(v=m[_],_,g),t))if(n)w[_]=b;else if(b)switch(t){case 3:return!0;case 5:return v;case 6:return _;case 2:w.push(v)}else if(u)return!1;return h?-1:c||u?u:w}}},function(t,e,n){var i=n(102),r=n(74);t.exports=Object.keys||function(t){return i(t,r)}},function(t,e,n){var i=n(2),r=n(103),o=n(74),s=n(73)("IE_PROTO"),a=function(){},l=function(){var t,e=n(71)("iframe"),i=o.length;for(e.style.display="none",n(75).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write(" - - - - - - - - - - + - -
-
Supersaw
-
- Tone.FatOscillator creates multiple oscillators + + + + + Tone.FatOscillator creates multiple oscillators and detunes them slightly from each other to thicken the sound. The count parameter sets the number of oscillators and spread sets the total spread (in cents) between the oscillators.

- FatOscillator is also available in Tone.OmniOscillator + FatOscillator is also available in Tone.OmniOscillator by prefixing another type with "fat", then use the count and spread to control the number and detune of the oscillators. To create a "supersaw": omniOscillator.type = "fatsawtooth".

Jump by Van Halen MIDI converted using MidiConvert -
-
+ - diff --git a/examples/lfoEffects.html b/examples/lfoEffects.html index 3639a003..7ff54134 100644 --- a/examples/lfoEffects.html +++ b/examples/lfoEffects.html @@ -3,39 +3,44 @@ LFO Effects - - - + + + + - - - - - - - - - + -
-
LFO Effects
-
- These effects use an LFO (Low Frequency Oscillator) to modulate the effect. Click and drag the dot to change the frequency and depth of the effect. + + + + These effects use an LFO (Low Frequency Oscillator) to modulate the effect. Click and drag the dot to change the frequency and depth of the effect.

- Docs on Tone.AutoPanner, - Tone.AutoFilter, and - Tone.Tremolo -
-
- -
-
- diff --git a/examples/meter.html b/examples/meter.html index c83277ea..f436fe72 100644 --- a/examples/meter.html +++ b/examples/meter.html @@ -4,106 +4,49 @@ Meter - - + + + - - - - - - - - - - + -
-
Meter
-
- Tone.Meter + + + + + Tone.Meter gives you the level of the incoming signal in decibels. -
+ -
+ + + + - diff --git a/examples/mic.html b/examples/mic.html index 139297ed..a598249a 100644 --- a/examples/mic.html +++ b/examples/mic.html @@ -2,104 +2,44 @@ - MICROPHONE + Microphone - - + + + - - - - - - - - - - - + -
-
Microphone
-
+ + If supported, Tone.UserMedia uses getUserMedia to open the user's microphone where it can then be processed with Tone.js. Only works on https domains. -
-
- diff --git a/examples/mixer.html b/examples/mixer.html index d8dfc4ea..5dbeaa40 100644 --- a/examples/mixer.html +++ b/examples/mixer.html @@ -4,149 +4,58 @@ Mixer - - + + + - - - - - - - - - - - - + -
-
PanVol / Solo
-
- Tone.PanVol combines panning and volume control into one component. Tone.Solo allows you to selectively solo the connected audio. -
-
-
+ + + + + + Tone.Channel provides a simple channel interface. It allows for panning and volume changes as well as the ability to solo (exclude audio in other Tone.Channels). + - diff --git a/examples/monoSynth.html b/examples/monoSynth.html index ffd0b6bc..ba601743 100644 --- a/examples/monoSynth.html +++ b/examples/monoSynth.html @@ -4,38 +4,34 @@ MonoSynth - - - + + + + - - - - - - - - - - - + - -
-
MonoSynth
-
- Tone.MonoSynth + + + + + Tone.MonoSynth is composed of one oscillator, one filter, and two envelopes. Both envelopes are triggered simultaneously when a note is triggered. -
-
-
+ - diff --git a/examples/noises.html b/examples/noises.html index f41fcd0f..f9abce30 100644 --- a/examples/noises.html +++ b/examples/noises.html @@ -2,68 +2,50 @@ - NOISES + Noise - - + + + - - - - - - - - - - + - -
-
Noise
-
- Tone.Noise + + + Tone.Noise has 3 different types of noise. Careful, it's loud! -
-
-
- diff --git a/examples/offline.html b/examples/offline.html index e9e310e4..4f1628e3 100644 --- a/examples/offline.html +++ b/examples/offline.html @@ -3,45 +3,39 @@ Offline - - - + + + + - - - - - - - - - - + -
-
Offline
-
+ + + + Tone.Offline renders a chunk of Tone.js code into an AudioBuffer. An offline instance of Tone.Transport is passed into the callback which can be used to schedule events. It may take a moment to render the sound.

- Tone.Offline docs. -
-
- diff --git a/examples/oscillator.html b/examples/oscillator.html index 88156aa7..d9171239 100644 --- a/examples/oscillator.html +++ b/examples/oscillator.html @@ -3,64 +3,45 @@ Oscillator - - - + + + + - - - - - - - - - - + + -
-
Oscillator
-
- Click and drag the dot to hear the oscillator. The x-axis controls the frequency of the oscillator and the y-axis controls the volume. + + + The oscillator has 4 basic types which can be altered by setting the number + of partials and partials array.

- Tone.Oscillator docs. -
-
-
- diff --git a/examples/pianoPhase.html b/examples/pianoPhase.html index 6f7559a9..de8a48dc 100644 --- a/examples/pianoPhase.html +++ b/examples/pianoPhase.html @@ -4,51 +4,46 @@ Phasing - - - + + + + - - - - - - - - - - + - + -
-
Piano Phase
-
+ + By slightly slowing down the playbackRate of the Tone.Sequence in the right channel, the two identical melodies phase against each other in interesting ways. +

Composition by Steve Reich. Inspiration from Alexander Chen. -
- - -
+ - diff --git a/examples/pingPongDelay.html b/examples/pingPongDelay.html index 0cb3cc33..8fb0018f 100644 --- a/examples/pingPongDelay.html +++ b/examples/pingPongDelay.html @@ -2,34 +2,43 @@ - PINGPONG DELAY + Ping Pong Delay - - - + + + + - - - - - - - - - + + -
-
Ping Pong Delay
-
+ + + + A Ping Pong Delay is a stereo feedback delay where the delay bounces back and forth between the left and right channels. Hit the button to trigger a snare sample into the effect.

- Tone.PingPongDelay docs. -
-
- diff --git a/examples/player.html b/examples/player.html index 43ad86cf..5322369f 100644 --- a/examples/player.html +++ b/examples/player.html @@ -2,55 +2,47 @@ - PLAYER + Player - - - + + + + - - - - - - - - - - + + -
-
Grains
-
- Click on the button to play the audio file on loop - using Tone.Player. -
-
- diff --git a/examples/polySynth.html b/examples/polySynth.html index 30d1a36d..c44e67b5 100644 --- a/examples/polySynth.html +++ b/examples/polySynth.html @@ -4,59 +4,45 @@ PolySynth - - - + + + + - - - - - - - - - - - + - -
-
PolySynth
-
- Tone.PolySynth - handles voice creation and allocation for any + + + + + Tone.PolySynth + handles voice creation and allocation for any monophonic instruments passed in as the second parameter. PolySynth is not a synthesizer by itself, it merely manages voices of one of the other types of synths, allowing any of the monophonic synthesizers to be polyphonic. -
-
-
+ - - + \ No newline at end of file diff --git a/examples/quantization.html b/examples/quantization.html index de1db2de..772d3937 100644 --- a/examples/quantization.html +++ b/examples/quantization.html @@ -2,79 +2,76 @@ - Quantize - - - + Quantization + + + + - - - - - - - - - + - -
-
Quantization
-
+ + Using the "@" symbol, Time expressions can be quantized (aligned to a subdivision). In this example, a note's start time is aligned to the given subdivision. -
-
- diff --git a/examples/rampTo.html b/examples/rampTo.html index fa843816..4da0a7cd 100644 --- a/examples/rampTo.html +++ b/examples/rampTo.html @@ -2,46 +2,38 @@ - SIGNAL RAMP + Signal Ramping - - + + + - - - - - - - - - - + - - -
-
rampTo
-
- In Tone.js, many of a class' members are Tone.Signals. + + Working with signals is different than working with numbers or strings: Signals are values which are updated at audio rate, which allows for sample-accurate scheduling and ramping. .rampTo(value, rampTime) smoothly changes the signal from the current value to the target value over the duration of the rampTime. This example uses .rampTo in to smooth out changes in volume and frequency. -
-
+ - diff --git a/examples/require.html b/examples/require.html deleted file mode 100644 index c1eb5d24..00000000 --- a/examples/require.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - MODULE LOADERS - - - - - - - - - - - -
-
Module Loaders
-
- RequireJS - is a powerful module and build system which Tone.js uses internally. - By only including the modules that your application needs, your build can be - much smaller and your code much more modular. -

- If you use RequireJS (or any other UMD module loader), but build-size is less of a concern, - you can simply include the entire Tone.js build. -

- Take a look at the source to see how. -
-
- - - diff --git a/examples/reverb.html b/examples/reverb.html index 1ce344eb..7899c962 100644 --- a/examples/reverb.html +++ b/examples/reverb.html @@ -4,88 +4,50 @@ Reverb - - - + + + + - - - - - - - - - - - - + -
-
Reverb
-
- Tone.Reverb + + + + Tone.Reverb is a convolution-based reverb. An impulse response is created with a decaying noise burst when you click 'Generate Reverb'. The 'Decay Time' controls how long the noise burst lasts. If the 'Decay Time' is changed, a new noise burst will need to be generated.

Note: because of restrictions on iOS, 'generate' must be called from an explicit user action like a tap or click. -
-
- - diff --git a/examples/sampler.html b/examples/sampler.html index d164d5fd..22a2f620 100644 --- a/examples/sampler.html +++ b/examples/sampler.html @@ -4,98 +4,72 @@ Sampler - - + + + - - - - - - - - - - - + - -
-
Sampler
-
+ + + + Tone.Sampler makes it easy to create an instrument from audio samples. Pass in an object which maps the note's pitch or midi value to the url, then you can trigger the attack and release of that note like other instruments. By automatically repitching the samples, it is possible to play pitches which were not explicitly included which can save loading time. -
-
-
+ - diff --git a/examples/scripts/Interface.js b/examples/scripts/Interface.js deleted file mode 100644 index d6eeebd4..00000000 --- a/examples/scripts/Interface.js +++ /dev/null @@ -1,535 +0,0 @@ -/* globals Tone, StartAudioContext */ - - -var Interface = { - isMobile : false -}; - -/** - * - * - * INIT - * - */ -$(function(){ - // make all links open a new tab - $("a").attr("target", "_blank"); - //mobile start - if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { - Interface.isMobile = true; - $("body").addClass("Mobile"); - var element = $("
", {"id" : "MobileStart"}).appendTo("body"); - var button = $("
").attr("id", "Button").text("Enter").appendTo(element); - StartAudioContext(Tone.context, button, function(){ - element.remove(); - }); - } -}); - -/** - * - * LOADING INDICATOR - * - */ -Interface.Loader = function(){ - if (this instanceof Interface.Loader){ - - this.element = $("
", { - "id" : "Loading", - }).appendTo("body"); - - this.text = $("
", { - "id" : "Text", - "text" : "Loading" - }).appendTo(this.element); - - Tone.Buffer.on("load", function(){ - this.element.addClass("Loaded"); - }.bind(this)); - - } else { - return new Interface.Loader(); - } -}; - -/** - * - * - * DRAGGER - * - */ -Interface.Dragger = function(params){ - - if (this instanceof Interface.Dragger){ - - if ($("#DragContainer").length === 0){ - $("
", { - "id" : "DragContainer" - }).appendTo(params.parent || "#Content"); - } - - this.container = $("#DragContainer"); - - /** - * the tone object - */ - this.tone = params.tone; - - /** - * callbacks - */ - this.start = params.start; - - this.end = params.end; - - this.drag = params.drag; - - /** - * the name - */ - var name = params.name ? params.name : this.tone ? this.tone.toString() : ""; - - /** - * elements - */ - this.element = $("
", { - "class" : "Dragger", - "id" : name - }).appendTo(this.container) - .on("dragMove", this._ondrag.bind(this)) - .on("touchstart mousedown", this._onstart.bind(this)) - .on("dragEnd touchend mouseup", this._onend.bind(this)); - - this.name = $("
", { - "id" : "Name", - "text" : name - }).appendTo(this.element); - - this.element.draggabilly({ - "axis" : this.axis, - "containment": this.container - }); - - /** - * x slider - */ - var xParams = params.x; - xParams.axis = "x"; - xParams.element = this.element; - xParams.tone = this.tone; - xParams.container = this.container; - this.xAxis = new Interface.Slider(xParams); - - /** - * y slider - */ - var yParams = params.y; - yParams.axis = "y"; - yParams.element = this.element; - yParams.tone = this.tone; - yParams.container = this.container; - this.yAxis = new Interface.Slider(yParams); - - //set the axis indicator - var position = this.element.position(); - this.halfSize = this.xAxis.halfSize; - this.xAxis.axisIndicator.css("top", position.top + this.halfSize); - this.yAxis.axisIndicator.css("left", position.left + this.halfSize); - } else { - return new Interface.Dragger(params); - } -}; - -Interface.Dragger.prototype._ondrag = function(e, pointer){ - if (this.drag){ - this.drag(); - } - this.xAxis._ondrag(e, pointer); - this.yAxis._ondrag(e, pointer); - var position = this.element.position(); - this.xAxis.axisIndicator.css("top", position.top + this.halfSize); - this.yAxis.axisIndicator.css("left", position.left + this.halfSize); -}; - -Interface.Dragger.prototype._onstart = function(e){ - if (this.start){ - this.start(); - } - this.xAxis._onstart(e); - this.yAxis._onstart(e); -}; - -Interface.Dragger.prototype._onend = function(e){ - if (this.end){ - this.end(); - } - this.xAxis._onend(e); - this.yAxis._onend(e); - var position = this.element.position(); - this.xAxis.axisIndicator.css("top", position.top + this.halfSize); - this.yAxis.axisIndicator.css("left", position.left + this.halfSize); -}; - - - -/** - * - * - * SLIDER - * - */ -Interface.Slider = function(params){ - - if (this instanceof Interface.Slider){ - - this.tone = params.tone; - - /** - * the name - */ - var name = params.name ? params.name : this.tone ? this.tone.toString() : ""; - - /** - * callback functions - */ - this.start = params.start; - - this.end = params.end; - - this.drag = params.drag; - - /** - * the axis indicator - */ - this.axis = params.axis || "x"; - - if (!params.element){ - - this.container = $("
", { - "class" : "Slider "+this.axis, - }).appendTo(params.parent || "#Content"); - - this.element = $("
", { - "class" : "Dragger", - "id" : name - }).appendTo(this.container) - .on("dragMove", this._ondrag.bind(this)) - .on("touchstart mousedown", this._onstart.bind(this)) - .on("dragEnd touchend mouseup", this._onend.bind(this)); - - this.name = $("
", { - "id" : "Name", - "text" : name - }).appendTo(this.element); - - this.element.draggabilly({ - "axis" : this.axis, - "containment": this.container.get(0) - }); - } else { - this.element = params.element; - - this.container = params.container; - } - - this.axisIndicator = $("
", { - "id" : this.axis + "Axis", - "class" : "Axis" - }).appendTo(this.container); - - /** - * the initial value / position - */ - this.parameter = params.param || false; - //default values - this.min = typeof params.min === "undefined" ? 0 : params.min; - this.max = typeof params.max === "undefined" ? 1 : params.max; - this.exp = typeof params.exp === "undefined" ? 1 : params.exp; - if (params.options){ - this.options = params.options; - this.min = 0; - this.max = this.options.length - 1; - this.exp = params.exp || 1; - } - - /** - * cache some measurements for later - */ - this.halfSize = this.element.width() / 2; - - this.maxAxis = this.axis === "x" ? "width" : "height"; - this.posAxis = this.axis === "x" ? "left" : "top"; - this.oppositeAxis = this.axis === "x" ? "top" : "left"; - - /** - * initial value - */ - if (this.parameter || typeof params.value !== "undefined"){ - - var paramValue = typeof params.value !== "undefined" ? params.value : this.tone.get(this.parameter); - - this.value(paramValue); - } - - } else { - return new Interface.Slider(params); - } -}; - -Interface.Slider.prototype.value = function(val){ - var maxSize = this.container[this.maxAxis]() - this.element[this.maxAxis](); - //y gets inverted - if (this.axis === "y"){ - maxSize = this.container[this.maxAxis]() - maxSize; - } - - if (val.hasOwnProperty(this.parameter)){ - val = val[this.parameter]; - } - - if (this.options){ - val = this.options.indexOf(val); - } - - var pos = (val - this.min) / (this.max - this.min); - if (this.axis === "y"){ - pos = 1 - pos - } - pos = Math.pow(pos, 1 / this.exp) * (maxSize ); - this.element.css(this.posAxis, pos); - - if (this.options){ - this._setParam(this.options[val]); - } -}; - - -Interface.Slider.prototype._ondrag = function(e, pointer){ - if (typeof this.top === "undefined"){ - this.top = this.container.offset().top; - this.left = this.container.offset().left; - } - - var normPos; - if (this.axis === "x"){ - var xVal = Math.max((pointer.pageX - this.left), 0); - normPos = xVal / (this.container.width()); - } else { - var yVal = Math.max((pointer.pageY - this.top ), 0); - normPos = yVal / (this.container.height()); - normPos = Math.max(1 - normPos, 0); - } - normPos = Math.pow(normPos, this.exp); - - var result = normPos * (this.max - this.min) + this.min; - - result = Math.max(Math.min(this.max, result), this.min); - - var value = result; - - if (this.options){ - value = this.options[Math.round(result)]; - } - - if (this.drag){ - this.drag(value); - } - - this._setParam(value); -}; - -Interface.Slider.prototype._onstart = function(e){ - e.preventDefault(); - if (this.start){ - this.start(); - } -}; - -Interface.Slider.prototype._onend = function(){ - if (this.end){ - this.end(); - } -}; - -Interface.Slider.prototype._setParam = function(value){ - if (this.parameter && this.tone){ - this.tone.set(this.parameter, value); - } -}; - -/** - * - * BUTTON - * - */ -Interface.Button = function(params){ - - if (this instanceof Interface.Button){ - - this.activeText = params.activeText || false; - - this.text = params.text || "Button"; - - this.type = params.type || "moment"; - - this.element = $("
", { - "class" : "Button", - "text" : this.text - }).appendTo(params.parent || "#Content") - .on("mousedown touchstart", this._start.bind(this)); - - if (this.type === "moment"){ - this.element.on("mouseup touchend", this._end.bind(this)); - } else { - this.element.addClass("Toggle"); - } - - /** - * the button state - */ - this.active = false; - - /** - * callbacks - */ - this.start = params.start; - this.end = params.end; - - /** - * key presses - */ - if (params.key){ - this.key = params.key; - $(window).on("keydown", this._keydown.bind(this)); - if (this.type === "moment"){ - $(window).on("keyup", this._keyup.bind(this)); - } - } - } else { - return new Interface.Button(params); - } -}; - -Interface.Button.prototype._start = function(e){ - if (e){ - e.preventDefault(); - } - if (!this.active){ - this.active = true; - this.element.addClass("Active"); - if (this.activeText){ - this.element.text(this.activeText); - } - if (this.start){ - this.start(); - } - } else if (this.type === "toggle" && this.active){ - this._end(); - } -}; - -Interface.Button.prototype._end = function(e){ - if (e){ - e.preventDefault(); - } - if (this.active){ - this.active = false; - this.element.removeClass("Active"); - this.element.text(this.text); - if (this.end){ - this.end(); - } - } -}; - -Interface.Button.prototype._keydown = function(e){ - if (e.which === this.key){ - e.preventDefault(); - this._start(); - } -}; - -Interface.Button.prototype._keyup = function(e){ - if (e.which === this.key){ - e.preventDefault(); - this._end(); - } -}; - -/** - * - * TRANSPORT - * - */ -Interface.Transport = function(){ - - if (this instanceof Interface.Transport){ - - this.element = $("
", { - "class" : "Transport", - }).appendTo("#Content"); - - this.position = $("
", { - "id" : "Position" - }).appendTo(this.element); - - this._boundLoop = this._loop.bind(this); - this._loop(); - - } else { - return new Interface.Transport(); - } -}; - -Interface.Transport.prototype._loop = function(){ - setTimeout(this._boundLoop, 50); - this.position.text(Tone.Transport.position); -}; - - -/** - * - * KEYBOARD - * - */ -Interface.Keyboard = function(){ - - if (this instanceof Interface.Keyboard){ - - this.element = $("
", { - "class" : "Keyboard", - }).appendTo("#Content"); - - if (window.Keyboard){ - this.keyboard = new Keyboard(this.element.get(0), 48, 4); - $(window).on("resize", this._resize.bind(this)); - this._resize(); - - this.keyboard.on("keyDown", function(midi){ - if (this.keyDown){ - this.keyDown(Tone.Frequency(midi, "midi").toNote()); - } - }.bind(this)); - - this.keyboard.on("keyUp", function(midi){ - if (this.keyUp){ - this.keyUp(Tone.Frequency(midi, "midi").toNote()); - } - }.bind(this)); - } - - } else { - return new Interface.Keyboard(); - } -}; - -Interface.Keyboard.prototype._resize = function(){ - var width = $(window).width(); - var octaves = Math.round(width / 220); - this.keyboard.octaves = Math.max(octaves, 2); - if (octaves > 4){ - this.keyboard.rootNote = 36; - } else { - this.keyboard.rootNote = 48; - } -} diff --git a/examples/scripts/Keyboard.js b/examples/scripts/Keyboard.js deleted file mode 100644 index bf9c099d..00000000 --- a/examples/scripts/Keyboard.js +++ /dev/null @@ -1,6 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Keyboard=t():e.Keyboard=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:36,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;i(this,t);var s=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s._lowest=n,s._octaves=r,s._audioKeys=new c.default({polyphony:88,rows:1,octaveControls:!1}),s._audioKeys.down(function(e){s.keyDown(e.note),s.emit("keyDown",e.note)}),s._audioKeys.up(function(e){s.keyUp(e.note),s.emit("keyUp",e.note)}),s._keyboardInterface=new p.KeyboardElement(e,48,2),s._keyboardInterface.on("keyDown",function(e){s.keyDown(e),s.emit("keyDown",e)}),s._keyboardInterface.on("keyUp",function(e){s.keyUp(e),s.emit("keyUp",e)}),window.addEventListener("resize",s._resize.bind(s)),s._resize(),s._midi=new f.Midi,s._midi.on("keyDown",function(e){s.keyDown(e),s.emit("keyDown",e)}),s._midi.on("keyUp",function(e){s.keyUp(e),s.emit("keyUp",e)}),s}return s(t,e),a(t,[{key:"keyDown",value:function(e){this._keyboardInterface.keyDown(e)}},{key:"keyUp",value:function(e){this._keyboardInterface.keyUp(e)}},{key:"_resize",value:function(){this._keyboardInterface.resize(this._lowest,this._octaves)}},{key:"octaves",get:function(){return this._octaves},set:function(e){this._octaves=e,this._resize()}},{key:"rootNote",get:function(){return this._rootNote},set:function(e){this._lowest=e,this._resize()}}]),t}(l.default.EventEmitter);e.exports=d},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardElement=void 0;var a=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:36,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;i(this,t);var s=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s._container=document.createElement("div"),s._container.id="keyboard",e.setAttribute("touch-action","none"),e.addEventListener("pointerup",function(e){return s._pointerUp(e.pointerId)}),e.addEventListener("pointerout",function(e){return s._pointerUp(e.pointerId)}),e.appendChild(s._container),s._keys={},s._downPointers=[],s.resize(n,r),s._notes={},s}return s(t,e),a(t,[{key:"resize",value:function(e,t){this._keys={},this._container.innerHTML="";for(var n=1/7/t,r=e;r=e._state.keys.length?e._state.keys=e._state.keys.map(function(e){return e.isActive=!0,e}):(e._state.keys=e._state.keys.map(function(e){return e.isActive=!1,e}),e["_"+e._state.priority]()),e._state.buffer=[],void e._state.keys.forEach(function(t){t.isActive&&e._state.buffer.push(t)})):void(e._state.buffer=[])},r.prototype._last=function(){for(var e=this,t=e._state.keys.length-e._state.polyphony;t=a}return this.firstXY=null,t}},findTouch:function(e,t){for(var n,r=0,i=e.length;r=t.length){var n=[];F.forEach(function(e,r){if(1!==r&&!this.findTouch(t,r-2)){var i=e.out;n.push(i)}},this),n.forEach(this.cancelOut,this)}},touchstart:function(e){this.vacuumTouches(e),this.setPrimaryTouch(e.changedTouches[0]),this.dedupSynthMouse(e),this.scrolling||(this.clickCount++,this.processTouches(e,this.overDown))},overDown:function(e){F.set(e.pointerId,{target:e.target,out:e,outTarget:e.target}),b.enterOver(e),b.down(e)},touchmove:function(e){this.scrolling||(this.shouldScroll(e)?(this.scrolling=!0,this.touchcancel(e)):(e.preventDefault(),this.processTouches(e,this.moveOverOut)))},moveOverOut:function(e){var t=e,n=F.get(t.pointerId);if(n){var r=n.out,i=n.outTarget;b.move(t),r&&i!==t.target&&(r.relatedTarget=t.target,t.relatedTarget=i,r.target=i,t.target?(b.leaveOut(r),b.enterOver(t)):(t.target=i,t.relatedTarget=null,this.cancelOut(t))),n.out=t,n.outTarget=t.target}},touchend:function(e){this.dedupSynthMouse(e),this.processTouches(e,this.upOut)},upOut:function(e){this.scrolling||(b.up(e),b.leaveOut(e)),this.cleanUpPointer(e)},touchcancel:function(e){this.processTouches(e,this.cancelOut)},cancelOut:function(e){b.cancel(e),b.leaveOut(e),this.cleanUpPointer(e)},cleanUpPointer:function(e){F.delete(e.pointerId),this.removePrimaryPointer(e)},dedupSynthMouse:function(e){var t=G.lastTouches,n=e.changedTouches[0];if(this.isPrimaryTouch(n)){var r={x:n.clientX,y:n.clientY};t.push(r);var i=function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)}.bind(null,t,r);setTimeout(i,K)}}};H=new n(z.elementAdded,z.elementRemoved,z.elementChanged,z);var q,W,V=b.pointermap,Q=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,J={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(e){b.listen(e,this.events)},unregister:function(e){b.unlisten(e,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(e){var t=e;return Q&&(t=b.cloneEvent(e),t.pointerType=this.POINTER_TYPES[e.pointerType]),t},cleanup:function(e){V.delete(e)},MSPointerDown:function(e){V.set(e.pointerId,e);var t=this.prepareEvent(e);b.down(t)},MSPointerMove:function(e){var t=this.prepareEvent(e);b.move(t)},MSPointerUp:function(e){var t=this.prepareEvent(e);b.up(t),this.cleanup(e.pointerId)},MSPointerOut:function(e){var t=this.prepareEvent(e);b.leaveOut(t)},MSPointerOver:function(e){var t=this.prepareEvent(e);b.enterOver(t)},MSPointerCancel:function(e){var t=this.prepareEvent(e);b.cancel(t),this.cleanup(e.pointerId)},MSLostPointerCapture:function(e){var t=b.makeEvent("lostpointercapture",e);b.dispatchEvent(t)},MSGotPointerCapture:function(e){var t=b.makeEvent("gotpointercapture",e);b.dispatchEvent(t)}},$=window.navigator;$.msPointerEnabled?(q=function(e){u(e),c(this),h(e)&&this.msSetPointerCapture(e)},W=function(e){u(e),this.msReleasePointerCapture(e)}):(q=function(e){u(e),c(this),h(e)&&b.setCapture(e,this)},W=function(e){u(e),b.releaseCapture(e,this)}),s(),a(),l();var Z={dispatcher:b,Installer:n,PointerEvent:e,PointerMap:v,targetFinding:g};return Z})},function(e,t,n){function r(e,t){for(var n=0;n=0&&E.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",o(e,t),t}function u(e){var t=document.createElement("link");return t.rel="stylesheet",o(e,t),t}function c(e,t){var n,r,i;if(t.singleton){var o=_++;n=m||(m=a(t)),r=h.bind(null,n,o,!1),i=h.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=u(t),r=p.bind(null,n),i=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=a(t),r=l.bind(null,n),i=function(){s(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}function h(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=b(t,i);else{var o=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(o,s[t]):e.appendChild(o)}}function l(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var i=new Blob([n],{type:"text/css"}),o=e.href;e.href=URL.createObjectURL(i),o&&URL.revokeObjectURL(o)}var f={},d=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},v=d(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),y=d(function(){return document.head||document.getElementsByTagName("head")[0]}),m=null,_=0,E=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=v()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=i(e);return r(n,t),function(e){for(var o=[],s=0;s=0))throw new TypeError("The specified event type is not supported.");return this._userHandlers[e].push(t),this},o.prototype.hasListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before checking event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(this._midiInterfaceEvents.indexOf(e)>=0))throw new TypeError("The specified event type is not supported.");for(var n=0;n=0)if(t)for(var n=0;n=0&&127>=e?t=Math.round(e):parseInt(e)>=0&&parseInt(e)<=127?t=parseInt(e):("string"==typeof e||e instanceof String)&&(t=this.noteNameToNumber(e)),t===!1)throw new Error("Invalid note number ("+e+").");return t},o.prototype.noteNameToNumber=function(e){"string"!=typeof e&&(e="");var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw new RangeError("Invalid note name.");var n=u._semitones[t[1].toUpperCase()],r=parseInt(t[3]),i=12*(r+2)+n;if(t[2].toLowerCase().indexOf("b")>-1?i-=t[2].length:t[2].toLowerCase().indexOf("#")>-1&&(i+=t[2].length),0>n||-2>r||r>8||0>i||i>127)throw new RangeError("Invalid note name or note outside valid range.");return i},o.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},o.prototype._updateInputs=function(){for(var e=0;e0;)this._processStateChange(this._stateChangeQueue.shift());this._processingStateChange=!1}},o.prototype._processStateChange=function(e){if(this._updateInputsAndOutputs(),null!==e){var t={timestamp:e.timeStamp,type:e.port.state,id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name};"connected"===e.port.state&&("output"===e.port.type?t.output=this.getOutputById(e.port.id):"input"===e.port.type&&(t.input=this.getInputById(e.port.id))),this._userHandlers[e.port.state].forEach(function(e){e(t)})}},o.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e=1&&16>=e))throw new RangeError("The 'channel' parameter is invalid.")}),"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(u.MIDI_SYSTEM_MESSAGES[e])this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(n);else{if(!u.MIDI_CHANNEL_MESSAGES[e])throw new TypeError("The specified event type is not supported.");if(t.indexOf("all")>-1){t=[];for(var i=1;16>=i;i++)t.push(i)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach(function(t){r._userHandlers.channel[e][t]||(r._userHandlers.channel[e][t]=[]),r._userHandlers.channel[e][t].push(n)})}return this},s.prototype.on=s.prototype.addListener,s.prototype.hasListener=function(e,t,n){var r=this;if("function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),u.MIDI_SYSTEM_MESSAGES[e]){for(var i=0;i-1){t=[];for(var o=1;16>=o;o++)t.push(o)}return!!this._userHandlers.channel[e]&&t.every(function(t){var i=r._userHandlers.channel[e][t];return i&&i.indexOf(n)>-1})}return!1},s.prototype.removeListener=function(e,t,n){ -var r=this;if(void 0!==n&&"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),u.MIDI_SYSTEM_MESSAGES[e])if(void 0===n)this._userHandlers.system[e]=[];else for(var i=0;i-1){t=[];for(var o=1;16>=o;o++)t.push(o)}if(!this._userHandlers.channel[e])return this;t.forEach(function(t){var i=r._userHandlers.channel[e][t];if(i)if(void 0===n)r._userHandlers.channel[e][t]=[];else for(var o=0;o>4,i=(15&e.data[0])+1;e.data.length>1&&(t=e.data[1],n=e.data.length>2?e.data[2]:void 0);var o={target:this,data:e.data,timestamp:e.timeStamp,channel:i};r===u.MIDI_CHANNEL_MESSAGES.noteoff||r===u.MIDI_CHANNEL_MESSAGES.noteon&&0===n?(o.type="noteoff",o.note={number:t,name:u._notes[t%12],octave:Math.floor(t/12-1)-3},o.velocity=n/127,o.rawVelocity=n):r===u.MIDI_CHANNEL_MESSAGES.noteon?(o.type="noteon",o.note={number:t,name:u._notes[t%12],octave:Math.floor(t/12-1)-3},o.velocity=n/127,o.rawVelocity=n):r===u.MIDI_CHANNEL_MESSAGES.keyaftertouch?(o.type="keyaftertouch",o.note={number:t,name:u._notes[t%12],octave:Math.floor(t/12-1)-3},o.value=n/127):r===u.MIDI_CHANNEL_MESSAGES.controlchange&&t>=0&&119>=t?(o.type="controlchange",o.controller={number:t,name:this.getCcNameByNumber(t)},o.value=n):r===u.MIDI_CHANNEL_MESSAGES.channelmode&&t>=120&&127>=t?(o.type="channelmode",o.controller={number:t,name:this.getChannelModeByNumber(t)},o.value=n):r===u.MIDI_CHANNEL_MESSAGES.programchange?(o.type="programchange",o.value=t):r===u.MIDI_CHANNEL_MESSAGES.channelaftertouch?(o.type="channelaftertouch",o.value=t/127):r===u.MIDI_CHANNEL_MESSAGES.pitchbend?(o.type="pitchbend",o.value=((n<<7)+t-8192)/8192):o.type="unknownchannelmessage",this._userHandlers.channel[o.type]&&this._userHandlers.channel[o.type][i]&&this._userHandlers.channel[o.type][i].forEach(function(e){e(o)})},s.prototype.getCcNameByNumber=function(e){if(e=parseInt(e),!(e>=0&&119>=e))throw new RangeError("The control change number must be between 0 and 119.");for(var t in u.MIDI_CONTROL_CHANGE_MESSAGES)if(e===u.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},s.prototype.getChannelModeByNumber=function(e){if(e=parseInt(e),!(e>=120&&status<=127))throw new RangeError("The control change number must be between 120 and 127.");for(var t in u.MIDI_CHANNEL_MODE_MESSAGES)if(e===u.MIDI_CHANNEL_MODE_MESSAGES[t])return t},s.prototype._parseSystemEvent=function(e){var t=e.data[0],n={target:this,data:e.data,timestamp:e.timeStamp};t===u.MIDI_SYSTEM_MESSAGES.sysex?n.type="sysex":t===u.MIDI_SYSTEM_MESSAGES.timecode?n.type="timecode":t===u.MIDI_SYSTEM_MESSAGES.songposition?n.type="songposition":t===u.MIDI_SYSTEM_MESSAGES.songselect?(n.type="songselect",n.song=e.data[1]):t===u.MIDI_SYSTEM_MESSAGES.tuningrequest?n.type="tuningrequest":t===u.MIDI_SYSTEM_MESSAGES.clock?n.type="clock":t===u.MIDI_SYSTEM_MESSAGES.start?n.type="start":t===u.MIDI_SYSTEM_MESSAGES.continue?n.type="continue":t===u.MIDI_SYSTEM_MESSAGES.stop?n.type="stop":t===u.MIDI_SYSTEM_MESSAGES.activesensing?n.type="activesensing":t===u.MIDI_SYSTEM_MESSAGES.reset?n.type="reset":n.type="unknownsystemmessage",this._userHandlers.system[n.type]&&this._userHandlers.system[n.type].forEach(function(e){e(n)})},a.prototype.send=function(e,t,n){if(!(e>=128&&255>=e))throw new RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");Array.isArray(t)||(t=parseInt(t)>=0&&parseInt(t)<=127?[parseInt(t)]:[]);var r=[e];return t.forEach(function(e){if(!(e>=0&&255>=e))throw new RangeError("The data bytes must be integers between 0 (0x00) and 255 (0xFF).");r.push(e)}),this._midiOutput.send(r,parseFloat(n)||0),this},a.prototype.sendSysex=function(e,t,n){if(!u.sysexEnabled)throw new Error("SysEx message support must first be activated.");return n=n||{},e=[].concat(e),t.forEach(function(e){if(0>e||e>127)throw new RangeError("The data bytes of a SysEx message must be integers between 0 (0x00) and 127 (0x7F).")}),t=e.concat(t,u.MIDI_SYSTEM_MESSAGES.sysexend),this.send(u.MIDI_SYSTEM_MESSAGES.sysex,t,n.time),this},a.prototype.sendTimecodeQuarterFrame=function(e,t){return t=t||{},this.send(u.MIDI_SYSTEM_MESSAGES.timecode,e,t.time),this},a.prototype.sendSongPosition=function(e,t){e=parseInt(e)||0,t=t||{};var n=e>>7&127,r=127&e;return this.send(u.MIDI_SYSTEM_MESSAGES.songposition,[n,r],t.time),this},a.prototype.sendSongSelect=function(e,t){if(e=parseInt(e),t=t||{},!(e>=0&&127>=e))throw new RangeError("The song number must be between 0 and 127.");return this.send(u.MIDI_SYSTEM_MESSAGES.songselect,[e],t.time),this},a.prototype.sendTuningRequest=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,e.time),this},a.prototype.sendClock=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.clock,void 0,e.time),this},a.prototype.sendStart=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.start,void 0,e.time),this},a.prototype.sendContinue=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.continue,void 0,e.time),this},a.prototype.sendStop=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.stop,void 0,e.time),this},a.prototype.sendActiveSensing=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.activesensing,void 0,e.time),this},a.prototype.sendReset=function(e){return e=e||{},this.send(u.MIDI_SYSTEM_MESSAGES.reset,void 0,e.time),this},a.prototype.stopNote=function(e,t,n){if("all"===e)return this.sendChannelMode("allnotesoff",0,t,n);var r=64;return n=n||{},n.velocity=parseFloat(n.velocity),n.rawVelocity?!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=127&&(r=n.velocity):!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=1&&(r=127*n.velocity),this._convertNoteToArray(e).forEach(function(e){this._convertChannelToArray(t).forEach(function(t){this.send((u.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(r)],this._parseTimeParameter(n.time))}.bind(this))}.bind(this)),this},a.prototype.playNote=function(e,t,n){var r=64;if(n=n||{},n.velocity=parseFloat(n.velocity),n.rawVelocity?!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=127&&(r=n.velocity):!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=1&&(r=127*n.velocity),n.time=this._parseTimeParameter(n.time)||0,this._convertNoteToArray(e).forEach(function(e){this._convertChannelToArray(t).forEach(function(t){this.send((u.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(r)],n.time)}.bind(this))}.bind(this)),void 0!==n.duration){var i=64;n.release=parseFloat(n.release),n.rawVelocity?!isNaN(n.release)&&n.release>=0&&n.release<=127&&(i=n.release):!isNaN(n.release)&&n.release>=0&&n.release<=1&&(i=127*n.release),this._convertNoteToArray(e).forEach(function(e){this._convertChannelToArray(t).forEach(function(t){this.send((u.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(i)],n.time+n.duration)}.bind(this))}.bind(this))}return this},a.prototype.sendKeyAftertouch=function(e,t,n,r){var i=this;if(r=r||{},1>t||t>16)throw new RangeError("The channel must be between 1 and 16.");n=parseFloat(n),(isNaN(n)||0>n||n>1)&&(n=.5);var o=Math.round(127*n);return this._convertNoteToArray(e).forEach(function(e){i._convertChannelToArray(t).forEach(function(t){i.send((u.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,o],i._parseTimeParameter(r.time))})}),this},a.prototype.sendControlChange=function(e,t,n,r){if(r=r||{},"string"==typeof e){if(e=u.MIDI_CONTROL_CHANGE_MESSAGES[e],!e)throw new TypeError("Invalid controller name.")}else if(e=parseInt(e),!(e>=0&&119>=e))throw new RangeError("Controller numbers must be between 0 and 119.");if(t=parseInt(t)||0,!(t>=0&&127>=t))throw new RangeError("Controller value must be between 0 and 127.");return this._convertChannelToArray(n).forEach(function(n){this.send((u.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(n-1),[e,t],this._parseTimeParameter(r.time))}.bind(this)),this},a.prototype._selectRegisteredParameter=function(e,t,n){var r=this;if(e[0]=parseInt(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The control65 value must be between 0 and 127");if(e[1]=parseInt(e[1]),!(e[1]>=0&&e[1]<=127))throw new RangeError("The control64 value must be between 0 and 127");return this._convertChannelToArray(t).forEach(function(i){r.sendControlChange(101,e[0],t,{time:n}),r.sendControlChange(100,e[1],t,{time:n})}),this},a.prototype._selectNonRegisteredParameter=function(e,t,n){var r=this;if(e[0]=parseInt(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The control63 value must be between 0 and 127");if(e[1]=parseInt(e[1]),!(e[1]>=0&&e[1]<=127))throw new RangeError("The control62 value must be between 0 and 127");return this._convertChannelToArray(t).forEach(function(i){r.sendControlChange(99,e[0],t,{time:n}),r.sendControlChange(98,e[1],t,{time:n})}),this},a.prototype._setCurrentRegisteredParameter=function(e,t,n){var r=this;if(e=[].concat(e),e[0]=parseInt(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The msb value must be between 0 and 127");return this._convertChannelToArray(t).forEach(function(i){r.sendControlChange(6,e[0],t,{time:n})}),e[1]=parseInt(e[1]),e[1]>=0&&e[1]<=127&&this._convertChannelToArray(t).forEach(function(i){r.sendControlChange(38,e[1],t,{time:n})}),this},a.prototype._deselectRegisteredParameter=function(e,t){var n=this;return this._convertChannelToArray(e).forEach(function(r){n.sendControlChange(101,127,e,{time:t}),n.sendControlChange(100,127,e,{time:t})}),this},a.prototype.setRegisteredParameter=function(e,t,n,r){var i=this;if(r=r||{},!Array.isArray(e)){if(!u.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=u.MIDI_REGISTERED_PARAMETER[e]}return this._convertChannelToArray(n).forEach(function(o){i._selectRegisteredParameter(e,n,r.time),i._setCurrentRegisteredParameter(t,n,r.time),i._deselectRegisteredParameter(n,r.time)}),this},a.prototype.setNonRegisteredParameter=function(e,t,n,r){var i=this;if(r=r||{},!(e[0]>=0&&e[0]<=127&&e[1]>=0&&e[1]<=127))throw new Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");return t=[].concat(t),this._convertChannelToArray(n).forEach(function(o){i._selectNonRegisteredParameter(e,n,r.time),i._setCurrentRegisteredParameter(t,n,r.time),i._deselectRegisteredParameter(n,r.time)}),this},a.prototype.incrementRegisteredParameter=function(e,t,n){var r=this;if(n=n||{},!Array.isArray(e)){if(!u.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=u.MIDI_REGISTERED_PARAMETER[e]}return this._convertChannelToArray(t).forEach(function(i){r._selectRegisteredParameter(e,t,n.time),r.sendControlChange(96,0,t,{time:n.time}),r._deselectRegisteredParameter(t,n.time)}),this},a.prototype.decrementRegisteredParameter=function(e,t,n){if(n=n||{},!Array.isArray(e)){if(!u.MIDI_REGISTERED_PARAMETER[e])throw new TypeError("The specified parameter is not available.");e=u.MIDI_REGISTERED_PARAMETER[e]}return this._convertChannelToArray(t).forEach(function(r){this._selectRegisteredParameter(e,t,n.time),this.sendControlChange(97,0,t,{time:n.time}),this._deselectRegisteredParameter(t,n.time)}.bind(this)),this},a.prototype.setPitchBendRange=function(e,t,n,r){var i=this;if(r=r||{},e=parseInt(e)||0,!(e>=0&&127>=e))throw new RangeError("The semitones value must be between 0 and 127");if(t=parseInt(t)||0,!(t>=0&&127>=t))throw new RangeError("The cents value must be between 0 and 127");return this._convertChannelToArray(n).forEach(function(o){i.setRegisteredParameter("pitchbendrange",[e,t],n,{time:r.time})}),this},a.prototype.setModulationRange=function(e,t,n,r){var i=this;if(r=r||{},e=parseInt(e)||0,!(e>=0&&127>=e))throw new RangeError("The semitones value must be between 0 and 127");if(t=parseInt(t)||0,!(t>=0&&127>=t))throw new RangeError("The cents value must be between 0 and 127");return this._convertChannelToArray(n).forEach(function(o){i.setRegisteredParameter("modulationrange",[e,t],n,{time:r.time})}),this},a.prototype.setMasterTuning=function(e,t,n){var r=this;if(n=n||{},e=parseFloat(e)||0,-65>=e||e>=64)throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");var i=parseInt(e)+64,o=e-parseInt(e);o=Math.round((o+1)/2*16383);var s=o>>7&127,a=127&o;return this._convertChannelToArray(t).forEach(function(e){r.setRegisteredParameter("channelcoarsetuning",i,t,{time:n.time}),r.setRegisteredParameter("channelfinetuning",[s,a],t,{time:n.time})}),this},a.prototype.setTuningProgram=function(e,t,n){var r=this;if(n=n||{},e=parseInt(e)||0,!(e>=0&&127>=e))throw new RangeError("The program value must be between 0 and 127");return this._convertChannelToArray(t).forEach(function(i){r.setRegisteredParameter("tuningprogram",e,t,{time:n.time})}),this},a.prototype.setTuningBank=function(e,t,n){var r=this;if(n=n||{},e=parseInt(e)||0,!(e>=0&&127>=e))throw new RangeError("The bank value must be between 0 and 127");return this._convertChannelToArray(t).forEach(function(i){r.setRegisteredParameter("tuningbank",e,t,{time:n.time})}),this},a.prototype.sendChannelMode=function(e,t,n,r){var i=this;if(r=r||{},"string"==typeof e){if(e=u.MIDI_CHANNEL_MODE_MESSAGES[e],!e)throw new TypeError("Invalid channel mode message name.")}else if(e=parseInt(e),!(e>=120&&127>=e))throw new RangeError("Channel mode numerical identifiers must be between 120 and 127.");if(t=parseInt(t),isNaN(t)||0>t||t>127)throw new RangeError("Value must be integers between 0 and 127.");return this._convertChannelToArray(n).forEach(function(n){i.send((u.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(n-1),[e,t],i._parseTimeParameter(r.time))}),this},a.prototype.sendProgramChange=function(e,t,n){var r=this;if(n=n||{},e=parseInt(e),isNaN(e)||0>e||e>127)throw new RangeError("Program numbers must be between 0 and 127.");return this._convertChannelToArray(t).forEach(function(t){r.send((u.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],r._parseTimeParameter(n.time))}),this},a.prototype.sendChannelAftertouch=function(e,t,n){var r=this;n=n||{},e=parseFloat(e),(isNaN(e)||0>e||e>1)&&(e=.5);var i=Math.round(127*e);return this._convertChannelToArray(t).forEach(function(e){r.send((u.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[i],r._parseTimeParameter(n.time))}),this},a.prototype.sendPitchBend=function(e,t,n){var r=this;if(n=n||{},e=parseFloat(e),isNaN(e)||-1>e||e>1)throw new RangeError("Pitch bend value must be between -1 and 1.");var i=Math.round((e+1)/2*16383),o=i>>7&127,s=127&i;return this._convertChannelToArray(t).forEach(function(e){r.send((u.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[s,o],r._parseTimeParameter(n.time))}),this},a.prototype._parseTimeParameter=function(e){var t;if(void 0===e)return 0;if(e&&e.substring&&"+"===e.substring(0,1)){if(t=parseFloat(e),!t)throw new TypeError("Invalid relative time format.");return t+u.time}if(t=parseFloat(e),!t)throw new TypeError("Invalid absolute time format.");return t},a.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach(function(e){t.push(u.guessNoteNumber(e))}),t},a.prototype._convertChannelToArray=function(e){if(("all"===e||void 0===e)&&(e=["all"]),Array.isArray(e)||(e=[e]),e.indexOf("all")>-1){e=[];for(var t=1;16>=t;t++)e.push(t)}return e.forEach(function(e){if(!(e>=1&&16>=e))throw new RangeError("MIDI channels must be between 1 and 16.")}),e},a.prototype._onMidiMessage=function(e){},r=[],i=function(){return u}.apply(t,r),!(void 0!==i&&(e.exports=i))}(this)}])}); \ No newline at end of file diff --git a/examples/scripts/StartAudioContext.js b/examples/scripts/StartAudioContext.js deleted file mode 100644 index 181de468..00000000 --- a/examples/scripts/StartAudioContext.js +++ /dev/null @@ -1,185 +0,0 @@ -/** - * StartAudioContext.js - * @author Yotam Mann - * @license http://opensource.org/licenses/MIT MIT License - * @copyright 2016 Yotam Mann - */ -(function (root, factory) { - if (typeof define === "function" && define.amd) { - define([], factory) - } else if (typeof module === "object" && module.exports) { - module.exports = factory() - } else { - root.StartAudioContext = factory() - } -}(this, function () { - - //TAP LISTENER///////////////////////////////////////////////////////////// - - /** - * @class Listens for non-dragging tap ends on the given element - * @param {Element} element - * @internal - */ - var TapListener = function(element, context){ - - this._dragged = false - - this._element = element - - this._bindedMove = this._moved.bind(this) - this._bindedEnd = this._ended.bind(this, context) - - element.addEventListener("touchmove", this._bindedMove) - element.addEventListener("touchend", this._bindedEnd) - element.addEventListener("mouseup", this._bindedEnd) - } - - /** - * drag move event - */ - TapListener.prototype._moved = function(e){ - this._dragged = true - }; - - /** - * tap ended listener - */ - TapListener.prototype._ended = function(context){ - if (!this._dragged){ - startContext(context) - } - this._dragged = false - }; - - /** - * remove all the bound events - */ - TapListener.prototype.dispose = function(){ - this._element.removeEventListener("touchmove", this._bindedMove) - this._element.removeEventListener("touchend", this._bindedEnd) - this._element.removeEventListener("mouseup", this._bindedEnd) - this._bindedMove = null - this._bindedEnd = null - this._element = null - }; - - //END TAP LISTENER///////////////////////////////////////////////////////// - - /** - * Plays a silent sound and also invoke the "resume" method - * @param {AudioContext} context - * @private - */ - function startContext(context){ - // this accomplishes the iOS specific requirement - var buffer = context.createBuffer(1, 1, context.sampleRate) - var source = context.createBufferSource() - source.buffer = buffer - source.connect(context.destination) - source.start(0) - - // resume the audio context - if (context.resume){ - context.resume() - } - } - - /** - * Returns true if the audio context is started - * @param {AudioContext} context - * @return {Boolean} - * @private - */ - function isStarted(context){ - return context.state === "running" - } - - /** - * Invokes the callback as soon as the AudioContext - * is started - * @param {AudioContext} context - * @param {Function} callback - */ - function onStarted(context, callback){ - - function checkLoop(){ - if (isStarted(context)){ - callback() - } else { - requestAnimationFrame(checkLoop) - if (context.resume){ - context.resume() - } - } - } - - if (isStarted(context)){ - callback() - } else { - checkLoop() - } - } - - /** - * Add a tap listener to the audio context - * @param {Array|Element|String|jQuery} element - * @param {Array} tapListeners - */ - function bindTapListener(element, tapListeners, context){ - if (Array.isArray(element) || (NodeList && element instanceof NodeList)){ - for (var i = 0; i < element.length; i++){ - bindTapListener(element[i], tapListeners, context) - } - } else if (typeof element === "string"){ - bindTapListener(document.querySelectorAll(element), tapListeners, context) - } else if (element.jquery && typeof element.toArray === "function"){ - bindTapListener(element.toArray(), tapListeners, context) - } else if (Element && element instanceof Element){ - //if it's an element, create a TapListener - var tap = new TapListener(element, context) - tapListeners.push(tap) - } - } - - /** - * @param {AudioContext} context The AudioContext to start. - * @param {Array|String|Element|jQuery} elements For iOS, the list of elements - * to bind tap event listeners - * which will start the AudioContext. - * @param {Function=} callback The callback to invoke when the AudioContext is started. - * @return {Promise} The promise is invoked when the AudioContext - * is started. - */ - function StartAudioContext(context, elements, callback){ - - //the promise is invoked when the AudioContext is started - var promise = new Promise(function(success) { - onStarted(context, success) - }) - - // The TapListeners bound to the elements - var tapListeners = [] - - // add all the tap listeners - if (elements){ - bindTapListener(elements, tapListeners, context) - } - - //dispose all these tap listeners when the context is started - promise.then(function(){ - for (var i = 0; i < tapListeners.length; i++){ - tapListeners[i].dispose() - } - tapListeners = null - - if (callback){ - callback() - } - }) - - return promise - } - - return StartAudioContext -})) \ No newline at end of file diff --git a/examples/scripts/draggabilly.js b/examples/scripts/draggabilly.js deleted file mode 100644 index 11861d97..00000000 --- a/examples/scripts/draggabilly.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * Draggabilly PACKAGED v1.2.4 - * Make that shiz draggable - * http://draggabilly.desandro.com - * MIT license - */ - -!function(t){function e(){}function n(t){function n(e){e.prototype.option||(e.prototype.option=function(e){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))})}function o(e,n){t.fn[e]=function(o){if("string"==typeof o){for(var s=i.call(arguments,1),a=0,p=this.length;p>a;a++){var u=this[a],d=t.data(u,e);if(d)if(t.isFunction(d[o])&&"_"!==o.charAt(0)){var c=d[o].apply(d,s);if(void 0!==c)return c}else r("no such method '"+o+"' for "+e+" instance");else r("cannot call methods on "+e+" prior to initialization; attempted to call '"+o+"'")}return this}return this.each(function(){var i=t.data(this,e);i?(i.option(o),i._init()):(i=new n(this,o),t.data(this,e,i))})}}if(t){var r="undefined"==typeof console?e:function(t){console.error(t)};return t.bridget=function(t,e){n(e),o(t,e)},t.bridget}}var i=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],n):n("object"==typeof exports?require("jquery"):t.jQuery)}(window),function(t){function e(t){return new RegExp("(^|\\s+)"+t+"(\\s+|$)")}function n(t,e){var n=i(t,e)?r:o;n(t,e)}var i,o,r;"classList"in document.documentElement?(i=function(t,e){return t.classList.contains(e)},o=function(t,e){t.classList.add(e)},r=function(t,e){t.classList.remove(e)}):(i=function(t,n){return e(n).test(t.className)},o=function(t,e){i(t,e)||(t.className=t.className+" "+e)},r=function(t,n){t.className=t.className.replace(e(n)," ")});var s={hasClass:i,addClass:o,removeClass:r,toggleClass:n,has:i,add:o,remove:r,toggle:n};"function"==typeof define&&define.amd?define("classie/classie",s):"object"==typeof exports?module.exports=s:t.classie=s}(window),function(t){function e(t){if(t){if("string"==typeof i[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,o=0,r=n.length;r>o;o++)if(e=n[o]+t,"string"==typeof i[e])return e}}var n="Webkit Moz ms Ms O".split(" "),i=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t){function e(t){var e=parseFloat(t),n=-1===t.indexOf("%")&&!isNaN(e);return n&&e}function n(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,n=s.length;n>e;e++){var i=s[e];t[i]=0}return t}function o(n){function o(){if(!h){h=!0;var i=t.getComputedStyle;if(u=function(){var t=i?function(t){return i(t,null)}:function(t){return t.currentStyle};return function(e){var n=t(e);return n||r("Style returned "+n+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),n}}(),d=n("boxSizing")){var o=document.createElement("div");o.style.width="200px",o.style.padding="1px 2px 3px 4px",o.style.borderStyle="solid",o.style.borderWidth="1px 2px 3px 4px",o.style[d]="border-box";var s=document.body||document.documentElement;s.appendChild(o);var a=u(o);c=200===e(a.width),s.removeChild(o)}}}function a(t){if(o(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var n=u(t);if("none"===n.display)return i();var r={};r.width=t.offsetWidth,r.height=t.offsetHeight;for(var a=r.isBorderBox=!(!d||!n[d]||"border-box"!==n[d]),h=0,f=s.length;f>h;h++){var l=s[h],g=n[l];g=p(t,g);var v=parseFloat(g);r[l]=isNaN(v)?0:v}var y=r.paddingLeft+r.paddingRight,m=r.paddingTop+r.paddingBottom,E=r.marginLeft+r.marginRight,b=r.marginTop+r.marginBottom,P=r.borderLeftWidth+r.borderRightWidth,x=r.borderTopWidth+r.borderBottomWidth,_=a&&c,w=e(n.width);w!==!1&&(r.width=w+(_?0:y+P));var S=e(n.height);return S!==!1&&(r.height=S+(_?0:m+x)),r.innerWidth=r.width-(y+P),r.innerHeight=r.height-(m+x),r.outerWidth=r.width+E,r.outerHeight=r.height+b,r}}function p(e,n){if(t.getComputedStyle||-1===n.indexOf("%"))return n;var i=e.style,o=i.left,r=e.runtimeStyle,s=r&&r.left;return s&&(r.left=e.currentStyle.left),i.left=n,n=i.pixelLeft,i.left=o,s&&(r.left=s),n}var u,d,c,h=!1;return a}var r="undefined"==typeof console?n:function(t){console.error(t)},s=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],o):"object"==typeof exports?module.exports=o(require("desandro-get-style-property")):t.getSize=o(t.getStyleProperty)}(window),function(t){function e(e){var n=t.event;return n.target=n.target||n.srcElement||e,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(t,e,n){t.addEventListener(e,n,!1)}:n.attachEvent&&(i=function(t,n,i){t[n+i]=i.handleEvent?function(){var n=e(t);i.handleEvent.call(i,n)}:function(){var n=e(t);i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var o=function(){};n.removeEventListener?o=function(t,e,n){t.removeEventListener(e,n,!1)}:n.detachEvent&&(o=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(i){t[e+n]=void 0}});var r={bind:i,unbind:o};"function"==typeof define&&define.amd?define("eventie/eventie",r):"object"==typeof exports?module.exports=r:t.eventie=r}(window),function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype,o=this,r=o.EventEmitter;i.getListeners=function(t){var e,n,i=this._getEvents();if(t instanceof RegExp){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;ee;e++){var i=t[e];if(i.identifier==this.pointerIdentifier)return i}},o.prototype.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},o.prototype.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},o.prototype.onMSPointerDown=o.prototype.onpointerdown=function(t){this._pointerDown(t,t)},o.prototype._pointerDown=function(t,e){this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},o.prototype.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var r={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"],MSPointerDown:["MSPointerMove","MSPointerUp","MSPointerCancel"]};return o.prototype._bindPostStartEvents=function(e){if(e){for(var i=r[e.type],o=e.preventDefault?t:document,s=0,a=i.length;a>s;s++){var p=i[s];n.bind(o,p,this)}this._boundPointerEvents={events:i,node:o}}},o.prototype._unbindPostStartEvents=function(){var t=this._boundPointerEvents;if(t&&t.events){for(var e=0,i=t.events.length;i>e;e++){var o=t.events[e];n.unbind(t.node,o,this)}delete this._boundPointerEvents}},o.prototype.onmousemove=function(t){this._pointerMove(t,t)},o.prototype.onMSPointerMove=o.prototype.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},o.prototype.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},o.prototype._pointerMove=function(t,e){this.pointerMove(t,e)},o.prototype.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},o.prototype.onmouseup=function(t){this._pointerUp(t,t)},o.prototype.onMSPointerUp=o.prototype.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},o.prototype.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},o.prototype._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},o.prototype.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},o.prototype._pointerDone=function(){this.isPointerDown=!1,delete this.pointerIdentifier,this._unbindPostStartEvents(),this.pointerDone()},o.prototype.pointerDone=i,o.prototype.onMSPointerCancel=o.prototype.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},o.prototype.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},o.prototype._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},o.prototype.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},o.getPointerPoint=function(t){return{x:void 0!==t.pageX?t.pageX:t.clientX,y:void 0!==t.pageY?t.pageY:t.clientY}},o}),function(t,e){"function"==typeof define&&define.amd?define("unidragger/unidragger",["eventie/eventie","unipointer/unipointer"],function(n,i){return e(t,n,i)}):"object"==typeof exports?module.exports=e(t,require("eventie"),require("unipointer")):t.Unidragger=e(t,t.eventie,t.Unipointer)}(window,function(t,e,n){function i(){}function o(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function r(t){for(;t!=document.body;)if(t=t.parentNode,"A"==t.nodeName)return t}function s(){}function a(){return!1}s.prototype=new n,s.prototype.bindHandles=function(){this._bindHandles(!0)},s.prototype.unbindHandles=function(){this._bindHandles(!1)};var p=t.navigator;s.prototype._bindHandles=function(t){t=void 0===t?!0:!!t;var n;n=p.pointerEnabled?function(e){e.style.touchAction=t?"none":""}:p.msPointerEnabled?function(e){e.style.msTouchAction=t?"none":""}:function(){t&&d(s)};for(var i=t?"bind":"unbind",o=0,r=this.handles.length;r>o;o++){var s=this.handles[o];this._bindStartEvent(s,t),n(s),e[i](s,"click",this)}};var u="attachEvent"in document.documentElement,d=u?function(t){"IMG"==t.nodeName&&(t.ondragstart=a);for(var e=t.querySelectorAll("img"),n=0,i=e.length;i>n;n++){var o=e[n];o.ondragstart=a}}:i,c=s.allowTouchstartNodes={INPUT:!0,A:!0,BUTTON:!0,SELECT:!0};return s.prototype.pointerDown=function(t,e){this._dragPointerDown(t,e);var n=document.activeElement;n&&n.blur&&n.blur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])},s.prototype._dragPointerDown=function(t,e){this.pointerDownPoint=n.getPointerPoint(e);var i=t.target.nodeName,s="touchstart"==t.type&&(c[i]||r(t.target));s||"SELECT"==i||o(t)},s.prototype.pointerMove=function(t,e){var n=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,n]),this._dragMove(t,e,n)},s.prototype._dragPointerMove=function(t,e){var i=n.getPointerPoint(e),o={x:i.x-this.pointerDownPoint.x,y:i.y-this.pointerDownPoint.y};return!this.isDragging&&this.hasDragStarted(o)&&this._dragStart(t,e),o},s.prototype.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3},s.prototype.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},s.prototype._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},s.prototype._dragStart=function(t,e){this.isDragging=!0,this.dragStartPoint=s.getPointerPoint(e),this.isPreventingClicks=!0,this.dragStart(t,e)},s.prototype.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},s.prototype._dragMove=function(t,e,n){this.isDragging&&this.dragMove(t,e,n)},s.prototype.dragMove=function(t,e,n){this.emitEvent("dragMove",[t,e,n])},s.prototype._dragEnd=function(t,e){this.isDragging=!1;var n=this;setTimeout(function(){delete n.isPreventingClicks}),this.dragEnd(t,e)},s.prototype.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},s.prototype.onclick=function(t){this.isPreventingClicks&&o(t)},s.prototype._staticClick=function(t,e){"INPUT"==t.target.nodeName&&"text"==t.target.type&&t.target.focus(),this.staticClick(t,e)},s.prototype.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},s.getPointerPoint=function(t){return{x:void 0!==t.pageX?t.pageX:t.clientX,y:void 0!==t.pageY?t.pageY:t.clientY}},s.getPointerPoint=n.getPointerPoint,s}),function(t,e){"function"==typeof define&&define.amd?define(["classie/classie","get-style-property/get-style-property","get-size/get-size","unidragger/unidragger"],function(n,i,o,r){return e(t,n,i,o,r)}):"object"==typeof exports?module.exports=e(t,require("desandro-classie"),require("desandro-get-style-property"),require("get-size"),require("unidragger")):t.Draggabilly=e(t,t.classie,t.getStyleProperty,t.getSize,t.Unidragger)}(window,function(t,e,n,i,o){function r(){}function s(t,e){for(var n in e)t[n]=e[n];return t}function a(t,e){this.element="string"==typeof t?d.querySelector(t):t,P&&(this.$element=P(this.element)),this.options=s({},this.constructor.defaults),this.option(e),this._create()}function p(t,e,n){return n=n||"round",e?Math[n](t/e)*e:t}for(var u,d=t.document,c=d.defaultView,h=c&&c.getComputedStyle?function(t){return c.getComputedStyle(t,null)}:function(t){return t.currentStyle},f="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1==t.nodeType&&"string"==typeof t.nodeName},l=0,g="webkit moz ms o".split(" "),v=t.requestAnimationFrame,y=t.cancelAnimationFrame,m=0;ma?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) -},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("