From: yomguy Date: Tue, 2 Oct 2012 12:19:03 +0000 (+0200) Subject: * delete timeside static files, please ADD 'timeside' to INSTALLED_APPS X-Git-Tag: 1.4.5~59^2~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=5facf059045fc128e05fea35eb9bf5f30a2e1526;p=telemeta.git * delete timeside static files, please ADD 'timeside' to INSTALLED_APPS * cleanup --- diff --git a/example/sandbox_mysql/settings.py b/example/sandbox_mysql/settings.py index efbd18b1..f0888698 100644 --- a/example/sandbox_mysql/settings.py +++ b/example/sandbox_mysql/settings.py @@ -63,7 +63,7 @@ MEDIA_URL = '/media/' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '/home/dev/telemeta/static/' +STATIC_ROOT = '/var/www/static/' # URL prefix for static files. # Example: "http://media.lawrence.com/static/" @@ -122,6 +122,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.staticfiles', 'telemeta', + 'timeside', 'jsonrpc', 'south', 'sorl.thumbnail', diff --git a/example/sandbox_sqlite/settings.py b/example/sandbox_sqlite/settings.py index 316fefce..2e21f4ae 100644 --- a/example/sandbox_sqlite/settings.py +++ b/example/sandbox_sqlite/settings.py @@ -66,7 +66,7 @@ MEDIA_URL = '/media/' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '/home/dev/telemeta/static/' +STATIC_ROOT = '/var/www/static/' # URL prefix for static files. # Example: "http://media.lawrence.com/static/" @@ -125,6 +125,7 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django_extensions', 'telemeta', + 'timeside', 'jsonrpc', 'south', 'sorl.thumbnail', diff --git a/setup.py b/setup.py index acff376c..67ebe5a6 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages import os -import telemeta CLASSIFIERS = ['Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Science/Research', 'Intended Audience :: Education', 'Programming Language :: Python', 'Programming Language :: JavaScript', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', 'Topic :: Multimedia :: Sound/Audio', 'Topic :: Multimedia :: Sound/Audio :: Analysis', 'Topic :: Multimedia :: Sound/Audio :: Players', 'Topic :: Scientific/Engineering :: Information Analysis', 'Topic :: System :: Archiving', ] @@ -12,7 +11,7 @@ setup( long_description = open('README.rst').read(), author = "Guillaume Pellerin", author_email = "yomguy@parisson.com", - version = telemeta.__version__, + version = '1.4.4', install_requires = [ 'django>=1.4', 'django-registration', @@ -20,9 +19,6 @@ setup( 'timeside', 'south', 'sorl-thumbnail', - 'django-pagination', - 'django-postman', - 'django-socialregistration', 'django-extensions', ], platforms=['OS Independent'], diff --git a/telemeta/static/timeside/README b/telemeta/static/timeside/README deleted file mode 100644 index 0f9d21d7..00000000 --- a/telemeta/static/timeside/README +++ /dev/null @@ -1,20 +0,0 @@ -=============================== -TimeSide - Web Audio Components -=============================== - -TimeSide UI Dependencies -======================== - -* SoundManager 2 >= 2.91 : http://www.schillmania.com/projects/soundmanager2 -* jQuery => 1.2.6 : http://www.jquery.com -* jsGraphics => 3.03 http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm - -Licensing -========= - -Copyright (c) 2008-2009 Samalyse -Author: Olivier Guilyardi - -TimeSide is released under the terms of the GNU General Public License -version 2. Please see the LICENSE file for details. - diff --git a/telemeta/static/timeside/js/libs/jquery-1.6.min.js b/telemeta/static/timeside/js/libs/jquery-1.6.min.js deleted file mode 100644 index c72011df..00000000 --- a/telemeta/static/timeside/js/libs/jquery-1.6.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon May 2 13:50:00 2011 -0400 - */ -(function(a,b){function cw(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function ct(a){if(!ch[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ci||(ci=c.createElement("iframe"),ci.frameBorder=ci.width=ci.height=0),c.body.appendChild(ci);if(!cj||!ci.createElement)cj=(ci.contentWindow||ci.contentDocument).document,cj.write("");b=cj.createElement(a),cj.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ci)}ch[a]=d}return ch[a]}function cs(a,b){var c={};f.each(cn.concat.apply([],cn.slice(0,b)),function(){c[this]=a});return c}function cr(){co=b}function cq(){setTimeout(cr,0);return co=f.now()}function cg(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cf(){try{return new a.XMLHttpRequest}catch(b){}}function b_(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){name="data-"+c.replace(j,"$1-$2").toLowerCase(),d=a.getAttribute(name);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(e){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?g=[null,a,null]:g=i.exec(a);if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",b=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!b||!b.length||!d)return{};e=c.createElement("select"),f=e.appendChild(c.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function click(){i.noCloneEvent=!1,a.detachEvent("onclick",click)}),a.cloneNode(!0).fireEvent("onclick")),g=c.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=c.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=c.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),c.documentElement.appendChild(k),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(h=c.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(h,null).marginRight,10)||0)===0),k.innerHTML="",c.documentElement.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[c]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||"set"in c&&c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b=a.selectedIndex,c=[],d=a.options,e=a.type==="select-one";if(b<0)return null;for(var g=e?b:0,h=e?b+1:d.length;g=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c]||(v&&(f.nodeName(a,"form")||u.test(c))?v:b);if(d!==b){if(d===null||d===!1&&!t.test(c)){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;d===!0&&!t.test(c)&&(d=c),a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.getAttribute("value");a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),f.support.getSetAttribute||(f.attrFix=f.extend(f.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}),v=f.attrHooks.name=f.attrHooks.value=f.valHooks.button={get:function(a,c){var d;if(c==="value"&&!f.nodeName(a,"button"))return a.getAttribute(c);d=a.getAttributeNode(c);return d&&d.specified?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=Object.prototype.hasOwnProperty,x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function J(a){var c=a.target,d,e;if(!!y.test(c.nodeName)&&!c.readOnly){d=f._data(c,"_change_data"),e=I(c),(a.type!=="focusout"||c.type!=="radio")&&f._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,f.event.trigger(a,arguments[1],c)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){return a.nodeName.toLowerCase()==="input"&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!be[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[];for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!ba.test(j))j=b.createTextNode(j);else{j=j.replace(Z,"<$1>");var k=($.exec(j)||["",""])[1].toLowerCase(),l=be[k]||be._default,m=l[0],n=b.createElement("div");n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!f.support.tbody){var o=_.test(j),p=k==="table"&&!o?n.firstChild&&n.firstChild.childNodes:l[1]===""&&!o?n.childNodes:[];for(var q=p.length-1;q>=0;--q)f.nodeName(p[q],"tbody")&&!p[q].childNodes.length&&p[q].parentNode.removeChild(p[q])}!f.support.leadingWhitespace&&Y.test(j)&&n.insertBefore(b.createTextNode(Y.exec(j)[0]),n.firstChild),j=n.childNodes}var r;if(!f.support.appendChecked)if(j[0]&&typeof (r=j.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV;try{bU=e.href}catch(bW){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bX(bS),ajaxTransport:bX(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?b$(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b_(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bY(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bY(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bZ(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var ca=f.now(),cb=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+ca++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cb.test(b.url)||e&&cb.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cb,l),b.url===j&&(e&&(k=k.replace(cb,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cc=a.ActiveXObject?function(){for(var a in ce)ce[a](0,1)}:!1,cd=0,ce;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cf()||cg()}:cf,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cc&&delete ce[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cd,cc&&(ce||(ce={},f(a).unload(cc)),ce[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ch={},ci,cj,ck=/^(?:toggle|show|hide)$/,cl=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cm,cn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],co,cp=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cs("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a=f.timers,b=a.length;while(b--)a[b]()||a.splice(b,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cm),cm=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cu=/^t(?:able|d|h)$/i,cv=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cw(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cu.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cv.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cv.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cw(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cw(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/telemeta/static/timeside/js/libs/raphael-min.js b/telemeta/static/timeside/js/libs/raphael-min.js deleted file mode 100644 index e5e71261..00000000 --- a/telemeta/static/timeside/js/libs/raphael-min.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Raphael 1.5.2 - JavaScript Vector Library - * - * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com) - * Licensed under the MIT (http://raphaeljs.com/license.html) license. - */ -(function(){function a(){if(a.is(arguments[0],G)){var b=arguments[0],d=bV[m](a,b.splice(0,3+a.is(b[0],E))),e=d.set();for(var g=0,h=b[w];g";bg=bf.firstChild;bg.style.behavior="url(#default#VML)";if(!(bg&&typeof bg.adj=="object"))return a.type=null;bf=null}a.svg=!(a.vml=a.type=="VML");j[e]=a[e];k=j[e];a._id=0;a._oid=0;a.fn={};a.is=function(a,b){b=x.call(b);if(b=="finite")return!O[f](+a);return b=="null"&&a===null||b==typeof a||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||J.call(a).slice(8,-1).toLowerCase()==b};a.angle=function(b,c,d,e,f,g){{if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return((h<0)*180+y.atan(-i/-h)*180/D+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)}};a.rad=function(a){return a%360*D/180};a.deg=function(a){return a*180/D%360};a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,G)){var e=b.length;while(e--)if(B(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(fb-d)return c-f+b}return c};function bh(){var a=[],b=0;for(;b<32;b++)a[b]=(~(~(y.random()*16)))[H](16);a[12]=4;a[16]=(a[16]&3|8)[H](16);return"r-"+a[v]("")}a.setWindow=function(a){h=a;g=h.document};var bi=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("");e.close();d=e.body}catch(a){d=createPopup().document.body}var f=d.createTextRange();bi=bm(function(a){try{d.style.color=r(a)[Y](c,p);var b=f.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b[H](16)).slice(-6)}catch(a){return"none"}})}else{var h=g.createElement("i");h.title="Raphaël Colour Picker";h.style.display="none";g.body[l](h);bi=bm(function(a){h.style.color=a;return g.defaultView.getComputedStyle(h,p).getPropertyValue("color")})}return bi(b)},bj=function(){return"hsb("+[this.h,this.s,this.b]+")"},bk=function(){return"hsl("+[this.h,this.s,this.l]+")"},bl=function(){return this.hex};a.hsb2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b){d=b.b;c=b.s;b=b.h;e=b.o}return a.hsl2rgb(b,c,d/2,e)};a.hsl2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b){d=b.l;c=b.s;b=b.h}if(b>1||c>1||d>1){b/=360;c/=100;d/=100}var f={},g=["r","g","b"],h,i,j,k,l,m;if(c){d<0.5?h=d*(1+c):h=d+c-d*c;i=2*d-h;for(var n=0;n<3;n++){j=b+1/3*-(n-1);j<0&&j++;j>1&&j--;j*6<1?f[g[n]]=i+(h-i)*6*j:j*2<1?f[g[n]]=h:j*3<2?f[g[n]]=i+(h-i)*(2/3-j)*6:f[g[n]]=i}}else f={r:d,g:d,b:d};f.r*=255;f.g*=255;f.b*=255;f.hex="#"+(16777216|f.b|f.g<<8|f.r<<16).toString(16).slice(1);a.is(e,"finite")&&(f.opacity=e);f.toString=bl;return f};a.rgb2hsb=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=f;{if(g==f)return{h:0,s:0,b:f,toString:bj};var k=f-g;i=k/f;b==f?h=(c-d)/k:c==f?h=2+(d-b)/k:h=4+(b-c)/k;h/=6;h<0&&h++;h>1&&h--}return{h:h,s:i,b:j,toString:bj}};a.rgb2hsl=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=(f+g)/2,k;if(g==f)k={h:0,s:0,l:j};else{var l=f-g;i=j<0.5?l/(f+g):l/(2-f-g);b==f?h=(c-d)/l:c==f?h=2+(d-b)/l:h=4+(b-c)/l;h/=6;h<0&&h++;h>1&&h--;k={h:h,s:i,l:j}}k.toString=bk;return k};a._path2string=function(){return this.join(",")[Y](ba,"$1")};function bm(a,b,c){function d(){var g=Array[e].slice.call(arguments,0),h=g[v]("►"),i=d.cache=d.cache||{},j=d.count=d.count||[];if(i[f](h))return c?c(i[h]):i[h];j[w]>=1000&&delete i[j.shift()];j[L](h);i[h]=a[m](b,g);return c?c(i[h]):i[h]}return d}a.getRGB=bm(function(b){if(!b||!(!((b=r(b)).indexOf("-")+1)))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(_[f](b.toLowerCase().substring(0,2))||b.charAt()=="#")&&(b=bi(b));var c,d,e,g,h,i,j,k=b.match(N);if(k){if(k[2]){g=T(k[2].substring(5),16);e=T(k[2].substring(3,5),16);d=T(k[2].substring(1,3),16)}if(k[3]){g=T((i=k[3].charAt(3))+i,16);e=T((i=k[3].charAt(2))+i,16);d=T((i=k[3].charAt(1))+i,16)}if(k[4]){j=k[4][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);k[1].toLowerCase().slice(0,4)=="rgba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100)}if(k[5]){j=k[5][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,g,h)}if(k[6]){j=k[6][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsla"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,g,h)}k={r:d,g:e,b:g};k.hex="#"+(16777216|g|e<<8|d<<16).toString(16).slice(1);a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1}},a);a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=0.075;if(b.h>1){b.h=0;b.s-=0.2;b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})}return c.hex};a.getColor.reset=function(){delete this.start};a.parsePathString=bm(function(b){if(!b)return null;var c={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=[];a.is(b,G)&&a.is(b[0],G)&&(d=bo(b));d[w]||r(b)[Y](bb,function(a,b,e){var f=[],g=x.call(b);e[Y](bc,function(a,b){b&&f[L](+b)});if(g=="m"&&f[w]>2){d[L]([b][n](f.splice(0,2)));g="l";b=b=="m"?"l":"L"}while(f[w]>=c[g]){d[L]([b][n](f.splice(0,c[g])));if(!c[g])break}});d[H]=a._path2string;return d});a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=C(j,3)*a+C(j,2)*3*i*c+j*3*i*i*e+C(i,3)*g,l=C(j,3)*b+C(j,2)*3*i*d+j*3*i*i*f+C(i,3)*h,m=a+2*i*(c-a)+i*i*(e-2*c+a),n=b+2*i*(d-b)+i*i*(f-2*d+b),o=c+2*i*(e-c)+i*i*(g-2*e+c),p=d+2*i*(f-d)+i*i*(h-2*f+d),q=(1-i)*a+i*c,r=(1-i)*b+i*d,s=(1-i)*e+i*g,t=(1-i)*f+i*h,u=90-y.atan((m-o)/(n-p))*180/D;(m>o||n1){x=y.sqrt(x);c=x*c;d=x*d}var z=c*c,A=d*d,C=(f==g?-1:1)*y.sqrt(B((z*A-z*u*u-A*t*t)/(z*u*u+A*t*t))),E=C*c*u/d+(a+h)/2,F=C*-d*t/c+(b+i)/2,G=y.asin(((b-F)/d).toFixed(9)),H=y.asin(((i-F)/d).toFixed(9));G=aH&&(G=G-D*2);!g&&H>G&&(H=H-D*2)}var I=H-G;if(B(I)>k){var J=H,K=h,L=i;H=G+k*(g&&H>G?1:-1);h=E+c*y.cos(H);i=F+d*y.sin(H);m=bt(h,i,c,d,e,0,g,K,L,[H,J,E,F])}I=H-G;var M=y.cos(G),N=y.sin(G),O=y.cos(H),P=y.sin(H),Q=y.tan(I/4),R=4/3*c*Q,S=4/3*d*Q,T=[a,b],U=[a+R*N,b-S*M],V=[h+R*P,i-S*O],W=[h,i];U[0]=2*T[0]-U[0];U[1]=2*T[1]-U[1];{if(j)return[U,V,W][n](m);m=[U,V,W][n](m)[v]()[s](",");var X=[];for(var Y=0,Z=m[w];Y"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}i=f-2*d+b-(h-2*f+d);j=2*(d-b)-2*(f-d);k=b-d;l=(-j+y.sqrt(j*j-4*i*k))/2/i;n=(-j-y.sqrt(j*j-4*i*k))/2/i;B(l)>"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}return{min:{x:A[m](0,p),y:A[m](0,o)},max:{x:z[m](0,p),y:z[m](0,o)}}}),bw=bm(function(a,b){var c=bq(a),d=b&&bq(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1];b.Y=a[2];break;case"A":a=["C"][n](bt[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x));d=b.y+(b.y-(b.by||b.y));a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x));b.qy=b.y+(b.y-(b.qy||b.y));a=["C"][n](bs(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1];b.qy=a[2];a=["C"][n](bs(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](br(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](br(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](br(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](br(b.x,b.y,b.X,b.Y));break}return a},h=function(a,b){if(a[b][w]>7){a[b].shift();var e=a[b];while(e[w])a.splice(b++,0,["C"][n](e.splice(0,6)));a.splice(b,1);k=z(c[w],d&&d[w]||0)}},i=function(a,b,e,f,g){if(a&&b&&a[g][0]=="M"&&b[g][0]!="M"){b.splice(g,0,["M",f.x,f.y]);e.bx=0;e.by=0;e.x=a[g][1];e.y=a[g][2];k=z(c[w],d&&d[w]||0)}};for(var j=0,k=z(c[w],d&&d[w]||0);j0.5)*2-1;C(e-0.5,2)+C(f-0.5,2)>0.25&&(f=y.sqrt(0.25-C(e-0.5,2))*g+0.5)&&f!=0.5&&(f=f.toFixed(5)-0.00001*g)}return p});b=b[s](/\s*\-\s*/);if(d=="linear"){var i=b.shift();i=-S(i);if(isNaN(i))return null;var j=[0,0,y.cos(i*D/180),y.sin(i*D/180)],k=1/(z(B(j[2]),B(j[3]))||1);j[2]*=k;j[3]*=k;if(j[2]<0){j[0]=-j[2];j[2]=0}if(j[3]<0){j[1]=-j[3];j[3]=0}}var m=bx(b);if(!m)return null;var n=a.getAttribute(I);n=n.match(/^url\(#(.*)\)$/);n&&c.defs.removeChild(g.getElementById(n[1]));var o=bG(d+"Gradient");o.id=bh();bG(o,d=="radial"?{fx:e,fy:f}:{x1:j[0],y1:j[1],x2:j[2],y2:j[3]});c.defs[l](o);for(var q=0,t=m[w];q1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(o);h[R](n,G.hex);n=="stroke"&&G[f]("opacity")&&bG(h,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity});break;case"gradient":(({circle:1,ellipse:1})[f](c.type)||r(o).charAt()!="r")&&bI(h,o,c.paper);break;case"opacity":i.gradient&&!i[f]("stroke-opacity")&&bG(h,{"stroke-opacity":o>1?o/100:o});case"fill-opacity":if(i.gradient){var H=g.getElementById(h.getAttribute(I)[Y](/^url\(#|\)$/g,p));if(H){var J=H.getElementsByTagName("stop");J[J[w]-1][R]("stop-opacity",o)}break}default:n=="font-size"&&(o=T(o,10)+"px");var K=n[Y](/(\-.)/g,function(a){return V.call(a.substring(1))});h.style[K]=o;h[R](n,o);break}}}bM(c,d);m?c.rotate(m.join(q)):S(j)&&c.rotate(j,true)},bL=1.2,bM=function(b,c){if(b.type!="text"||!(c[f]("text")||c[f]("font")||c[f]("font-size")||c[f]("x")||c[f]("y")))return;var d=b.attrs,e=b.node,h=e.firstChild?T(g.defaultView.getComputedStyle(e.firstChild,p).getPropertyValue("font-size"),10):10;if(c[f]("text")){d.text=c.text;while(e.firstChild)e.removeChild(e.firstChild);var i=r(c.text)[s]("\n");for(var j=0,k=i[w];jb.height&&(b.height=e.y+e.height-b.y);e.x+e.width-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};bN[e].attr=function(b,c){if(this.removed)return this;if(b==null){var d={};for(var e in this.attrs)this.attrs[f](e)&&(d[e]=this.attrs[e]);this._.rt.deg&&(d.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(d.scale=this.scale());d.gradient&&d.fill=="none"&&(d.fill=d.gradient)&&delete d.gradient;return d}if(c==null&&a.is(b,F)){if(b=="translation")return cz.call(this);if(b=="rotation")return this.rotate();if(b=="scale")return this.scale();if(b==I&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[b]}if(c==null&&a.is(b,G)){var g={};for(var h=0,i=b.length;h"));m.W=h.w=m.paper.span.offsetWidth;m.H=h.h=m.paper.span.offsetHeight;m.X=h.x;m.Y=h.y+Q(m.H/2);switch(h["text-anchor"]){case"start":m.node.style["v-text-align"]="left";m.bbx=Q(m.W/2);break;case"end":m.node.style["v-text-align"]="right";m.bbx=-Q(m.W/2);break;default:m.node.style["v-text-align"]="center";break}}};bI=function(a,b){a.attrs=a.attrs||{};var c=a.attrs,d,e="linear",f=".5 .5";a.attrs.gradient=b;b=r(b)[Y](bd,function(a,b,c){e="radial";if(b&&c){b=S(b);c=S(c);C(b-0.5,2)+C(c-0.5,2)>0.25&&(c=y.sqrt(0.25-C(b-0.5,2))*((c>0.5)*2-1)+0.5);f=b+q+c}return p});b=b[s](/\s*\-\s*/);if(e=="linear"){var g=b.shift();g=-S(g);if(isNaN(g))return null}var h=bx(b);if(!h)return null;a=a.shape||a.node;d=a.getElementsByTagName(I)[0]||cd(I);!d.parentNode&&a.appendChild(d);if(h[w]){d.on=true;d.method="none";d.color=h[0].color;d.color2=h[h[w]-1].color;var i=[];for(var j=0,k=h[w];j")}}catch(a){cd=function(a){return g.createElement("<"+a+" xmlns=\"urn:schemas-microsoft.com:vml\" class=\"rvml\">")}}bV=function(){var b=by[m](0,arguments),c=b.container,d=b.height,e,f=b.width,h=b.x,i=b.y;if(!c)throw new Error("VML container not found.");var k=new j,n=k.canvas=g.createElement("div"),o=n.style;h=h||0;i=i||0;f=f||512;d=d||342;f==+f&&(f+="px");d==+d&&(d+="px");k.width=1000;k.height=1000;k.coordsize=b_*1000+q+b_*1000;k.coordorigin="0 0";k.span=g.createElement("span");k.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";n[l](k.span);o.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d);if(c==1){g.body[l](n);o.left=h+"px";o.top=i+"px";o.position="absolute"}else c.firstChild?c.insertBefore(n,c.firstChild):c[l](n);bz.call(k,k,a.fn);return k};k.clear=function(){this.canvas.innerHTML=p;this.span=g.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[l](this.span);this.bottom=this.top=null};k.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bF(a);return true}}var ce=navigator.userAgent.match(/Version\\x2f(.*?)\s/);navigator.vendor=="Apple Computer, Inc."&&(ce&&ce[1]<4||navigator.platform.slice(0,2)=="iP")?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});h.setTimeout(function(){a.remove()})}:k.safari=function(){};var cf=function(){this.returnValue=false},cg=function(){return this.originalEvent.preventDefault()},ch=function(){this.cancelBubble=true},ci=function(){return this.originalEvent.stopPropagation()},cj=(function(){{if(g.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,g=function(e){if(o&&u[f](b))for(var g=0,h=e.targetTouches&&e.targetTouches.length;g1&&(a=Array[e].splice.call(arguments,0,arguments[w]));return new cC(a)};k.setSize=bU;k.top=k.bottom=null;k.raphael=a;function co(){return this.x+q+this.y}bO.resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};bO.scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:co};b=b||a;!(+b)&&(b=a);var e,f,g,h,i=this.attrs;if(a!=0){var j=this.getBBox(),k=j.x+j.width/2,l=j.y+j.height/2,m=B(a/this._.sx),o=B(b/this._.sy);c=+c||c==0?c:k;d=+d||d==0?d:l;var r=this._.sx>0,s=this._.sy>0,t=~(~(a/B(a))),u=~(~(b/B(b))),x=m*t,y=o*u,z=this.node.style,A=c+B(k-c)*x*(k>c==r?1:-1),C=d+B(l-d)*y*(l>d==s?1:-1),D=a*t>b*u?o:m;switch(this.type){case"rect":case"image":var E=i.width*m,F=i.height*o;this.attr({height:F,r:i.r*D,width:E,x:A-E/2,y:C-F/2});break;case"circle":case"ellipse":this.attr({rx:i.rx*m,ry:i.ry*o,r:i.r*D,cx:A,cy:C});break;case"text":this.attr({x:A,y:C});break;case"path":var G=bp(i.path),H=true,I=r?x:m,J=s?y:o;for(var K=0,L=G[w];Kr)p=n.data[r*l];else{p=a.findDotsAtSegment(b,c,d,e,f,g,h,i,r/l);n.data[r]=p}r&&(k+=C(C(o.x-p.x,2)+C(o.y-p.y,2),0.5));if(j!=null&&k>=j)return p;o=p}if(j==null)return k},cr=function(b,c){return function(d,e,f){d=bw(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;oe){if(c&&!l.start){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);k+=["C",m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k;k=["M",m.x,m.y+"C",m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]][v]();n+=j;g=+i[5];h=+i[6];continue}if(!b&&!c){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j;g=+i[5];h=+i[6]}k+=i}l.end=k;m=b?n:c?l:a.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],1);m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cs=cr(1),ct=cr(),cu=cr(0,1);bO.getTotalLength=function(){if(this.type!="path")return;if(this.node.getTotalLength)return this.node.getTotalLength();return cs(this.attrs.path)};bO.getPointAtLength=function(a){if(this.type!="path")return;return ct(this.attrs.path,a)};bO.getSubpath=function(a,b){if(this.type!="path")return;if(B(this.getTotalLength()-b)<"1e-6")return cu(this.attrs.path,a).end;var c=cu(this.attrs.path,b,1);return a?cu(c,a).end:c};a.easing_formulas={linear:function(a){return a},"<":function(a){return C(a,3)},">":function(a){return C(a-1,3)+1},"<>":function(a){a=a*2;if(a<1)return C(a,3)/2;a-=2;return(C(a,3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=0.3,c=b/4;return C(2,-10*a)*y.sin((a-c)*(2*D)/b)+1},bounce:function(a){var b=7.5625,c=2.75,d;if(a<1/c)d=b*a*a;else if(a<2/c){a-=1.5/c;d=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;d=b*a*a+0.9375}else{a-=2.625/c;d=b*a*a+0.984375}return d}};var cv=[],cw=function(){var b=+(new Date);for(var c=0;cd)return d;while(cf?c=e:d=e;e=(d-c)/2+c}return e}return n(a,1/(200*f))}bO.onAnimation=function(a){this._run=a||0;return this};bO.animate=function(c,d,e,g){var h=this;h.timeouts=h.timeouts||[];if(a.is(e,"function")||!e)g=e||null;if(h.removed){g&&g.call(h);return h}var i={},j={},k=false,l={};for(var m in c)if(c[f](m)){if(X[f](m)||h.paper.customAttributes[f](m)){k=true;i[m]=h.attr(m);i[m]==null&&(i[m]=W[m]);j[m]=c[m];switch(X[m]){case"along":var n=cs(c[m]),o=ct(c[m],n*!(!c.back)),p=h.getBBox();l[m]=n/d;l.tx=p.x;l.ty=p.y;l.sx=o.x;l.sy=o.y;j.rot=c.rot;j.back=c.back;j.len=n;c.rot&&(l.r=S(h.rotate())||0);break;case E:l[m]=(j[m]-i[m])/d;break;case"colour":i[m]=a.getRGB(i[m]);var q=a.getRGB(j[m]);l[m]={r:(q.r-i[m].r)/d,g:(q.g-i[m].g)/d,b:(q.b-i[m].b)/d};break;case"path":var t=bw(i[m],j[m]);i[m]=t[0];var u=t[1];l[m]=[];for(var v=0,x=i[m][w];v8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Oa):false)||d.url.match(Wa);d.isMovieStar&&c._wD("soundManager.createSound(): using MovieStar handling"); -if(d.isMovieStar){if(d.usePeakData)l("noPeak"),d.usePeakData=false;d.loops>1&&l("noNSLoop")}}d=ba(d,"soundManager.createSound(): ");f=a();if(j===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:false,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,true,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=true,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&& -f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!o(b))return false;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f8&&b.match(Oa)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=P({url:b}));return!w||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?true:c.canPlayURL(b.href)}; -this.getSoundById=function(b,a){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");var e=c.sounds[b];!e&&!a&&c._wD('"'+b+'" is an invalid sound ID.',2);return e};this.onready=function(b,a){if(b&&b instanceof Function)return m&&c._wD(n("queue","onready")),a||(a=i),ja("onready",b,a),C(),true;else throw n("needFunction","onready");};this.ontimeout=function(b,a){if(b&&b instanceof Function)return m&&c._wD(n("queue","ontimeout")),a||(a=i),ja("ontimeout",b,a),C({type:"ontimeout"}), -true;else throw n("needFunction","ontimeout");};this._wD=this._writeDebug=function(b,a,e){var f,d;if(!c.debugMode)return false;typeof e!=="undefined"&&e&&(b=b+" | "+(new Date).getTime());if(va&&c.useConsole){e=Ra[a];if(typeof console[e]!=="undefined")console[e](b);else console.log(b);if(c.useConsoleOnly)return true}try{f=u("soundmanager-debug");if(!f)return false;d=g.createElement("div");if(++Qa%2===0)d.className="sm2-alt";a=typeof a==="undefined"?0:parseInt(a,10);d.appendChild(g.createTextNode(b)); -if(a){if(a>=2)d.style.fontWeight="bold";if(a===3)d.style.color="#ff3333"}f.insertBefore(d,f.firstChild)}catch(Ya){}return true};this._debug=function(){var b,a;l("currentObj",1);for(b=0,a=c.soundIDs.length;b0&&a.position===a.duration)c._wD('SMSound.play(): "'+a.sID+'": Sound at end, resetting to position:0'),a._iO.position=0;if(a.paused&&a.position&&a.position>0)c._wD('SMSound.play(): "'+a.sID+'" is resuming from paused state',1),a.resume();else{c._wD('SMSound.play(): "'+a.sID+'" is starting to play');a.playState=1;a.paused=false;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&j>8&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&& -!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=ba(aa(a._iO));if(a._iO.onplay&&e)a._iO.onplay.apply(a),a._onplay_called=true;a.setVolume(a._iO.volume,true);a.setPan(a._iO.pan,true);a.isHTML5?(d(),f=a._setup_html5(),a.setPosition(a._iO.position),f.play()):c.o._start(a.sID,a._iO.loops||1,j===9?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);a.paused=false;if(!a.isHTML5)a.playState=0;a._iO.onstop&&a._iO.onstop.apply(a); -if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){c._wD("sound "+a.sID+" turned autoplay "+(b?"on":"off"));a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),b&&!a.instanceCount&&a.readyState===1&&(a.instanceCount++,c._wD("sound "+a.sID+" incremented instance count to "+a.instanceCount)))};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition= -function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a)if(a._html5_canplay){if(a._a.currentTime!==b){c._wD("setPosition("+b+"): setting position");try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){c._wD("setPosition("+b+"): setting position failed: "+e.message,2)}}}else c._wD("setPosition("+b+"): delaying, sound not ready")}else b= -j===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(true);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;c._wD("SMSound.pause()");a.paused=true;a.isHTML5?(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;c._wD("SMSound.resume()");a.paused=false;a.playState=1;a.isHTML5?(a._setup_html5().play(), -d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=true):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){c._wD("SMSound.togglePause()");if(a.playState===0)return a.play({position:j===9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=false);a.isHTML5||c.o._setPan(a.sID, -b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=false);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume=b;return a};this.mute=function(){a.muted=true;if(a.isHTML5){if(a._a)a._a.muted=true}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=false;var b=typeof a._iO.volume!== -"undefined";if(a.isHTML5){if(a._a)a._a.muted=false}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(c,b,d){a._onPositionItems.push({position:c,method:b,scope:typeof d!=="undefined"?d:a,fired:false});return a};this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return false;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>= -d.position)d.fired=true,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return true};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return false;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=false,c._onPositionFired--;return true};d=function(){a.isHTML5&&Ea(a)};f=function(){a.isHTML5&&Fa(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=false;a._a=null;a._html5_canplay=false;a.bytesLoaded=null; -a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=false;a.playState=0;a.paused=false;a.readyState=0;a.muted=false;a.isBuffering=false;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};e();this._onTimer=function(b){var d={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(), -a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,d,d,d,d),true):(c._wD('_onTimer: Warn for "'+a.sID+'": '+(!a._a?"Could not find element. ":"")+(a.playState===0?"playState bad, 0?":"playState = "+a.playState+", OK")),false)};this._get_html5_duration=function(){var c=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return c&&!isNaN(c)&&c!==Infinity?c:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=s(a._iO,b),d=Q?c._global_a:a._a,f=decodeURI(b.url), -g=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&g.url===b.url&&(!a._lastURL||a._lastURL===g.url))return d;c._wD("setting new URL on existing object: "+f+(a._lastURL?", old URL: "+a._lastURL:""));Q&&d._t&&d._t.playState&&b.url!==g.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=false}else{c._wD("creating HTML5 Audio() element with URL: "+f);d=new Audio(b.url);d._called_load=false;if(Ta)d._called_load=true;if(Q)c._global_a=d}a.isHTML5=true;a._a=d;d._t=a;a._add_html5_events(); -d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=true):(d.autobuffer=false,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return false;var b;c._wD(h+"adding event listeners: "+a.sID);a._a._added_events=true;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,x[b],false);return true};this._remove_html5_events=function(){var b;c._wD(h+"removing event listeners: "+ -a.sID);a._a._added_events=false;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,x[b],false)};this._onload=function(b){b=!!b;c._wD('SMSound._onload(): "'+a.sID+'"'+(b?" loaded.":" failed to load? - "+a.url),b?1:2);!b&&!a.isHTML5&&(c.sandbox.noRemote===true&&c._wD("SMSound._onload(): "+n("noNet"),1),c.sandbox.noLocal===true&&c._wD("SMSound._onload(): "+n("noLocal"),1));a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return true};this._onbufferchange= -function(b){if(a.playState===0)return false;if(b&&a.isBuffering||!b&&!a.isBuffering)return false;a.isBuffering=b===1;a._iO.onbufferchange&&(c._wD("SMSound._onbufferchange(): "+b),a._iO.onbufferchange.apply(a));return true};this._onsuspend=function(){a._iO.onsuspend&&(c._wD("SMSound._onsuspend()"),a._iO.onsuspend.apply(a));return true};this._onfailure=function(b,d,e){a.failures++;c._wD('SMSound._onfailure(): "'+a.sID+'" count '+a.failures);if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,d,e); -else c._wD("SMSound._onfailure(): ignoring")};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=false,a.instanceCount=0,a.instanceOptions={},a._iO={},f();if((!a.instanceCount||a._iO.multiShotEvents)&&b)c._wD('SMSound._onfinish(): "'+a.sID+'"'),b.apply(a)}};this._whileloading=function(c,b,d,e){a.bytesLoaded=c;a.bytesTotal=b;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate= -a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(c,b,d,e,f){if(isNaN(c)||c===null)return false;a.position=c;a.processOnPosition();if(!a.isHTML5&&j>8){if(a._iO.usePeakData&&typeof b!=="undefined"&&b)a.peakData={left:b.leftPeak,right:b.rightPeak}; -if(a._iO.useWaveformData&&typeof d!=="undefined"&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!=="undefined"&&f&&f.leftEQ&&(c=f.leftEQ.split(","),a.eqData=c,a.eqData.left=c,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&j===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return true};this._onid3=function(b,d){c._wD('SMSound._onid3(): "'+this.sID+ -'" ID3 data received.');var e=[],f,g;for(f=0,g=b.length;f0&&(c._wD("SMSound._ondataerror(): "+ -b),a._iO.ondataerror&&a._iO.ondataerror.apply(a))}};Y=function(){return g.body||g._docElement||g.getElementsByTagName("div")[0]};u=function(b){return g.getElementById(b)};s=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};p=function(){function b(a){var a=Ia.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(false);return a}function a(a,b){var g= -a.shift(),j=[f[b]];if(c)g[j](a[0],a[1]);else g[j].apply(g,a)}var c=i.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();x={abort:k(function(){c._wD(h+"abort: "+this._t.sID)}),canplay:k(function(){if(this._t._html5_canplay)return true;this._t._html5_canplay=true;c._wD(h+"canplay: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0);var b=!isNaN(this._t.position)? -this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b){c._wD(h+"canplay: setting position to "+b);try{this.currentTime=b}catch(a){c._wD(h+"setting position failed: "+a.message,2)}}}),load:k(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(true))}),emptied:k(function(){c._wD(h+"emptied: "+this._t.sID)}),ended:k(function(){c._wD(h+"ended: "+this._t.sID);this._t._onfinish()}), -error:k(function(){c._wD(h+"error: "+this.error.code);this._t._onload(false)}),loadeddata:k(function(){var b=this._t,a=b.bytesTotal||1;c._wD(h+"loadeddata: "+this._t.sID);if(!b._loaded&&!R)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(true)}),loadedmetadata:k(function(){c._wD(h+"loadedmetadata: "+this._t.sID)}),loadstart:k(function(){c._wD(h+"loadstart: "+this._t.sID);this._t._onbufferchange(1)}),play:k(function(){c._wD(h+"play: "+this._t.sID+", "+this._t.url); -this._t._onbufferchange(0)}),playing:k(function(){c._wD(h+"playing: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0)}),progress:k(function(b){if(this._t.loaded)return false;var a,e,f;f=0;var d=b.type==="progress";e=b.target.buffered;var g=b.loaded||0,xa=b.total||1;if(e&&e.length){for(a=e.length;a--;)f=e.end(a)-e.start(a);g=f/b.target.duration;if(d&&e.length>1){f=[];e=e.length;for(a=0;a1&&b.stream)l("as2loop"),b.stream=false;return b};ba=function(b,a){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))c._wD((a||"")+n("policy")),b.usePolicyFile=true;return b};pa=function(b){typeof console!=="undefined"&&typeof console.warn!=="undefined"?console.warn(b):c._wD(b)};ga=function(){return false}; -Ba=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=ga)};$=function(b){typeof b==="undefined"&&(b=false);if(v||b)l("smFail",2),c.disable(b)};Ca=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};ka=function(){j=parseInt(c.flashVersion, -10);if(j!==8&&j!==9)c._wD(n("badFV",j,8)),c.flashVersion=j=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&j<9)c._wD(n("needfl9")),c.flashVersion=j=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":j===9?" (AS3/Flash 9)":" (AS2/Flash 8)");j>8?(c.defaultOptions=s(c.defaultOptions,c.flash9Options),c.features.buffering=true,c.defaultOptions=s(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Pa.join("|")+ -")(\\?.*)?$","i"),c.features.movieStar=true):c.features.movieStar=false;c.filePattern=c.filePatterns[j!==8?"flash9":"flash8"];c.movieURL=(j===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=j>8};Aa=function(b,a){if(!c.o)return false;c.o._setPolling(b,a)};ma=function(){if(c.debugURLParam.test(K))c.debugMode=true;if(u(c.debugID))return false;var b,a,e,f;if(c.debugMode&&!u(c.debugID)&&(!va||!c.useConsole||c.useConsole&& -va&&!c.consoleOnly)){b=g.createElement("div");b.id=c.debugID+"-toggle";a={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};b.appendChild(g.createTextNode("-"));b.onclick=Da;b.title="Toggle SM2 debug console";if(q.match(/msie 6/i))b.style.position="absolute",b.style.cursor="hand";for(f in a)a.hasOwnProperty(f)&&(b.style[f]=a[f]);a=g.createElement("div"); -a.id=c.debugID;a.style.display=c.debugMode?"block":"none";if(c.debugMode&&!u(b.id)){try{e=Y(),e.appendChild(b)}catch(d){throw Error(n("domError")+" \n"+d.toString());}e.appendChild(a)}}};o=this.getSoundById;l=function(b,a){return b?c._wD(n(b),a):""};if(K.indexOf("sm2-debug=alert")+1&&c.debugMode)c._wD=function(b){S.alert(b)};Da=function(){var b=u(c.debugID),a=u(c.debugID+"-toggle");if(!b)return false;ha?(a.innerHTML="+",b.style.display="none"):(a.innerHTML="-",b.style.display="block");ha=!ha};r=function(b, -a,c){if(typeof sm2Debugger!=="undefined")try{sm2Debugger.handleEvent(b,a,c)}catch(f){}return true};G=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};oa=function(){var b=n("fbHandler"),a=c.getMoviePercent(),e=c.swfCSS,f={type:"FLASHBLOCK"};if(c.html5Only)return false;if(c.ok()){if(c.didFlashBlock&&c._wD(b+": Unblocked"),c.oMC)c.oMC.className=[G(),e.swfDefault,e.swfLoaded+(c.didFlashBlock? -" "+e.swfUnblocked:"")].join(" ")}else{if(w)c.oMC.className=G()+" "+e.swfDefault+" "+(a===null?e.swfTimedout:e.swfError),c._wD(b+": "+n("fbTimeout")+(a?" ("+n("fbLoaded")+")":""));c.didFlashBlock=true;C({type:"ontimeout",ignoreInit:true,error:f});F(f)}};ja=function(b,a,c){typeof y[b]==="undefined"&&(y[b]=[]);y[b].push({method:a,scope:c||null,fired:false})};C=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return false;if(b.type==="ontimeout"&&c.ok())return false;var a={success:b&&b.ignoreInit? -c.ok():!v},e=b&&b.type?y[b.type]||[]:[],f=[],d,g=[a],j=w&&c.useFlashBlock&&!c.ok();if(b.error)g[0].error=b.error;for(a=0,d=e.length;a'}if(L&&M)return false;if(c.html5Only)return ka(),e(),c.oMC= -u(c.movieID),U(),M=L=true,false;var d=a||c.url,j=c.altURL||d,h;h=Y();var i,o,k=G(),m,p=null,p=(p=g.getElementsByTagName("html")[0])&&p.dir&&p.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;ka();c.url=Ca(I?d:j);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(c.wmode!==null&&(q.match(/msie 8/i)||!A&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=true,l("spcWmode"),c.wmode=null;h={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high", -allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Na+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)h.FlashVars="debug=1";c.wmode||delete h.wmode;if(A)d=g.createElement("div"),o=['',f("movie",a),f("AllowScriptAccess",c.allowScriptAccess),f("quality",h.quality),c.wmode?f("wmode",c.wmode):"",f("bgcolor",c.bgColor),f("hasPriority","true"),c.debugFlash?f("FlashVars",h.FlashVars):"",""].join("");else for(i in d=g.createElement("embed"),h)h.hasOwnProperty(i)&&d.setAttribute(i,h[i]);ma();k=G();if(h=Y())if(c.oMC=u(c.movieID)||g.createElement("div"),c.oMC.id){m=c.oMC.className;c.oMC.className=(m?m+" ":c.swfCSS.swfDefault)+(k?" "+k:"");c.oMC.appendChild(d); -if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;M=true}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+k;i=k=null;if(!c.useFlashBlock)if(c.useHighPerformance)k={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},p)k.left=Math.abs(parseInt(k.left,10))+"px";if(Ua)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(m in k)k.hasOwnProperty(m)&& -(c.oMC.style[m]=k[m]);try{A||c.oMC.appendChild(d);h.appendChild(c.oMC);if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;M=true}catch(r){throw Error(n("domError")+" \n"+r.toString());}}L=true;e();c._wD("soundManager::createMovie(): Trying to load "+a+(!I&&c.altURL?" (alternate URL)":""),1);return true};X=function(){if(c.html5Only)return Z(),false;if(c.o)return false;c.o=c.getMovie(c.id);if(!c.o)O?(A?c.oMC.innerHTML=na:c.oMC.appendChild(O),O=null,L=true):Z(c.id, -c.url),c.o=c.getMovie(c.id);c.o&&l("waitEI");c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return true};V=function(){setTimeout(za,1E3)};za=function(){if(ca)return false;ca=true;p.remove(i,"load",V);if(H&&!wa)return l("waitFocus"),false;var b;m||(b=c.getMoviePercent(),c._wD(n("waitImpatient",b===100?" (SWF loaded)":b>0?" (SWF "+b+"% loaded)":"")));setTimeout(function(){b=c.getMoviePercent();m||(c._wD("soundManager: No Flash response within expected time.\nLikely causes: "+(b===0? -"Loading "+c.movieURL+" may have failed (and/or Flash "+j+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+n("checkSWF"):""),2),!I&&b&&(l("localFail",2),c.debugFlash||l("tryDebug",2)),b===0&&c._wD(n("swf404",c.url)),r("flashtojs",false,": Timed out"+I?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!m&&La&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?(c.useFlashBlock&&oa(),l("waitForever")):$(true):c.flashLoadTimeout===0?l("waitForever"): -$(true))},c.flashLoadTimeout)};B=function(){function b(){p.remove(i,"focus",B);p.remove(i,"load",B)}if(wa||!H)return b(),true;wa=La=true;c._wD("soundManager::handleFocus()");R&&H&&p.remove(i,"mousemove",B);ca=false;b();return true};Ka=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5){for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&t&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&t?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required? -"required, ":"")+"and no flash support)":""));c._wD("-- SoundManager 2: HTML5 support tests ("+c.html5Test+"): "+a.join(", ")+" --",1)}};N=function(b){if(m)return false;if(c.html5Only)return c._wD("-- SoundManager 2: loaded --"),m=true,D(),r("onload",true),true;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=true,v&&(a={type:!t&&w?"NO_FLASH":"INIT_TIMEOUT"});c._wD("-- SoundManager 2 "+(v?"failed to load":"loaded")+" ("+(v?"security/load error":"OK")+") --",1);if(v||b){if(c.useFlashBlock&& -c.oMC)c.oMC.className=G()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);C({type:"ontimeout",error:a});r("onload",false);F(a);return false}else r("onload",true);if(c.waitForWindowLoad&&!ia)return l("waitOnload"),p.add(i,"load",D),false;else c.waitForWindowLoad&&ia&&l("docLoaded"),D();return true};U=function(){l("init");if(m)return l("didInit"),false;if(c.html5Only){if(!m)p.remove(i,"load",c.beginDelayedInit),c.enabled=true,N();return true}X();try{l("flashJS"),c.o._externalInterfaceTest(false), -Aa(true,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=true,r("jstoflash",true),c.html5Only||p.add(i,"unload",ga)}catch(b){return c._wD("js/flash exception: "+b.toString()),r("jstoflash",false),F({type:"JS_TO_FLASH_EXCEPTION",fatal:true}),$(true),N(),false}N();p.remove(i,"load",c.beginDelayedInit);return true};E=function(){if(la)return false;la=true;ma();var b=K.toLowerCase(),a=null,a=null,e=typeof console!=="undefined"&&typeof console.log!=="undefined"; -if(b.indexOf("sm2-usehtml5audio=")!==-1)a=b.charAt(b.indexOf("sm2-usehtml5audio=")+18)==="1",e&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.useHTML5Audio=a;if(b.indexOf("sm2-preferflash=")!==-1)a=b.charAt(b.indexOf("sm2-preferflash=")+16)==="1",e&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),c.preferFlash=a;if(!t&&c.hasHTML5)c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode.")),c.useHTML5Audio= -true,c.preferFlash=false;Ha();c.html5.usingFlash=Ga();w=c.html5.usingFlash;Ka();if(!t&&w)c._wD("SoundManager: Fatal error: Flash is needed to play some required formats, but is not available."),c.flashLoadTimeout=1;g.removeEventListener&&g.removeEventListener("DOMContentLoaded",E,false);X();return true};sa=function(){g.readyState==="complete"&&(E(),g.detachEvent("onreadystatechange",sa));return true};ea();p.add(i,"focus",B);p.add(i,"load",B);p.add(i,"load",V);R&&H&&p.add(i,"mousemove",B);g.addEventListener? -g.addEventListener("DOMContentLoaded",E,false):g.attachEvent?g.attachEvent("onreadystatechange",sa):(r("onload",false),F({type:"NO_DOM2_EVENTS",fatal:true}));g.readyState==="complete"&&setTimeout(E,100)}var fa=null;if(typeof SM2_DEFER==="undefined"||!SM2_DEFER)fa=new T;S.SoundManager=T;S.soundManager=fa})(window); \ No newline at end of file diff --git a/telemeta/static/timeside/js/libs/soundmanager2-nodebug-jsmin.js b/telemeta/static/timeside/js/libs/soundmanager2-nodebug-jsmin.js deleted file mode 100755 index 6bc09204..00000000 --- a/telemeta/static/timeside/js/libs/soundmanager2-nodebug-jsmin.js +++ /dev/null @@ -1,76 +0,0 @@ -/** @license - * - * SoundManager 2: JavaScript Sound for the Web - * ---------------------------------------------- - * http://schillmania.com/projects/soundmanager2/ - * - * Copyright (c) 2007, Scott Schiller. All rights reserved. - * Code provided under the BSD License: - * http://schillmania.com/projects/soundmanager2/license.txt - * - * V2.97a.20111030 - */ -(function($){function N(N,Z){function j(c){return function(a){return!this._t||!this._t._a?null:c.call(this,a)}}this.flashVersion=8;this.debugFlash=this.debugMode=false;this.useConsole=true;this.waitForWindowLoad=this.consoleOnly=false;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock=false;this.useHTML5Audio=true;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=true; -this.noSWFCache=false;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:true},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:false},ogg:{type:["audio/ogg; codecs=vorbis"],required:false},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:false}};this.defaultOptions={autoLoad:false,stream:true,autoPlay:false, -loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,multiShot:true,multiShotEvents:false,position:null,pan:0,type:null,usePolicyFile:false,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";this.id=Z||"sm2movie"; -this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20111030";this.movieURL=this.version=null;this.url=N||null;this.altURL=null;this.enabled=this.swfLoaded=false;this.oMC=this.o=null;this.sounds={};this.soundIDs=[]; -this.didFlashBlock=this.specialWmodeCase=this.muted=false;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={};var F;try{F=typeof Audio!=="undefined"&&typeof(new Audio).canPlayType!=="undefined"}catch(Oa){F=false}this.hasHTML5=F;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=false;var ra,c=this,O,o=navigator.userAgent,i=$,aa= -i.location.href.toString(),h=document,ba,P,g,s=[],G=false,H=false,m=false,t=false,sa=false,I,n,ca,z,A,Q,ta,da,x,R,B,ea,fa,S,C,ua,ga,va,T,wa,J=null,ha=null,y,ia,D,U,V,ja,l,W=false,ka=false,xa,ya,q=null,za,X,K,u,la,ma,Aa,k,Ia=Array.prototype.slice,L=false,p,Y,Ba,r,Ca,na=o.match(/(ipad|iphone|ipod)/i),Ja=o.match(/firefox/i),Ka=o.match(/droid/i),v=o.match(/msie/i),La=o.match(/webkit/i),M=o.match(/safari/i)&&!o.match(/chrome/i),Ma=o.match(/opera/i);F=o.match(/(mobile|pre\/|xoom)/i)||na;var oa=!aa.match(/usehtml5audio/i)&& -!aa.match(/sm2\-ignorebadua/i)&&M&&o.match(/OS X 10_6_([3-7])/i),pa=typeof h.hasFocus!=="undefined"?h.hasFocus():null,E=M&&typeof h.hasFocus==="undefined",Da=!E,Ea=/(mp3|mp4|mpa)/i,qa=h.location?h.location.protocol.match(/http/i):null,Fa=!qa?"http://":"",Ga=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Ha="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),Na=RegExp("\\.("+Ha.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; -this.useAltURL=!qa;this._global_a=null;if(F&&(c.useHTML5Audio=true,c.preferFlash=false,na))L=c.ignoreFlash=true;this.supported=this.ok=function(){return q?m&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return O(c)||h[c]||i[c]};this.createSound=function(b){function a(){e=U(e);c.sounds[d.id]=new ra(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return ja("soundManager.createSound(): "+y(!m?"notReady":"notOK")),false;arguments.length===2&&(b={id:arguments[0], -url:arguments[1]});d=e=n(b);if(l(d.id,true))return c.sounds[d.id];if(X(d))f=a(),f._setup_html5(d);else{if(g>8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Ga):false)||d.url.match(Na);if(d.isMovieStar&&d.usePeakData)d.usePeakData=false}d=V(d,"soundManager.createSound(): ");f=a();if(g===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:false,d.loops|| -1,d.serverURL,d.duration||null,d.autoPlay,true,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=true,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&&f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!l(b))return false;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f -8&&b.match(Ga)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=K({url:b}));return!q||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?true:c.canPlayURL(b.href)};this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");return c.sounds[b]};this.onready=function(c,a){if(c&&c instanceof Function)return a||(a=i),ca("onready",c,a),z(),true;else throw y("needFunction", -"onready");};this.ontimeout=function(c,a){if(c&&c instanceof Function)return a||(a=i),ca("ontimeout",c,a),z({type:"ontimeout"}),true;else throw y("needFunction","ontimeout");};this._wD=this._writeDebug=function(){return true};this._debug=function(){};this.reboot=function(){var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(v)ha=c.o.innerHTML;J=c.o.parentNode.removeChild(c.o)}catch(e){}ha=J=q=null;c.enabled=ea=m=W=ka=G=H=t=c.swfLoaded=false;c.soundIDs=c.sounds=[];c.o=null; -for(b in s)if(s.hasOwnProperty(b))for(a=s[b].length;a--;)s[b][a].fired=false;i.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?c.o.PercentLoaded():null};this.beginDelayedInit=function(){sa=true;B();setTimeout(function(){if(ka)return false;S();R();return ka=true},20);Q()};this.destruct=function(){c.disable(true)};ra=function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=n(b);this.pan= -this.options.pan;this.volume=this.options.volume;this._lastURL=null;this.isHTML5=false;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=n(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;if(a._iO.url===a.url&&a.readyState!==0&&a.readyState!==2)return a;a._lastURL=a.url;a.loaded=false;a.readyState=1;a.playState= -0;if(X(a._iO)){if(d=a._setup_html5(a._iO),!d._called_load)a._html5_canplay=false,d.load(),d._called_load=true,a._iO.autoPlay&&a.play()}else try{a.isHTML5=false,a._iO=V(U(a._iO)),g===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1,a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,!!a._iO.stream,!!a._iO.autoPlay,a._iO.loops||1,!!a._iO.autoLoad,a._iO.usePolicyFile)}catch(e){C({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:true})}return a};this.unload=function(){a.readyState!== -0&&(a.isHTML5?(f(),a._a&&(a._a.pause(),la(a._a))):g===8?c.o._unload(a.sID,"about:blank"):c.o._unload(a.sID),e());return a};this.destruct=function(b){if(a.isHTML5){if(f(),a._a)a._a.pause(),la(a._a),L||a._remove_html5_events(),a._a._t=null,a._a=null}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,true)};this.start=this.play=function(b,w){var e,w=w===void 0?true:w;b||(b={});a._iO=n(b,a._iO);a._iO=n(a._iO,a.options);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()|| -a.setAutoPlay(true),a;X(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState===1&&!a.paused&&(e=a._iO.multiShot,!e))return a;if(!a.loaded)if(a.readyState===0){if(!a.isHTML5)a._iO.autoPlay=true;a.load(a._iO)}else if(a.readyState===2)return a;if(!a.isHTML5&&g===9&&a.position>0&&a.position===a.duration)a._iO.position=0;if(a.paused&&a.position&&a.position>0)a.resume();else{a.playState=1;a.paused=false;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&g>8&&!a.getAutoPlay())&&a.instanceCount++;a.position= -typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=V(U(a._iO));if(a._iO.onplay&&w)a._iO.onplay.apply(a),a._onplay_called=true;a.setVolume(a._iO.volume,true);a.setPan(a._iO.pan,true);a.isHTML5?(d(),e=a._setup_html5(),a.setPosition(a._iO.position),e.play()):c.o._start(a.sID,a._iO.loops||1,g===9?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);a.paused=false;if(!a.isHTML5)a.playState= -0;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),b&&!a.instanceCount&&a.readyState===1&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration|| -a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==b)try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){}}else b=g===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(true);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;a.paused=true;a.isHTML5? -(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;a.paused=false;a.playState=1;a.isHTML5?(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=true):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){if(a.playState===0)return a.play({position:g===9&&!a.isHTML5? -a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=false);a.isHTML5||c.o._setPan(a.sID,b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=false);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume= -b;return a};this.mute=function(){a.muted=true;if(a.isHTML5){if(a._a)a._a.muted=true}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=false;var b=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=false}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(b,c,d){a._onPositionItems.push({position:b,method:c,scope:typeof d!=="undefined"?d:a,fired:false});return a}; -this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return false;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>=d.position)d.fired=true,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return true};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return false;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=false,c._onPositionFired--;return true};d=function(){a.isHTML5&&xa(a)}; -f=function(){a.isHTML5&&ya(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=false;a._a=null;a._html5_canplay=false;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=false;a.playState=0;a.paused=false;a.readyState=0;a.muted=false;a.isBuffering=false;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData= -[];a.eqData.left=[];a.eqData.right=[]};e();this._onTimer=function(b){var c={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,c,c,c,c),true):false};this._get_html5_duration=function(){var b=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return b&&!isNaN(b)&&b!==Infinity?b:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=n(a._iO, -b),d=L?c._global_a:a._a;decodeURI(b.url);var f=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&f.url===b.url&&(!a._lastURL||a._lastURL===f.url))return d;L&&d._t&&d._t.playState&&b.url!==f.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=false}else{d=new Audio(b.url);d._called_load=false;if(Ka)d._called_load=true;if(L)c._global_a=d}a.isHTML5=true;a._a=d;d._t=a;a._add_html5_events();d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto", -a.load(),d._called_load=true):(d.autobuffer=false,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return false;var b;a._a._added_events=true;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,r[b],false);return true};this._remove_html5_events=function(){var b;a._a._added_events=false;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,r[b],false)};this._onload=function(b){b=!!b;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0); -a._iO.onload&&a._iO.onload.apply(a,[b]);return true};this._onbufferchange=function(b){if(a.playState===0)return false;if(b&&a.isBuffering||!b&&!a.isBuffering)return false;a.isBuffering=b===1;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return true};this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);return true};this._onfailure=function(b,c,d){a.failures++;if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,c,d)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0); -a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=false,a.instanceCount=0,a.instanceOptions={},a._iO={},f();(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a)}};this._whileloading=function(b,c,d,e){a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded* -a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(b,c,d,e,f){if(isNaN(b)||b===null)return false;a.position=b;a.processOnPosition();if(!a.isHTML5&&g>8){if(a._iO.usePeakData&&typeof c!=="undefined"&&c)a.peakData={left:c.leftPeak,right:c.rightPeak};if(a._iO.useWaveformData&&typeof d!=="undefined"&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!== -"undefined"&&f&&f.leftEQ&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&g===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return true};this._onid3=function(b,c){var d=[],e,f;for(e=0,f=b.length;e0&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};fa=function(){return h.body||h._docElement||h.getElementsByTagName("div")[0]};O=function(b){return h.getElementById(b)};n=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&& -(e[d]=f[d]);return e};k=function(){function b(a){var a=Ia.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(false);return a}function a(a,b){var w=a.shift(),h=[f[b]];if(c)w[h](a[0],a[1]);else w[h].apply(w,a)}var c=i.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();r={abort:j(function(){}),canplay:j(function(){if(this._t._html5_canplay)return true; -this._t._html5_canplay=true;this._t._onbufferchange(0);var b=!isNaN(this._t.position)?this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b)try{this.currentTime=b}catch(a){}}),load:j(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(true))}),emptied:j(function(){}),ended:j(function(){this._t._onfinish()}),error:j(function(){this._t._onload(false)}),loadeddata:j(function(){var b= -this._t,a=b.bytesTotal||1;if(!b._loaded&&!M)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(true)}),loadedmetadata:j(function(){}),loadstart:j(function(){this._t._onbufferchange(1)}),play:j(function(){this._t._onbufferchange(0)}),playing:j(function(){this._t._onbufferchange(0)}),progress:j(function(b){if(this._t.loaded)return false;var a,c=0,f=b.target.buffered;a=b.loaded||0;var d=b.total||1;if(f&&f.length){for(a=f.length;a--;)c=f.end(a)-f.start(a);a=c/b.target.duration}isNaN(a)|| -(this._t._onbufferchange(0),this._t._whileloading(a,d,this._t._get_html5_duration()),a&&d&&a===d&&r.load.call(this,b))}),ratechange:j(function(){}),suspend:j(function(b){r.progress.call(this,b);this._t._onsuspend()}),stalled:j(function(){}),timeupdate:j(function(){this._t._onTimer()}),waiting:j(function(){this._t._onbufferchange(1)})};X=function(b){return!b.serverURL&&(b.type?K({type:b.type}):K({url:b.url})||c.html5Only)};la=function(b){if(b)b.src=Ja?"":"about:blank"};K=function(b){function a(a){return c.preferFlash&& -p&&!c.ignoreFlash&&typeof c.flash[a]!=="undefined"&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return false;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&c.html5[b]!=="undefined")return c.html5[b]&&!a(b);if(!u){u=[];for(d in f)f.hasOwnProperty(d)&&(u.push(d),f[d].related&&(u=u.concat(f[d].related)));u=RegExp("\\.("+u.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(u):null;if(!d||!d.length)if(b)e=b.indexOf(";"),d=(e!==-1?b.substr(0,e):b).substr(6);else return false;else d=d[1];return d&& -typeof c.html5[d]!=="undefined"?c.html5[d]&&!a(d):(b="audio/"+d,e=c.html5.canPlayType({type:b}),(c.html5[d]=e)&&c.html5[b]&&!a(b))};Aa=function(){function b(b){var d,e,f=false;if(!a||typeof a.canPlayType!=="function")return false;if(b instanceof Array){for(d=0,e=b.length;d1&&b.stream)b.stream=false;return b};V=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=true;return b};ja=function(){};ba=function(){return false};va=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=ba)};T=function(b){typeof b==="undefined"&&(b=false);(t||b)&&c.disable(b)};wa=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+ -4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};da=function(){g=parseInt(c.flashVersion,10);if(g!==8&&g!==9)c.flashVersion=g=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&g<9)c.flashVersion=g=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":g===9?" (AS3/Flash 9)":" (AS2/Flash 8)"); -g>8?(c.defaultOptions=n(c.defaultOptions,c.flash9Options),c.features.buffering=true,c.defaultOptions=n(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Ha.join("|")+")(\\?.*)?$","i"),c.features.movieStar=true):c.features.movieStar=false;c.filePattern=c.filePatterns[g!==8?"flash9":"flash8"];c.movieURL=(g===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=g>8};ua=function(b,a){if(!c.o)return false; -c.o._setPolling(b,a)};ga=function(){if(c.debugURLParam.test(aa))c.debugMode=true};l=this.getSoundById;D=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};ia=function(){y("fbHandler");var b=c.getMoviePercent(),a=c.swfCSS,e={type:"FLASHBLOCK"};if(c.html5Only)return false;if(c.ok()){if(c.oMC)c.oMC.className=[D(),a.swfDefault,a.swfLoaded+(c.didFlashBlock?" "+a.swfUnblocked:"")].join(" ")}else{if(q)c.oMC.className= -D()+" "+a.swfDefault+" "+(b===null?a.swfTimedout:a.swfError);c.didFlashBlock=true;z({type:"ontimeout",ignoreInit:true,error:e});C(e)}};ca=function(b,a,c){typeof s[b]==="undefined"&&(s[b]=[]);s[b].push({method:a,scope:c||null,fired:false})};z=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return false;if(b.type==="ontimeout"&&c.ok())return false;var a={success:b&&b.ignoreInit?c.ok():!t},e=b&&b.type?s[b.type]||[]:[],f=[],d,a=[a],h=q&&c.useFlashBlock&&!c.ok();if(b.error)a[0].error=b.error; -for(b=0,d=e.length;b'}if(G&&H)return false;if(c.html5Only)return da(),c.oMC=O(c.movieID),P(),H=G=true,false;var f=a||c.url,d=c.altURL||f,g;g=fa();var i,l,j=D(),k,m=null,m=(m=h.getElementsByTagName("html")[0])&&m.dir&&m.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;da();c.url=wa(qa?f:d);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(c.wmode!==null&&(o.match(/msie 8/i)||!v&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=true,c.wmode= -null;g={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Fa+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)g.FlashVars="debug=1";c.wmode||delete g.wmode;if(v)f=h.createElement("div"),l=['',e("movie",a),e("AllowScriptAccess",c.allowScriptAccess),e("quality",g.quality),c.wmode?e("wmode",c.wmode):"",e("bgcolor",c.bgColor),e("hasPriority","true"),c.debugFlash?e("FlashVars",g.FlashVars):"",""].join("");else for(i in f=h.createElement("embed"),g)g.hasOwnProperty(i)&&f.setAttribute(i,g[i]);ga();j=D();if(g=fa())if(c.oMC=O(c.movieID)||h.createElement("div"), -c.oMC.id){k=c.oMC.className;c.oMC.className=(k?k+" ":c.swfCSS.swfDefault)+(j?" "+j:"");c.oMC.appendChild(f);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;H=true}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+j;i=j=null;if(!c.useFlashBlock)if(c.useHighPerformance)j={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(j={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},m)j.left= -Math.abs(parseInt(j.left,10))+"px";if(La)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(k in j)j.hasOwnProperty(k)&&(c.oMC.style[k]=j[k]);try{v||c.oMC.appendChild(f);g.appendChild(c.oMC);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;H=true}catch(n){throw Error(y("domError")+" \n"+n.toString());}}return G=true};R=function(){if(c.html5Only)return S(),false;if(c.o)return false;c.o=c.getMovie(c.id);if(!c.o)J?(v?c.oMC.innerHTML=ha:c.oMC.appendChild(J),J=null,G= -true):S(c.id,c.url),c.o=c.getMovie(c.id);c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return true};Q=function(){setTimeout(ta,1E3)};ta=function(){if(W)return false;W=true;k.remove(i,"load",Q);if(E&&!pa)return false;var b;m||(b=c.getMoviePercent());setTimeout(function(){b=c.getMoviePercent();!m&&Da&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?c.useFlashBlock&&ia():T(true):c.flashLoadTimeout!==0&&T(true))},c.flashLoadTimeout)};x=function(){function b(){k.remove(i,"focus",x); -k.remove(i,"load",x)}if(pa||!E)return b(),true;pa=Da=true;M&&E&&k.remove(i,"mousemove",x);W=false;b();return true};Ca=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5)for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&p&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&p?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required?"required, ":"")+"and no flash support)":""))};I=function(b){if(m)return false;if(c.html5Only)return m=true, -A(),true;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=true,t&&(a={type:!p&&q?"NO_FLASH":"INIT_TIMEOUT"});if(t||b){if(c.useFlashBlock&&c.oMC)c.oMC.className=D()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);z({type:"ontimeout",error:a});C(a);return false}if(c.waitForWindowLoad&&!sa)return k.add(i,"load",A),false;else A();return true};P=function(){if(m)return false;if(c.html5Only){if(!m)k.remove(i,"load",c.beginDelayedInit),c.enabled=true,I();return true}R(); -try{c.o._externalInterfaceTest(false),ua(true,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=true,c.html5Only||k.add(i,"unload",ba)}catch(b){return C({type:"JS_TO_FLASH_EXCEPTION",fatal:true}),T(true),I(),false}I();k.remove(i,"load",c.beginDelayedInit);return true};B=function(){if(ea)return false;ea=true;ga();if(!p&&c.hasHTML5)c.useHTML5Audio=true,c.preferFlash=false;Aa();c.html5.usingFlash=za();q=c.html5.usingFlash;Ca();if(!p&&q)c.flashLoadTimeout= -1;h.removeEventListener&&h.removeEventListener("DOMContentLoaded",B,false);R();return true};ma=function(){h.readyState==="complete"&&(B(),h.detachEvent("onreadystatechange",ma));return true};Y();k.add(i,"focus",x);k.add(i,"load",x);k.add(i,"load",Q);M&&E&&k.add(i,"mousemove",x);h.addEventListener?h.addEventListener("DOMContentLoaded",B,false):h.attachEvent?h.attachEvent("onreadystatechange",ma):C({type:"NO_DOM2_EVENTS",fatal:true});h.readyState==="complete"&&setTimeout(B,100)}var Z=null;if(typeof SM2_DEFER=== -"undefined"||!SM2_DEFER)Z=new N;$.SoundManager=N;$.soundManager=Z})(window); \ No newline at end of file diff --git a/telemeta/static/timeside/js/libs/soundmanager2-nodebug.js b/telemeta/static/timeside/js/libs/soundmanager2-nodebug.js deleted file mode 100755 index 09de509e..00000000 --- a/telemeta/static/timeside/js/libs/soundmanager2-nodebug.js +++ /dev/null @@ -1,2184 +0,0 @@ -/** @license - * - * SoundManager 2: JavaScript Sound for the Web - * ---------------------------------------------- - * http://schillmania.com/projects/soundmanager2/ - * - * Copyright (c) 2007, Scott Schiller. All rights reserved. - * Code provided under the BSD License: - * http://schillmania.com/projects/soundmanager2/license.txt - * - * V2.97a.20111030 - */ - -/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ -/* jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */ - -(function(window) { -var soundManager = null; -function SoundManager(smURL, smID) { - this.flashVersion = 8; - this.debugMode = false; - this.debugFlash = false; - this.useConsole = true; - this.consoleOnly = false; - this.waitForWindowLoad = false; - this.bgColor = '#ffffff'; - this.useHighPerformance = false; - this.flashPollingInterval = null; - this.flashLoadTimeout = 1000; - this.wmode = null; - this.allowScriptAccess = 'always'; - this.useFlashBlock = false; - this.useHTML5Audio = true; - this.html5Test = /^(probably|maybe)$/i; - this.preferFlash = true; - this.noSWFCache = false; - this.audioFormats = { - 'mp3': { - 'type': ['audio/mpeg; codecs="mp3"', 'audio/mpeg', 'audio/mp3', 'audio/MPA', 'audio/mpa-robust'], - 'required': true - }, - 'mp4': { - 'related': ['aac','m4a'], - 'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'], - 'required': false - }, - 'ogg': { - 'type': ['audio/ogg; codecs=vorbis'], - 'required': false - }, - 'wav': { - 'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'], - 'required': false - } - }; - this.defaultOptions = { - 'autoLoad': false, - 'stream': true, - 'autoPlay': false, - 'loops': 1, - 'onid3': null, - 'onload': null, - 'whileloading': null, - 'onplay': null, - 'onpause': null, - 'onresume': null, - 'whileplaying': null, - 'onstop': null, - 'onfailure': null, - 'onfinish': null, - 'multiShot': true, - 'multiShotEvents': false, - 'position': null, - 'pan': 0, - 'type': null, - 'usePolicyFile': false, - 'volume': 100 - }; - this.flash9Options = { - 'isMovieStar': null, - 'usePeakData': false, - 'useWaveformData': false, - 'useEQData': false, - 'onbufferchange': null, - 'ondataerror': null - }; - this.movieStarOptions = { - 'bufferTime': 3, - 'serverURL': null, - 'onconnect': null, - 'duration': null - }; - this.movieID = 'sm2-container'; - this.id = (smID || 'sm2movie'); - this.swfCSS = { - 'swfBox': 'sm2-object-box', - 'swfDefault': 'movieContainer', - 'swfError': 'swf_error', - 'swfTimedout': 'swf_timedout', - 'swfLoaded': 'swf_loaded', - 'swfUnblocked': 'swf_unblocked', - 'sm2Debug': 'sm2_debug', - 'highPerf': 'high_performance', - 'flashDebug': 'flash_debug' - }; - this.debugID = 'soundmanager-debug'; - this.debugURLParam = /([#?&])debug=1/i; - this.versionNumber = 'V2.97a.20111030'; - this.version = null; - this.movieURL = null; - this.url = (smURL || null); - this.altURL = null; - this.swfLoaded = false; - this.enabled = false; - this.o = null; - this.oMC = null; - this.sounds = {}; - this.soundIDs = []; - this.muted = false; - this.specialWmodeCase = false; - this.didFlashBlock = false; - this.filePattern = null; - this.filePatterns = { - 'flash8': /\.mp3(\?.*)?$/i, - 'flash9': /\.mp3(\?.*)?$/i - }; - this.features = { - 'buffering': false, - 'peakData': false, - 'waveformData': false, - 'eqData': false, - 'movieStar': false - }; - this.sandbox = { - }; - this.hasHTML5 = (function() { - try { - return (typeof Audio !== 'undefined' && typeof new Audio().canPlayType !== 'undefined'); - } catch(e) { - return false; - } - }()); - this.html5 = { - 'usingFlash': null - }; - this.flash = {}; - this.html5Only = false; - this.ignoreFlash = false; - var SMSound, - _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, - _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _is_firefox = _ua.match(/firefox/i), _is_android = _ua.match(/droid/i), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)), - _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), - _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)), - _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i, - _emptyURL = 'about:blank', - _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null), - _http = (!_overHTTP ? 'http:/'+'/' : ''), - _netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i, - _netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'], - _netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); - this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; - this.useAltURL = !_overHTTP; - this._global_a = null; - if (_likesHTML5) { - _s.useHTML5Audio = true; - _s.preferFlash = false; - if (_is_iDevice) { - _s.ignoreFlash = true; - _useGlobalHTML5Audio = true; - } - } - this.ok = function() { - return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5)); - }; - this.supported = this.ok; - this.getMovie = function(smID) { - return _id(smID) || _doc[smID] || _win[smID]; - }; - this.createSound = function(oOptions) { - var _cs = _sm+'.createSound(): ', - thisOptions = null, oSound = null, _tO = null; - if (!_didInit || !_s.ok()) { - _complain(_cs + _str(!_didInit?'notReady':'notOK')); - return false; - } - if (arguments.length === 2) { - oOptions = { - 'id': arguments[0], - 'url': arguments[1] - }; - } - thisOptions = _mixin(oOptions); - _tO = thisOptions; - if (_idCheck(_tO.id, true)) { - return _s.sounds[_tO.id]; - } - function make() { - thisOptions = _loopFix(thisOptions); - _s.sounds[_tO.id] = new SMSound(_tO); - _s.soundIDs.push(_tO.id); - return _s.sounds[_tO.id]; - } - if (_html5OK(_tO)) { - oSound = make(); - oSound._setup_html5(_tO); - } else { - if (_fV > 8) { - if (_tO.isMovieStar === null) { - _tO.isMovieStar = (_tO.serverURL || (_tO.type ? _tO.type.match(_netStreamMimeTypes) : false) || _tO.url.match(_netStreamPattern)); - } - if (_tO.isMovieStar) { - if (_tO.usePeakData) { - _tO.usePeakData = false; - } - } - } - _tO = _policyFix(_tO, _cs); - oSound = make(); - if (_fV === 8) { - _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); - } else { - _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); - if (!_tO.serverURL) { - oSound.connected = true; - if (_tO.onconnect) { - _tO.onconnect.apply(oSound); - } - } - } - if (!_tO.serverURL && (_tO.autoLoad || _tO.autoPlay)) { - oSound.load(_tO); - } - } - if (!_tO.serverURL && _tO.autoPlay) { - oSound.play(); - } - return oSound; - }; - this.destroySound = function(sID, _bFromSound) { - if (!_idCheck(sID)) { - return false; - } - var oS = _s.sounds[sID], i; - oS._iO = {}; - oS.stop(); - oS.unload(); - for (i = 0; i < _s.soundIDs.length; i++) { - if (_s.soundIDs[i] === sID) { - _s.soundIDs.splice(i, 1); - break; - } - } - if (!_bFromSound) { - oS.destruct(true); - } - oS = null; - delete _s.sounds[sID]; - return true; - }; - this.load = function(sID, oOptions) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].load(oOptions); - }; - this.unload = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].unload(); - }; - this.onposition = function(sID, nPosition, oMethod, oScope) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].onposition(nPosition, oMethod, oScope); - }; - this.play = function(sID, oOptions) { - var fN = _sm+'.play(): '; - if (!_didInit || !_s.ok()) { - _complain(fN + _str(!_didInit?'notReady':'notOK')); - return false; - } - if (!_idCheck(sID)) { - if (!(oOptions instanceof Object)) { - oOptions = { - url: oOptions - }; - } - if (oOptions && oOptions.url) { - oOptions.id = sID; - return _s.createSound(oOptions).play(); - } else { - return false; - } - } - return _s.sounds[sID].play(oOptions); - }; - this.start = this.play; - this.setPosition = function(sID, nMsecOffset) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].setPosition(nMsecOffset); - }; - this.stop = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].stop(); - }; - this.stopAll = function() { - var oSound; - for (oSound in _s.sounds) { - if (_s.sounds.hasOwnProperty(oSound)) { - _s.sounds[oSound].stop(); - } - } - }; - this.pause = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].pause(); - }; - this.pauseAll = function() { - var i; - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].pause(); - } - }; - this.resume = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].resume(); - }; - this.resumeAll = function() { - var i; - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].resume(); - } - }; - this.togglePause = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].togglePause(); - }; - this.setPan = function(sID, nPan) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].setPan(nPan); - }; - this.setVolume = function(sID, nVol) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].setVolume(nVol); - }; - this.mute = function(sID) { - var fN = _sm+'.mute(): ', - i = 0; - if (typeof sID !== 'string') { - sID = null; - } - if (!sID) { - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].mute(); - } - _s.muted = true; - } else { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].mute(); - } - return true; - }; - this.muteAll = function() { - _s.mute(); - }; - this.unmute = function(sID) { - var fN = _sm+'.unmute(): ', i; - if (typeof sID !== 'string') { - sID = null; - } - if (!sID) { - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].unmute(); - } - _s.muted = false; - } else { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].unmute(); - } - return true; - }; - this.unmuteAll = function() { - _s.unmute(); - }; - this.toggleMute = function(sID) { - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].toggleMute(); - }; - this.getMemoryUse = function() { - var ram = 0; - if (_s.o && _fV !== 8) { - ram = parseInt(_s.o._getMemoryUse(), 10); - } - return ram; - }; - this.disable = function(bNoDisable) { - var i; - if (typeof bNoDisable === 'undefined') { - bNoDisable = false; - } - if (_disabled) { - return false; - } - _disabled = true; - for (i = _s.soundIDs.length; i--;) { - _disableObject(_s.sounds[_s.soundIDs[i]]); - } - _initComplete(bNoDisable); - _event.remove(_win, 'load', _initUserOnload); - return true; - }; - this.canPlayMIME = function(sMIME) { - var result; - if (_s.hasHTML5) { - result = _html5CanPlay({type:sMIME}); - } - if (!_needsFlash || result) { - return result; - } else { - return (sMIME ? !!((_fV > 8 ? sMIME.match(_netStreamMimeTypes) : null) || sMIME.match(_s.mimePattern)) : null); - } - }; - this.canPlayURL = function(sURL) { - var result; - if (_s.hasHTML5) { - result = _html5CanPlay({url: sURL}); - } - if (!_needsFlash || result) { - return result; - } else { - return (sURL ? !!(sURL.match(_s.filePattern)) : null); - } - }; - this.canPlayLink = function(oLink) { - if (typeof oLink.type !== 'undefined' && oLink.type) { - if (_s.canPlayMIME(oLink.type)) { - return true; - } - } - return _s.canPlayURL(oLink.href); - }; - this.getSoundById = function(sID, _suppressDebug) { - if (!sID) { - throw new Error(_sm+'.getSoundById(): sID is null/undefined'); - } - var result = _s.sounds[sID]; - return result; - }; - this.onready = function(oMethod, oScope) { - var sType = 'onready'; - if (oMethod && oMethod instanceof Function) { - if (!oScope) { - oScope = _win; - } - _addOnEvent(sType, oMethod, oScope); - _processOnEvents(); - return true; - } else { - throw _str('needFunction', sType); - } - }; - this.ontimeout = function(oMethod, oScope) { - var sType = 'ontimeout'; - if (oMethod && oMethod instanceof Function) { - if (!oScope) { - oScope = _win; - } - _addOnEvent(sType, oMethod, oScope); - _processOnEvents({type:sType}); - return true; - } else { - throw _str('needFunction', sType); - } - }; - this._writeDebug = function(sText, sType, _bTimestamp) { - return true; - }; - this._wD = this._writeDebug; - this._debug = function() { - }; - this.reboot = function() { - var i, j; - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].destruct(); - } - try { - if (_isIE) { - _oRemovedHTML = _s.o.innerHTML; - } - _oRemoved = _s.o.parentNode.removeChild(_s.o); - } catch(e) { - } - _oRemovedHTML = _oRemoved = _needsFlash = null; - _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; - _s.soundIDs = _s.sounds = []; - _s.o = null; - for (i in _on_queue) { - if (_on_queue.hasOwnProperty(i)) { - for (j = _on_queue[i].length; j--;) { - _on_queue[i][j].fired = false; - } - } - } - _win.setTimeout(_s.beginDelayedInit, 20); - }; - this.getMoviePercent = function() { - return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null); - }; - this.beginDelayedInit = function() { - _windowLoaded = true; - _domContentLoaded(); - setTimeout(function() { - if (_initPending) { - return false; - } - _createMovie(); - _initMovie(); - _initPending = true; - return true; - }, 20); - _delayWaitForEI(); - }; - this.destruct = function() { - _s.disable(true); - }; - SMSound = function(oOptions) { - var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer; - this.sID = oOptions.id; - this.url = oOptions.url; - this.options = _mixin(oOptions); - this.instanceOptions = this.options; - this._iO = this.instanceOptions; - this.pan = this.options.pan; - this.volume = this.options.volume; - this._lastURL = null; - this.isHTML5 = false; - this._a = null; - this.id3 = {}; - this._debug = function() { - }; - this.load = function(oOptions) { - var oS = null; - if (typeof oOptions !== 'undefined') { - _t._iO = _mixin(oOptions, _t.options); - _t.instanceOptions = _t._iO; - } else { - oOptions = _t.options; - _t._iO = oOptions; - _t.instanceOptions = _t._iO; - if (_t._lastURL && _t._lastURL !== _t.url) { - _t._iO.url = _t.url; - _t.url = null; - } - } - if (!_t._iO.url) { - _t._iO.url = _t.url; - } - if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { - return _t; - } - _t._lastURL = _t.url; - _t.loaded = false; - _t.readyState = 1; - _t.playState = 0; - if (_html5OK(_t._iO)) { - oS = _t._setup_html5(_t._iO); - if (!oS._called_load) { - _t._html5_canplay = false; - oS.load(); - oS._called_load = true; - if (_t._iO.autoPlay) { - _t.play(); - } - } else { - } - } else { - try { - _t.isHTML5 = false; - _t._iO = _policyFix(_loopFix(_t._iO)); - if (_fV === 8) { - _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); - } else { - _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile); - } - } catch(e) { - _catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true}); - } - } - return _t; - }; - this.unload = function() { - if (_t.readyState !== 0) { - if (!_t.isHTML5) { - if (_fV === 8) { - _s.o._unload(_t.sID, _emptyURL); - } else { - _s.o._unload(_t.sID); - } - } else { - _stop_html5_timer(); - if (_t._a) { - _t._a.pause(); - _html5Unload(_t._a); - } - } - _resetProperties(); - } - return _t; - }; - this.destruct = function(_bFromSM) { - if (!_t.isHTML5) { - _t._iO.onfailure = null; - _s.o._destroySound(_t.sID); - } else { - _stop_html5_timer(); - if (_t._a) { - _t._a.pause(); - _html5Unload(_t._a); - if (!_useGlobalHTML5Audio) { - _t._remove_html5_events(); - } - _t._a._t = null; - _t._a = null; - } - } - if (!_bFromSM) { - _s.destroySound(_t.sID, true); - } - }; - this.play = function(oOptions, _updatePlayState) { - var fN = 'SMSound.play(): ', allowMulti, a; - _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; - if (!oOptions) { - oOptions = {}; - } - _t._iO = _mixin(oOptions, _t._iO); - _t._iO = _mixin(_t._iO, _t.options); - _t.instanceOptions = _t._iO; - if (_t._iO.serverURL && !_t.connected) { - if (!_t.getAutoPlay()) { - _t.setAutoPlay(true); - } - return _t; - } - if (_html5OK(_t._iO)) { - _t._setup_html5(_t._iO); - _start_html5_timer(); - } - if (_t.playState === 1 && !_t.paused) { - allowMulti = _t._iO.multiShot; - if (!allowMulti) { - return _t; - } else { - } - } - if (!_t.loaded) { - if (_t.readyState === 0) { - if (!_t.isHTML5) { - _t._iO.autoPlay = true; - } - _t.load(_t._iO); - } else if (_t.readyState === 2) { - return _t; - } else { - } - } else { - } - if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) { - _t._iO.position = 0; - } - if (_t.paused && _t.position && _t.position > 0) { - _t.resume(); - } else { - _t.playState = 1; - _t.paused = false; - if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) { - _t.instanceCount++; - } - _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); - if (!_t.isHTML5) { - _t._iO = _policyFix(_loopFix(_t._iO)); - } - if (_t._iO.onplay && _updatePlayState) { - _t._iO.onplay.apply(_t); - _t._onplay_called = true; - } - _t.setVolume(_t._iO.volume, true); - _t.setPan(_t._iO.pan, true); - if (!_t.isHTML5) { - _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); - } else { - _start_html5_timer(); - a = _t._setup_html5(); - _t.setPosition(_t._iO.position); - a.play(); - } - } - return _t; - }; - this.start = this.play; - this.stop = function(bAll) { - if (_t.playState === 1) { - _t._onbufferchange(0); - _t.resetOnPosition(0); - _t.paused = false; - if (!_t.isHTML5) { - _t.playState = 0; - } - if (_t._iO.onstop) { - _t._iO.onstop.apply(_t); - } - if (!_t.isHTML5) { - _s.o._stop(_t.sID, bAll); - if (_t._iO.serverURL) { - _t.unload(); - } - } else { - if (_t._a) { - _t.setPosition(0); - _t._a.pause(); - _t.playState = 0; - _t._onTimer(); - _stop_html5_timer(); - } - } - _t.instanceCount = 0; - _t._iO = {}; - } - return _t; - }; - this.setAutoPlay = function(autoPlay) { - _t._iO.autoPlay = autoPlay; - if (!_t.isHTML5) { - _s.o._setAutoPlay(_t.sID, autoPlay); - if (autoPlay) { - if (!_t.instanceCount && _t.readyState === 1) { - _t.instanceCount++; - } - } - } - }; - this.getAutoPlay = function() { - return _t._iO.autoPlay; - }; - this.setPosition = function(nMsecOffset) { - if (nMsecOffset === undefined) { - nMsecOffset = 0; - } - var original_pos, - position, position1K, - offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); - original_pos = _t.position; - _t.position = offset; - position1K = _t.position/1000; - _t.resetOnPosition(_t.position); - _t._iO.position = offset; - if (!_t.isHTML5) { - position = (_fV === 9 ? _t.position : position1K); - if (_t.readyState && _t.readyState !== 2) { - _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); - } - } else if (_t._a) { - if (_t._html5_canplay) { - if (_t._a.currentTime !== position1K) { - try { - _t._a.currentTime = position1K; - if (_t.playState === 0 || _t.paused) { - _t._a.pause(); - } - } catch(e) { - } - } - } else { - } - } - if (_t.isHTML5) { - if (_t.paused) { - _t._onTimer(true); - } - } - return _t; - }; - this.pause = function(_bCallFlash) { - if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) { - return _t; - } - _t.paused = true; - if (!_t.isHTML5) { - if (_bCallFlash || _bCallFlash === undefined) { - _s.o._pause(_t.sID); - } - } else { - _t._setup_html5().pause(); - _stop_html5_timer(); - } - if (_t._iO.onpause) { - _t._iO.onpause.apply(_t); - } - return _t; - }; - this.resume = function() { - if (!_t.paused) { - return _t; - } - _t.paused = false; - _t.playState = 1; - if (!_t.isHTML5) { - if (_t._iO.isMovieStar) { - _t.setPosition(_t.position); - } - _s.o._pause(_t.sID); - } else { - _t._setup_html5().play(); - _start_html5_timer(); - } - if (!_t._onplay_called && _t._iO.onplay) { - _t._iO.onplay.apply(_t); - _t._onplay_called = true; - } else if (_t._iO.onresume) { - _t._iO.onresume.apply(_t); - } - return _t; - }; - this.togglePause = function() { - if (_t.playState === 0) { - _t.play({ - position: (_fV === 9 && !_t.isHTML5 ? _t.position : _t.position / 1000) - }); - return _t; - } - if (_t.paused) { - _t.resume(); - } else { - _t.pause(); - } - return _t; - }; - this.setPan = function(nPan, bInstanceOnly) { - if (typeof nPan === 'undefined') { - nPan = 0; - } - if (typeof bInstanceOnly === 'undefined') { - bInstanceOnly = false; - } - if (!_t.isHTML5) { - _s.o._setPan(_t.sID, nPan); - } - _t._iO.pan = nPan; - if (!bInstanceOnly) { - _t.pan = nPan; - _t.options.pan = nPan; - } - return _t; - }; - this.setVolume = function(nVol, _bInstanceOnly) { - if (typeof nVol === 'undefined') { - nVol = 100; - } - if (typeof _bInstanceOnly === 'undefined') { - _bInstanceOnly = false; - } - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); - } else if (_t._a) { - _t._a.volume = Math.max(0, Math.min(1, nVol/100)); - } - _t._iO.volume = nVol; - if (!_bInstanceOnly) { - _t.volume = nVol; - _t.options.volume = nVol; - } - return _t; - }; - this.mute = function() { - _t.muted = true; - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, 0); - } else if (_t._a) { - _t._a.muted = true; - } - return _t; - }; - this.unmute = function() { - _t.muted = false; - var hasIO = typeof _t._iO.volume !== 'undefined'; - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); - } else if (_t._a) { - _t._a.muted = false; - } - return _t; - }; - this.toggleMute = function() { - return (_t.muted?_t.unmute():_t.mute()); - }; - this.onposition = function(nPosition, oMethod, oScope) { - _t._onPositionItems.push({ - position: nPosition, - method: oMethod, - scope: (typeof oScope !== 'undefined'?oScope:_t), - fired: false - }); - return _t; - }; - this.processOnPosition = function() { - var i, item, j = _t._onPositionItems.length; - if (!j || !_t.playState || _t._onPositionFired >= j) { - return false; - } - for (i=j; i--;) { - item = _t._onPositionItems[i]; - if (!item.fired && _t.position >= item.position) { - item.fired = true; - _s._onPositionFired++; - item.method.apply(item.scope,[item.position]); - } - } - return true; - }; - this.resetOnPosition = function(nPosition) { - var i, item, j = _t._onPositionItems.length; - if (!j) { - return false; - } - for (i=j; i--;) { - item = _t._onPositionItems[i]; - if (item.fired && nPosition <= item.position) { - item.fired = false; - _s._onPositionFired--; - } - } - return true; - }; - _start_html5_timer = function() { - if (_t.isHTML5) { - _startTimer(_t); - } - }; - _stop_html5_timer = function() { - if (_t.isHTML5) { - _stopTimer(_t); - } - }; - _resetProperties = function() { - _t._onPositionItems = []; - _t._onPositionFired = 0; - _t._hasTimer = null; - _t._onplay_called = false; - _t._a = null; - _t._html5_canplay = false; - _t.bytesLoaded = null; - _t.bytesTotal = null; - _t.position = null; - _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); - _t.durationEstimate = null; - _t.failures = 0; - _t.loaded = false; - _t.playState = 0; - _t.paused = false; - _t.readyState = 0; - _t.muted = false; - _t.isBuffering = false; - _t.instanceOptions = {}; - _t.instanceCount = 0; - _t.peakData = { - left: 0, - right: 0 - }; - _t.waveformData = { - left: [], - right: [] - }; - _t.eqData = []; - _t.eqData.left = []; - _t.eqData.right = []; - }; - _resetProperties(); - this._onTimer = function(bForce) { - var time, x = {}; - if (_t._hasTimer || bForce) { - if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { - _t.duration = _t._get_html5_duration(); - _t.durationEstimate = _t.duration; - time = _t._a.currentTime?_t._a.currentTime*1000:0; - _t._whileplaying(time,x,x,x,x); - return true; - } else { - return false; - } - } - }; - this._get_html5_duration = function() { - var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)), - result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null)); - return result; - }; - this._setup_html5 = function(oOptions) { - var _iO = _mixin(_t._iO, oOptions), d = decodeURI, - _a = _useGlobalHTML5Audio ? _s._global_a : _t._a, - _dURL = d(_iO.url), - _oldIO = (_a && _a._t ? _a._t.instanceOptions : null); - if (_a) { - if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) { - return _a; - } - if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) { - _a._t.stop(); - } - _resetProperties(); - _a.src = _iO.url; - _t.url = _iO.url; - _t._lastURL = _iO.url; - _a._called_load = false; - } else { - _a = new Audio(_iO.url); - _a._called_load = false; - if (_is_android) { - _a._called_load = true; - } - if (_useGlobalHTML5Audio) { - _s._global_a = _a; - } - } - _t.isHTML5 = true; - _t._a = _a; - _a._t = _t; - _t._add_html5_events(); - _a.loop = (_iO.loops>1?'loop':''); - if (_iO.autoLoad || _iO.autoPlay) { - _a.autobuffer = 'auto'; - _a.preload = 'auto'; - _t.load(); - _a._called_load = true; - } else { - _a.autobuffer = false; - _a.preload = 'none'; - } - _a.loop = (_iO.loops>1?'loop':''); - return _a; - }; - this._add_html5_events = function() { - if (_t._a._added_events) { - return false; - } - var f; - function add(oEvt, oFn, bCapture) { - return _t._a ? _t._a.addEventListener(oEvt, oFn, bCapture||false) : null; - } - _t._a._added_events = true; - for (f in _html5_events) { - if (_html5_events.hasOwnProperty(f)) { - add(f, _html5_events[f]); - } - } - return true; - }; - this._remove_html5_events = function() { - var f; - function remove(oEvt, oFn, bCapture) { - return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null); - } - _t._a._added_events = false; - for (f in _html5_events) { - if (_html5_events.hasOwnProperty(f)) { - remove(f, _html5_events[f]); - } - } - }; - this._onload = function(nSuccess) { - var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess); - _t.loaded = loadOK; - _t.readyState = loadOK?3:2; - _t._onbufferchange(0); - if (_t._iO.onload) { - _t._iO.onload.apply(_t, [loadOK]); - } - return true; - }; - this._onbufferchange = function(nIsBuffering) { - var fN = 'SMSound._onbufferchange()'; - if (_t.playState === 0) { - return false; - } - if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) { - return false; - } - _t.isBuffering = (nIsBuffering === 1); - if (_t._iO.onbufferchange) { - _t._iO.onbufferchange.apply(_t); - } - return true; - }; - this._onsuspend = function () { - if (_t._iO.onsuspend) { - _t._iO.onsuspend.apply(_t); - } - return true; - }; - this._onfailure = function(msg, level, code) { - _t.failures++; - if (_t._iO.onfailure && _t.failures === 1) { - _t._iO.onfailure(_t, msg, level, code); - } else { - } - }; - this._onfinish = function() { - var _io_onfinish = _t._iO.onfinish; - _t._onbufferchange(0); - _t.resetOnPosition(0); - if (_t.instanceCount) { - _t.instanceCount--; - if (!_t.instanceCount) { - _t.playState = 0; - _t.paused = false; - _t.instanceCount = 0; - _t.instanceOptions = {}; - _t._iO = {}; - _stop_html5_timer(); - } - if (!_t.instanceCount || _t._iO.multiShotEvents) { - if (_io_onfinish) { - _io_onfinish.apply(_t); - } - } - } - }; - this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { - _t.bytesLoaded = nBytesLoaded; - _t.bytesTotal = nBytesTotal; - _t.duration = Math.floor(nDuration); - _t.bufferLength = nBufferLength; - if (!_t._iO.isMovieStar) { - if (_t._iO.duration) { - _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; - } else { - _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); - } - if (_t.durationEstimate === undefined) { - _t.durationEstimate = _t.duration; - } - if (_t.readyState !== 3 && _t._iO.whileloading) { - _t._iO.whileloading.apply(_t); - } - } else { - _t.durationEstimate = _t.duration; - if (_t.readyState !== 3 && _t._iO.whileloading) { - _t._iO.whileloading.apply(_t); - } - } - }; - this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { - if (isNaN(nPosition) || nPosition === null) { - return false; - } - _t.position = nPosition; - _t.processOnPosition(); - if (!_t.isHTML5 && _fV > 8) { - if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { - _t.peakData = { - left: oPeakData.leftPeak, - right: oPeakData.rightPeak - }; - } - if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { - _t.waveformData = { - left: oWaveformDataLeft.split(','), - right: oWaveformDataRight.split(',') - }; - } - if (_t._iO.useEQData) { - if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { - var eqLeft = oEQData.leftEQ.split(','); - _t.eqData = eqLeft; - _t.eqData.left = eqLeft; - if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) { - _t.eqData.right = oEQData.rightEQ.split(','); - } - } - } - } - if (_t.playState === 1) { - if (!_t.isHTML5 && _fV === 8 && !_t.position && _t.isBuffering) { - _t._onbufferchange(0); - } - if (_t._iO.whileplaying) { - _t._iO.whileplaying.apply(_t); - } - } - return true; - }; - this._onid3 = function(oID3PropNames, oID3Data) { - var oData = [], i, j; - for (i = 0, j = oID3PropNames.length; i < j; i++) { - oData[oID3PropNames[i]] = oID3Data[i]; - } - _t.id3 = _mixin(_t.id3, oData); - if (_t._iO.onid3) { - _t._iO.onid3.apply(_t); - } - }; - this._onconnect = function(bSuccess) { - var fN = 'SMSound._onconnect(): '; - bSuccess = (bSuccess === 1); - _t.connected = bSuccess; - if (bSuccess) { - _t.failures = 0; - if (_idCheck(_t.sID)) { - if (_t.getAutoPlay()) { - _t.play(undefined, _t.getAutoPlay()); - } else if (_t._iO.autoLoad) { - _t.load(); - } - } - if (_t._iO.onconnect) { - _t._iO.onconnect.apply(_t,[bSuccess]); - } - } - }; - this._ondataerror = function(sError) { - if (_t.playState > 0) { - if (_t._iO.ondataerror) { - _t._iO.ondataerror.apply(_t); - } - } - }; - }; - _getDocument = function() { - return (_doc.body || _doc._docElement || _doc.getElementsByTagName('div')[0]); - }; - _id = function(sID) { - return _doc.getElementById(sID); - }; - _mixin = function(oMain, oAdd) { - var o1 = {}, i, o2, o; - for (i in oMain) { - if (oMain.hasOwnProperty(i)) { - o1[i] = oMain[i]; - } - } - o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd); - for (o in o2) { - if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') { - o1[o] = o2[o]; - } - } - return o1; - }; - _event = (function() { - var old = (_win.attachEvent), - evt = { - add: (old?'attachEvent':'addEventListener'), - remove: (old?'detachEvent':'removeEventListener') - }; - function getArgs(oArgs) { - var args = _slice.call(oArgs), len = args.length; - if (old) { - args[1] = 'on' + args[1]; - if (len > 3) { - args.pop(); - } - } else if (len === 3) { - args.push(false); - } - return args; - } - function apply(args, sType) { - var element = args.shift(), - method = [evt[sType]]; - if (old) { - element[method](args[0], args[1]); - } else { - element[method].apply(element, args); - } - } - function add() { - apply(getArgs(arguments), 'add'); - } - function remove() { - apply(getArgs(arguments), 'remove'); - } - return { - 'add': add, - 'remove': remove - }; - }()); - function _html5_event(oFn) { - return function(e) { - if (!this._t || !this._t._a) { - return null; - } else { - return oFn.call(this, e); - } - }; - } - _html5_events = { - abort: _html5_event(function(e) { - }), - canplay: _html5_event(function(e) { - if (this._t._html5_canplay) { - return true; - } - this._t._html5_canplay = true; - this._t._onbufferchange(0); - var position1K = (!isNaN(this._t.position)?this._t.position/1000:null); - if (this._t.position && this.currentTime !== position1K) { - try { - this.currentTime = position1K; - } catch(ee) { - } - } - }), - load: _html5_event(function(e) { - if (!this._t.loaded) { - this._t._onbufferchange(0); - this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration()); - this._t._onload(true); - } - }), - emptied: _html5_event(function(e) { - }), - ended: _html5_event(function(e) { - this._t._onfinish(); - }), - error: _html5_event(function(e) { - this._t._onload(false); - }), - loadeddata: _html5_event(function(e) { - var t = this._t, - bytesTotal = t.bytesTotal || 1; - if (!t._loaded && !_isSafari) { - t.duration = t._get_html5_duration(); - t._whileloading(bytesTotal, bytesTotal, t._get_html5_duration()); - t._onload(true); - } - }), - loadedmetadata: _html5_event(function(e) { - }), - loadstart: _html5_event(function(e) { - this._t._onbufferchange(1); - }), - play: _html5_event(function(e) { - this._t._onbufferchange(0); - }), - playing: _html5_event(function(e) { - this._t._onbufferchange(0); - }), - progress: _html5_event(function(e) { - if (this._t.loaded) { - return false; - } - var i, j, str, buffered = 0, - isProgress = (e.type === 'progress'), - ranges = e.target.buffered, - loaded = (e.loaded||0), - total = (e.total||1); - if (ranges && ranges.length) { - for (i=ranges.length; i--;) { - buffered = (ranges.end(i) - ranges.start(i)); - } - loaded = buffered/e.target.duration; - } - if (!isNaN(loaded)) { - this._t._onbufferchange(0); - this._t._whileloading(loaded, total, this._t._get_html5_duration()); - if (loaded && total && loaded === total) { - _html5_events.load.call(this, e); - } - } - }), - ratechange: _html5_event(function(e) { - }), - suspend: _html5_event(function(e) { - _html5_events.progress.call(this, e); - this._t._onsuspend(); - }), - stalled: _html5_event(function(e) { - }), - timeupdate: _html5_event(function(e) { - this._t._onTimer(); - }), - waiting: _html5_event(function(e) { - this._t._onbufferchange(1); - }) - }; - _html5OK = function(iO) { - return (!iO.serverURL && (iO.type?_html5CanPlay({type:iO.type}):_html5CanPlay({url:iO.url})||_s.html5Only)); - }; - _html5Unload = function(oAudio) { - if (oAudio) { - oAudio.src = (_is_firefox ? '' : _emptyURL); - } - }; - _html5CanPlay = function(o) { - if (!_s.useHTML5Audio || !_s.hasHTML5) { - return false; - } - var url = (o.url || null), - mime = (o.type || null), - aF = _s.audioFormats, - result, - offset, - fileExt, - item; - function preferFlashCheck(kind) { - return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind])); - } - if (mime && _s.html5[mime] !== 'undefined') { - return (_s.html5[mime] && !preferFlashCheck(mime)); - } - if (!_html5Ext) { - _html5Ext = []; - for (item in aF) { - if (aF.hasOwnProperty(item)) { - _html5Ext.push(item); - if (aF[item].related) { - _html5Ext = _html5Ext.concat(aF[item].related); - } - } - } - _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')(\\?.*)?$','i'); - } - fileExt = (url ? url.toLowerCase().match(_html5Ext) : null); - if (!fileExt || !fileExt.length) { - if (!mime) { - return false; - } else { - offset = mime.indexOf(';'); - fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6); - } - } else { - fileExt = fileExt[1]; - } - if (fileExt && typeof _s.html5[fileExt] !== 'undefined') { - return (_s.html5[fileExt] && !preferFlashCheck(fileExt)); - } else { - mime = 'audio/'+fileExt; - result = _s.html5.canPlayType({type:mime}); - _s.html5[fileExt] = result; - return (result && _s.html5[mime] && !preferFlashCheck(mime)); - } - }; - _testHTML5 = function() { - if (!_s.useHTML5Audio || typeof Audio === 'undefined') { - return false; - } - var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null), - item, support = {}, aF, i; - function _cp(m) { - var canPlay, i, j, isOK = false; - if (!a || typeof a.canPlayType !== 'function') { - return false; - } - if (m instanceof Array) { - for (i=0, j=m.length; i 1 && sOpt.stream) { - sOpt.stream = false; - } - return sOpt; - }; - _policyFix = function(sOpt, sPre) { - if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) { - sOpt.usePolicyFile = true; - } - return sOpt; - }; - _complain = function(sMsg) { - }; - _doNothing = function() { - return false; - }; - _disableObject = function(o) { - var oProp; - for (oProp in o) { - if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') { - o[oProp] = _doNothing; - } - } - oProp = null; - }; - _failSafely = function(bNoDisable) { - if (typeof bNoDisable === 'undefined') { - bNoDisable = false; - } - if (_disabled || bNoDisable) { - _s.disable(bNoDisable); - } - }; - _normalizeMovieURL = function(smURL) { - var urlParams = null, url; - if (smURL) { - if (smURL.match(/\.swf(\?.*)?$/i)) { - urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4); - if (urlParams) { - return smURL; - } - } else if (smURL.lastIndexOf('/') !== smURL.length - 1) { - smURL += '/'; - } - } - url = (smURL && smURL.lastIndexOf('/') !== - 1 ? smURL.substr(0, smURL.lastIndexOf('/') + 1) : './') + _s.movieURL; - if (_s.noSWFCache) { - url += ('?ts=' + new Date().getTime()); - } - return url; - }; - _setVersionInfo = function() { - _fV = parseInt(_s.flashVersion, 10); - if (_fV !== 8 && _fV !== 9) { - _s.flashVersion = _fV = _defaultFlashVersion; - } - var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); - if (_s.useHTML5Audio && !_s.html5Only && _s.audioFormats.mp4.required && _fV < 9) { - _s.flashVersion = _fV = 9; - } - _s.version = _s.versionNumber + (_s.html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)')); - if (_fV > 8) { - _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options); - _s.features.buffering = true; - _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions); - _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); - _s.features.movieStar = true; - } else { - _s.features.movieStar = false; - } - _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')]; - _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug); - _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8); - }; - _setPolling = function(bPolling, bHighPerformance) { - if (!_s.o) { - return false; - } - _s.o._setPolling(bPolling, bHighPerformance); - }; - _initDebug = function() { - if (_s.debugURLParam.test(_wl)) { - _s.debugMode = true; - } - }; - _idCheck = this.getSoundById; - _getSWFCSS = function() { - var css = []; - if (_s.debugMode) { - css.push(_s.swfCSS.sm2Debug); - } - if (_s.debugFlash) { - css.push(_s.swfCSS.flashDebug); - } - if (_s.useHighPerformance) { - css.push(_s.swfCSS.highPerf); - } - return css.join(' '); - }; - _flashBlockHandler = function() { - var name = _str('fbHandler'), - p = _s.getMoviePercent(), - css = _s.swfCSS, - error = {type:'FLASHBLOCK'}; - if (_s.html5Only) { - return false; - } - if (!_s.ok()) { - if (_needsFlash) { - _s.oMC.className = _getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError); - } - _s.didFlashBlock = true; - _processOnEvents({type:'ontimeout', ignoreInit:true, error:error}); - _catchError(error); - } else { - if (_s.didFlashBlock) { - } - if (_s.oMC) { - _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' '); - } - } - }; - _addOnEvent = function(sType, oMethod, oScope) { - if (typeof _on_queue[sType] === 'undefined') { - _on_queue[sType] = []; - } - _on_queue[sType].push({ - 'method': oMethod, - 'scope': (oScope || null), - 'fired': false - }); - }; - _processOnEvents = function(oOptions) { - if (!oOptions) { - oOptions = { - type: 'onready' - }; - } - if (!_didInit && oOptions && !oOptions.ignoreInit) { - return false; - } - if (oOptions.type === 'ontimeout' && _s.ok()) { - return false; - } - var status = { - success: (oOptions && oOptions.ignoreInit?_s.ok():!_disabled) - }, - srcQueue = (oOptions && oOptions.type?_on_queue[oOptions.type]||[]:[]), - queue = [], i, j, - args = [status], - canRetry = (_needsFlash && _s.useFlashBlock && !_s.ok()); - if (oOptions.error) { - args[0].error = oOptions.error; - } - for (i = 0, j = srcQueue.length; i < j; i++) { - if (srcQueue[i].fired !== true) { - queue.push(srcQueue[i]); - } - } - if (queue.length) { - for (i = 0, j = queue.length; i < j; i++) { - if (queue[i].scope) { - queue[i].method.apply(queue[i].scope, args); - } else { - queue[i].method.apply(this, args); - } - if (!canRetry) { - queue[i].fired = true; - } - } - } - return true; - }; - _initUserOnload = function() { - _win.setTimeout(function() { - if (_s.useFlashBlock) { - _flashBlockHandler(); - } - _processOnEvents(); - if (_s.onload instanceof Function) { - _s.onload.apply(_win); - } - if (_s.waitForWindowLoad) { - _event.add(_win, 'load', _initUserOnload); - } - },1); - }; - _detectFlash = function() { - if (_hasFlash !== undefined) { - return _hasFlash; - } - var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = _win.ActiveXObject; - if (nP && nP.length) { - type = 'application/x-shockwave-flash'; - types = n.mimeTypes; - if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) { - hasPlugin = true; - } - } else if (typeof AX !== 'undefined') { - try { - obj = new AX('ShockwaveFlash.ShockwaveFlash'); - } catch(e) { - } - hasPlugin = (!!obj); - } - _hasFlash = hasPlugin; - return hasPlugin; - }; - _featureCheck = function() { - var needsFlash, item, - isSpecial = (_is_iDevice && !!(_ua.match(/os (1|2|3_0|3_1)/i))); - if (isSpecial) { - _s.hasHTML5 = false; - _s.html5Only = true; - if (_s.oMC) { - _s.oMC.style.display = 'none'; - } - return false; - } - if (_s.useHTML5Audio) { - if (!_s.html5 || !_s.html5.canPlayType) { - _s.hasHTML5 = false; - return true; - } else { - _s.hasHTML5 = true; - } - if (_isBadSafari) { - if (_detectFlash()) { - return true; - } - } - } else { - return true; - } - for (item in _s.audioFormats) { - if (_s.audioFormats.hasOwnProperty(item)) { - if ((_s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) || _s.flash[item] || _s.flash[_s.audioFormats[item].type]) { - needsFlash = true; - } - } - } - if (_s.ignoreFlash) { - needsFlash = false; - } - _s.html5Only = (_s.hasHTML5 && _s.useHTML5Audio && !needsFlash); - return (!_s.html5Only); - }; - _startTimer = function(oSound) { - if (!oSound._hasTimer) { - oSound._hasTimer = true; - } - }; - _stopTimer = function(oSound) { - if (oSound._hasTimer) { - oSound._hasTimer = false; - } - }; - _catchError = function(options) { - options = (typeof options !== 'undefined' ? options : {}); - if (_s.onerror instanceof Function) { - _s.onerror.apply(_win, [{type:(typeof options.type !== 'undefined' ? options.type : null)}]); - } - if (typeof options.fatal !== 'undefined' && options.fatal) { - _s.disable(); - } - }; - _badSafariFix = function() { - if (!_isBadSafari || !_detectFlash()) { - return false; - } - var aF = _s.audioFormats, i, item; - for (item in aF) { - if (aF.hasOwnProperty(item)) { - if (item === 'mp3' || item === 'mp4') { - _s.html5[item] = false; - if (aF[item] && aF[item].related) { - for (i = aF[item].related.length; i--;) { - _s.html5[aF[item].related[i]] = false; - } - } - } - } - } - }; - this._setSandboxType = function(sandboxType) { - }; - this._externalInterfaceOK = function(flashDate) { - if (_s.swfLoaded) { - return false; - } - var eiTime = new Date().getTime(); - _s.swfLoaded = true; - _tryInitOnFocus = false; - if (_isBadSafari) { - _badSafariFix(); - } - if (_isIE) { - setTimeout(_init, 100); - } else { - _init(); - } - }; - _createMovie = function(smID, smURL) { - if (_didAppend && _appendSuccess) { - return false; - } - function _initMsg() { - } - if (_s.html5Only) { - _setVersionInfo(); - _initMsg(); - _s.oMC = _id(_s.movieID); - _init(); - _didAppend = true; - _appendSuccess = true; - return false; - } - var remoteURL = (smURL || _s.url), - localURL = (_s.altURL || remoteURL), - swfTitle = 'JS/Flash audio component (SoundManager 2)', - oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), - s, x, sClass, side = 'auto', isRTL = null, - html = _doc.getElementsByTagName('html')[0]; - isRTL = (html && html.dir && html.dir.match(/rtl/i)); - smID = (typeof smID === 'undefined'?_s.id:smID); - function param(name, value) { - return ''; - } - _setVersionInfo(); - _s.url = _normalizeMovieURL(_overHTTP?remoteURL:localURL); - smURL = _s.url; - _s.wmode = (!_s.wmode && _s.useHighPerformance ? 'transparent' : _s.wmode); - if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) { - _s.specialWmodeCase = true; - _s.wmode = null; - } - oEmbed = { - 'name': smID, - 'id': smID, - 'src': smURL, - 'width': side, - 'height': side, - 'quality': 'high', - 'allowScriptAccess': _s.allowScriptAccess, - 'bgcolor': _s.bgColor, - 'pluginspage': _http+'www.macromedia.com/go/getflashplayer', - 'title': swfTitle, - 'type': 'application/x-shockwave-flash', - 'wmode': _s.wmode, - 'hasPriority': 'true' - }; - if (_s.debugFlash) { - oEmbed.FlashVars = 'debug=1'; - } - if (!_s.wmode) { - delete oEmbed.wmode; - } - if (_isIE) { - oMovie = _doc.createElement('div'); - movieHTML = [ - '', - param('movie', smURL), - param('AllowScriptAccess', _s.allowScriptAccess), - param('quality', oEmbed.quality), - (_s.wmode? param('wmode', _s.wmode): ''), - param('bgcolor', _s.bgColor), - param('hasPriority', 'true'), - (_s.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''), - '' - ].join(''); - } else { - oMovie = _doc.createElement('embed'); - for (tmp in oEmbed) { - if (oEmbed.hasOwnProperty(tmp)) { - oMovie.setAttribute(tmp, oEmbed[tmp]); - } - } - } - _initDebug(); - extraClass = _getSWFCSS(); - oTarget = _getDocument(); - if (oTarget) { - _s.oMC = (_id(_s.movieID) || _doc.createElement('div')); - if (!_s.oMC.id) { - _s.oMC.id = _s.movieID; - _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; - s = null; - oEl = null; - if (!_s.useFlashBlock) { - if (_s.useHighPerformance) { - s = { - 'position': 'fixed', - 'width': '8px', - 'height': '8px', - 'bottom': '0px', - 'left': '0px', - 'overflow': 'hidden' - }; - } else { - s = { - 'position': 'absolute', - 'width': '6px', - 'height': '6px', - 'top': '-9999px', - 'left': '-9999px' - }; - if (isRTL) { - s.left = Math.abs(parseInt(s.left,10))+'px'; - } - } - } - if (_isWebkit) { - _s.oMC.style.zIndex = 10000; - } - if (!_s.debugFlash) { - for (x in s) { - if (s.hasOwnProperty(x)) { - _s.oMC.style[x] = s[x]; - } - } - } - try { - if (!_isIE) { - _s.oMC.appendChild(oMovie); - } - oTarget.appendChild(_s.oMC); - if (_isIE) { - oEl = _s.oMC.appendChild(_doc.createElement('div')); - oEl.className = _s.swfCSS.swfBox; - oEl.innerHTML = movieHTML; - } - _appendSuccess = true; - } catch(e) { - throw new Error(_str('domError')+' \n'+e.toString()); - } - } else { - sClass = _s.oMC.className; - _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); - _s.oMC.appendChild(oMovie); - if (_isIE) { - oEl = _s.oMC.appendChild(_doc.createElement('div')); - oEl.className = _s.swfCSS.swfBox; - oEl.innerHTML = movieHTML; - } - _appendSuccess = true; - } - } - _didAppend = true; - _initMsg(); - return true; - }; - _initMovie = function() { - if (_s.html5Only) { - _createMovie(); - return false; - } - if (_s.o) { - return false; - } - _s.o = _s.getMovie(_s.id); - if (!_s.o) { - if (!_oRemoved) { - _createMovie(_s.id, _s.url); - } else { - if (!_isIE) { - _s.oMC.appendChild(_oRemoved); - } else { - _s.oMC.innerHTML = _oRemovedHTML; - } - _oRemoved = null; - _didAppend = true; - } - _s.o = _s.getMovie(_s.id); - } - if (_s.oninitmovie instanceof Function) { - setTimeout(_s.oninitmovie, 1); - } - return true; - }; - _delayWaitForEI = function() { - setTimeout(_waitForEI, 1000); - }; - _waitForEI = function() { - if (_waitingForEI) { - return false; - } - _waitingForEI = true; - _event.remove(_win, 'load', _delayWaitForEI); - if (_tryInitOnFocus && !_isFocused) { - return false; - } - var p; - if (!_didInit) { - p = _s.getMoviePercent(); - } - setTimeout(function() { - p = _s.getMoviePercent(); - if (!_didInit && _okToDisable) { - if (p === null) { - if (_s.useFlashBlock || _s.flashLoadTimeout === 0) { - if (_s.useFlashBlock) { - _flashBlockHandler(); - } - } else { - _failSafely(true); - } - } else { - if (_s.flashLoadTimeout === 0) { - } else { - _failSafely(true); - } - } - } - }, _s.flashLoadTimeout); - }; - _handleFocus = function() { - function cleanup() { - _event.remove(_win, 'focus', _handleFocus); - _event.remove(_win, 'load', _handleFocus); - } - if (_isFocused || !_tryInitOnFocus) { - cleanup(); - return true; - } - _okToDisable = true; - _isFocused = true; - if (_isSafari && _tryInitOnFocus) { - _event.remove(_win, 'mousemove', _handleFocus); - } - _waitingForEI = false; - cleanup(); - return true; - }; - _showSupport = function() { - var item, tests = []; - if (_s.useHTML5Audio && _s.hasHTML5) { - for (item in _s.audioFormats) { - if (_s.audioFormats.hasOwnProperty(item)) { - tests.push(item + ': ' + _s.html5[item] + (!_s.html5[item] && _hasFlash && _s.flash[item] ? ' (using flash)' : (_s.preferFlash && _s.flash[item] && _hasFlash ? ' (preferring flash)': (!_s.html5[item] ? ' (' + (_s.audioFormats[item].required ? 'required, ':'') + 'and no flash support)' : '')))); - } - } - } - }; - _initComplete = function(bNoDisable) { - if (_didInit) { - return false; - } - if (_s.html5Only) { - _didInit = true; - _initUserOnload(); - return true; - } - var wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()), - error; - if (!wasTimeout) { - _didInit = true; - if (_disabled) { - error = {type: (!_hasFlash && _needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')}; - } - } - if (_disabled || bNoDisable) { - if (_s.useFlashBlock && _s.oMC) { - _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); - } - _processOnEvents({type:'ontimeout', error:error}); - _catchError(error); - return false; - } else { - } - if (_s.waitForWindowLoad && !_windowLoaded) { - _event.add(_win, 'load', _initUserOnload); - return false; - } else { - _initUserOnload(); - } - return true; - }; - _init = function() { - if (_didInit) { - return false; - } - function _cleanup() { - _event.remove(_win, 'load', _s.beginDelayedInit); - } - if (_s.html5Only) { - if (!_didInit) { - _cleanup(); - _s.enabled = true; - _initComplete(); - } - return true; - } - _initMovie(); - try { - _s.o._externalInterfaceTest(false); - _setPolling(true, (_s.flashPollingInterval || (_s.useHighPerformance ? 10 : 50))); - if (!_s.debugMode) { - _s.o._disableDebug(); - } - _s.enabled = true; - if (!_s.html5Only) { - _event.add(_win, 'unload', _doNothing); - } - } catch(e) { - _catchError({type:'JS_TO_FLASH_EXCEPTION', fatal:true}); - _failSafely(true); - _initComplete(); - return false; - } - _initComplete(); - _cleanup(); - return true; - }; - _domContentLoaded = function() { - if (_didDCLoaded) { - return false; - } - _didDCLoaded = true; - _initDebug(); - if (!_hasFlash && _s.hasHTML5) { - _s.useHTML5Audio = true; - _s.preferFlash = false; - } - _testHTML5(); - _s.html5.usingFlash = _featureCheck(); - _needsFlash = _s.html5.usingFlash; - _showSupport(); - if (!_hasFlash && _needsFlash) { - _s.flashLoadTimeout = 1; - } - if (_doc.removeEventListener) { - _doc.removeEventListener('DOMContentLoaded', _domContentLoaded, false); - } - _initMovie(); - return true; - }; - _domContentLoadedIE = function() { - if (_doc.readyState === 'complete') { - _domContentLoaded(); - _doc.detachEvent('onreadystatechange', _domContentLoadedIE); - } - return true; - }; - _detectFlash(); - _event.add(_win, 'focus', _handleFocus); - _event.add(_win, 'load', _handleFocus); - _event.add(_win, 'load', _delayWaitForEI); - if (_isSafari && _tryInitOnFocus) { - _event.add(_win, 'mousemove', _handleFocus); - } - if (_doc.addEventListener) { - _doc.addEventListener('DOMContentLoaded', _domContentLoaded, false); - } else if (_doc.attachEvent) { - _doc.attachEvent('onreadystatechange', _domContentLoadedIE); - } else { - _catchError({type:'NO_DOM2_EVENTS', fatal:true}); - } - if (_doc.readyState === 'complete') { - setTimeout(_domContentLoaded,100); - } -} -// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading -if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) { - soundManager = new SoundManager(); -} -window.SoundManager = SoundManager; -window.soundManager = soundManager; -}(window)); \ No newline at end of file diff --git a/telemeta/static/timeside/js/libs/soundmanager2.js b/telemeta/static/timeside/js/libs/soundmanager2.js deleted file mode 100755 index 6e4cb4f9..00000000 --- a/telemeta/static/timeside/js/libs/soundmanager2.js +++ /dev/null @@ -1,4520 +0,0 @@ -/** @license - * - * SoundManager 2: JavaScript Sound for the Web - * ---------------------------------------------- - * http://schillmania.com/projects/soundmanager2/ - * - * Copyright (c) 2007, Scott Schiller. All rights reserved. - * Code provided under the BSD License: - * http://schillmania.com/projects/soundmanager2/license.txt - * - * V2.97a.20111030 - */ - -/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ -/* jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */ - -/** - * About this file - * --------------- - * This is the fully-commented source version of the SoundManager 2 API, - * recommended for use during development and testing. - * - * See soundmanager2-nodebug-jsmin.js for an optimized build (~10KB with gzip.) - * http://schillmania.com/projects/soundmanager2/doc/getstarted/#basic-inclusion - * Alternately, serve this file with gzip for 75% compression savings (~30KB over HTTP.) - * - * You may notice and comments in this source; these are delimiters for - * debug blocks which are removed in the -nodebug builds, further optimizing code size. - */ - -(function(window) { - -var soundManager = null; - -/** - * The SoundManager constructor. - * - * @constructor - * @param {string} smURL Optional: Path to SWF files - * @param {string} smID Optional: The ID to use for the SWF container element - * @this {SoundManager} - * @return {SoundManager} The new SoundManager instance - */ - -function SoundManager(smURL, smID) { - - // Top-level configuration options - - this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9. - this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured) - this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues - this.useConsole = true; // use firebug/safari console.log()-type debug console if available - this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug - this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload() - this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000' - this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag - this.flashPollingInterval = null; // msec affecting whileplaying/loading callback frequency. If null, default of 50 msec is used. - this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity) - this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top) - this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain' - this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable. - this.useHTML5Audio = true; // use HTML5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible. - this.html5Test = /^(probably|maybe)$/i; // HTML5 Audio() format support test. Use /^probably$/i; if you want to be more conservative. - this.preferFlash = true; // overrides useHTML5audio. if true and flash support present, will try to use flash for MP3/MP4 as needed since HTML5 audio support is still quirky in browsers. - this.noSWFCache = false; // if true, appends ?ts={date} to break aggressive SWF caching. - - this.audioFormats = { - - /** - * determines HTML5 support + flash requirements. - * if no support (via flash and/or HTML5) for a "required" format, SM2 will fail to start. - * flash fallback is used for MP3 or MP4 if HTML5 can't play it (or if preferFlash = true) - * multiple MIME types may be tested while trying to get a positive canPlayType() response. - */ - - 'mp3': { - 'type': ['audio/mpeg; codecs="mp3"', 'audio/mpeg', 'audio/mp3', 'audio/MPA', 'audio/mpa-robust'], - 'required': true - }, - - 'mp4': { - 'related': ['aac','m4a'], // additional formats under the MP4 container - 'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'], - 'required': false - - }, - - 'ogg': { - 'type': ['audio/ogg; codecs=vorbis'], - 'required': false - }, - - 'wav': { - 'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'], - 'required': false - } - - }; - - this.defaultOptions = { - - /** - * the default configuration for sound objects made with createSound() and related methods - * eg., volume, auto-load behaviour and so forth - */ - - 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can) - 'stream': true, // allows playing before entire file has loaded (recommended) - 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true) - 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0) - 'onid3': null, // callback function for "ID3 data is added/available" - 'onload': null, // callback function for "load finished" - 'whileloading': null, // callback function for "download progress update" (X of Y bytes received) - 'onplay': null, // callback for "play" start - 'onpause': null, // callback for "pause" - 'onresume': null, // callback for "resume" (pause toggle) - 'whileplaying': null, // callback during play (position update) - 'onstop': null, // callback for "user stop" - 'onfailure': null, // callback function for when playing fails - 'onfinish': null, // callback function for "sound finished playing" - 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time - 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled - 'position': null, // offset (milliseconds) to seek to within loaded sound data. - 'pan': 0, // "pan" settings, left-to-right, -100 to 100 - 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3 - 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access) - 'volume': 100 // self-explanatory. 0-100, the latter being the max. - - }; - - this.flash9Options = { - - /** - * flash 9-only options, - * merged into defaultOptions if flash 9 is being used - */ - - 'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL - 'usePeakData': false, // enable left/right channel peak (level) data - 'useWaveformData': false, // enable sound spectrum (raw waveform data) - NOTE: May increase CPU load. - 'useEQData': false, // enable sound EQ (frequency spectrum data) - NOTE: May increase CPU load. - 'onbufferchange': null, // callback for "isBuffering" property change - 'ondataerror': null // callback for waveform/eq data access error (flash playing audio in other tabs/domains) - - }; - - this.movieStarOptions = { - - /** - * flash 9.0r115+ MPEG4 audio options, - * merged into defaultOptions if flash 9+movieStar mode is enabled - */ - - 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.) - 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants - 'onconnect': null, // rtmp: callback for connection to flash media server - 'duration': null // rtmp: song duration (msec) - - }; - - // HTML attributes (id + class names) for the SWF container - - this.movieID = 'sm2-container'; - this.id = (smID || 'sm2movie'); - - this.swfCSS = { - - 'swfBox': 'sm2-object-box', - 'swfDefault': 'movieContainer', - 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error) - 'swfTimedout': 'swf_timedout', - 'swfLoaded': 'swf_loaded', - 'swfUnblocked': 'swf_unblocked', // or loaded OK - 'sm2Debug': 'sm2_debug', - 'highPerf': 'high_performance', - 'flashDebug': 'flash_debug' - - }; - - this.debugID = 'soundmanager-debug'; - this.debugURLParam = /([#?&])debug=1/i; - - // dynamic attributes - - this.versionNumber = 'V2.97a.20111030'; - this.version = null; - this.movieURL = null; - this.url = (smURL || null); - this.altURL = null; - this.swfLoaded = false; - this.enabled = false; - this.o = null; - this.oMC = null; - this.sounds = {}; - this.soundIDs = []; - this.muted = false; - this.specialWmodeCase = false; - this.didFlashBlock = false; - this.filePattern = null; - - this.filePatterns = { - - 'flash8': /\.mp3(\?.*)?$/i, - 'flash9': /\.mp3(\?.*)?$/i - - }; - - // support indicators, set at init - - this.features = { - - 'buffering': false, - 'peakData': false, - 'waveformData': false, - 'eqData': false, - 'movieStar': false - - }; - - // flash sandbox info, used primarily in troubleshooting - - this.sandbox = { - - // - 'type': null, - 'types': { - 'remote': 'remote (domain-based) rules', - 'localWithFile': 'local with file access (no internet access)', - 'localWithNetwork': 'local with network (internet access only, no local access)', - 'localTrusted': 'local, trusted (local+internet access)' - }, - 'description': null, - 'noRemote': null, - 'noLocal': null - // - - }; - - /** - * basic HTML5 Audio() support test - * try...catch because of IE 9 "not implemented" nonsense - * https://github.com/Modernizr/Modernizr/issues/224 - */ - - this.hasHTML5 = (function() { - try { - return (typeof Audio !== 'undefined' && typeof new Audio().canPlayType !== 'undefined'); - } catch(e) { - return false; - } - }()); - - /** - * format support (html5/flash) - * stores canPlayType() results based on audioFormats. - * eg. { mp3: boolean, mp4: boolean } - * treat as read-only. - */ - - this.html5 = { - 'usingFlash': null // set if/when flash fallback is needed - }; - - this.flash = {}; - - this.html5Only = false; // determined at init time - this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?) - - /** - * a few private internals (OK, a lot. :D) - */ - - var SMSound, - _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, - _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _is_firefox = _ua.match(/firefox/i), _is_android = _ua.match(/droid/i), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)), - _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), - _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159 - _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i, - _emptyURL = 'about:blank', // safe URL to unload, or load nothing from (flash 8 + most HTML5 UAs) - _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null), - _http = (!_overHTTP ? 'http:/'+'/' : ''), - // mp3, mp4, aac etc. - _netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i, - // Flash v9.0r115+ "moviestar" formats - _netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'], - _netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); - this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // default mp3 set - - // use altURL if not "online" - this.useAltURL = !_overHTTP; - this._global_a = null; - - if (_likesHTML5) { - - // prefer HTML5 for mobile + tablet-like devices, probably more reliable vs. flash at this point. - _s.useHTML5Audio = true; - _s.preferFlash = false; - - if (_is_iDevice) { - // by default, use global feature. iOS onfinish() -> next may fail otherwise. - _s.ignoreFlash = true; - _useGlobalHTML5Audio = true; - } - - } - - /** - * Public SoundManager API - * ----------------------- - */ - - this.ok = function() { - - return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5)); - - }; - - this.supported = this.ok; // legacy - - this.getMovie = function(smID) { - - // safety net: some old browsers differ on SWF references, possibly related to ExternalInterface / flash version - return _id(smID) || _doc[smID] || _win[smID]; - - }; - - /** - * Creates a SMSound sound object instance. - * - * @param {object} oOptions Sound options (at minimum, id and url are required.) - * @return {object} SMSound The new SMSound object. - */ - - this.createSound = function(oOptions) { - - var _cs = _sm+'.createSound(): ', - thisOptions = null, oSound = null, _tO = null; - - if (!_didInit || !_s.ok()) { - _complain(_cs + _str(!_didInit?'notReady':'notOK')); - return false; - } - - if (arguments.length === 2) { - // function overloading in JS! :) ..assume simple createSound(id,url) use case - oOptions = { - 'id': arguments[0], - 'url': arguments[1] - }; - } - - // inherit from defaultOptions - thisOptions = _mixin(oOptions); - - // alias - _tO = thisOptions; - - // - if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) { - _s._wD(_cs + _str('badID', _tO.id), 2); - } - - _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1); - // - - if (_idCheck(_tO.id, true)) { - _s._wD(_cs + _tO.id + ' exists', 1); - return _s.sounds[_tO.id]; - } - - function make() { - - thisOptions = _loopFix(thisOptions); - _s.sounds[_tO.id] = new SMSound(_tO); - _s.soundIDs.push(_tO.id); - return _s.sounds[_tO.id]; - - } - - if (_html5OK(_tO)) { - - oSound = make(); - _s._wD('Loading sound '+_tO.id+' via HTML5'); - oSound._setup_html5(_tO); - - } else { - - if (_fV > 8) { - if (_tO.isMovieStar === null) { - // attempt to detect MPEG-4 formats - _tO.isMovieStar = (_tO.serverURL || (_tO.type ? _tO.type.match(_netStreamMimeTypes) : false) || _tO.url.match(_netStreamPattern)); - } - // - if (_tO.isMovieStar) { - _s._wD(_cs + 'using MovieStar handling'); - } - // - if (_tO.isMovieStar) { - if (_tO.usePeakData) { - _wDS('noPeak'); - _tO.usePeakData = false; - } - // - if (_tO.loops > 1) { - _wDS('noNSLoop'); - } - // - } - } - - _tO = _policyFix(_tO, _cs); - oSound = make(); - - if (_fV === 8) { - _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); - } else { - _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); - if (!_tO.serverURL) { - // We are connected immediately - oSound.connected = true; - if (_tO.onconnect) { - _tO.onconnect.apply(oSound); - } - } - } - - if (!_tO.serverURL && (_tO.autoLoad || _tO.autoPlay)) { - // call load for non-rtmp streams - oSound.load(_tO); - } - - } - - // rtmp will play in onconnect - if (!_tO.serverURL && _tO.autoPlay) { - oSound.play(); - } - - return oSound; - - }; - - /** - * Destroys a SMSound sound object instance. - * - * @param {string} sID The ID of the sound to destroy - */ - - this.destroySound = function(sID, _bFromSound) { - - // explicitly destroy a sound before normal page unload, etc. - - if (!_idCheck(sID)) { - return false; - } - - var oS = _s.sounds[sID], i; - - // Disable all callbacks while the sound is being destroyed - oS._iO = {}; - - oS.stop(); - oS.unload(); - - for (i = 0; i < _s.soundIDs.length; i++) { - if (_s.soundIDs[i] === sID) { - _s.soundIDs.splice(i, 1); - break; - } - } - - if (!_bFromSound) { - // ignore if being called from SMSound instance - oS.destruct(true); - } - - oS = null; - delete _s.sounds[sID]; - - return true; - - }; - - /** - * Calls the load() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {object} oOptions Optional: Sound options - */ - - this.load = function(sID, oOptions) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].load(oOptions); - - }; - - /** - * Calls the unload() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - */ - - this.unload = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - - return _s.sounds[sID].unload(); - - }; - - /** - * Calls the onposition() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {number} nPosition The position to watch for - * @param {function} oMethod The relevant callback to fire - * @param {object} oScope Optional: The scope to apply the callback to - * @return {SMSound} The SMSound object - */ - - this.onposition = function(sID, nPosition, oMethod, oScope) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].onposition(nPosition, oMethod, oScope); - - }; - - /** - * Calls the play() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {object} oOptions Optional: Sound options - * @return {SMSound} The SMSound object - */ - - this.play = function(sID, oOptions) { - - var fN = _sm+'.play(): '; - - if (!_didInit || !_s.ok()) { - _complain(fN + _str(!_didInit?'notReady':'notOK')); - return false; - } - - if (!_idCheck(sID)) { - if (!(oOptions instanceof Object)) { - oOptions = { - url: oOptions - }; // overloading use case: play('mySound','/path/to/some.mp3'); - } - if (oOptions && oOptions.url) { - // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'}); - _s._wD(fN + 'attempting to create "' + sID + '"', 1); - oOptions.id = sID; - return _s.createSound(oOptions).play(); - } else { - return false; - } - } - - return _s.sounds[sID].play(oOptions); - - }; - - this.start = this.play; // just for convenience - - /** - * Calls the setPosition() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {number} nMsecOffset Position (milliseconds) - * @return {SMSound} The SMSound object - */ - - this.setPosition = function(sID, nMsecOffset) { - - if (!_idCheck(sID)) { - return false; - - } - return _s.sounds[sID].setPosition(nMsecOffset); - - }; - - /** - * Calls the stop() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.stop = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - _s._wD(_sm+'.stop(' + sID + ')', 1); - return _s.sounds[sID].stop(); - - }; - - /** - * Stops all currently-playing sounds. - */ - - this.stopAll = function() { - - var oSound; - _s._wD(_sm+'.stopAll()', 1); - - for (oSound in _s.sounds) { - if (_s.sounds.hasOwnProperty(oSound)) { - // apply only to sound objects - _s.sounds[oSound].stop(); - } - } - - }; - - /** - * Calls the pause() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.pause = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].pause(); - - }; - - /** - * Pauses all currently-playing sounds. - */ - - this.pauseAll = function() { - - var i; - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].pause(); - } - - }; - - /** - * Calls the resume() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.resume = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].resume(); - - }; - - /** - * Resumes all currently-paused sounds. - */ - - this.resumeAll = function() { - - var i; - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].resume(); - } - - }; - - /** - * Calls the togglePause() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.togglePause = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].togglePause(); - - }; - - /** - * Calls the setPan() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {number} nPan The pan value (-100 to 100) - * @return {SMSound} The SMSound object - */ - - this.setPan = function(sID, nPan) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].setPan(nPan); - - }; - - /** - * Calls the setVolume() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @param {number} nVol The volume value (0 to 100) - * @return {SMSound} The SMSound object - */ - - this.setVolume = function(sID, nVol) { - - if (!_idCheck(sID)) { - return false; - } - return _s.sounds[sID].setVolume(nVol); - - }; - - /** - * Calls the mute() method of either a single SMSound object by ID, or all sound objects. - * - * @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.) - */ - - this.mute = function(sID) { - - var fN = _sm+'.mute(): ', - i = 0; - - if (typeof sID !== 'string') { - sID = null; - } - - if (!sID) { - _s._wD(fN + 'Muting all sounds'); - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].mute(); - } - _s.muted = true; - } else { - if (!_idCheck(sID)) { - return false; - } - _s._wD(fN + 'Muting "' + sID + '"'); - return _s.sounds[sID].mute(); - } - - return true; - - }; - - /** - * Mutes all sounds. - */ - - this.muteAll = function() { - - _s.mute(); - - }; - - /** - * Calls the unmute() method of either a single SMSound object by ID, or all sound objects. - * - * @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.) - */ - - this.unmute = function(sID) { - - var fN = _sm+'.unmute(): ', i; - - if (typeof sID !== 'string') { - sID = null; - } - - if (!sID) { - - _s._wD(fN + 'Unmuting all sounds'); - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].unmute(); - } - _s.muted = false; - - } else { - - if (!_idCheck(sID)) { - return false; - } - _s._wD(fN + 'Unmuting "' + sID + '"'); - return _s.sounds[sID].unmute(); - - } - - return true; - - }; - - /** - * Unmutes all sounds. - */ - - this.unmuteAll = function() { - - _s.unmute(); - - }; - - /** - * Calls the toggleMute() method of a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.toggleMute = function(sID) { - - if (!_idCheck(sID)) { - return false; - } - - return _s.sounds[sID].toggleMute(); - - }; - - /** - * Retrieves the memory used by the flash plugin. - * - * @return {number} The amount of memory in use - */ - - this.getMemoryUse = function() { - - // flash-only - var ram = 0; - - if (_s.o && _fV !== 8) { - ram = parseInt(_s.o._getMemoryUse(), 10); - } - - return ram; - - }; - - /** - * Undocumented: NOPs soundManager and all SMSound objects. - */ - - this.disable = function(bNoDisable) { - - // destroy all functions - var i; - - if (typeof bNoDisable === 'undefined') { - bNoDisable = false; - } - - if (_disabled) { - return false; - } - - _disabled = true; - _wDS('shutdown', 1); - - for (i = _s.soundIDs.length; i--;) { - _disableObject(_s.sounds[_s.soundIDs[i]]); - } - - // fire "complete", despite fail - _initComplete(bNoDisable); - _event.remove(_win, 'load', _initUserOnload); - - return true; - - }; - - /** - * Determines playability of a MIME type, eg. 'audio/mp3'. - */ - - this.canPlayMIME = function(sMIME) { - - var result; - - if (_s.hasHTML5) { - result = _html5CanPlay({type:sMIME}); - } - - if (!_needsFlash || result) { - // no flash, or OK - return result; - } else { - // if flash 9, test netStream (movieStar) types as well. - return (sMIME ? !!((_fV > 8 ? sMIME.match(_netStreamMimeTypes) : null) || sMIME.match(_s.mimePattern)) : null); - } - - }; - - /** - * Determines playability of a URL based on audio support. - * - * @param {string} sURL The URL to test - * @return {boolean} URL playability - */ - - this.canPlayURL = function(sURL) { - - var result; - - if (_s.hasHTML5) { - result = _html5CanPlay({url: sURL}); - } - - if (!_needsFlash || result) { - // no flash, or OK - return result; - } else { - return (sURL ? !!(sURL.match(_s.filePattern)) : null); - } - - }; - - /** - * Determines playability of an HTML DOM <a> object (or similar object literal) based on audio support. - * - * @param {object} oLink an HTML DOM <a> object or object literal including href and/or type attributes - * @return {boolean} URL playability - */ - - this.canPlayLink = function(oLink) { - - if (typeof oLink.type !== 'undefined' && oLink.type) { - if (_s.canPlayMIME(oLink.type)) { - return true; - } - } - - return _s.canPlayURL(oLink.href); - - }; - - /** - * Retrieves a SMSound object by ID. - * - * @param {string} sID The ID of the sound - * @return {SMSound} The SMSound object - */ - - this.getSoundById = function(sID, _suppressDebug) { - - if (!sID) { - throw new Error(_sm+'.getSoundById(): sID is null/undefined'); - } - - var result = _s.sounds[sID]; - - // - if (!result && !_suppressDebug) { - _s._wD('"' + sID + '" is an invalid sound ID.', 2); - } - // - - return result; - - }; - - /** - * Queues a callback for execution when SoundManager has successfully initialized. - * - * @param {function} oMethod The callback method to fire - * @param {object} oScope Optional: The scope to apply to the callback - */ - - this.onready = function(oMethod, oScope) { - - var sType = 'onready'; - - if (oMethod && oMethod instanceof Function) { - - // - if (_didInit) { - _s._wD(_str('queue', sType)); - } - // - - if (!oScope) { - oScope = _win; - } - - _addOnEvent(sType, oMethod, oScope); - _processOnEvents(); - - return true; - - } else { - - throw _str('needFunction', sType); - - } - - }; - - /** - * Queues a callback for execution when SoundManager has failed to initialize. - * - * @param {function} oMethod The callback method to fire - * @param {object} oScope Optional: The scope to apply to the callback - */ - - this.ontimeout = function(oMethod, oScope) { - - var sType = 'ontimeout'; - - if (oMethod && oMethod instanceof Function) { - - // - if (_didInit) { - _s._wD(_str('queue', sType)); - } - // - - if (!oScope) { - oScope = _win; - } - - _addOnEvent(sType, oMethod, oScope); - _processOnEvents({type:sType}); - - return true; - - } else { - - throw _str('needFunction', sType); - - } - - }; - - /** - * Writes console.log()-style debug output to a console or in-browser element. - * Applies when SoundManager.debugMode = true - * - * @param {string} sText The console message - * @param {string} sType Optional: Log type of 'info', 'warn' or 'error' - * @param {object} Optional: The scope to apply to the callback - */ - - this._writeDebug = function(sText, sType, _bTimestamp) { - - // pseudo-private console.log()-style output - // - - var sDID = 'soundmanager-debug', o, oItem, sMethod; - - if (!_s.debugMode) { - return false; - } - - if (typeof _bTimestamp !== 'undefined' && _bTimestamp) { - sText = sText + ' | ' + new Date().getTime(); - } - - if (_hasConsole && _s.useConsole) { - sMethod = _debugLevels[sType]; - if (typeof console[sMethod] !== 'undefined') { - console[sMethod](sText); - } else { - console.log(sText); - } - if (_s.useConsoleOnly) { - return true; - } - } - - try { - - o = _id(sDID); - - if (!o) { - return false; - } - - oItem = _doc.createElement('div'); - - if (++_wdCount % 2 === 0) { - oItem.className = 'sm2-alt'; - } - - if (typeof sType === 'undefined') { - sType = 0; - } else { - sType = parseInt(sType, 10); - } - - oItem.appendChild(_doc.createTextNode(sText)); - - if (sType) { - if (sType >= 2) { - oItem.style.fontWeight = 'bold'; - } - if (sType === 3) { - oItem.style.color = '#ff3333'; - } - } - - // top-to-bottom - // o.appendChild(oItem); - - // bottom-to-top - o.insertBefore(oItem, o.firstChild); - - } catch(e) { - // oh well - } - - o = null; - // - - return true; - - }; - - // alias - this._wD = this._writeDebug; - - /** - * Provides debug / state information on all SMSound objects. - */ - - this._debug = function() { - - // - var i, j; - _wDS('currentObj', 1); - - for (i = 0, j = _s.soundIDs.length; i < j; i++) { - _s.sounds[_s.soundIDs[i]]._debug(); - } - // - - }; - - /** - * Restarts and re-initializes the SoundManager instance. - */ - - this.reboot = function() { - - // attempt to reset and init SM2 - _s._wD(_sm+'.reboot()'); - - // - if (_s.soundIDs.length) { - _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...'); - } - // - - var i, j; - - for (i = _s.soundIDs.length; i--;) { - _s.sounds[_s.soundIDs[i]].destruct(); - } - - // trash ze flash - - try { - if (_isIE) { - _oRemovedHTML = _s.o.innerHTML; - } - _oRemoved = _s.o.parentNode.removeChild(_s.o); - _s._wD('Flash movie removed.'); - } catch(e) { - // uh-oh. - _wDS('badRemove', 2); - } - - // actually, force recreate of movie. - _oRemovedHTML = _oRemoved = _needsFlash = null; - - _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; - _s.soundIDs = _s.sounds = []; - _s.o = null; - - for (i in _on_queue) { - if (_on_queue.hasOwnProperty(i)) { - for (j = _on_queue[i].length; j--;) { - _on_queue[i][j].fired = false; - } - } - } - - _s._wD(_sm + ': Rebooting...'); - _win.setTimeout(_s.beginDelayedInit, 20); - - }; - - /** - * Undocumented: Determines the SM2 flash movie's load progress. - * - * @return {number or null} Percent loaded, or if invalid/unsupported, null. - */ - - this.getMoviePercent = function() { - - return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null); - - }; - - /** - * Additional helper for manually invoking SM2's init process after DOM Ready / window.onload(). - */ - - this.beginDelayedInit = function() { - - _windowLoaded = true; - _domContentLoaded(); - - setTimeout(function() { - - if (_initPending) { - return false; - } - - _createMovie(); - _initMovie(); - _initPending = true; - - return true; - - }, 20); - - _delayWaitForEI(); - - }; - - /** - * Destroys the SoundManager instance and all SMSound instances. - */ - - this.destruct = function() { - - _s._wD(_sm+'.destruct()'); - _s.disable(true); - - }; - - /** - * SMSound() (sound object) constructor - * ------------------------------------ - * - * @param {object} oOptions Sound options (id and url are required attributes) - * @return {SMSound} The new SMSound object - */ - - SMSound = function(oOptions) { - - var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer; - this.sID = oOptions.id; - this.url = oOptions.url; - this.options = _mixin(oOptions); - - // per-play-instance-specific options - this.instanceOptions = this.options; - - // short alias - this._iO = this.instanceOptions; - - // assign property defaults - this.pan = this.options.pan; - this.volume = this.options.volume; - this._lastURL = null; - this.isHTML5 = false; - this._a = null; - - /** - * SMSound() public methods - * ------------------------ - */ - - this.id3 = {}; - - /** - * Writes SMSound object parameters to debug console - */ - - this._debug = function() { - - // - // pseudo-private console.log()-style output - - if (_s.debugMode) { - - var stuff = null, msg = [], sF, sfBracket, maxLength = 64; - - for (stuff in _t.options) { - if (_t.options[stuff] !== null) { - if (_t.options[stuff] instanceof Function) { - // handle functions specially - sF = _t.options[stuff].toString(); - // normalize spaces - sF = sF.replace(/\s\s+/g, ' '); - sfBracket = sF.indexOf('{'); - msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }'); - } else { - msg.push(' ' + stuff + ': ' + _t.options[stuff]); - } - } - } - - _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}'); - - } - // - - }; - - // - this._debug(); - // - - /** - * Begins loading a sound per its *url*. - * - * @param {object} oOptions Optional: Sound options - * @return {SMSound} The SMSound object - */ - - this.load = function(oOptions) { - - var oS = null; - - if (typeof oOptions !== 'undefined') { - _t._iO = _mixin(oOptions, _t.options); - _t.instanceOptions = _t._iO; - } else { - oOptions = _t.options; - _t._iO = oOptions; - _t.instanceOptions = _t._iO; - if (_t._lastURL && _t._lastURL !== _t.url) { - _wDS('manURL'); - _t._iO.url = _t.url; - _t.url = null; - } - } - - if (!_t._iO.url) { - _t._iO.url = _t.url; - } - - _s._wD('SMSound.load(): ' + _t._iO.url, 1); - - if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { - _wDS('onURL', 1); - return _t; - } - - _t._lastURL = _t.url; - _t.loaded = false; - _t.readyState = 1; - _t.playState = 0; - - // TODO: If switching from HTML5 -> flash (or vice versa), stop currently-playing audio. - - if (_html5OK(_t._iO)) { - - oS = _t._setup_html5(_t._iO); - if (!oS._called_load) { - _s._wD(_h5+'load: '+_t.sID); - _t._html5_canplay = false; - oS.load(); - oS._called_load = true; - if (_t._iO.autoPlay) { - _t.play(); - } - } else { - _s._wD(_h5+'ignoring request to load again: '+_t.sID); - } - - } else { - - try { - _t.isHTML5 = false; - _t._iO = _policyFix(_loopFix(_t._iO)); - if (_fV === 8) { - _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); - } else { - _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile); - } - } catch(e) { - _wDS('smError', 2); - _debugTS('onload', false); - _catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true}); - - } - - } - - return _t; - - }; - - /** - * Unloads a sound, canceling any open HTTP requests. - * - * @return {SMSound} The SMSound object - */ - - this.unload = function() { - - // Flash 8/AS2 can't "close" a stream - fake it by loading an empty URL - // Flash 9/AS3: Close stream, preventing further load - // HTML5: Most UAs will use empty URL - - if (_t.readyState !== 0) { - - _s._wD('SMSound.unload(): "' + _t.sID + '"'); - - if (!_t.isHTML5) { - if (_fV === 8) { - _s.o._unload(_t.sID, _emptyURL); - } else { - _s.o._unload(_t.sID); - } - } else { - _stop_html5_timer(); - if (_t._a) { - _t._a.pause(); - _html5Unload(_t._a); - } - } - - // reset load/status flags - _resetProperties(); - - } - - return _t; - - }; - - /** - * Unloads and destroys a sound. - */ - - this.destruct = function(_bFromSM) { - - _s._wD('SMSound.destruct(): "' + _t.sID + '"'); - - if (!_t.isHTML5) { - - // kill sound within Flash - // Disable the onfailure handler - _t._iO.onfailure = null; - _s.o._destroySound(_t.sID); - - } else { - - _stop_html5_timer(); - - if (_t._a) { - _t._a.pause(); - _html5Unload(_t._a); - if (!_useGlobalHTML5Audio) { - _t._remove_html5_events(); - } - // break obvious circular reference - _t._a._t = null; - _t._a = null; - } - - } - - if (!_bFromSM) { - // ensure deletion from controller - _s.destroySound(_t.sID, true); - - } - - }; - - /** - * Begins playing a sound. - * - * @param {object} oOptions Optional: Sound options - * @return {SMSound} The SMSound object - */ - - this.play = function(oOptions, _updatePlayState) { - - var fN = 'SMSound.play(): ', allowMulti, a; - - _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; // default to true - - if (!oOptions) { - oOptions = {}; - } - - _t._iO = _mixin(oOptions, _t._iO); - _t._iO = _mixin(_t._iO, _t.options); - _t.instanceOptions = _t._iO; - - // RTMP-only - if (_t._iO.serverURL && !_t.connected) { - if (!_t.getAutoPlay()) { - _s._wD(fN+' Netstream not connected yet - setting autoPlay'); - _t.setAutoPlay(true); - } - // play will be called in _onconnect() - return _t; - } - - if (_html5OK(_t._iO)) { - _t._setup_html5(_t._iO); - _start_html5_timer(); - } - - if (_t.playState === 1 && !_t.paused) { - allowMulti = _t._iO.multiShot; - if (!allowMulti) { - _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1); - return _t; - } else { - _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1); - } - } - - if (!_t.loaded) { - - if (_t.readyState === 0) { - - _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1); - // try to get this sound playing ASAP - if (!_t.isHTML5) { - // assign directly because setAutoPlay() increments the instanceCount - _t._iO.autoPlay = true; - } - _t.load(_t._iO); - - } else if (_t.readyState === 2) { - - _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2); - return _t; - - } else { - - _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1); - - } - - } else { - - _s._wD(fN + '"' + _t.sID + '"'); - - } - - if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) { - // flash 9 needs a position reset if play() is called while at the end of a sound. - _s._wD(fN + '"' + _t.sID + '": Sound at end, resetting to position:0'); - _t._iO.position = 0; - } - - /** - * Streams will pause when their buffer is full if they are being loaded. - * In this case paused is true, but the song hasn't started playing yet. - * If we just call resume() the onplay() callback will never be called. - * So only call resume() if the position is > 0. - * Another reason is because options like volume won't have been applied yet. - */ - - if (_t.paused && _t.position && _t.position > 0) { - - // https://gist.github.com/37b17df75cc4d7a90bf6 - _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1); - _t.resume(); - - } else { - - _s._wD(fN+'"'+ _t.sID+'" is starting to play'); - _t.playState = 1; - _t.paused = false; - - if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) { - _t.instanceCount++; - } - - _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); - - if (!_t.isHTML5) { - _t._iO = _policyFix(_loopFix(_t._iO)); - } - - if (_t._iO.onplay && _updatePlayState) { - _t._iO.onplay.apply(_t); - _t._onplay_called = true; - } - - _t.setVolume(_t._iO.volume, true); - _t.setPan(_t._iO.pan, true); - - if (!_t.isHTML5) { - _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); - } else { - _start_html5_timer(); - a = _t._setup_html5(); - _t.setPosition(_t._iO.position); - a.play(); - } - - } - - return _t; - - }; - - // just for convenience - this.start = this.play; - - /** - * Stops playing a sound (and optionally, all sounds) - * - * @param {boolean} bAll Optional: Whether to stop all sounds - * @return {SMSound} The SMSound object - */ - - this.stop = function(bAll) { - - if (_t.playState === 1) { - - _t._onbufferchange(0); - _t.resetOnPosition(0); - _t.paused = false; - - if (!_t.isHTML5) { - _t.playState = 0; - } - - if (_t._iO.onstop) { - _t._iO.onstop.apply(_t); - } - - if (!_t.isHTML5) { - - _s.o._stop(_t.sID, bAll); - // hack for netStream: just unload - if (_t._iO.serverURL) { - _t.unload(); - } - - } else { - - if (_t._a) { - - // act like Flash, though - _t.setPosition(0); - - // html5 has no stop() - _t._a.pause(); - - _t.playState = 0; - - // and update UI - _t._onTimer(); - - _stop_html5_timer(); - - } - - } - - _t.instanceCount = 0; - _t._iO = {}; - - } - - return _t; - - }; - - /** - * Undocumented/internal: Sets autoPlay for RTMP. - * - * @param {boolean} autoPlay state - */ - - this.setAutoPlay = function(autoPlay) { - - _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off')); - _t._iO.autoPlay = autoPlay; - - if (!_t.isHTML5) { - _s.o._setAutoPlay(_t.sID, autoPlay); - if (autoPlay) { - // only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP) - if (!_t.instanceCount && _t.readyState === 1) { - _t.instanceCount++; - _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount); - } - } - } - - }; - - /** - * Undocumented/internal: Returns the autoPlay boolean. - * - * @return {boolean} The current autoPlay value - */ - - this.getAutoPlay = function() { - - return _t._iO.autoPlay; - - }; - - /** - * Sets the position of a sound. - * - * @param {number} nMsecOffset Position (milliseconds) - * @return {SMSound} The SMSound object - */ - - this.setPosition = function(nMsecOffset) { - - if (nMsecOffset === undefined) { - nMsecOffset = 0; - } - - var original_pos, - position, position1K, - // Use the duration from the instance options, if we don't have a track duration yet. - // position >= 0 and <= current available (loaded) duration - offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); - - original_pos = _t.position; - _t.position = offset; - position1K = _t.position/1000; - _t.resetOnPosition(_t.position); - _t._iO.position = offset; - - if (!_t.isHTML5) { - - position = (_fV === 9 ? _t.position : position1K); - if (_t.readyState && _t.readyState !== 2) { - // if paused or not playing, will not resume (by playing) - _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); - } - - } else if (_t._a) { - - // Set the position in the canplay handler if the sound is not ready yet - if (_t._html5_canplay) { - if (_t._a.currentTime !== position1K) { - /* - * DOM/JS errors/exceptions to watch out for: - * if seek is beyond (loaded?) position, "DOM exception 11" - * "INDEX_SIZE_ERR": DOM exception 1 - */ - _s._wD('setPosition('+position1K+'): setting position'); - try { - _t._a.currentTime = position1K; - if (_t.playState === 0 || _t.paused) { - // allow seek without auto-play/resume - _t._a.pause(); - } - } catch(e) { - _s._wD('setPosition('+position1K+'): setting position failed: '+e.message, 2); - } - } - } else { - _s._wD('setPosition('+position1K+'): delaying, sound not ready'); - } - - } - - if (_t.isHTML5) { - if (_t.paused) { - // if paused, refresh UI right away - // force update - _t._onTimer(true); - } - } - - return _t; - - }; - - /** - * Pauses sound playback. - * - * @return {SMSound} The SMSound object - */ - - this.pause = function(_bCallFlash) { - - if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) { - return _t; - } - - _s._wD('SMSound.pause()'); - _t.paused = true; - - if (!_t.isHTML5) { - if (_bCallFlash || _bCallFlash === undefined) { - _s.o._pause(_t.sID); - } - } else { - _t._setup_html5().pause(); - _stop_html5_timer(); - } - - if (_t._iO.onpause) { - _t._iO.onpause.apply(_t); - } - - return _t; - - }; - - /** - * Resumes sound playback. - * - * @return {SMSound} The SMSound object - */ - - /** - * When auto-loaded streams pause on buffer full they have a playState of 0. - * We need to make sure that the playState is set to 1 when these streams "resume". - * When a paused stream is resumed, we need to trigger the onplay() callback if it - * hasn't been called already. In this case since the sound is being played for the - * first time, I think it's more appropriate to call onplay() rather than onresume(). - */ - - this.resume = function() { - - if (!_t.paused) { - return _t; - } - - _s._wD('SMSound.resume()'); - _t.paused = false; - _t.playState = 1; - - if (!_t.isHTML5) { - if (_t._iO.isMovieStar) { - // Bizarre Webkit bug (Chrome reported via 8tracks.com dudes): AAC content paused for 30+ seconds(?) will not resume without a reposition. - _t.setPosition(_t.position); - } - // flash method is toggle-based (pause/resume) - _s.o._pause(_t.sID); - } else { - _t._setup_html5().play(); - _start_html5_timer(); - } - - if (!_t._onplay_called && _t._iO.onplay) { - _t._iO.onplay.apply(_t); - _t._onplay_called = true; - } else if (_t._iO.onresume) { - _t._iO.onresume.apply(_t); - } - - return _t; - - }; - - /** - * Toggles sound playback. - * - * @return {SMSound} The SMSound object - */ - - this.togglePause = function() { - - _s._wD('SMSound.togglePause()'); - - if (_t.playState === 0) { - _t.play({ - position: (_fV === 9 && !_t.isHTML5 ? _t.position : _t.position / 1000) - }); - return _t; - } - - if (_t.paused) { - _t.resume(); - } else { - _t.pause(); - } - - return _t; - - }; - - /** - * Sets the panning (L-R) effect. - * - * @param {number} nPan The pan value (-100 to 100) - * @return {SMSound} The SMSound object - */ - - this.setPan = function(nPan, bInstanceOnly) { - - if (typeof nPan === 'undefined') { - nPan = 0; - } - - if (typeof bInstanceOnly === 'undefined') { - bInstanceOnly = false; - } - - if (!_t.isHTML5) { - _s.o._setPan(_t.sID, nPan); - } // else { no HTML5 pan? } - - _t._iO.pan = nPan; - - if (!bInstanceOnly) { - _t.pan = nPan; - _t.options.pan = nPan; - } - - return _t; - - }; - - /** - * Sets the volume. - * - * @param {number} nVol The volume value (0 to 100) - * @return {SMSound} The SMSound object - */ - - this.setVolume = function(nVol, _bInstanceOnly) { - - if (typeof nVol === 'undefined') { - nVol = 100; - } - - if (typeof _bInstanceOnly === 'undefined') { - _bInstanceOnly = false; - } - - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); - } else if (_t._a) { - _t._a.volume = Math.max(0, Math.min(1, nVol/100)); // valid range: 0-1 - } - - _t._iO.volume = nVol; - - if (!_bInstanceOnly) { - _t.volume = nVol; - _t.options.volume = nVol; - } - - return _t; - - }; - - /** - * Mutes the sound. - * - * @return {SMSound} The SMSound object - */ - - this.mute = function() { - - _t.muted = true; - - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, 0); - } else if (_t._a) { - _t._a.muted = true; - } - - return _t; - - }; - - /** - * Unmutes the sound. - * - * @return {SMSound} The SMSound object - */ - - this.unmute = function() { - - _t.muted = false; - var hasIO = typeof _t._iO.volume !== 'undefined'; - - if (!_t.isHTML5) { - _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); - } else if (_t._a) { - _t._a.muted = false; - } - - return _t; - - }; - - /** - * Toggles the muted state of a sound. - * - * @return {SMSound} The SMSound object - */ - - this.toggleMute = function() { - - return (_t.muted?_t.unmute():_t.mute()); - - }; - - /** - * Calls the onposition() method of a SMSound object. - * - * @param {number} nPosition The position to watch for - * @param {function} oMethod The relevant callback to fire - * @param {object} oScope Optional: The scope to apply the callback to - * @return {SMSound} The SMSound object - */ - - this.onposition = function(nPosition, oMethod, oScope) { - - // TODO: allow for ranges, too? eg. (nPosition instanceof Array) - - _t._onPositionItems.push({ - position: nPosition, - method: oMethod, - scope: (typeof oScope !== 'undefined'?oScope:_t), - fired: false - }); - - return _t; - - }; - - /** - * TODO: This should be marked as pseudo-private. - */ - - this.processOnPosition = function() { - - var i, item, j = _t._onPositionItems.length; - - if (!j || !_t.playState || _t._onPositionFired >= j) { - return false; - } - - for (i=j; i--;) { - item = _t._onPositionItems[i]; - if (!item.fired && _t.position >= item.position) { - item.fired = true; - _s._onPositionFired++; - item.method.apply(item.scope,[item.position]); - } - } - - return true; - - }; - - this.resetOnPosition = function(nPosition) { - - // reset "fired" for items interested in this position - var i, item, j = _t._onPositionItems.length; - - if (!j) { - return false; - } - - for (i=j; i--;) { - item = _t._onPositionItems[i]; - if (item.fired && nPosition <= item.position) { - item.fired = false; - _s._onPositionFired--; - } - } - - return true; - - }; - - /** - * SoundManager() private internals - * -------------------------------- - */ - - _start_html5_timer = function() { - - if (_t.isHTML5) { - _startTimer(_t); - } - - }; - - _stop_html5_timer = function() { - - if (_t.isHTML5) { - _stopTimer(_t); - } - - }; - - _resetProperties = function() { - - _t._onPositionItems = []; - _t._onPositionFired = 0; - _t._hasTimer = null; - _t._onplay_called = false; - _t._a = null; - _t._html5_canplay = false; - _t.bytesLoaded = null; - _t.bytesTotal = null; - _t.position = null; - _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); - _t.durationEstimate = null; - _t.failures = 0; - _t.loaded = false; - _t.playState = 0; - _t.paused = false; - - // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success - _t.readyState = 0; - - _t.muted = false; - _t.isBuffering = false; - _t.instanceOptions = {}; - _t.instanceCount = 0; - - _t.peakData = { - left: 0, - right: 0 - }; - - _t.waveformData = { - left: [], - right: [] - }; - - // legacy: 1D array - _t.eqData = []; - - _t.eqData.left = []; - _t.eqData.right = []; - - }; - - _resetProperties(); - - /** - * Pseudo-private SMSound internals - * -------------------------------- - */ - - this._onTimer = function(bForce) { - - // HTML5-only _whileplaying() etc. - - var time, x = {}; - - if (_t._hasTimer || bForce) { - - // TODO: May not need to track readyState (1 = loading) - - if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { - - _t.duration = _t._get_html5_duration(); - _t.durationEstimate = _t.duration; - time = _t._a.currentTime?_t._a.currentTime*1000:0; - _t._whileplaying(time,x,x,x,x); - return true; - - } else { - - _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_t._a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK')); - return false; - - } - - } - - }; - - this._get_html5_duration = function() { - - var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)), - result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null)); - - return result; - - }; - - this._setup_html5 = function(oOptions) { - - var _iO = _mixin(_t._iO, oOptions), d = decodeURI, - _a = _useGlobalHTML5Audio ? _s._global_a : _t._a, - _dURL = d(_iO.url), - _oldIO = (_a && _a._t ? _a._t.instanceOptions : null); - - if (_a) { - - if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) { - // same url, ignore request - return _a; - } - - _s._wD('setting new URL on existing object: ' + _dURL + (_t._lastURL ? ', old URL: ' + _t._lastURL : '')); - - /** - * "First things first, I, Poppa.." (reset the previous state of the old sound, if playing) - * Fixes case with devices that can only play one sound at a time - * Otherwise, other sounds in mid-play will be terminated without warning and in a stuck state - */ - - if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) { - _a._t.stop(); - } - - // new URL, so reset load/playstate and so on - _resetProperties(); - - _a.src = _iO.url; - _t.url = _iO.url; - _t._lastURL = _iO.url; - _a._called_load = false; - - } else { - - _s._wD('creating HTML5 Audio() element with URL: '+_dURL); - _a = new Audio(_iO.url); - - _a._called_load = false; - - // android (seen in 2.3/Honeycomb) sometimes fails first .load() -> .play(), results in playback failure and ended() events? - if (_is_android) { - _a._called_load = true; - } - - if (_useGlobalHTML5Audio) { - _s._global_a = _a; - } - - } - _t.isHTML5 = true; - - // store a ref on the track - _t._a = _a; - - // store a ref on the audio - _a._t = _t; - - _t._add_html5_events(); - _a.loop = (_iO.loops>1?'loop':''); - - if (_iO.autoLoad || _iO.autoPlay) { - - // early HTML5 implementation (non-standard) - _a.autobuffer = 'auto'; - - // standard - _a.preload = 'auto'; - - _t.load(); - _a._called_load = true; - - } else { - - // early HTML5 implementation (non-standard) - _a.autobuffer = false; - - // standard - _a.preload = 'none'; - - } - - // boolean instead of "loop", for webkit? - spec says string. http://www.w3.org/TR/html-markup/audio.html#audio.attrs.loop - _a.loop = (_iO.loops>1?'loop':''); - - return _a; - - }; - - this._add_html5_events = function() { - - if (_t._a._added_events) { - return false; - } - - var f; - - function add(oEvt, oFn, bCapture) { - return _t._a ? _t._a.addEventListener(oEvt, oFn, bCapture||false) : null; - } - - _s._wD(_h5+'adding event listeners: '+_t.sID); - _t._a._added_events = true; - - for (f in _html5_events) { - if (_html5_events.hasOwnProperty(f)) { - add(f, _html5_events[f]); - } - } - - return true; - - }; - - this._remove_html5_events = function() { - - // Remove event listeners - - var f; - - function remove(oEvt, oFn, bCapture) { - return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null); - } - - _s._wD(_h5+'removing event listeners: '+_t.sID); - _t._a._added_events = false; - - for (f in _html5_events) { - if (_html5_events.hasOwnProperty(f)) { - remove(f, _html5_events[f]); - } - } - - }; - - /** - * Pseudo-private event internals - * ------------------------------ - */ - - this._onload = function(nSuccess) { - - - var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess); - _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2)); - // - - if (!loadOK && !_t.isHTML5) { - if (_s.sandbox.noRemote === true) { - _s._wD(fN + _str('noNet'), 1); - } - if (_s.sandbox.noLocal === true) { - _s._wD(fN + _str('noLocal'), 1); - } - } - // - - _t.loaded = loadOK; - _t.readyState = loadOK?3:2; - _t._onbufferchange(0); - - if (_t._iO.onload) { - _t._iO.onload.apply(_t, [loadOK]); - } - - return true; - - }; - - this._onbufferchange = function(nIsBuffering) { - - var fN = 'SMSound._onbufferchange()'; - - if (_t.playState === 0) { - // ignore if not playing - return false; - } - - if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) { - return false; - } - - _t.isBuffering = (nIsBuffering === 1); - if (_t._iO.onbufferchange) { - _s._wD(fN + ': ' + nIsBuffering); - _t._iO.onbufferchange.apply(_t); - } - - return true; - - }; - - /** - * Notify Mobile Safari that user action is required - * to continue playing / loading the audio file. - */ - - this._onsuspend = function () { - - if (_t._iO.onsuspend) { - _s._wD('SMSound._onsuspend()'); - _t._iO.onsuspend.apply(_t); - } - - return true; - - }; - - /** - * flash 9/movieStar + RTMP-only method, should fire only once at most - * at this point we just recreate failed sounds rather than trying to reconnect - */ - - this._onfailure = function(msg, level, code) { - - _t.failures++; - _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures); - - if (_t._iO.onfailure && _t.failures === 1) { - _t._iO.onfailure(_t, msg, level, code); - } else { - _s._wD('SMSound._onfailure(): ignoring'); - } - - }; - - this._onfinish = function() { - - // store local copy before it gets trashed.. - var _io_onfinish = _t._iO.onfinish; - _t._onbufferchange(0); - _t.resetOnPosition(0); - - // reset some state items - if (_t.instanceCount) { - - _t.instanceCount--; - if (!_t.instanceCount) { - // reset instance options - _t.playState = 0; - _t.paused = false; - _t.instanceCount = 0; - _t.instanceOptions = {}; - _t._iO = {}; - _stop_html5_timer(); - } - - if (!_t.instanceCount || _t._iO.multiShotEvents) { - // fire onfinish for last, or every instance - if (_io_onfinish) { - _s._wD('SMSound._onfinish(): "' + _t.sID + '"'); - _io_onfinish.apply(_t); - } - } - - } - - }; - - this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { - - _t.bytesLoaded = nBytesLoaded; - _t.bytesTotal = nBytesTotal; - _t.duration = Math.floor(nDuration); - _t.bufferLength = nBufferLength; - - if (!_t._iO.isMovieStar) { - - if (_t._iO.duration) { - // use options, if specified and larger - _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; - } else { - _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); - - } - - if (_t.durationEstimate === undefined) { - _t.durationEstimate = _t.duration; - } - - if (_t.readyState !== 3 && _t._iO.whileloading) { - _t._iO.whileloading.apply(_t); - } - - } else { - - _t.durationEstimate = _t.duration; - if (_t.readyState !== 3 && _t._iO.whileloading) { - _t._iO.whileloading.apply(_t); - } - - } - - }; - - this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { - - if (isNaN(nPosition) || nPosition === null) { - // flash safety net - return false; - } - - _t.position = nPosition; - _t.processOnPosition(); - - if (!_t.isHTML5 && _fV > 8) { - - if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { - _t.peakData = { - left: oPeakData.leftPeak, - right: oPeakData.rightPeak - }; - } - - if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { - _t.waveformData = { - left: oWaveformDataLeft.split(','), - right: oWaveformDataRight.split(',') - }; - } - - if (_t._iO.useEQData) { - if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { - var eqLeft = oEQData.leftEQ.split(','); - _t.eqData = eqLeft; - _t.eqData.left = eqLeft; - if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) { - _t.eqData.right = oEQData.rightEQ.split(','); - } - } - } - - } - - if (_t.playState === 1) { - - // special case/hack: ensure buffering is false if loading from cache (and not yet started) - if (!_t.isHTML5 && _fV === 8 && !_t.position && _t.isBuffering) { - _t._onbufferchange(0); - } - - if (_t._iO.whileplaying) { - // flash may call after actual finish - _t._iO.whileplaying.apply(_t); - } - - } - - return true; - - }; - - this._onid3 = function(oID3PropNames, oID3Data) { - - // oID3PropNames: string array (names) - // ID3Data: string array (data) - _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.'); - - var oData = [], i, j; - - for (i = 0, j = oID3PropNames.length; i < j; i++) { - oData[oID3PropNames[i]] = oID3Data[i]; - } - _t.id3 = _mixin(_t.id3, oData); - - if (_t._iO.onid3) { - _t._iO.onid3.apply(_t); - } - - }; - - // flash/RTMP-only - - this._onconnect = function(bSuccess) { - - var fN = 'SMSound._onconnect(): '; - bSuccess = (bSuccess === 1); - _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2)); - _t.connected = bSuccess; - - if (bSuccess) { - - _t.failures = 0; - - if (_idCheck(_t.sID)) { - if (_t.getAutoPlay()) { - // only update the play state if auto playing - _t.play(undefined, _t.getAutoPlay()); - } else if (_t._iO.autoLoad) { - _t.load(); - } - } - - if (_t._iO.onconnect) { - _t._iO.onconnect.apply(_t,[bSuccess]); - } - - } - - }; - - this._ondataerror = function(sError) { - - // flash 9 wave/eq data handler - // hack: called at start, and end from flash at/after onfinish() - if (_t.playState > 0) { - _s._wD('SMSound._ondataerror(): ' + sError); - if (_t._iO.ondataerror) { - _t._iO.ondataerror.apply(_t); - } - } - - }; - - }; // SMSound() - - /** - * Private SoundManager internals - * ------------------------------ - */ - - _getDocument = function() { - - return (_doc.body || _doc._docElement || _doc.getElementsByTagName('div')[0]); - - }; - - _id = function(sID) { - - return _doc.getElementById(sID); - - }; - - _mixin = function(oMain, oAdd) { - - // non-destructive merge - var o1 = {}, i, o2, o; - - // clone c1 - for (i in oMain) { - if (oMain.hasOwnProperty(i)) { - o1[i] = oMain[i]; - } - } - - o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd); - for (o in o2) { - if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') { - o1[o] = o2[o]; - } - } - return o1; - - }; - - _event = (function() { - - var old = (_win.attachEvent), - evt = { - add: (old?'attachEvent':'addEventListener'), - remove: (old?'detachEvent':'removeEventListener') - }; - - function getArgs(oArgs) { - - var args = _slice.call(oArgs), len = args.length; - - if (old) { - // prefix - args[1] = 'on' + args[1]; - if (len > 3) { - // no capture - args.pop(); - } - } else if (len === 3) { - args.push(false); - } - return args; - - } - - function apply(args, sType) { - - var element = args.shift(), - method = [evt[sType]]; - - if (old) { - element[method](args[0], args[1]); - } else { - element[method].apply(element, args); - } - - } - - function add() { - - apply(getArgs(arguments), 'add'); - - } - - function remove() { - - apply(getArgs(arguments), 'remove'); - - } - - return { - 'add': add, - 'remove': remove - }; - - }()); - - /** - * Internal HTML5 event handling - * ----------------------------- - */ - - function _html5_event(oFn) { - - // wrap html5 event handlers so we don't call them on destroyed sounds - - return function(e) { - - if (!this._t || !this._t._a) { - // - if (this._t && this._t.sID) { - _s._wD(_h5+'ignoring '+e.type+': '+this._t.sID); - } else { - _s._wD(_h5+'ignoring '+e.type); - } - // - return null; - } else { - return oFn.call(this, e); - } - - }; - - } - - _html5_events = { - - // HTML5 event-name-to-handler map - - abort: _html5_event(function(e) { - - _s._wD(_h5+'abort: '+this._t.sID); - - }), - - // enough has loaded to play - - canplay: _html5_event(function(e) { - - if (this._t._html5_canplay) { - // this event has already fired. ignore. - return true; - } - - this._t._html5_canplay = true; - _s._wD(_h5+'canplay: '+this._t.sID+', '+this._t.url); - this._t._onbufferchange(0); - var position1K = (!isNaN(this._t.position)?this._t.position/1000:null); - - // set the position if position was set before the sound loaded - if (this._t.position && this.currentTime !== position1K) { - _s._wD(_h5+'canplay: setting position to '+position1K); - try { - this.currentTime = position1K; - } catch(ee) { - _s._wD(_h5+'setting position failed: '+ee.message, 2); - } - } - - }), - - load: _html5_event(function(e) { - - if (!this._t.loaded) { - this._t._onbufferchange(0); - // should be 1, and the same - this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration()); - this._t._onload(true); - } - - }), - - emptied: _html5_event(function(e) { - - _s._wD(_h5+'emptied: '+this._t.sID); - - }), - - ended: _html5_event(function(e) { - - _s._wD(_h5+'ended: '+this._t.sID); - this._t._onfinish(); - - }), - - error: _html5_event(function(e) { - - _s._wD(_h5+'error: '+this.error.code); - // call load with error state? - this._t._onload(false); - - }), - - loadeddata: _html5_event(function(e) { - - var t = this._t, - // at least 1 byte, so math works - bytesTotal = t.bytesTotal || 1; - - _s._wD(_h5+'loadeddata: '+this._t.sID); - - // safari seems to nicely report progress events, eventually totalling 100% - if (!t._loaded && !_isSafari) { - t.duration = t._get_html5_duration(); - // fire whileloading() with 100% values - t._whileloading(bytesTotal, bytesTotal, t._get_html5_duration()); - t._onload(true); - } - - }), - - loadedmetadata: _html5_event(function(e) { - - _s._wD(_h5+'loadedmetadata: '+this._t.sID); - - }), - - loadstart: _html5_event(function(e) { - - _s._wD(_h5+'loadstart: '+this._t.sID); - // assume buffering at first - this._t._onbufferchange(1); - - }), - - play: _html5_event(function(e) { - - _s._wD(_h5+'play: '+this._t.sID+', '+this._t.url); - // once play starts, no buffering - this._t._onbufferchange(0); - - }), - - // TODO: verify if this is actually implemented anywhere yet. - playing: _html5_event(function(e) { - - _s._wD(_h5+'playing: '+this._t.sID+', '+this._t.url); - - // once play starts, no buffering - this._t._onbufferchange(0); - - }), - - progress: _html5_event(function(e) { - - if (this._t.loaded) { - return false; - } - - var i, j, str, buffered = 0, - isProgress = (e.type === 'progress'), - ranges = e.target.buffered, - - // firefox 3.6 implements e.loaded/total (bytes) - loaded = (e.loaded||0), - - total = (e.total||1); - - if (ranges && ranges.length) { - - // if loaded is 0, try TimeRanges implementation as % of load - // https://developer.mozilla.org/en/DOM/TimeRanges - - for (i=ranges.length; i--;) { - buffered = (ranges.end(i) - ranges.start(i)); - } - - // linear case, buffer sum; does not account for seeking and HTTP partials / byte ranges - loaded = buffered/e.target.duration; - - // - if (isProgress && ranges.length > 1) { - str = []; - j = ranges.length; - for (i=0; i - - } - - if (!isNaN(loaded)) { - - // if progress, likely not buffering - this._t._onbufferchange(0); - this._t._whileloading(loaded, total, this._t._get_html5_duration()); - if (loaded && total && loaded === total) { - // in case "onload" doesn't fire (eg. gecko 1.9.2) - _html5_events.load.call(this, e); - } - - } - - }), - - ratechange: _html5_event(function(e) { - - _s._wD(_h5+'ratechange: '+this._t.sID); - - }), - - suspend: _html5_event(function(e) { - - // download paused/stopped, may have finished (eg. onload) - - _s._wD(_h5+'suspend: '+this._t.sID); - _html5_events.progress.call(this, e); - this._t._onsuspend(); - - }), - - stalled: _html5_event(function(e) { - - _s._wD(_h5+'stalled: '+this._t.sID); - - }), - - timeupdate: _html5_event(function(e) { - - this._t._onTimer(); - - }), - - waiting: _html5_event(function(e) { - - // see also: seeking - _s._wD(_h5+'waiting: '+this._t.sID); - - // playback faster than download rate, etc. - this._t._onbufferchange(1); - - }) - - }; - - _html5OK = function(iO) { - - // Use type, if specified. If HTML5-only mode, no other options, so just give 'er - return (!iO.serverURL && (iO.type?_html5CanPlay({type:iO.type}):_html5CanPlay({url:iO.url})||_s.html5Only)); - - }; - - _html5Unload = function(oAudio) { - - /** - * Internal method: Unload media, and cancel any current/pending network requests. - * Firefox can load an empty URL, which allegedly destroys the decoder and stops the download. - * https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Stopping_the_download_of_media - * Other UA behaviour is unclear, so everyone else gets an about:blank-style URL. - */ - - if (oAudio) { - // Firefox likes '' for unload, most other UAs don't and fail to unload. - oAudio.src = (_is_firefox ? '' : _emptyURL); - } - - }; - - _html5CanPlay = function(o) { - - /** - * Try to find MIME, test and return truthiness - * o = { - * url: '/path/to/an.mp3', - * type: 'audio/mp3' - * } - */ - - if (!_s.useHTML5Audio || !_s.hasHTML5) { - return false; - } - - var url = (o.url || null), - mime = (o.type || null), - aF = _s.audioFormats, - result, - offset, - fileExt, - item; - - function preferFlashCheck(kind) { - - // whether flash should play a given type - return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind])); - - } - - // account for known cases like audio/mp3 - - if (mime && _s.html5[mime] !== 'undefined') { - return (_s.html5[mime] && !preferFlashCheck(mime)); - } - - if (!_html5Ext) { - _html5Ext = []; - for (item in aF) { - if (aF.hasOwnProperty(item)) { - _html5Ext.push(item); - if (aF[item].related) { - _html5Ext = _html5Ext.concat(aF[item].related); - } - } - } - _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')(\\?.*)?$','i'); - } - - // TODO: Strip URL queries, etc. - fileExt = (url ? url.toLowerCase().match(_html5Ext) : null); - - if (!fileExt || !fileExt.length) { - if (!mime) { - return false; - } else { - // audio/mp3 -> mp3, result should be known - offset = mime.indexOf(';'); - // strip "audio/X; codecs.." - fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6); - } - } else { - // match the raw extension name - "mp3", for example - fileExt = fileExt[1]; - } - - if (fileExt && typeof _s.html5[fileExt] !== 'undefined') { - // result known - return (_s.html5[fileExt] && !preferFlashCheck(fileExt)); - } else { - mime = 'audio/'+fileExt; - result = _s.html5.canPlayType({type:mime}); - _s.html5[fileExt] = result; - // _s._wD('canPlayType, found result: '+result); - return (result && _s.html5[mime] && !preferFlashCheck(mime)); - } - - }; - - _testHTML5 = function() { - - if (!_s.useHTML5Audio || typeof Audio === 'undefined') { - return false; - } - - // double-whammy: Opera 9.64 throws WRONG_ARGUMENTS_ERR if no parameter passed to Audio(), and Webkit + iOS happily tries to load "null" as a URL. :/ - var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null), - item, support = {}, aF, i; - - function _cp(m) { - - var canPlay, i, j, isOK = false; - - if (!a || typeof a.canPlayType !== 'function') { - return false; - } - - if (m instanceof Array) { - // iterate through all mime types, return any successes - for (i=0, j=m.length; i - notReady: 'Not loaded yet - wait for soundManager.onload()/onready()', - notOK: 'Audio support is not available.', - domError: _smc + 'createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.', - spcWmode: _smc + 'createMovie(): Removing wmode, preventing known SWF loading issue(s)', - swf404: _sm + ': Verify that %s is a valid path.', - tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)', - checkSWF: 'See SWF output for more debug info.', - localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/', - waitFocus: _sm + ': Special case: Waiting for focus-related event..', - waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...', - waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...', - needFunction: _sm + ': Function object expected for %s', - badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character', - currentObj: '--- ' + _sm + '._debug(): Current sound objects ---', - waitEI: _smc + 'initMovie(): Waiting for ExternalInterface call from Flash..', - waitOnload: _sm + ': Waiting for window.onload()', - docLoaded: _sm + ': Document already loaded', - onload: _smc + 'initComplete(): calling soundManager.onload()', - onloadOK: _sm + '.onload() complete', - init: _smc + 'init()', - didInit: _smc + 'init(): Already called?', - flashJS: _sm + ': Attempting to call Flash from JS..', - secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html', - badRemove: 'Warning: Failed to remove flash movie.', - noPeak: 'Warning: peakData features unsupported for movieStar formats', - shutdown: _sm + '.disable(): Shutting down', - queue: _sm + ': Queueing %s handler', - smFail: _sm + ': Failed to initialise.', - smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.', - fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..', - fbLoaded: 'Flash loaded', - fbHandler: _smc+'flashBlockHandler()', - manURL: 'SMSound.load(): Using manually-assigned URL', - onURL: _sm + '.load(): current URL already assigned.', - badFV: _sm + '.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.', - as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)', - noNSLoop: 'Note: Looping not implemented for MovieStar formats', - needfl9: 'Note: Switching to flash 9, required for MP4 formats.', - mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case', - mfOn: 'mobileFlash::enabling on-screen flash repositioning', - policy: 'Enabling usePolicyFile for data access' - // - - }; - - _str = function() { - - // internal string replace helper. - // arguments: o [,items to replace] - // - - // real array, please - var args = _slice.call(arguments), - - // first arg - o = args.shift(), - - str = (_strings && _strings[o]?_strings[o]:''), i, j; - if (str && args && args.length) { - for (i = 0, j = args.length; i < j; i++) { - str = str.replace('%s', args[i]); - } - } - - return str; - // - - }; - - _loopFix = function(sOpt) { - - // flash 8 requires stream = false for looping to work - if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) { - _wDS('as2loop'); - sOpt.stream = false; - } - - return sOpt; - - }; - - _policyFix = function(sOpt, sPre) { - - if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) { - _s._wD((sPre || '') + _str('policy')); - sOpt.usePolicyFile = true; - } - - return sOpt; - - }; - - _complain = function(sMsg) { - - // - if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') { - console.warn(sMsg); - } else { - _s._wD(sMsg); - } - // - - }; - - _doNothing = function() { - - return false; - - }; - - _disableObject = function(o) { - - var oProp; - - for (oProp in o) { - if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') { - o[oProp] = _doNothing; - } - } - - oProp = null; - - }; - - _failSafely = function(bNoDisable) { - - // general failure exception handler - - if (typeof bNoDisable === 'undefined') { - bNoDisable = false; - } - - if (_disabled || bNoDisable) { - _wDS('smFail', 2); - _s.disable(bNoDisable); - } - - }; - - _normalizeMovieURL = function(smURL) { - - var urlParams = null, url; - - if (smURL) { - if (smURL.match(/\.swf(\?.*)?$/i)) { - urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4); - if (urlParams) { - // assume user knows what they're doing - return smURL; - } - } else if (smURL.lastIndexOf('/') !== smURL.length - 1) { - // append trailing slash, if needed - smURL += '/'; - } - } - - url = (smURL && smURL.lastIndexOf('/') !== - 1 ? smURL.substr(0, smURL.lastIndexOf('/') + 1) : './') + _s.movieURL; - - if (_s.noSWFCache) { - url += ('?ts=' + new Date().getTime()); - } - - return url; - - }; - - _setVersionInfo = function() { - - // short-hand for internal use - - _fV = parseInt(_s.flashVersion, 10); - - if (_fV !== 8 && _fV !== 9) { - _s._wD(_str('badFV', _fV, _defaultFlashVersion)); - _s.flashVersion = _fV = _defaultFlashVersion; - } - - // debug flash movie, if applicable - - var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); - - if (_s.useHTML5Audio && !_s.html5Only && _s.audioFormats.mp4.required && _fV < 9) { - _s._wD(_str('needfl9')); - _s.flashVersion = _fV = 9; - } - - _s.version = _s.versionNumber + (_s.html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)')); - - // set up default options - if (_fV > 8) { - // +flash 9 base options - _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options); - _s.features.buffering = true; - // +moviestar support - _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions); - _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); - _s.features.movieStar = true; - } else { - _s.features.movieStar = false; - } - - // regExp for flash canPlay(), etc. - _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')]; - - // if applicable, use _debug versions of SWFs - _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug); - - _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8); - - }; - - _setPolling = function(bPolling, bHighPerformance) { - - if (!_s.o) { - return false; - } - - _s.o._setPolling(bPolling, bHighPerformance); - - }; - - _initDebug = function() { - - // starts debug mode, creating output
for UAs without console object - - // allow force of debug mode via URL - if (_s.debugURLParam.test(_wl)) { - _s.debugMode = true; - } - - // - if (_id(_s.debugID)) { - return false; - } - - var oD, oDebug, oTarget, oToggle, tmp; - - if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) { - - oD = _doc.createElement('div'); - oD.id = _s.debugID + '-toggle'; - - oToggle = { - 'position': 'fixed', - 'bottom': '0px', - 'right': '0px', - 'width': '1.2em', - 'height': '1.2em', - 'lineHeight': '1.2em', - 'margin': '2px', - 'textAlign': 'center', - 'border': '1px solid #999', - 'cursor': 'pointer', - 'background': '#fff', - 'color': '#333', - 'zIndex': 10001 - }; - - oD.appendChild(_doc.createTextNode('-')); - oD.onclick = _toggleDebug; - oD.title = 'Toggle SM2 debug console'; - - if (_ua.match(/msie 6/i)) { - oD.style.position = 'absolute'; - oD.style.cursor = 'hand'; - } - - for (tmp in oToggle) { - if (oToggle.hasOwnProperty(tmp)) { - oD.style[tmp] = oToggle[tmp]; - } - } - - oDebug = _doc.createElement('div'); - oDebug.id = _s.debugID; - oDebug.style.display = (_s.debugMode?'block':'none'); - - if (_s.debugMode && !_id(oD.id)) { - try { - oTarget = _getDocument(); - oTarget.appendChild(oD); - } catch(e2) { - throw new Error(_str('domError')+' \n'+e2.toString()); - } - oTarget.appendChild(oDebug); - } - - } - - oTarget = null; - // - - }; - - _idCheck = this.getSoundById; - - // - _wDS = function(o, errorLevel) { - - if (!o) { - return ''; - } else { - return _s._wD(_str(o), errorLevel); - } - - }; - - // last-resort debugging option - - if (_wl.indexOf('sm2-debug=alert') + 1 && _s.debugMode) { - _s._wD = function(sText) {window.alert(sText);}; - } - - _toggleDebug = function() { - - var o = _id(_s.debugID), - oT = _id(_s.debugID + '-toggle'); - - if (!o) { - return false; - } - - if (_debugOpen) { - // minimize - oT.innerHTML = '+'; - o.style.display = 'none'; - } else { - oT.innerHTML = '-'; - o.style.display = 'block'; - } - - _debugOpen = !_debugOpen; - - }; - - _debugTS = function(sEventType, bSuccess, sMessage) { - - // troubleshooter debug hooks - - if (typeof sm2Debugger !== 'undefined') { - try { - sm2Debugger.handleEvent(sEventType, bSuccess, sMessage); - } catch(e) { - // oh well - } - } - - return true; - - }; - // - - _getSWFCSS = function() { - - var css = []; - - if (_s.debugMode) { - css.push(_s.swfCSS.sm2Debug); - } - - if (_s.debugFlash) { - css.push(_s.swfCSS.flashDebug); - } - - if (_s.useHighPerformance) { - css.push(_s.swfCSS.highPerf); - } - - return css.join(' '); - - }; - - _flashBlockHandler = function() { - - // *possible* flash block situation. - - var name = _str('fbHandler'), - p = _s.getMoviePercent(), - css = _s.swfCSS, - error = {type:'FLASHBLOCK'}; - - if (_s.html5Only) { - return false; - } - - if (!_s.ok()) { - - if (_needsFlash) { - // make the movie more visible, so user can fix - _s.oMC.className = _getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError); - _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':'')); - } - - _s.didFlashBlock = true; - - // fire onready(), complain lightly - _processOnEvents({type:'ontimeout', ignoreInit:true, error:error}); - _catchError(error); - - } else { - - // SM2 loaded OK (or recovered) - - if (_s.didFlashBlock) { - _s._wD(name+': Unblocked'); - } - - if (_s.oMC) { - _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' '); - } - - } - - }; - - _addOnEvent = function(sType, oMethod, oScope) { - - if (typeof _on_queue[sType] === 'undefined') { - _on_queue[sType] = []; - } - - _on_queue[sType].push({ - 'method': oMethod, - 'scope': (oScope || null), - 'fired': false - }); - - }; - - _processOnEvents = function(oOptions) { - - // assume onready, if unspecified - - if (!oOptions) { - oOptions = { - type: 'onready' - }; - } - - if (!_didInit && oOptions && !oOptions.ignoreInit) { - // not ready yet. - return false; - } - - if (oOptions.type === 'ontimeout' && _s.ok()) { - // invalid case - return false; - } - - var status = { - success: (oOptions && oOptions.ignoreInit?_s.ok():!_disabled) - }, - - // queue specified by type, or none - srcQueue = (oOptions && oOptions.type?_on_queue[oOptions.type]||[]:[]), - - queue = [], i, j, - args = [status], - canRetry = (_needsFlash && _s.useFlashBlock && !_s.ok()); - - if (oOptions.error) { - args[0].error = oOptions.error; - } - - for (i = 0, j = srcQueue.length; i < j; i++) { - if (srcQueue[i].fired !== true) { - queue.push(srcQueue[i]); - } - } - - if (queue.length) { - _s._wD(_sm + ': Firing ' + queue.length + ' '+oOptions.type+'() item' + (queue.length === 1?'':'s')); - for (i = 0, j = queue.length; i < j; i++) { - if (queue[i].scope) { - queue[i].method.apply(queue[i].scope, args); - } else { - queue[i].method.apply(this, args); - } - if (!canRetry) { - // flashblock case doesn't count here - queue[i].fired = true; - } - } - } - - return true; - - }; - - _initUserOnload = function() { - - _win.setTimeout(function() { - - if (_s.useFlashBlock) { - _flashBlockHandler(); - } - - _processOnEvents(); - - // call user-defined "onload", scoped to window - - if (_s.onload instanceof Function) { - _wDS('onload', 1); - _s.onload.apply(_win); - _wDS('onloadOK', 1); - } - - if (_s.waitForWindowLoad) { - _event.add(_win, 'load', _initUserOnload); - } - - },1); - - }; - - _detectFlash = function() { - - // hat tip: Flash Detect library (BSD, (C) 2007) by Carl "DocYes" S. Yestrau - http://featureblend.com/javascript-flash-detection-library.html / http://featureblend.com/license.txt - - if (_hasFlash !== undefined) { - // this work has already been done. - return _hasFlash; - } - - var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = _win.ActiveXObject; - - if (nP && nP.length) { - type = 'application/x-shockwave-flash'; - types = n.mimeTypes; - if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) { - hasPlugin = true; - } - } else if (typeof AX !== 'undefined') { - try { - obj = new AX('ShockwaveFlash.ShockwaveFlash'); - } catch(e) { - // oh well - } - hasPlugin = (!!obj); - } - - _hasFlash = hasPlugin; - - return hasPlugin; - - }; - - _featureCheck = function() { - - var needsFlash, item, - - // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works. - isSpecial = (_is_iDevice && !!(_ua.match(/os (1|2|3_0|3_1)/i))); - - if (isSpecial) { - - // has Audio(), but is broken; let it load links directly. - _s.hasHTML5 = false; - - // ignore flash case, however - _s.html5Only = true; - - if (_s.oMC) { - _s.oMC.style.display = 'none'; - } - - return false; - - } - - if (_s.useHTML5Audio) { - - if (!_s.html5 || !_s.html5.canPlayType) { - _s._wD('SoundManager: No HTML5 Audio() support detected.'); - _s.hasHTML5 = false; - return true; - } else { - _s.hasHTML5 = true; - } - if (_isBadSafari) { - _s._wD(_smc+'Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - '+(!_hasFlash?' would use flash fallback for MP3/MP4, but none detected.':'will use flash fallback for MP3/MP4, if available'),1); - if (_detectFlash()) { - return true; - } - } - } else { - - // flash needed (or, HTML5 needs enabling.) - return true; - - } - - for (item in _s.audioFormats) { - if (_s.audioFormats.hasOwnProperty(item)) { - if ((_s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) || _s.flash[item] || _s.flash[_s.audioFormats[item].type]) { - // flash may be required, or preferred for this format - needsFlash = true; - } - } - } - - // sanity check.. - if (_s.ignoreFlash) { - needsFlash = false; - } - - _s.html5Only = (_s.hasHTML5 && _s.useHTML5Audio && !needsFlash); - - return (!_s.html5Only); - - }; - - _startTimer = function(oSound) { - - if (!oSound._hasTimer) { - oSound._hasTimer = true; - } - - }; - - _stopTimer = function(oSound) { - - if (oSound._hasTimer) { - oSound._hasTimer = false; - } - - }; - - _catchError = function(options) { - - options = (typeof options !== 'undefined' ? options : {}); - - if (_s.onerror instanceof Function) { - _s.onerror.apply(_win, [{type:(typeof options.type !== 'undefined' ? options.type : null)}]); - } - - if (typeof options.fatal !== 'undefined' && options.fatal) { - _s.disable(); - } - - }; - - _badSafariFix = function() { - - // special case: "bad" Safari (OS X 10.3 - 10.7) must fall back to flash for MP3/MP4 - if (!_isBadSafari || !_detectFlash()) { - // doesn't apply - return false; - } - - var aF = _s.audioFormats, i, item; - - for (item in aF) { - if (aF.hasOwnProperty(item)) { - if (item === 'mp3' || item === 'mp4') { - _s._wD(_sm+': Using flash fallback for '+item+' format'); - _s.html5[item] = false; - // assign result to related formats, too - if (aF[item] && aF[item].related) { - for (i = aF[item].related.length; i--;) { - _s.html5[aF[item].related[i]] = false; - } - } - } - } - } - - }; - - /** - * Pseudo-private flash/ExternalInterface methods - * ---------------------------------------------- - */ - - this._setSandboxType = function(sandboxType) { - - // - var sb = _s.sandbox; - - sb.type = sandboxType; - sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')]; - - _s._wD('Flash security sandbox type: ' + sb.type); - - if (sb.type === 'localWithFile') { - - sb.noRemote = true; - sb.noLocal = false; - _wDS('secNote', 2); - - } else if (sb.type === 'localWithNetwork') { - - sb.noRemote = false; - sb.noLocal = true; - - } else if (sb.type === 'localTrusted') { - - sb.noRemote = false; - sb.noLocal = false; - - } - // - - }; - - this._externalInterfaceOK = function(flashDate) { - - // flash callback confirming flash loaded, EI working etc. - // flashDate = approx. timing/delay info for JS/flash bridge - - if (_s.swfLoaded) { - return false; - } - - var eiTime = new Date().getTime(); - - _s._wD(_smc+'externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':'')); - _debugTS('swf', true); - _debugTS('flashtojs', true); - _s.swfLoaded = true; - _tryInitOnFocus = false; - - if (_isBadSafari) { - _badSafariFix(); - } - - if (_isIE) { - // IE needs a timeout OR delay until window.onload - may need TODO: investigating - setTimeout(_init, 100); - } else { - _init(); - } - - }; - - /** - * Private initialization helpers - * ------------------------------ - */ - - _createMovie = function(smID, smURL) { - - if (_didAppend && _appendSuccess) { - // ignore if already succeeded - return false; - } - - function _initMsg() { - _s._wD('-- SoundManager 2 ' + _s.version + (!_s.html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (!_s.html5Only ? (_s.useHighPerformance?', high performance mode, ':', ') + (( _s.flashPollingInterval ? 'custom (' + _s.flashPollingInterval + 'ms)' : 'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') : '') + ' --', 1); - } - - if (_s.html5Only) { - - // 100% HTML5 mode - _setVersionInfo(); - - _initMsg(); - _s.oMC = _id(_s.movieID); - _init(); - - // prevent multiple init attempts - _didAppend = true; - - _appendSuccess = true; - - return false; - - } - - // flash path - var remoteURL = (smURL || _s.url), - localURL = (_s.altURL || remoteURL), - swfTitle = 'JS/Flash audio component (SoundManager 2)', - oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), - s, x, sClass, side = 'auto', isRTL = null, - html = _doc.getElementsByTagName('html')[0]; - - isRTL = (html && html.dir && html.dir.match(/rtl/i)); - smID = (typeof smID === 'undefined'?_s.id:smID); - - function param(name, value) { - return ''; - } - - // safety check for legacy (change to Flash 9 URL) - _setVersionInfo(); - _s.url = _normalizeMovieURL(_overHTTP?remoteURL:localURL); - smURL = _s.url; - - _s.wmode = (!_s.wmode && _s.useHighPerformance ? 'transparent' : _s.wmode); - - if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) { - /** - * extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here - * does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout - * wmode breaks IE 8 on Vista + Win7 too in some cases, as of January 2011 (?) - */ - _s.specialWmodeCase = true; - _wDS('spcWmode'); - _s.wmode = null; - } - - oEmbed = { - 'name': smID, - 'id': smID, - 'src': smURL, - 'width': side, - 'height': side, - 'quality': 'high', - 'allowScriptAccess': _s.allowScriptAccess, - 'bgcolor': _s.bgColor, - 'pluginspage': _http+'www.macromedia.com/go/getflashplayer', - 'title': swfTitle, - 'type': 'application/x-shockwave-flash', - 'wmode': _s.wmode, - // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html - 'hasPriority': 'true' - }; - - if (_s.debugFlash) { - oEmbed.FlashVars = 'debug=1'; - } - - if (!_s.wmode) { - // don't write empty attribute - delete oEmbed.wmode; - } - - if (_isIE) { - - // IE is "special". - oMovie = _doc.createElement('div'); - movieHTML = [ - '', - param('movie', smURL), - param('AllowScriptAccess', _s.allowScriptAccess), - param('quality', oEmbed.quality), - (_s.wmode? param('wmode', _s.wmode): ''), - param('bgcolor', _s.bgColor), - param('hasPriority', 'true'), - (_s.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''), - '' - ].join(''); - - } else { - - oMovie = _doc.createElement('embed'); - for (tmp in oEmbed) { - if (oEmbed.hasOwnProperty(tmp)) { - oMovie.setAttribute(tmp, oEmbed[tmp]); - } - } - - } - - _initDebug(); - extraClass = _getSWFCSS(); - oTarget = _getDocument(); - - if (oTarget) { - - _s.oMC = (_id(_s.movieID) || _doc.createElement('div')); - - if (!_s.oMC.id) { - - _s.oMC.id = _s.movieID; - _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; - s = null; - oEl = null; - - if (!_s.useFlashBlock) { - if (_s.useHighPerformance) { - // on-screen at all times - s = { - 'position': 'fixed', - 'width': '8px', - 'height': '8px', - // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes. - 'bottom': '0px', - 'left': '0px', - 'overflow': 'hidden' - }; - } else { - // hide off-screen, lower priority - s = { - 'position': 'absolute', - 'width': '6px', - 'height': '6px', - 'top': '-9999px', - 'left': '-9999px' - }; - if (isRTL) { - s.left = Math.abs(parseInt(s.left,10))+'px'; - } - } - } - - if (_isWebkit) { - // soundcloud-reported render/crash fix, safari 5 - _s.oMC.style.zIndex = 10000; - } - - if (!_s.debugFlash) { - for (x in s) { - if (s.hasOwnProperty(x)) { - _s.oMC.style[x] = s[x]; - } - } - } - - try { - if (!_isIE) { - _s.oMC.appendChild(oMovie); - } - oTarget.appendChild(_s.oMC); - if (_isIE) { - oEl = _s.oMC.appendChild(_doc.createElement('div')); - oEl.className = _s.swfCSS.swfBox; - oEl.innerHTML = movieHTML; - } - _appendSuccess = true; - } catch(e) { - throw new Error(_str('domError')+' \n'+e.toString()); - } - - } else { - - // SM2 container is already in the document (eg. flashblock use case) - sClass = _s.oMC.className; - _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); - _s.oMC.appendChild(oMovie); - if (_isIE) { - oEl = _s.oMC.appendChild(_doc.createElement('div')); - oEl.className = _s.swfCSS.swfBox; - oEl.innerHTML = movieHTML; - } - _appendSuccess = true; - - } - - } - - _didAppend = true; - _initMsg(); - _s._wD(_smc+'createMovie(): Trying to load ' + smURL + (!_overHTTP && _s.altURL?' (alternate URL)':''), 1); - - return true; - - }; - - _initMovie = function() { - - if (_s.html5Only) { - _createMovie(); - return false; - } - - // attempt to get, or create, movie - // may already exist - if (_s.o) { - return false; - } - - // inline markup case - _s.o = _s.getMovie(_s.id); - - if (!_s.o) { - if (!_oRemoved) { - // try to create - _createMovie(_s.id, _s.url); - } else { - // try to re-append removed movie after reboot() - if (!_isIE) { - _s.oMC.appendChild(_oRemoved); - } else { - _s.oMC.innerHTML = _oRemovedHTML; - } - _oRemoved = null; - _didAppend = true; - } - _s.o = _s.getMovie(_s.id); - } - - // - if (_s.o) { - _wDS('waitEI'); - } - // - - if (_s.oninitmovie instanceof Function) { - setTimeout(_s.oninitmovie, 1); - } - - return true; - - }; - - _delayWaitForEI = function() { - - setTimeout(_waitForEI, 1000); - - }; - - _waitForEI = function() { - - if (_waitingForEI) { - return false; - } - - _waitingForEI = true; - _event.remove(_win, 'load', _delayWaitForEI); - - if (_tryInitOnFocus && !_isFocused) { - // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event - _wDS('waitFocus'); - return false; - } - - var p; - if (!_didInit) { - p = _s.getMoviePercent(); - _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':'')))); - } - - setTimeout(function() { - - p = _s.getMoviePercent(); - - // - if (!_didInit) { - _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2); - if (!_overHTTP && p) { - _wDS('localFail', 2); - if (!_s.debugFlash) { - _wDS('tryDebug', 2); - } - } - if (p === 0) { - // if 0 (not null), probably a 404. - _s._wD(_str('swf404', _s.url)); - } - _debugTS('flashtojs', false, ': Timed out' + _overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)'); - } - // - - // give up / time-out, depending - - if (!_didInit && _okToDisable) { - if (p === null) { - // SWF failed. Maybe blocked. - if (_s.useFlashBlock || _s.flashLoadTimeout === 0) { - if (_s.useFlashBlock) { - _flashBlockHandler(); - } - _wDS('waitForever'); - } else { - // old SM2 behaviour, simply fail - _failSafely(true); - } - } else { - // flash loaded? Shouldn't be a blocking issue, then. - if (_s.flashLoadTimeout === 0) { - _wDS('waitForever'); - } else { - _failSafely(true); - } - } - } - - }, _s.flashLoadTimeout); - - }; - - _handleFocus = function() { - - function cleanup() { - _event.remove(_win, 'focus', _handleFocus); - _event.remove(_win, 'load', _handleFocus); - } - - if (_isFocused || !_tryInitOnFocus) { - cleanup(); - return true; - } - - _okToDisable = true; - _isFocused = true; - _s._wD(_smc+'handleFocus()'); - - if (_isSafari && _tryInitOnFocus) { - _event.remove(_win, 'mousemove', _handleFocus); - } - - // allow init to restart - _waitingForEI = false; - - cleanup(); - return true; - - }; - - _showSupport = function() { - - var item, tests = []; - - if (_s.useHTML5Audio && _s.hasHTML5) { - for (item in _s.audioFormats) { - if (_s.audioFormats.hasOwnProperty(item)) { - tests.push(item + ': ' + _s.html5[item] + (!_s.html5[item] && _hasFlash && _s.flash[item] ? ' (using flash)' : (_s.preferFlash && _s.flash[item] && _hasFlash ? ' (preferring flash)': (!_s.html5[item] ? ' (' + (_s.audioFormats[item].required ? 'required, ':'') + 'and no flash support)' : '')))); - } - } - _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1); - } - - }; - - _initComplete = function(bNoDisable) { - - if (_didInit) { - return false; - } - - if (_s.html5Only) { - // all good. - _s._wD('-- SoundManager 2: loaded --'); - _didInit = true; - _initUserOnload(); - _debugTS('onload', true); - return true; - } - - var wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()), - error; - - if (!wasTimeout) { - _didInit = true; - if (_disabled) { - error = {type: (!_hasFlash && _needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')}; - } - } - - _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1); - - if (_disabled || bNoDisable) { - if (_s.useFlashBlock && _s.oMC) { - _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); - } - _processOnEvents({type:'ontimeout', error:error}); - _debugTS('onload', false); - _catchError(error); - return false; - } else { - _debugTS('onload', true); - } - - if (_s.waitForWindowLoad && !_windowLoaded) { - _wDS('waitOnload'); - _event.add(_win, 'load', _initUserOnload); - return false; - } else { - // - if (_s.waitForWindowLoad && _windowLoaded) { - _wDS('docLoaded'); - } - // - _initUserOnload(); - } - - return true; - - }; - - _init = function() { - - _wDS('init'); - - // called after onload() - - if (_didInit) { - _wDS('didInit'); - return false; - } - - function _cleanup() { - _event.remove(_win, 'load', _s.beginDelayedInit); - } - - if (_s.html5Only) { - if (!_didInit) { - // we don't need no steenking flash! - _cleanup(); - _s.enabled = true; - _initComplete(); - } - return true; - } - - // flash path - _initMovie(); - - try { - - _wDS('flashJS'); - - // attempt to talk to Flash - _s.o._externalInterfaceTest(false); - - // apply user-specified polling interval, OR, if "high performance" set, faster vs. default polling - // (determines frequency of whileloading/whileplaying callbacks, effectively driving UI framerates) - _setPolling(true, (_s.flashPollingInterval || (_s.useHighPerformance ? 10 : 50))); - - if (!_s.debugMode) { - // stop the SWF from making debug output calls to JS - _s.o._disableDebug(); - } - - _s.enabled = true; - _debugTS('jstoflash', true); - - if (!_s.html5Only) { - // prevent browser from showing cached page state (or rather, restoring "suspended" page state) via back button, because flash may be dead - // http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/ - _event.add(_win, 'unload', _doNothing); - } - - } catch(e) { - - _s._wD('js/flash exception: ' + e.toString()); - _debugTS('jstoflash', false); - _catchError({type:'JS_TO_FLASH_EXCEPTION', fatal:true}); - // don't disable, for reboot() - _failSafely(true); - _initComplete(); - - return false; - - } - - _initComplete(); - - // disconnect events - _cleanup(); - - return true; - - }; - - _domContentLoaded = function() { - - if (_didDCLoaded) { - return false; - } - - _didDCLoaded = true; - _initDebug(); - - /** - * Temporary feature: allow force of HTML5 via URL params: sm2-usehtml5audio=0 or 1 - * Ditto for sm2-preferFlash, too. - */ - // - (function(){ - - var a = 'sm2-usehtml5audio=', l = _wl.toLowerCase(), b = null, - a2 = 'sm2-preferflash=', b2 = null, hasCon = (typeof console !== 'undefined' && typeof console.log !== 'undefined'); - - if (l.indexOf(a) !== -1) { - b = (l.charAt(l.indexOf(a)+a.length) === '1'); - if (hasCon) { - console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter'); - } - _s.useHTML5Audio = b; - } - - if (l.indexOf(a2) !== -1) { - b2 = (l.charAt(l.indexOf(a2)+a2.length) === '1'); - if (hasCon) { - console.log((b2?'Enabling ':'Disabling ')+'preferFlash via URL parameter'); - } - _s.preferFlash = b2; - } - - }()); - // - - if (!_hasFlash && _s.hasHTML5) { - _s._wD('SoundManager: No Flash detected'+(!_s.useHTML5Audio?', enabling HTML5.':'. Trying HTML5-only mode.')); - _s.useHTML5Audio = true; - // make sure we aren't preferring flash, either - // TODO: preferFlash should not matter if flash is not installed. Currently, stuff breaks without the below tweak. - _s.preferFlash = false; - } - - _testHTML5(); - _s.html5.usingFlash = _featureCheck(); - _needsFlash = _s.html5.usingFlash; - _showSupport(); - - if (!_hasFlash && _needsFlash) { - _s._wD('SoundManager: Fatal error: Flash is needed to play some required formats, but is not available.'); - // TODO: Fatal here vs. timeout approach, etc. - // hack: fail sooner. - _s.flashLoadTimeout = 1; - } - - if (_doc.removeEventListener) { - _doc.removeEventListener('DOMContentLoaded', _domContentLoaded, false); - } - - _initMovie(); - return true; - - }; - - _domContentLoadedIE = function() { - - if (_doc.readyState === 'complete') { - _domContentLoaded(); - _doc.detachEvent('onreadystatechange', _domContentLoadedIE); - } - - return true; - - }; - - // sniff up-front - _detectFlash(); - - // focus and window load, init (primarily flash-driven) - _event.add(_win, 'focus', _handleFocus); - _event.add(_win, 'load', _handleFocus); - _event.add(_win, 'load', _delayWaitForEI); - - if (_isSafari && _tryInitOnFocus) { - // massive Safari 3.1 focus detection hack - _event.add(_win, 'mousemove', _handleFocus); - } - - if (_doc.addEventListener) { - - _doc.addEventListener('DOMContentLoaded', _domContentLoaded, false); - - } else if (_doc.attachEvent) { - - _doc.attachEvent('onreadystatechange', _domContentLoadedIE); - - } else { - - // no add/attachevent support - safe to assume no JS -> Flash either - _debugTS('onload', false); - _catchError({type:'NO_DOM2_EVENTS', fatal:true}); - - } - - if (_doc.readyState === 'complete') { - // DOMReady has already happened. - setTimeout(_domContentLoaded,100); - } - -} // SoundManager() - -// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading - -if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) { - soundManager = new SoundManager(); -} - -/** - * SoundManager public interfaces - * ------------------------------ - */ - -window.SoundManager = SoundManager; // constructor -window.soundManager = soundManager; // public API, flash callbacks etc. - -}(window)); \ No newline at end of file diff --git a/telemeta/static/timeside/js/markermap.js b/telemeta/static/timeside/js/markermap.js deleted file mode 100644 index ad3ae8c5..00000000 --- a/telemeta/static/timeside/js/markermap.js +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2007-2011 Parisson - * Copyright (c) 2011 Riccardo Zaccarelli - * - * This file is part of TimeSide. - * - * TimeSide is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * TimeSide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TimeSide. If not, see . - * - * Author: Riccardo Zaccarelli - */ - -/** - * class fior managing markers in the player. This class extends TimesideArray (see timeside.js), and communicates with the other - * two TimesideArrays of the player which receive edit events (click, keys events etcetera): the ruler (ruler.js) and the markermapdiv (divmarker.js) - * All bindings between these three classes are set in in the player (See player.js , in particular loadMarkers method) - */ -Timeside.classes.MarkerMap = Timeside.classes.TimesideArray.extend({ - - init: function() { - this._super(); - }, - - pFloat: parseFloat, //reference to function parseFloat for faster lookup - //overridden - add: function(newMarker) { - if(!('offset' in newMarker)){ - return -1; - } - - if(typeof newMarker.offset != 'number'){ //check to be sure: - newMarker.offset = this.pFloat(newMarker.offset); - } - if(!('id' in newMarker)){ - newMarker.id = this.$TU.uniqid(); //Timeside.utils.uniqid(); - } - if(!('isEditable' in newMarker)){ - newMarker.isEditable = false; - } - var marker = newMarker; - var idx = this.insertionIndex(marker); - if(idx>=0){ //it exists? there is a problem.... - this.debug('markermap.add: adding an already existing marker!!'); //should not happen. however... - return -1; - } - - idx = -idx-1; - //we do not call the super add cause we want to insert at a specified index - this._super(marker,idx); - //notifies controller.onMarkerMapAdd - - this.fire('add', { - marker: marker, - index: idx - }); - - return idx; - }, - - //overridden method. Contrarily to super method, - //where the first argument is the index (integer), here the - //the first argument can also be a marker. Its index will be found and, if valid, the super method will be called - //RETURNS -1 IF SOMETHING HAS GONE WRONG, OTHERWISE THE - remove: function(markerOrMarkerIndex) { - var idx = -1; - if(typeof markerOrMarkerIndex == 'number'){ - idx = markerOrMarkerIndex; - }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){ - idx = this.insertionIndex(markerOrMarkerIndex); - //idx>=0 ONLY if marker has been found - } - if(idx<0 || idx>=this.length){ - this.debug('markermap.remove: index out of bounds or marker not found'); - return -1; - } - var marker = this._super(idx); - this.fire('remove',{ - 'index':idx, - 'marker':marker - }); - return idx; - }, - - //overridden method. Contrarily to super method, - //where the first argument is the 'from' index, here the - //the first argument can also be a marker - move: function(markerOrMarkerIndex, newOffset){ - var oldIndex = -1; - if(typeof markerOrMarkerIndex == 'number'){ - oldIndex = markerOrMarkerIndex; - }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){ - oldIndex = this.insertionIndex(markerOrMarkerIndex); - //oldIndex>=0 ONLY if marker has been found - } - if(oldIndex<0 || oldIndex>=this.length){ - this.debug('markermap.move: index out of bounds or marker not found'); - return -1; - } - - var newIndex = this.insertionIndex(newOffset); - //select the case: - if(newIndex<0){ //newindex should ALWAYS be lower than zero, as insertionIndex(number) should not match any marker - //we didn't move the marker on another marker (newOffset does not correspond to any marker) - //just return the real insertionIndex - newIndex = -newIndex-1; - } - - //now: if the isnertionIndex is greater than the marker index (oldIndex), - //we decrement newIndex cause super.move will first REMOVE the marker and then set it at newIndex - if(newIndex > oldIndex){ - newIndex--; - } - newIndex = this._super(oldIndex,newIndex); - - if(newIndex <0){ - this.debug('markermap.move: new index out of bounds'); - return -1; - } - - var markers = this.toArray(); - var marker = markers[newIndex]; - var oldOffset = marker.offset; - marker.offset = newOffset; - this.fire('move', { - marker: marker, - fromIndex: oldIndex, - toIndex: newIndex, - oldOffset: oldOffset - }); - return newIndex; - }, - - - //returns the insertion index of object in this sorted array by means of a binary search algorithm. - // A) If object is a marker and: - // a1) Is found (ie, there is a marker in this map - // with same offset and same id), returns the index of the marker found, in the range [0, this.length-1]. Otherwise, if - // a2) Is not found, then returns -(insertionIndex-1), where insertionIndex is the - // index at which object would be inserted preserving the array order. Note that this assures that a - // number lower than zero means that object is not present in the array, and viceversa - // B) If object is a number or a string number (eg, "12.567"), then a marker with offset = object is built and compared - // against the markers in the map. Note however that in this case that equality between marker's offset is sufficient, - // as object is not provided with an id. THEREFORE, IF THE MAP CONTAINS SEVERAL MARKERS AT INDICES i, i+1, ... i+n - // WITH SAME OFFSET == object, THERE IS NO WAY TO DETERMINE WHICH INDEX IN [i, i+1, ... i+n] WILL BE RETURNED. - // See player.forward and player.rewind for an example of the B) case. - //LAST NOTE: BE SURE object is either a number (float) or object.offset is a number (float). - //In case it is not known, If it is a string number such as - //"4.562" the comparison falis (eg, "2.567" > "10.544") but obviously, no error is thrown in javascript - // - insertionIndex: function(object){ - //default comparator function: - //returns 1 as the first argument is greater than the second - //returns -1 as the first argument is lower than the second - //returns 0 if the arguments are equal - var comparatorFunction = function(markerInMap,newMarker){ - var a = markerInMap.offset; - var b = newMarker.offset; - if(ab){ - return 1; - }else{ - var a1 = markerInMap.id; - var b1 = newMarker.id; - if(a1b1){ - return 1; - } - } - return 0; - }; - if(!(typeof object == 'object')){ - var offset; - if(typeof object == 'number'){ - offset = object; - }else{ //to be sure... - offset = parseFloat(object); - } - object = { - 'offset':offset - }; - //key will never be found, so return either 1 or -1: - comparatorFunction = function(markerInMap,newMarker){ - var a = markerInMap.offset; - var b = newMarker.offset; - return a < b ? -1 : (a>b ? 1 : 0); - }; - } - - var data = this.toArray(); - var low = 0; - var high = data.length-1; - - while (low <= high) { - var mid = (low + high) >>> 1; - //biwise operation is not as fast as in compiled languages such as C and java (see Jslint web page) - //However (tested on a PC in Chrome, IE and FF), it is faster than the equivalent: - //var mid = parseInt((low + high)/2); - //even if we reference parseInt before this loop and we call the variable assigned to it - var midVal = data[mid]; - var cmp = comparatorFunction(midVal,object); - if (cmp < 0){ - //the midvalue is lower than the searched index element - low = mid + 1; - }else if (cmp > 0){ - //the midvalue is greater than the searched index element - high = mid - 1; - }else{ - return mid; // key found - } - } - return -(low + 1); // key not found - }, - - //sets isEditable to value - setEditable: function(markerOrMarkerIndex, value) { - var idx = -1; - if(typeof markerOrMarkerIndex == 'number'){ - idx = markerOrMarkerIndex; - }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){ - idx = this.insertionIndex(markerOrMarkerIndex); - //idx>=0 ONLY if marker has been found - } - if(idx<0 || idx>=this.length){ - this.debug('markermap.setEditable: index out of bounds or marker not found'); - return -1; - } - var marker = this.toArray()[idx]; - var oldVal = marker.isEditable ? true : false; - marker.isEditable = value; - this.fire('markerEditStateChanged',{ - 'index':idx, - 'marker':marker, - 'oldValue':oldVal, - 'value':value - }); - return idx; - } - -} -); \ No newline at end of file diff --git a/telemeta/static/timeside/js/player.js b/telemeta/static/timeside/js/player.js deleted file mode 100644 index 4b6a1a0e..00000000 --- a/telemeta/static/timeside/js/player.js +++ /dev/null @@ -1,1066 +0,0 @@ -/* - * Copyright (C) 2007-2011 Parisson - * Copyright (c) 2011 Riccardo Zaccarelli - * Copyright (c) 2010 Olivier Guilyardi - * - * This file is part of TimeSide. - * - * TimeSide is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * TimeSide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TimeSide. If not, see . - * - * Authors: Riccardo Zaccarelli - * Olivier Guilyardi - */ - -/** - * The player class to instantiate a new player. Requires all necessary js (timeside, ruler, markermap etcetera...) and - * jQuery - */ - -//playerDiv, sound, durationInMsec, visualizers, markerMap); -Timeside.classes.Player = Timeside.classes.TimesideClass.extend({ - - //sound duration is in milliseconds because the soundmanager has that unit, - //player (according to timeside syntax) has durations in seconds - // newMarkerCallback must be either a string or a function, the necessary checks is done in Timeside.load - // (which calls this method) - //if markersArray is not an array, it defaults to [] - init: function(configObject) { - this._super(); - var $J = this.$J; - var me=this; - - var msgs = configObject.messages; - if(msgs){ - for(var k in msgs){ - if(msgs.hasOwnProperty(k)){ - var ms = msgs[k]; - if(typeof ms === 'string'){ - this.msgs[k] = ms; - } - } - } - } - - var onError = configObject.onError; - if(typeof onError !== 'function'){ - onError = function(msg){}; - } - - var onReady = configObject.onReady; - if(typeof onReady !== 'function'){ - onReady = function(player){}; - } - - var onReadyWithImage = configObject.onReadyWithImage; - - if(typeof onReadyWithImage === 'function'){ - var onReadyWithImageNamespace = 'imgRefreshed.temp_'+new Date().getTime(); //get an unique namespace - this.bind(onReadyWithImageNamespace,function(data){ - onReadyWithImage(me); - me.unbind(onReadyWithImageNamespace); - }); - } - - var container = configObject.container; - container = container instanceof $J ? container : $J(container); - container = container.length ? container.eq(0) : undefined; - if (!container || !container.length){ - onError('container not defined or invalid'); - return; - } - - var sMan = soundManager; - var sound = configObject.sound; - var createSound = false; - if(this.$TU.flashFailed){ - this.soundErrorMsg = 'soundManager error. If your browser does not support HTML5, Flash player (version '+sMan.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser'; - }else{ - if(typeof sound !== 'string' && typeof sound !== 'object'){ - this.soundErrorMsg ='bad sound parameter: specify a a valid soundManager sound-object, an object with at least two properties, url and id, or URL as string'; - }else if(typeof sound === 'string'){ - createSound = true; - var soundURL = sound; - sound = { - id: 'ts-sound', - autoLoad: false, - url: soundURL, - multiShot: false - }; - //do a raw check to see if it is a soundmanager object - }else if(!sound.hasWonProperty('sID') || !sound.hasWonProperty('_iO') || !sound.hasWonProperty('url')){ - if(!sound.hasWonProperty('url') || !sound.hasWonProperty('id')){ //it is not a soundManager object, has at least an url??? - this.soundErrorMsg = 'bad sound parameter: object requires properties url and id at minimum'; - }else{ - createSound = true; - } - } - if(createSound){ - var soundOptions = sound; - if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there - //check if we specified a valid sound duration, otherwise the sound must be loaded - - sound = sMan.createSound(soundOptions); - }else{ - this.soundErrorMsg = 'bad sound parameter (soundManager.canPlayURL returned false)'; - } - } - } - if(this.soundErrorMsg){ - this.getSound = function(){ - return undefined; - }; - }else{ - // sound.play = function(){ - // alert(this.readyState); - // }; - this.getSound = function(){ - return sound; - }; - } - var soundDurationInMsec = configObject.soundDuration; - if(typeof soundDurationInMsec !== 'number' || soundDurationInMsec<=0){ - onError('invalid soundDurationInMsec: NaN or not positive'); - return; - } - - - var soundImgFcn = configObject.soundImage; - - if(!(typeof soundImgFcn === 'string' || typeof soundImgFcn === 'function')){ - onError('invalid sound soundImgFcn. Provide a callback(width,height) or a string denoting a valid URL'); - return; - }else{ - if(typeof soundImgFcn === 'string'){ - var url = soundImgFcn; - this.imageCallback = new function(w,h){ - return url; - }; - }else{ //surely a function - this.imageCallback = soundImgFcn; - } - } - - var soundImgSize = configObject.imageSize; - var markersArray = configObject.markersArray; - var newMarker = configObject.newMarker; - - - - this.playState = 0; //0: not playing, 1: loading, 2:buffering, 3 playing (sound heard) - //container is the div #player - - this.getContainer = function(){ - return container; - }; - - - - var sd = this.toSec(soundDurationInMsec); - this.getSoundDuration = function(){ - return sd; - }; - - this.soundPosition = sound.position ? this.toSec(sound.position) : 0; - - - - // - - //initializing markermap and markerui - var map = new Timeside.classes.MarkerMap(); - this.getMarkerMap = function(){ - return map; - }; - - var canAddMarkers = false; - if(newMarker === true || (typeof newMarker === 'function')){ - canAddMarkers = true; - if(typeof newMarker === 'function'){ - this.newMarker = newMarker; - } - } - - //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers. - //Note that the player image (see below) is not created now, however, if it was, it should be given a src - //as NOT specifying any src for image tags can be harmful, - //see http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/ and - //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx for details - var html = [ - "
", - "
", - "
", - "
", - //lazily created: "", //not providing a src attribute is harmful. Dummy src attribute - "
", - "
", - "
", - "", - "", - "", - "", - "", - "", - "
", - "", - "", - "", - "
", - "
", - "
"]; - - container.html(html.join('')); - - var control = container.find('.ts-control'); - - //bind events to buttons: - var rewind = control.find('.ts-rewind'); - rewind.attr('href', '#').click(function(e){ - me.rewind.apply(me); - return false; - }); - - var forward = control.find('.ts-forward'); - forward.attr('href', '#').click(function(e){ - me.forward.apply(me); - return false; - }); - - var pause = control.find('.ts-pause'); - pause.attr('href', '#').bind('click', function(){ - me.pause.apply(me); - return false; - }); - - var play = control.find('.ts-play'); - play.attr('href', '#').bind('click', function(){ - me.play.apply(me); - return false; - }); - - var setMarkerButton = control.find('.ts-set-marker'); - - if(canAddMarkers){ - setMarkerButton.show().attr('href','#').unbind('click').bind('click', function(){ - me.addMarker(me.soundPosition); - return false; - }); - }else{ - setMarkerButton.hide().unbind('click'); - } - - - //volume: - var volumeSpeaker = control.find('.ts-volume-speaker'); - var volumeBarContainer = control.find('.ts-volume-bar-container'); - var volumeBar = volumeBarContainer.find('.ts-volume-bar'); - - var getVol = function(x){ - var vol = 100*x/volumeBarContainer.width(); - //allow click to easily set to zero or 100, ie set a margin to 5%: - var margin = 5; - if (vol < margin){ - vol=0; - }else if(vol >100-margin){ - vol = 100; - } - return vol; - }; - function setVolume(event,volumeElement){ - var x = event.pageX - volumeElement.offset().left; //using absolute coordinates allows us to - //avoid using layerX (not supported in all browsers) and clientX (which needs the window scrollLeft variable) - me.setSoundVolume(getVol(x)); - return false; - } - volumeBarContainer.attr('href', '#').click(function(event){ - return setVolume(event,volumeBar); - }); - volumeSpeaker.attr('href', '#').click(function(){ - me.setSoundVolume(me.getSoundVolume()>0 ? 0 : getVol(volumeBar.outerWidth())); - return false; - }); - this.setSoundVolume(this.getSoundVolume()); - - control.find('a').attr('href', '#') ; - - //SET NECESSARY CSS (THIS WILL OVERRIDE CSS SET IN STYLESHEETS): - //var viewer = container.find('.ts-viewer'); - var wave = container.find('.ts-wave'); - var ruler_ = container.find('.ts-ruler'); - wave.add(control).add(ruler_).css({ - 'position':'relative', - 'overflow':'hidden' - }); - //assigning display and title to all anchors - var subcontrolsToBeSetVisible = control.find('*'); - if(!canAddMarkers){ - subcontrolsToBeSetVisible = subcontrolsToBeSetVisible.filter(':not(a.ts-set-marker)'); - } - subcontrolsToBeSetVisible.css({ - 'display':'inline-block', - 'overflow':'hidden' - }); - - var waitImg = control.find('.ts-wait'); - waitImg.html('wait').css({ - 'position':'absolute' - }); - - var div = control.find('.ts-volume-wrapper-div'); - div.css({ - 'position':'absolute', - 'left':(volumeSpeaker.position().left+volumeSpeaker.outerWidth(true))+'px', - 'top':0, - 'width':'auto', - 'height':'100%' - }); - //END NECESSARY CSS - - //creating the ruler - var waveImage = container.find('.ts-image-canvas'); - var ruler = new Timeside.classes.Ruler(ruler_, waveImage, this.getSoundDuration()); - //var ruler = new Timeside.classes.Ruler(viewer, this.getSoundDuration()); - this.getRuler = function(){ - return ruler; - }; - //bind mouse events: - ruler.bind('rulermarkermouseevent', function(data){ - var idx = data.index; - data.marker = idx > -1 ? me.getMarker(idx) : undefined; - me.fire('markerMouseEvent',data); - }); - - //setting image size (if provided) and resize player. Note that _setImageSize (with underscore) is intended to be - //a private method (faster). setImageSize (without underscore) is the public method to use outside of player object - if(soundImgSize){ - this._setImageSize(soundImgSize.width,soundImgSize.height,container, wave,true); //calls this.resize which calls ruler.resize - }else{ - this._setImageSize('','',container, wave,true); //calls this.resize which calls ruler.resize - } - - //binds click for the pointer: - var v = wave; //.add(ruler); - v.unbind('click').click(function(evt){ - var w = v.width(); - var x = evt.pageX - v.offset().left; //using absolute coordinates allows us to - //avoid checking whether or not we are clicking on a vertical marker line, on a subdiv etcetera - var sd = me.getSoundDuration(); - me.setSoundPosition(sd*x/w); - }); - - - - //finally, load markers and bind events for markers (see method below): - //NOTE: loadMarkers ASYNCHRONOUSLY CALLS THE SERVER, SO METHODS WRITTEN AFTER IT MIGHT BE EXECUTED BEFORE - //loadMarkers has finished its job - //this.loadMarkers(callback); - if(!(markersArray) || !(markersArray.length)){ - markersArray = []; - } - this.loadMarkers(markersArray); - - - //IE7 BUG: the divs wave and control do not shift downwards after canvas is drawn and covers part of the rulrer. - //Weird enough (with IE it isn't actually), we have just to set the property we already set in the css: - //ie, top: auto. This is however useful even if somebody specified a top property on the divs - ruler_.add(wave).add(control).css('top','auto'); - onReady(this); - }, - - - - //functions for converting seconds (player unit) to milliseconds (sound manager unit) and viceversa: - toSec: function(milliseconds){ - return milliseconds/1000; - }, - toMsec : function(seconds){ //this function has less performances than toSec, as it calls Math.round - return Math.round(1000*seconds); //however, it is assumed that it is NOT called in loops - }, - isPlaying : function(){ - var sound = this.getSound(); - if(!sound){ - return false; - } - return this.playState; - /*Numeric value indicating the current playing state of the sound. - * 0 = stopped/uninitialised - * 1 = playing or buffering sound (play has been called, waiting for data etc.) - *Note that a 1 may not always guarantee that sound is being heard, given buffering and autoPlay status.*/ - //return sound && sound.playState==1; - }, - setSoundPosition: function(newPositionInSeconds){ - //if the player is playing and NOT yet fully loaded, simply calling: - //this.getSound().setPosition(this.toMsec(newPositionInSeconds)); - //resets the position to zero. So we use this workaround: - // this.getSound().stop(); //calling this.pause() hides the waiting bar, which is not the case here - // this.soundPosition = newPositionInSeconds; - // this.play(); - //however, that causes fast pointer move effect is undesiderable - //So: - var wasPlaying = this.isPlaying(); - if(wasPlaying){ - this.getSound().stop(); //dont call this.pause cause it hides the waitbar, if visible and resets the playState - } - //update pointer position. If this call is due to a pointer move (mouse release), - //ruler.isPointerMovingFromMouse=true and the following code has no effect (the pointer is already at the good position) - var ruler = this.getRuler(); - if(ruler){ - ruler.movePointer(newPositionInSeconds); - } - //set sound position: - var oldSoundPosition = this.soundPosition; - this.soundPosition = newPositionInSeconds; - - //resume playing if it was playing: - if(wasPlaying){ - var player = this; - - //delay a little bit the play resume, this might avoid fast pointer repositioning - //(it should not be the case, but it happens. why??) - setTimeout(function(){ - player.play.apply(player); - },100); - } - this.fire('soundPositionSet',{ - player:this, - oldSoundPosition:oldSoundPosition - }); - - }, - showSoundErroMessage: function(){ - alert(this.soundErrorMsg); - }, - //given a marker at index I, specifies that a marker corss event is fired whenever the sound position (pointer) - //is in the interval ]markerCrossedOffsetMargin-I,I+markerCrossedOffsetMargin[ - //the value is in seconds - //markerCrossedOffsetMargin : 0.5, - play : function(){ - - if(this.soundErrorMsg){ - alert(this.soundErrorMsg); - return false; - } - - var player = this; - var sound = player.getSound(); - - if(!player || !sound){ //just check. The cases here (especially, sound = undefined, should be - //together with this.soundErrorMsg != "", so we should have catch the case above - return false; - } - - - var fireOnMarkerPosition = function(seconds){}; //does nothing by default - var map = player.getMarkerMap(); - var markerCrossListeners = player.listenersMap['markerCrossed']; - //optimizing: if no listeners associated to markerCrossListeners, avoid creating a function - if(map && map.length && markerCrossListeners){ - var idx = 0; - if(player.soundPosition>0){ - idx = map.insertionIndex(player.soundPosition); - if(idx<0){ - idx=-idx-1; - } - } - var len = map.length; - if(idx>-1 && idx < len){ - var markers = map.toArray(); - var marker = markers[idx]; - var margin = 0.5; //1 second (0.5*2) of margin (before+after) - var offs = marker.offset; - var intervalUpperBound = offs+margin; - var intervalLowerBound = offs-margin; - var data = { //if you change data, change it also below - index:idx, - marker:marker, - currentSoundPosition: player.soundPosition, - nextMarkerTimeInterval: undefined - }; - fireOnMarkerPosition = function(seconds){ - if(marker){ - if(seconds>intervalLowerBound && seconds < intervalUpperBound){ - idx++; - marker = idx < len ? markers[idx] : undefined; - offs = marker ? marker.offset : undefined; - data.currentSoundPosition = seconds; - data.nextMarkerTimeInterval = marker ? [offs-margin, offs+margin] : undefined; - player.fire('markerCrossed',data); - - if(idx= this.getSoundDuration()){ - playOptions.onfinish(); - }else{ - sound.setVolume(sound.volume); //workaround. Just to be sure. Sometimes it fails when we re-play - sound.play(playOptions); - // soundManager.play(sound.sId,{ - // onload: function(success){ - // alert(success); - // } - // }); - } - - return false; - }, - - msgs : { - loading : 'loading', - buffering: 'buffering', - imgRefreshing : 'refreshing img' - }, - pause: function(){ - var sound = this.getSound(); - //we don't check if it's playing, as the stop must really stop anyway - //if(sound && this.isPlaying()){ - if(sound){ - var v = this.isPlaying(); - sound.stop(); - var data = { - player:this, - oldPlayState:this.playState, - endOfPlayback:false - }; - this.playState = 0; - this.fire('playStateChanged',data); - this.setWait(this.isImgRefreshing ? this.msgs.imgRefreshing : ''); - } - return false; - }, - - getWaitElement: function(){ - return this.getContainer().find('.ts-control').find('.ts-wait'); - }, - - setWait: function(msg){ - var wait = undefined; - - wait = this.getWaitElement(); - if(!wait || msg === undefined){ - return; - } - if(wait.html()!=msg){ - wait.html(msg); - } - - var visible = wait.css('display') != 'none'; - - if(msg && !visible){ - wait.show(); - this.fire('waitShown'); - }else if(!msg && visible){ - wait.hide(); - this.fire('waitHidden'); - } - }, - - /** - * sets whether or not window resize resizes also this player. When true, a variable _dynamicResize =setInterval(...) is attached to - * this class. When false, if _dynamicResize is in this class, clearInterval(_dynamicResize) is called and then the key is deleted - */ - setDynamicResize: function(value){ - var key = '_dynamicResize'; - if(!value && key in this){ - clearInterval(this[key]); - delete this[key]; - return; - } - var wdw = this.$J(window); - var w = wdw.width(); - //var h = wdw.height(); - var me = this; - this.dynamicResize = setInterval(function(){ - var newW = wdw.width(); - if(w!=newW){ - w = newW; - //still wait a second: are we still adjusting the window? (call resize just once): - setTimeout(function(){ - if(wdw.width()==newW){ - me.resize.apply(me); - } - },200); - } - },100); - }, - - resize: function() { - var height; - var container = this.getContainer(); - - var wave = container.find('.ts-wave'); - - height = wave.height(); - // if(!height){ - // height = this.minWaveHeight; - // wave.css('height',height+'px'); - // } - //if (height) { - //set image, imagecontainer and canvas (container on imagecontainer for lines and pointer triangles) css - var elements = wave.find('.ts-image-container').css('zIndex','0') - .add(wave.find('.ts-image-canvas').css('zIndex','1')); //the two children of ts-wave. Set also the zIndex - //in order to visualize the canvas OVER the wav image - var style = { - width: wave.width(), - height: height, - border: 0, - padding:0, - margin:0, - top:0, - left:0 - }; - elements.css(style); - elements.css('position','absolute'); - //} - - //refreshing images: - this.refreshImage(); - this.getRuler().resize(); - }, - getImageUrl : function(){ - var image = this.getContainer().find('.ts-image'); - if(image && image.length){ - return image.attr('src'); - } - return ''; - }, - refreshImage: function(){ - var container = this.getContainer(); - var imageC = container.find('.ts-image-container'); - var image = imageC.find('.ts-image'); - - - var size = this.getImageSize(); - - if(!size.width || !size.height){ - return; - } - var imgSrc = this.imageCallback(size.width,size.height); - var imageNotYetCreated = image.length == 0; - if(!imageNotYetCreated && image.attr('src')==imgSrc){ - return; - } - - var player= this; - - if(imageNotYetCreated){ - image = this.$J(''); - } - - //image inside ts-image-container: - image.css({ - 'width':'100%', - 'height':'100%' - }); // for IE7. Does not seem to hurt IE8, FF, Chrome - - var updateWait = function(){}; - var ir = player.msgs.imgRefreshing; - var we = player.getWaitElement(); - if(ir && we){ - updateWait = function(){ - if(!player.playState || player.playState==3){ - player.setWait(''); - } - } - } - image.load(function(){ - image.unbind('load'); - if(imageNotYetCreated){ - imageC.append(image.addClass('ts-image')); - } - updateWait(); - player.isImgRefreshing = false; - player.fire('imgRefreshed'); - }); - if(ir && we && (!this.playState || this.playState===3)){ //if loading (1) or buffering (2) do not update wait. - //If not playing (undefined or 0) playing (3) update wait - this.setWait(ir); - } - this.isImgRefreshing = true; - this.fire('imgRefreshing'); - image.attr('src', imgSrc); - - }, - getImageSize: function(){ - var wave = this.getContainer().find('.ts-wave'); - return { - width: wave.width(), - height:wave.height() - } - }, - - setImageSize: function(width,height){ - var container = this.getContainer(); - var wave = container.find('.ts-wave'); - this._setImageSize(width,height,container, wave,true); - }, - //this is intended to be a private method, use setImageSize from outside the player object) - _setImageSize: function(width,height,jQueryContainerElement, jQueryWaveElement, resize){ - if(width || height){ - var re = /(?:px|ex|em|%)$/; - if(width){ - width+=''; - width = re.exec(width) ? width : width+'px'; - jQueryContainerElement.css('width',width); - } - if(height){ - height+=''; - height = re.exec(height) ? height : height+'px'; - jQueryWaveElement.css('height',height); - } - } - if(resize){ - this.resize(); - } - }, - - getSoundVolume :function(){ - var s = this.getSound(); - return s ? s.volume : 0; - }, - //moves the pointer (and sound position) forward till the next marker or the end of sound - forward: function() { - var map = this.getMarkerMap(); - var markers = map.toArray(); - var len = markers.length; - var offset = this.getSoundDuration(); - var position = this.soundPosition; //parseFloat(this.getSoundPosition()); - var idx = map.insertionIndex(position); - if(idx<0){ - idx = -idx-1; //cursor is not on a a marker, get the insertion index - }else{ - //cursor is on a marker. As there might be several markers with the same offset - //(see MarkerMap.insertionIndex), move to the outmost right - while(idx0 && markers[idx-1].offset == position){ - idx--; - } - } - idx--; //move backward (rewind) - if(idx>=0){ - offset = markers[idx].offset; - } - this.setSoundPosition(offset); - return false; - }, - - setSoundVolume: function(volume){ - if(typeof volume != 'number'){ //note: typeof for primitive values, instanceof for the rest - //see topic http://stackoverflow.com/questions/472418/why-is-4-not-an-instance-of-number - volume = 100; - } - if(volume<0){ - volume = 0; - }else if(volume>100){ - volume = 100; - } - volume = Math.round(volume); - var sound = this.getSound(); - if(sound){ - sound.setVolume(volume); - } - var control = this.getContainer().find('.ts-control'); - var volumeSpeaker = control.find('.ts-volume-speaker'); - var volumeBarContainer = control.find('.ts-volume-bar-container'); - var volumeBar = volumeBarContainer.find('.ts-volume-bar'); - if(volume==0){ - volumeSpeaker.removeClass('ts-volume-speaker-on').addClass('ts-volume-speaker-off'); - volumeBar.css('visibility','hidden'); - }else{ - volumeSpeaker.removeClass('ts-volume-speaker-off').addClass('ts-volume-speaker-on'); - volumeBar.css('visibility','visible'); - volumeBar.css({ - 'height':'100%', - 'width':volume+'%' - }); - } - }, - - each: function(){ - var map = this.getMarkerMap(); - if(map){ - map.each.apply(map,arguments); - } - }, - - newMarker: function(offset){ - return { - offset:offset - }; - }, - addMarker: function(offset){ - var map = this.getMarkerMap(); - if(map){ - map.add(this.newMarker(offset)); - } - }, - - removeMarker: function(identifier){ //identifier can be an number (marker index) or a marker (the index will be aearched) - //see marlermap.remove - var map = this.getMarkerMap(); - if(map){ - map.remove(identifier); - } - }, - - moveMarker: function(identifier, newOffset){ //identifier can be an number (marker index) or a marker (the index will be aearched) - var map = this.getMarkerMap(); - if(map){ - map.move(identifier,newOffset); - } - }, - - getMarker: function(index){ - var map = this.getMarkerMap(); - if(map){ - return map.toArray()[index]; - } - return undefined; - }, - - setMarkerEditable: function(identifier, value){ - var map = this.getMarkerMap(); - if(map){ - return map.setEditable(identifier,value); - } - return undefined; - }, - - //markers is an array of objects with at least the field offset:sconds.milliseconds - loadMarkers: function(markers){ - //ruler.bind('markermoved',this.markerMoved,this); - //var $J = this.$J; //reference to jQuery - - var player = this; - //initialize the map. - var map = this.getMarkerMap(); - //var mapUI = this.getMarkersUI(); - var ruler = this.getRuler(); - - //TODO: think about if clearing or not: we assign some bindings in the constructor, too: - // map.clear(); - // ruler.clear(); - - var rulerAdd = ruler.add; - - if(markers){ - //add markers to the map. No listeners associated to it (for the moment) - for(var i =0; i< markers.length; i++){ - map.add.apply(map,[markers[i]]); - } - //add markers to ruler and div - map.each(function(i,marker){ - //isEditable and id are added if not present - rulerAdd.apply(ruler,[marker.offset, i, marker.isEditable]); - }); - } - - //the function above calls map.add: - //add bindings when adding a marker: - map.bind('add',function(data){ - //mapuiAdd.apply(mapUI,[data.marker, data.index,data.isNew]); - rulerAdd.apply(ruler,[data.marker.offset, data.index,data.marker.isEditable]); - player.fire('markerAdded',data); - }); - - //2) MOVE - - //add the binding when we move a marker on the ruler: - ruler.bind('markermoved',function(data){ - var soundPos = data.soundPosition; - var isPointer = data.isPointer; - if(isPointer){ - player.setSoundPosition(soundPos); - }else{ - map.move(data.markerElement.getIndex(), soundPos); - } - }); - - //and now add a binding to the map when we move a marker: - - map.bind('move', function(data){ - var from = data.fromIndex; - var to = data.toIndex; - ruler.move.apply(ruler,[from,to,data.marker.offset]); - player.fire('markerMoved',data); - }); - - //remove - map.bind('remove',function(data){ - ruler.remove.apply(ruler, [data.index]); - player.fire('markerRemoved',data); - }); - - //edit state changed - map.bind('markerEditStateChanged',function(data){ - ruler.setEditable.apply(ruler, [data.index, data.value]); - player.fire('markerEditStateChanged',data); - }); - } -}); diff --git a/telemeta/static/timeside/js/ruler.js b/telemeta/static/timeside/js/ruler.js deleted file mode 100644 index 259d7f38..00000000 --- a/telemeta/static/timeside/js/ruler.js +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (C) 2007-2011 Parisson - * Copyright (c) 2011 Riccardo Zaccarelli - * Copyright (c) 2010 Olivier Guilyardi - * - * This file is part of TimeSide. - * - * TimeSide is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * TimeSide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TimeSide. If not, see . - * - * Authors: Riccardo Zaccarelli - * Olivier Guilyardi - */ - -/** - * Class representing the ruler (upper part) of the player. Requires jQuery - * and Raphael - */ -Timeside.classes.Ruler = Timeside.classes.TimesideArray.extend({ - //init constructor: soundDuration is IN SECONDS!!! (float) - init: function(rulerContainer, waveContainer, soundDuration){ - this._super(); - - this.getSoundDuration= function(){ - return soundDuration; - }; - - this.getWaveContainer =function(){ - return waveContainer; - }; - - this.getContainerWidth =function(){ - return waveContainer.width(); - }; - - this.getRulerContainer = function(){ - return rulerContainer; - } - }, - - resize : function(){ - var duration = this.getSoundDuration(); //in seconds - if (!duration) { - this.debug("ruler.resize: Can't draw ruler with a duration of 0"); - return; - } - - var $J = this.$J; - var rulerContainer = this.getRulerContainer(); - - //remove all elements not pointer or marker - rulerContainer.find(':not(a.ts-pointer,a.ts-marker,a.ts-pointer>*,a.ts-marker>*)').remove(); - - //calculate h with an artifice: create a span (that will be reused later) with the "standard" label - var firstSpan = $J('').css({ - 'display':'block', - 'position':'absolute' - }).html('00000'); //typical timelabel should be '00:00', with '00000' we assure a bit of extra safety space - //note also that display and position must be set as below to calculate the proper outerHeight - rulerContainer.append(firstSpan); //to calculate height, element must be in the document, append it - var verticalMargin = 1; - var h = 2*(verticalMargin+firstSpan.outerHeight()); - //h is the default height of the ruler svg (according to ruler font size) - //to accomodate the necessary space for the labels - //however, if we set a custom height on the ruler, ie h2 is nonzero: - var h2 = rulerContainer.height(); - //then, set the custom height as height for the canvas: - //note that, as markers and pointer have position: absolute, they do not affect div height - if(h2){ - h = h2; - } - var obj = this.calculateRulerElements(rulerContainer.width(),h,firstSpan.outerWidth()); - this.drawRuler(rulerContainer,h,obj.path); - - var labels = obj.labels; - if(labels && labels.length){ - for(var i=0; i ')); - span.html(labels[i][0]).css({ - 'display':'block', - 'position':'absolute', - 'width':'', - 'height':'', - 'right':'', - 'bottom':'', - 'top':'0', - 'left':labels[i][1]+'px' - }); - rulerContainer.append(span); - } - }else{ - firstSpan.html(this.makeTimeLabel(0)); - } - - var pointer = undefined; - if('getPointer' in this){ - pointer = this.getPointer(); - } - if(!pointer){ - pointer = this.add(0,-1); - this.getPointer = function(){ - return pointer; - }; - }else{ - pointer.refreshPosition(); - - } - this.each(function(i,rulermarker){ - rulermarker.refreshPosition(); - }); - - - }, - - drawRuler: function(rulerContainer,h,rulerLinesPath){ - var cssPref = this.cssPrefix; - var upperRectClass = cssPref + 'svg-' + 'ruler-upper-rect'; - var rulerLinesClass = cssPref + 'svg-' + 'ruler-lines'; - - var vml = this.$TU.vml; - if(vml){ - //we create each time a new Raphael object. This is not a big performance issue - var paper = Raphael(rulerContainer[0], rulerContainer.width(), h); - var rect = paper.rect(0,0, rulerContainer.width(), h/2); - var path = paper.path(rulerLinesPath); - var attr = vml.getVmlAttr; - rect.attr(attr(upperRectClass)); - path.attr(attr(rulerLinesClass)); - return; - } - //create svg. Note that elements must be created within a namespace (createElementNS) - //and attributes must be set via .setAttributeNS(null,name,value) - //in other words, jQuery does not work (maybe in future releases) - var $J = this.$J; - var svgNS = "http://www.w3.org/2000/svg"; - var d = document; - var svg = d.createElementNS(svgNS, "svg:svg"); - svg.setAttributeNS( null, "width", rulerContainer.width()); //TODO: optimize width is called also below - svg.setAttributeNS( null, "height", h); - rulerContainer.append($J(svg)); - - var rect = d.createElementNS(svgNS, "svg:rect"); - rect.setAttributeNS( null, "x", 0); - rect.setAttributeNS( null, "y", 0); - rect.setAttributeNS( null, "width", rulerContainer.width()); - rect.setAttributeNS( null, "height", (h/2)); - rect.setAttributeNS( null, "class", upperRectClass); - svg.appendChild(rect); - var lines = d.createElementNS(svgNS, "svg:path"); - lines.setAttributeNS( null, "d", rulerLinesPath); - lines.setAttributeNS( null, "class", rulerLinesClass); - svg.appendChild(lines); - }, - /** - * returns an object with the following properties: - * path: (string) the path of the ruler to be drawn - * labels (array) an array of arrays ['text',x,y] - */ - calculateRulerElements: function(w,h,timeLabelWidth){ - - var duration = this.getSoundDuration(); - - var fontLeftMargin = 2; //should be eual or greater to the ruler stroke width, so that - //the labels are not overlapping the vertical ruler lines - timeLabelWidth+=fontLeftMargin; - - var timeLabelDuration = timeLabelWidth*duration/w; - - //determine the ticks: - var sectionDurations = [1,2,5,10,30,60,120,300,1800,3600,7200,18000,36000]; - //sectionDurations in seconds. Note that 60=1 minute, 3600=1 hour (so the maximum sectionDuration is 36000=10hours) - var i=0; - var len = sectionDurations.length; - while(isectionDurations[i]){ - i++; - } - var sectionDuration = sectionDurations[i]; - var sectionNums = parseInt(0.5+(duration/sectionDurations[i])); //ceil - var sectionWidth = w*sectionDuration/duration; - - - var tickCounts = [10,5,2,1]; - i=0; - var tickCount = tickCounts[0]; - while(isectionWidth){ - i++; - } - var tickAtHalfSectionWidthHigher = i==0 || i==2; //draw tick at half section higher if ticks are even - tickCount = tickCounts[i]; - var tickWidth = sectionWidth/tickCount; - var makeTimeLabel = this.makeTimeLabel; - var h_1 = h-1; //TODO: use line tickness instead of 1 - var path = new Array(parseInt(0.5+(w/tickWidth))); - path[0] = ['M 0 '+h_1]; - len = path.length; - for(i=0; i < len; i+=tickCount){ - for(var j=1; j=0 && index < a.length){ - this._setEditable(a[index],value,false); - } - }, - //do not call, use setEditable(index,value) instead - _setEditable: function(pointerOrMarker, value, isPointer){ - var eventNamespace = this.eventNamespace; - var doc = this.$J(document); - var lbl = pointerOrMarker.getLabel(); - var me = this; - var mme = this.mouseEventType; - - - lbl.unbind('.'+eventNamespace); //this should delete all previous events - - lbl.bind('mouseenter.'+eventNamespace,function(evt){ - me.fire(mme,{ - eventName: 'mouseenter', - eventObj: evt, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - return false; - }); - lbl.bind('mouseleave.'+eventNamespace,function(evt){ - me.fire(mme,{ - eventName: 'mouseleave', - eventObj: evt, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - return false; - }); - - //to prevent page scrolling after mouseup, as click is also fired - lbl.bind('click.'+this.eventNamespace, function(evt){ - return false; - }); - - - lbl.bind('mousedown.'+eventNamespace,function(evt) { - if(evt.which===1){ - if(value){ - pointerOrMarker.isMovedByMouse = true; - } - - var launchDragStart = true; - - var startX = evt.pageX; - var startPos = lbl.position().left+lbl.width()/2; - - evt.stopPropagation(); //dont notify the ruler or other elements; - var newPos = startPos; - doc.bind('mousemove.'+eventNamespace, function(evt_){ - //preventClickFire=true; - if(value){ - var x = evt_.pageX; - newPos = startPos+(x-startX); - pointerOrMarker.move(newPos); - //update the text if pointer - if(isPointer){ - pointerOrMarker.setText(me.makeTimeLabel(me.toSoundPosition(newPos))); - } - } - if(launchDragStart){ - launchDragStart = false; - me.fire(mme,{ - eventName: 'dragstart', - eventObj: evt_, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - } - return false; - - }); - //to avoid scrolling - ////TODO: check IE bug on mouseup on the ruler (pointer is moving too) - //TODO: what happens if the user releases the mouse OUTSIDE the browser???? check bug in IE (mouse release) - var mouseup = function(evt_){ - - doc.unbind('mousemove.'+eventNamespace); - doc.unbind('mouseup.'+eventNamespace); - evt_.stopPropagation(); - if(value){ - if(newPos !== startPos){ - - var data = { - 'markerElement':pointerOrMarker, - 'soundPosition': me.toSoundPosition.apply(me,[newPos]), - 'isPointer':isPointer - }; - me.fire('markermoved',data); - } - pointerOrMarker.isMovedByMouse = false; - } - if(evt_.pageX !== startX){ - me.fire(mme,{ - eventName: 'dragend', - eventObj: evt_, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - }else{ - me.fire(mme,{ - eventName: 'click', - eventObj: evt_, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - } - return false; - }; - doc.bind('mouseup.'+eventNamespace, mouseup); - } - - me.fire(mme,{ - eventName: 'mousedown', - eventObj: evt, - index: isPointer ? -1 : pointerOrMarker.getIndex() - }); - - - return false; - }); - }, - - //moves the pointer, does not notify any listener. - //soundPosition is in seconds (float) - movePointer : function(soundPosition) { - var pointer = this.getPointer(); - if (pointer && !pointer.isMovedByMouse) { - var pixelOffset = this.toPixelOffset(soundPosition); - //first set text, so the label width is set, then call move: - pointer.setText(this.makeTimeLabel(soundPosition)); - pointer.move(pixelOffset); //does NOT fire any move method - } - return soundPosition; - }, - - //soundPosition is in seconds (float) - toPixelOffset: function(soundPosition) { - var duration = this.getSoundDuration(); - if (soundPosition < 0){ - soundPosition = 0; - }else if (soundPosition > duration){ - soundPosition = duration; - } - var width = this.getContainerWidth(); - var pixelOffset = (soundPosition / duration) * width; - return pixelOffset; - }, - - //returns the soundPosition is in seconds (float) - toSoundPosition: function(pixelOffset) { - var width = this.getContainerWidth(); - - if (pixelOffset < 0){ - pixelOffset = 0; - }else if (pixelOffset > width){ - pixelOffset = width; - } - var duration = this.getSoundDuration(); - var soundPosition = (pixelOffset / width) *duration; - return soundPosition; - } -}); diff --git a/telemeta/static/timeside/js/rulermarker.js b/telemeta/static/timeside/js/rulermarker.js deleted file mode 100644 index e98730c4..00000000 --- a/telemeta/static/timeside/js/rulermarker.js +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2007-2011 Parisson - * Copyright (c) 2011 Riccardo Zaccarelli - * Copyright (c) 2010 Olivier Guilyardi - * - * This file is part of TimeSide. - * - * TimeSide is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * TimeSide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TimeSide. If not, see . - * - * Authors: Riccardo Zaccarelli - * Olivier Guilyardi - */ - -/** - * Class representing a RulerMarker in TimesideUI - * Requires jQuery Raphael and all associated player classes. rulerDiv position MUST be relative - * (if this class is called from within player, it is) - */ - -Timeside.classes.RulerMarker = Timeside.classes.TimesideClass.extend({ - - - init: function(ruler, waveImgDiv, className) { - this._super(); - var rulerDiv = ruler.getRulerContainer(); - var $J = this.$J; - - var tooltip = ''; - - var cssPref = this.cssPrefix; - - var label = $J('') - .addClass(cssPref + className) - .css({ - display: 'block', - textAlign: 'center', - position: 'absolute', - zIndex: 1000 - }).append($J('')).attr('href', '#'); - - if (tooltip){ - label.attr('title', tooltip); - } - rulerDiv.append(label); - - //rulerDiv MUST HAVE POSITON relative or absolute (it is relative, see player.resize) - if(className != "pointer"){ - label.css('bottom','0'); - }else{ - label.css('top','0'); - } - - //set the index, - var index = -1; - this.setIndex = function(idx, optionalUpdateLabelWidth){ - index = idx; - this.setText(idx+1, optionalUpdateLabelWidth ? true : false); - }; - this.getIndex = function(){ - return index; - }; - - //end======================================================= - //creating public methods: - this.getLabel = function(){ - return label; - }; - - - this.getRulerWidth = function(){ - return rulerDiv.width(); - }; - this.getWaveHeight = function(){ - return waveImgDiv.height(); - }; - - this.positionInPixels = 0; - this.positionAsViewerRatio = 0; - - var arrowBaselineWidth = 9; - - var canvas = undefined; - var canvasClass = cssPref + 'svg-'+className+'-line'; - var vml = this.$TU.vml; //if vml, this class is populated with methods and NOT undefined - var round = Math.round; - if(!vml){ - canvas = this.createCanvasSvg(waveImgDiv, arrowBaselineWidth); - var path = canvas.childNodes[0]; //note that $J(canvas).find('path') does not work in FF at least 3.5 - path.setAttributeNS(null,'class',canvasClass); - this.moveCanvas = function(pixelOffset){ - pixelOffset = round(pixelOffset); - canvas.setAttributeNS( null, "transform", "translate("+pixelOffset+",0)"); - }; - this.jQueryCanvas = $J(canvas); - }else{ - canvas = this.createCanvasVml(waveImgDiv, arrowBaselineWidth); - this.jQueryCanvas = $J(canvas.node); - var attributes = vml.getVmlAttr(canvasClass); - canvas.attr(attributes); //Raphael method - this.moveCanvas = function(pixelOffset){ - pixelOffset = round(pixelOffset); - //for some reason, coordinates inside the VML object are stored by raphael with a zoom of 10: - this.jQueryCanvas.css('left',(10*pixelOffset)+'px'); - }; - //apparently, when resizing the markers loose their attributes. Therefore: - var r = this.refreshPosition; //reference to current refreshPosition - this.refreshPosition = function(){ - r.apply(this); - canvas.attr(attributes); - } - } - }, - - //sets the text of the marker, if the text changes the marker width and optionalUpdateLabelPosition=true, - //re-arranges the marker position to be center-aligned with its vertical line (the one lying on the wav image) - setText: function(text, optionalUpdateLabelPosition) { - var label = this.getLabel(); - if (label) { - var oldWidth = label.width(); - label.find('span').html(text); - var labelWidth = label.width(); - if(oldWidth != labelWidth && optionalUpdateLabelPosition){ - this.refreshLabelPosition(); - } - } - return this; - }, - - //these methods are executed only if marker is movable (see Ruler.js) - move : function(pixelOffset) { - var width = this.getRulerWidth(); - if (this.positionInPixels != pixelOffset) { - if (pixelOffset < 0) { - pixelOffset = 0; - } else if (pixelOffset >= width) { - pixelOffset = width - 1; - } - //defined in the init method (it depends on wehter the current browser supports SVG or not) - this.moveCanvas(pixelOffset); - - this.positionInPixels = pixelOffset; - this.refreshLabelPosition(width); - //store relative position (see refreshPosition below) - this.positionAsViewerRatio = pixelOffset == width-1 ? 1 : pixelOffset/width; - } - return this; - }, - - refreshLabelPosition : function(optionalContainerWidth){ - if(!(optionalContainerWidth)){ - optionalContainerWidth = this.getRulerWidth(); - } - var label = this.getLabel(); - var width = optionalContainerWidth; - var pixelOffset = this.positionInPixels; - var labelWidth = label.outerWidth(); //consider margins and padding - var labelPixelOffset = pixelOffset - labelWidth / 2; - if (labelPixelOffset < 0){ - labelPixelOffset = 0; - }else if (labelPixelOffset + labelWidth > width){ - labelPixelOffset = width - labelWidth; - } - label.css({ - left: this.mRound(labelPixelOffset) + 'px' - }); - - }, - - //function called on ruler.resize. Instead of recreating all markers, simply redraw them - refreshPosition : function(){ - var width = this.getRulerWidth(); - //store relativePosition: - var rp = this.positionAsViewerRatio; - this.move(this.mRound(this.positionAsViewerRatio*width)); - //reset relative position, which does not have to change - //but in move might have been rounded: - this.positionAsViewerRatio = rp; - }, - - - remove : function() { - var label = this.getLabel(); - label.remove(); - this.jQueryCanvas.remove(); //defined in the constructor - return this; - }, - - - createCanvasSvg: function(container, arrowBaseWidth){ - //create svg. Note that elements must be created within a namespace (createElementNS) - //and attributes must be set via .setAttributeNS(null,name,value) - //in other words, jQuery does not work (maybe in future releases) - var $J = this.$J; - var svgNS = "http://www.w3.org/2000/svg"; - var d = document; - var svg = undefined; - if(container.children().length>0){ - svg = container.children().get(0); - }else{ - svg = d.createElementNS(svgNS, "svg:svg"); - container.append($J(svg)); - } - var group = d.createElementNS(svgNS, "svg:g"); - group.setAttributeNS( null, "transform", "translate(0,0)"); - - var path = d.createElementNS(svgNS, "svg:path"); - path.setAttributeNS( null, "d", this.createCanvasPath(0,arrowBaseWidth)); - - group.appendChild(path); - svg.appendChild(group); - - return group; //return the group, not the path, as it is the group that will be translated when moving - }, - - createCanvasVml: function(container, arrowBaseWidth){ - var vml = this.$TU.vml; - var paper = vml.Raphael(container.get(0),container.width(),container.height()); - var shape = paper.path(this.createCanvasPath(0, arrowBaseWidth)); - return shape; - }, - - //w must be odd. Cause the central line must be centered. Example: - // - // xxxxx - // xxx - // x - // x - // x - // - createCanvasPath: function(x,w){ - var halfW = w >>> 1; - //in order to calculate the line height, we could simply set the wave height. However, due to potential - //resizing afterwards, the line could not stretch till the bottom (if it overflows it's fine, as the wave div container has - //overflow = hidden). As we do not want to rebuild the canvas on resize, - //we assess an height which will 99% overflow the wave height in any case. - //We use the wave height and the window height, and take 2 times - //the maximum of those heights: - var wdwH = this.$J(window).height(); - var waveH = this.getWaveHeight(); - var h = 2* (wdwH > waveH ? wdwH : waveH); - return 'M '+(x-halfW)+' 0 L '+(x)+' '+(halfW)+' L '+x+' '+h+ - ' L '+ (x+1)+' '+h+' L '+(x+1)+ ' '+(halfW)+' L '+(x+halfW+1)+' 0 z'; - }, - - //used for faster lookup - mRound: Math.round - -}); diff --git a/telemeta/static/timeside/js/timeside.js b/telemeta/static/timeside/js/timeside.js deleted file mode 100644 index c764d46e..00000000 --- a/telemeta/static/timeside/js/timeside.js +++ /dev/null @@ -1,789 +0,0 @@ -/* - * Copyright (C) 2007-2011 Parisson - * Copyright (c) 2011 Riccardo Zaccarelli - * Copyright (c) 2010 Olivier Guilyardi - * - * This file is part of TimeSide. - * - * TimeSide is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * TimeSide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TimeSide. If not, see . - * - * Authors: Riccardo Zaccarelli - * Olivier Guilyardi - */ - -/** - * Root javascript file for TimesideUI, to be manually included in your web page (see online doc) - */ - -/** - *global variable housing all Timeside variables/mathods/classes: - */ -var Timeside = { - Class:undefined, - classes:{}, - player:undefined, - config: { - /** - *set to true to see debug messages on the console (only error or warning messages shown) - */ - debug: false, - /* - * timeside scripts to be loaded when Timeside.load is called. URL paths are relative to the timeside folder, which - * will be determined according to the src attribute of the timeside.js script path (to be included in the of the page) - */ - timesideScripts: ['rulermarker.js','markermap.js', 'player.js', 'ruler.js'], - //vml config variables. Used only if svg is NOT supported - vml : { - /* - * raphael script to be loaded when Timeside.load is called and svg is not supported. It will be prepended to the - * timesideScripts array defined above in config. URL paths are relative to the timeside folder, which - * will be determined according to the src attribute of the timeside.js script path (to be included in the of the page) - */ - raphaelScript : 'libs/raphael-min.js', - /* - * available attributes which can be converted from css-svg to Raphael attributes (see Raphael.js): - */ - raphaelAttributes : ["clip-rect", "cursor",'fill', "fill-opacity",'opacity', 'stroke', "stroke-dasharray", "stroke-linecap", "stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width", "text-anchor"] - } - }, - utils:{ - /** - * Returns an uniqid by creating the current local time in millisecond + a random number. - * Used for markers in markermap. The method is kind of public in order to be more accessible for other functions - * by calling Timeside.utils.uniqid(), in case it is needed - */ - uniqid : function() { - var d = new Date(); - return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18); - }, - /** - * vml object which will be populated by vml functions to interface timeside and raphael. See timeside.load. - * We could implement functions here for code readability, however, - * we delegate Timeside.load so that if svg is supported memory is free from unused vml methods. - * IN ANY CASE, svg support can be detected anywhere by calling, eg: - * var svg = !Timeside.utils.vml; - */ - vml: undefined, - - /** - * property that will be set to false if soundManager fails to initialize flash - */ - flashFailed : false - } -}; - - -/* Simple JavaScript Inheritance - * By John Resig http://ejohn.org/ - * MIT Licensed. - * (Inspired by base2 and Prototype) - */ - -/* - * In few words: the lightest and most-comprehensive way to implement inhertance and OOP in javascript. Usages can be found below. - * Basically, - * 1) a new Class is instantiated with Class.extend(). This function takes a dictionary - * of properties/methods which will be put IN THE PROTOTYPE of the class, so that each instance will share the same properties/methods - * and the latter don't have to be created for each instance separately. - * 2) If var A = Class.extend({...}) and var B = A.extend({..}), then methods which are found in B will override the same methods in A. - * In this case, the variable this._super inside the overridden methods will refers to the super-method and can thus be called safely. - * Consequently, if a _super property/method is implemented in the extend dictionary, it WILL NOT be accessible - * to the overriding methods of B. Basically, don't use _super as a key of the argument of extend. - * 3) AFTER the prototype has been populated, the init function, if exists, is called. The latter can be seen as a class constructor in java, - * with a substantial difference: when executing the init() method the class prototype has already been populated with all inherited methods. - * Private variable can be declared in the init function, as well as - * relative getters and setters, if needed. Downside is that the privileged getters and setters can’t be put in the prototype, - * i.e. they are created for each instance separately, and the _super keyword does not apply to them. Another issue is the overhead of closures in general (basically, write as less as possible - * in the init function, in particular if the class has to be declared several times) - * Of course, the this._super keyword of methods implemented in the init constructor does not work - * - * EXAMPLE: - * var MyClass = Class.extend({ - * init: function(optionalArray){ //constructor - * this._super(); //!!!ERROR: Class is the base class and does not have a super construcor - * var me = []; //private variable - * this.count = 6; //set the value of the public property defined below - * this.getMe = function(){ //public method - * this._super(); //!!!ERROR: methods defined in the init function don't have acces to _super - * } - * this.alert = function(){ //another public method, !!!WARNING: this will be put in the MyClass scope (NOT in the prototype) - * alert('ok'); - * } - * }, - * count:0, //public property - * alert: function(){ //public method. !!!WARNING: this method will be put in the prototype BEFORE the init is called, - * alert('no'); // so the alert defined above will be actually called - * } - * }); - * var MyClass2 = MyClass.extend({ - * init: function(){ - * this._super(); //call the super constructor - * } - * alert: function(){ //override a method - * this._super(); //call the super method, ie alerts 'no'. WARNING: However, as long as there is an alert written - * //in the init method of the superclass (see above), THAT method will be called - * } - * }); - * - */ - - -(function(parent){ - - var initializing = false, fnTest = /xyz/.test(function(){ - xyz; - }) ? /\b_super\b/ : /.*/; - - /*The xyz test above determines whether the browser can inspect the textual body of a function. - *If it can, you can perform an optimization by only wrapping an overridden method if it - *actually calls this._super() somewhere in its body. - *Since it requires an additional closure and function call overhead to support _super, - *it’s nice to skip that step if it isn’t needed. - */ - - //ADDED BY ME: - // before was: this.Class = function(){}, where this here is the DomWindow - // In order to chose where to attach the Class object, we added the argument parent (see above): - //if parent is undefined, attach Class to the DomWindow (same as before): - if(!parent){ - parent= window; - } - parent.Class = function(){}; - - //from here on, the code is untouched: - // - //We have the base Class implementation (does nothing) - //and we write here below the method extend which returns the Class with inhertance implemented: - // Create a new Class that inherits from this class - parent.Class.extend = function(prop) { - var _super = this.prototype; - - // Instantiate a base class (but only create the instance, - // don't run the init constructor) - initializing = true; - var prototype = new this(); - initializing = false; - - // Copy the properties over onto the new prototype - for (var name in prop) { - // Check if we're overwriting an existing function - prototype[name] = typeof prop[name] == "function" && - typeof _super[name] == "function" && fnTest.test(prop[name]) ? - (function(name, fn){ - return function() { - var tmp = this._super; - - // Add a new ._super() method that is the same method - // but on the super-class - this._super = _super[name]; - - // The method only need to be bound temporarily, so we - // remove it when we're done executing - var ret = fn.apply(this, arguments); - this._super = tmp; - - return ret; - }; - })(name, prop[name]) : - prop[name]; - } - - // The dummy class constructor - function Class() { - // All construction is actually done in the init method - if ( !initializing && this.init ){ - this.init.apply(this, arguments); - } - } - - // Populate our constructed prototype object - Class.prototype = prototype; - - // Enforce the constructor to be what we expect - Class.constructor = Class; - - // And make this class extendable - Class.extend = arguments.callee; - - return Class; - }; -})(Timeside); - - - -//Defining the base TimeClass class. Timeside.classes.[Player, Ruler, MarkerMap...] are typical implementations (see js files) -//Basically we store here static methods which must be accessible in several timside sub-classes -Timeside.classes.TimesideClass = Timeside.Class.extend({ - //init constructor. Define the 'bind' and 'fire' (TODO: rename as 'trigger'?) methods - //we do it in the init function so that we can set a private variable storing all - //listeners. This means we have to re-write all methods - init: function(){ - //the map for listeners. Must be declared in the init as it's private and NOT shared by all instances - //(ie, every instance has its own copy) - this.listenersMap={}; - }, - - cssPrefix : 'ts-', //actually almost uneuseful, still here for backward compatibility with old code (TODO: remove?) - $J : jQuery, //reference to jQuery for faster lookup inside methods - $TU : Timeside.utils, //reference to Timeside variable for faster lookup inside methods - debugging : false, - debug : Timeside.config.debug ? function(message) { - var C = console; - if (C && C.log) { - C.log(message); - } - } : function(message){}, - - /** - * 3 methods defining listeners, events fire and bind (aloing the lines of jQuery.bind, unbind and trigger. - * the only difference is that 'trigger' is 'fire' here). namespaces are allowed as in jQuery - */ - bind : function(eventType, callback, optionalThisArgInCallback){ - if(!callback || typeof callback !== 'function'){ - this.debug('TimesideClass.bind: cannot bind '+eventType+' to callback: the latter is null or not a function'); - return; - } - if(!eventType){ - this.debug('TimesideClass.bind: eventType is empty in bind'); - return; - } - var listenersMap = this.listenersMap; - if(optionalThisArgInCallback){ - var cb = callback; - callback = function(data){ - cb.apply(optionalThisArgInCallback,[data]); - }; - } - - if(listenersMap.hasOwnProperty(eventType)){ - listenersMap[eventType].push(callback); - }else{ - listenersMap[eventType] = [callback]; - } - - var idx = eventType.indexOf('.'); - if(idx <= 0 || idx >= eventType.length-1){ - return; - } - - eventType = eventType.substring(0,idx); - - - if(listenersMap.hasOwnProperty(eventType)){ - listenersMap[eventType].push(callback); - }else{ - listenersMap[eventType] = [callback]; - } - - }, - unbind : function(){ - var listenersMap = this.listenersMap; - var key,keyPlusDot; - if(arguments.length>0){ - key = arguments[0]; - if(listenersMap.hasOwnProperty(key)){ - var callbacks = listenersMap[key]; - var idx = key.indexOf('.'); - if(idx>0 && idx < key.length-1){ - //key is "eventtype.namespace", delete also functions stored in "eventType", if any - var baseKey = key.substring(0,idx); - var baseCallbacks = listenersMap[baseKey]; - if(baseCallbacks){ - for( var i = baseCallbacks.length; i>-1; i--){ - var bc = baseCallbacks[i]; - for( var j = callbacks.length; j>-1; j--){ - if(bc === callbacks[j]){ - baseCallbacks.splice(i,1); - } - } - } - } - }else if(idx<0){ - //key is "eventtype", delete also all functions stored in "eventType.namespace", if any - keyPlusDot = key+'.'; - for(var k in listenersMap){ - if(listenersMap.hasOwnProperty(k) && k.indexOf(keyPlusDot)==0 && k.length > keyPlusDot.length){ - delete listenersMap[k]; - } - } - } - delete listenersMap[key]; - } - }else{ - for(key in listenersMap){ - if(listenersMap.hasOwnProperty(key)){ - delete listenersMap[key]; - } - } - } - }, - fire : function(key, dataArgument){ - var listenersMap = this.listenersMap; - if(!(listenersMap.hasOwnProperty(key))){ - return; - } - if(arguments.length < 2 || !dataArgument){ - dataArgument = {}; - } - var callbacks = listenersMap[key]; - var len = callbacks && callbacks.length ? callbacks.length : 0; - for(var i=0; i0){ - ret[i] = separator+ret[i]; - } - } - return ret.join(""); - } -}); - -/** - * An Array-like implementation that suits the need of Marker mnanagement - * Ruler, MarkerMap and MarkerMapDiv implement this class - */ -Timeside.classes.TimesideArray = Timeside.classes.TimesideClass.extend({ - init: function(optionalArray){ - this._super(); - //here methods that CANNOT be overridden - var me= optionalArray ? optionalArray : []; - //note that this method written here OVERRIDES the same method written outside init in the children!!!! - this.toArray = function(returnACopy){ - if(returnACopy){ - var ret = []; - for(var i=0; i= l){ - return; - } - startInclusive = arg[0]=== undefined ? 0 : arg[0]; - endExclusive = l; - break; - default: - startInclusive = arg[0]=== undefined ? 0 : arg[0]; - endExclusive = arg[1]=== undefined ? l : arg[1]; - } - callback = arg[len-1]; - if(!(callback instanceof Function)){ - this.debug('TimesideClass.each: callback NOT a function!!!'); - return; - } - var me =this.toArray(); - for(var i = startInclusive; i=len)||(to<0 || to>=len)){ - return -1; - } - var elm = me.splice(from,1)[0]; - me.splice(to,0,elm); - - return to; - } -}); - - - -/** - *Main Timeside method to load player (see Timeside online doc) - */ - -Timeside.load =function(config){ - - var $J = jQuery; - var win = window; - var doc = document; - //function to be called onready or onerror: - var loadAll = function() { - - - //get the current script path (this file name is timeside.js?... or simplt timeside.js) - var scripts = $J('script'); - var thisScriptPath = ''; - scripts.each(function(i,s){ - var src = $J(s).attr('src'); - if(src){ - var srcName = src.split(/\//); - if(srcName.length){ - srcName = srcName[srcName.length-1]; - //is this script ? consider the case here we are loading timeside.js?.... - if(srcName.replace(/\.js(?:\?[^\?]*)*$/,'.js') == 'timeside.js'){ - src[src.length-1] = ''; - thisScriptPath = src.replace(/\/[^\/]+$/, ''); - } - } - } - }); - - var ts = Timeside; - var ts_scripts = ts.config.timesideScripts; - //detect SVG support and load Raphael in case. Copied from Raphael code v 1.5.2: - var svg = (win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); - if(!svg){ - //add the raphael path. Raphael will be loaded in Timeside.load (see below) - ts_scripts.splice(0,0,ts.config.vml.raphaelScript); - //populate the vml object with methods to be used in ruler and rulermarker: - - //global private variable: - //map to store each class name to the relative dictionary for raphael attr function (VML only) - var classToRaphaelAttr = {}; - //get the raphael attributes for which a conversion css -> raphael_attribute is possible: - var availableAttrs = ts.config.vml.raphaelAttributes; - //here below we store Raphael paper objects. var paper = Raphael(htmlElement) is the raphel method to build - //a new paper object. Internally, the method builds a div embedding vmls inside htmlElement, retriavable via the - //paper.node property. - //However, calling again var paper = Raphael(htmlElement) does not use the already created paper, - //but creates a new paper with a new paper.node (div). Too bad. The possibility to wrap existing paper node - //into a Raphael paper would be a nice and almost necessary feature, which however is not even - //planned to be implemented according to raphael developers (see raphael forums). - //In case of markers lines, we want to draw a new marker - //on the same raphael paper. Therefore, we store here raphael papers in a map htmlElement -> paper - var raphael_papers = {}; - ts.utils.vml = { - getVmlAttr: function(className){ - - if(classToRaphaelAttr.hasOwnProperty(className)){ - //if(className in classToRaphaelAttr){ - return classToRaphaelAttr[className]; - } - var d = document; - var dottedclassName = className.replace(/^\.*/,'.'); //add a dot if not present - var ssheets = d.styleSheets; - var len = ssheets.length-1; - - var attr = {}; - for(var i=0; i