diff -r 9859c4bae904 -r f9d51dd4a3fe src/js/libs/popcorn-complete.min.js --- a/src/js/libs/popcorn-complete.min.js Fri Nov 30 10:49:26 2012 +0100 +++ b/src/js/libs/popcorn-complete.min.js Wed Dec 19 19:02:52 2012 +0100 @@ -1,200 +1,160 @@ /* - * popcorn.js version 1.2 + * popcorn.js version 1.3 * http://popcornjs.org * * Copyright 2011, Mozilla Foundation * Licensed under the MIT license */ -(function(g,b){function d(e,m){return function(){if(n.plugin.debug)return e.apply(this,arguments);try{return e.apply(this,arguments)}catch(q){n.plugin.errors.push({plugin:m,thrown:q,source:e.toString()});this.emit("error",n.plugin.errors)}}}if(b.addEventListener){var a=Array.prototype,c=Object.prototype,f=a.forEach,h=a.slice,p=c.hasOwnProperty,o=c.toString,l=g.Popcorn,i=/^(#([\w\-\_\.]+))$/,r=[],k=false,j={events:{hash:{},apis:{}}},v=function(){return g.requestAnimationFrame||g.webkitRequestAnimationFrame|| -g.mozRequestAnimationFrame||g.oRequestAnimationFrame||g.msRequestAnimationFrame||function(e){g.setTimeout(e,16)}}(),w=function(e){var m=e.media.currentTime,q=e.options.frameAnimation,s=e.data.disabled,t=e.data.trackEvents,u=t.animating,x=t.startIndex,A=n.registryByName,B=0,D,E;for(x=Math.min(x+1,t.byStart.length-2);x>0&&t.byStart[x];){B=t.byStart[x];E=(D=B._natives)&&D.type;if(!D||A[E]||e[E])if(B.start<=m&&B.end>m&&s.indexOf(E)===-1){if(!B._running){B._running=true;D.start.call(e,null,B);q&&B&&B._running&& -B.natives.frame&&D.frame.call(e,null,B,m)}}else if(B._running===true){B._running=false;D.end.call(e,null,B);if(q&&B._natives.frame){B=u.indexOf(B);B>=0&&u.splice(B,1)}}x--}},n=function(e,m){return new n.p.init(e,m||null)};n.version="1.2";n.isSupported=true;n.instances=[];n.p=n.prototype={init:function(e,m){var q,s=this;if(typeof e==="function")if(b.readyState==="complete")e(b,n);else{r.push(e);if(!k){k=true;var t=function(){b.removeEventListener("DOMContentLoaded",t,false);for(var x=0,A=r.length;x< -A;x++)r[x].call(b,n);r=null};b.addEventListener("DOMContentLoaded",t,false)}}else{this.media=(q=i.exec(e))&&q.length&&q[2]?b.getElementById(q[2]):e;this[this.media.nodeName&&this.media.nodeName.toLowerCase()||"video"]=this.media;n.instances.push(this);this.options=m||{};this.isDestroyed=false;this.data={timeUpdate:n.nop,disabled:[],events:{},hooks:{},history:[],state:{volume:this.media.volume},trackRefs:{},trackEvents:{byStart:[{start:-1,end:-1}],byEnd:[{start:-1,end:-1}],animating:[],startIndex:0, -endIndex:0,previousUpdateTime:-1}};var u=function(){s.media.removeEventListener("loadeddata",u,false);var x;x=s.media.duration;x=x!=x?Number.MAX_VALUE:x+1;n.addTrackEvent(s,{start:x,end:x});if(s.options.frameAnimation){s.data.timeUpdate=function(){n.timeUpdate(s,{});s.emit("timeupdate");!s.isDestroyed&&v(s.data.timeUpdate)};!s.isDestroyed&&v(s.data.timeUpdate)}else{s.data.timeUpdate=function(A){n.timeUpdate(s,A)};s.isDestroyed||s.media.addEventListener("timeupdate",s.data.timeUpdate,false)}};s.media.readyState>= -2?u():s.media.addEventListener("loadeddata",u,false);return this}}};n.p.init.prototype=n.p;n.forEach=function(e,m,q){if(!e||!m)return{};q=q||this;var s,t;if(f&&e.forEach===f)return e.forEach(m,q);if(o.call(e)==="[object NodeList]"){s=0;for(t=e.length;s-1&&q.splice(s,1);w(e);return e},destroy:function(e){var m=e.data.events,q,s,t;for(s in m){q=m[s];for(t in q)delete q[t];m[s]=null}if(!e.isDestroyed){e.data.timeUpdate&&e.media.removeEventListener("timeupdate",e.data.timeUpdate,false);e.isDestroyed= -true}}});n.guid.counter=1;n.extend(n.p,function(){var e={};n.forEach("load play pause currentTime playbackRate volume duration preload playbackRate autoplay loop controls muted buffered readyState seeking paused played seekable ended".split(/\s+/g),function(m){e[m]=function(q){if(typeof this.media[m]==="function"){if(q!=null&&/play|pause/.test(m))this.media.currentTime=n.util.toSeconds(q);this.media[m]();return this}if(q!=null){this.media[m]=q;return this}return this.media[m]}});return e}());n.forEach("enable disable".split(" "), -function(e){n.p[e]=function(m){return n[e](this,m)}});n.extend(n.p,{roundTime:function(){return-~this.media.currentTime},exec:function(e,m){n.addTrackEvent(this,{start:e,end:e+1,_running:false,_natives:{start:m||n.nop,end:n.nop,type:"cue"}});return this},mute:function(e){e=e==null||e===true?"muted":"unmuted";if(e==="unmuted"){this.media.muted=false;this.media.volume=this.data.state.volume}if(e==="muted"){this.data.state.volume=this.media.volume;this.media.muted=true}this.emit(e);return this},unmute:function(e){return this.mute(e== -null?false:!e)},position:function(){return n.position(this.media)},toggle:function(e){return n[this.data.disabled.indexOf(e)>-1?"enable":"disable"](this,e)},defaults:function(e,m){if(n.isArray(e)){n.forEach(e,function(q){for(var s in q)this.defaults(s,q[s])},this);return this}if(!this.options.defaults)this.options.defaults={};this.options.defaults[e]||(this.options.defaults[e]={});n.extend(this.options.defaults[e],m);return this}});n.Events={UIEvents:"blur focus focusin focusout load resize scroll unload", -MouseEvents:"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave click dblclick",Events:"loadstart progress suspend emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange"};n.Events.Natives=n.Events.UIEvents+" "+n.Events.MouseEvents+" "+n.Events.Events;j.events.apiTypes=["UIEvents","MouseEvents","Events"];(function(e,m){for(var q=j.events.apiTypes,s=e.Natives.split(/\s+/g), -t=0,u=s.length;t-1&&this.media.addEventListener(e,function(x){n.forEach(q.data.events[e],function(A){typeof A==="function"&&A.call(q,x)})},false);return this},unlisten:function(e,m){if(this.data.events[e]&&this.data.events[e][m]){delete this.data.events[e][m];return this}this.data.events[e]=null;return this}},hooks:{canplayall:{bind:"canplaythrough",add:function(e,m){var q=false;if(this.media.readyState){m.call(this,e);q=true}this.data.hooks.canplayall={fired:q}}, -handler:function(e,m){if(!this.data.hooks.canplayall.fired){m.call(this,e);this.data.hooks.canplayall.fired=true}}}}};n.forEach([["trigger","emit"],["listen","on"],["unlisten","off"]],function(e){n.p[e[0]]=n.p[e[1]]=n.events.fn[e[0]]});n.addTrackEvent=function(e,m){if(m&&m._natives&&m._natives.type&&e.options.defaults&&e.options.defaults[m._natives.type])m=n.extend({},e.options.defaults[m._natives.type],m);if(m._natives){m._id=!m.id?n.guid(m._natives.type):m.id;e.data.history.push(m._id)}m.start= -n.util.toSeconds(m.start,e.options.framerate);m.end=n.util.toSeconds(m.end,e.options.framerate);var q=e.data.trackEvents.byStart,s=e.data.trackEvents.byEnd,t;for(t=q.length-1;t>=0;t--)if(m.start>=q[t].start){q.splice(t+1,0,m);break}for(q=s.length-1;q>=0;q--)if(m.end>s[q].end){s.splice(q+1,0,m);break}if(m._natives&&(n.registryByName[m._natives.type]||e[m._natives.type])){s=e.media.currentTime;if(m.end>s&&m.start<=s&&e.data.disabled.indexOf(m._natives.type)===-1){m._running=true;m._natives.start.call(e, -null,m);if(e.options.frameAnimation&&m._natives.frame){e.data.trackEvents.animating.push(m);m._natives.frame.call(e,null,m,s)}}}t<=e.data.trackEvents.startIndex&&m.start<=e.data.trackEvents.previousUpdateTime&&e.data.trackEvents.startIndex++;q<=e.data.trackEvents.endIndex&&m.end-1;){q=e.data.trackEvents.byStart[x];s=e.data.trackEvents.byEnd[x];if(!q._id){B.push(q);D.push(s)}if(q._id){q._id!==m&&B.push(q);s._id!==m&&D.push(s);if(q._id===m){A=x;q._natives._teardown&&q._natives._teardown.call(e,q)}}x++}u=e.data.trackEvents.animating.length;x=0;if(u)for(;--u>-1;){q=e.data.trackEvents.animating[x];q._id||E.push(q);q._id&&q._id!==m&&E.push(q);x++}A<=e.data.trackEvents.startIndex&& -e.data.trackEvents.startIndex--;A<=e.data.trackEvents.endIndex&&e.data.trackEvents.endIndex--;e.data.trackEvents.byStart=B;e.data.trackEvents.byEnd=D;e.data.trackEvents.animating=E;for(u=0;uq&&H._running===false&&e.data.disabled.indexOf(G)===-1){H._running=true;s.start.call(e,m,H);e.emit("trackstart",n.extend({},H,{plugin:G,type:"trackstart"})); -e.options.frameAnimation&&H&&H._running&&H._natives.frame&&u.push(H)}A++}else{n.removeTrackEvent(e,H._id);return}}if(e.options.frameAnimation)for(;Bq){for(;t.byStart[A]&&t.byStart[A].start>q;){H=t.byStart[A];G=(s=H._natives)&&s.type;if(!s||z[G]||e[G]){if(H._running===true){H._running=false;s.end.call(e,m,H);e.emit("trackend",n.extend({},F,{plugin:G,type:"trackend"}))}A--}else{n.removeTrackEvent(e,H._id); -return}}for(;t.byEnd[x]&&t.byEnd[x].end>q;){F=t.byEnd[x];G=(s=F._natives)&&s.type;if(!s||z[G]||e[G]){if(F.start<=q&&F._running===false&&e.data.disabled.indexOf(G)===-1){F._running=true;s.start.call(e,m,F);e.emit("trackstart",n.extend({},H,{plugin:G,type:"trackstart"}));e.options.frameAnimation&&F&&F._running&&F._natives.frame&&u.push(F)}x--}else{n.removeTrackEvent(e,F._id);return}}if(e.options.frameAnimation)for(;B=0)n.error("'"+e+"' is a protected function name");else{var s=["start","end"],t={},u=typeof m==="function",x=["_setup","_teardown","start","end","frame"],A=function(E,z){E=E||n.nop;z=z||n.nop;return function(){E.apply(this,arguments);z.apply(this,arguments)}};n.manifest[e]=q=q||m.manifest||{};x.forEach(function(E){m[E]= -d(m[E]||n.nop,e)});var B=function(E,z){if(!z)return this;var F=z._natives={},H="",G;n.extend(F,E);z._natives.type=e;z._running=false;F.start=F.start||F["in"];F.end=F.end||F.out;F._teardown=A(function(){var I=h.call(arguments);I.unshift(null);I[1]._running&&F.end.apply(this,I)},F._teardown);z.compose=z.compose&&z.compose.split(" ")||[];z.effect=z.effect&&z.effect.split(" ")||[];z.compose=z.compose.concat(z.effect);z.compose.forEach(function(I){H=n.compositions[I]||{};x.forEach(function(J){F[J]=A(F[J], -H[J])})});z._natives.manifest=q;if(!("start"in z))z.start=z["in"]||0;if(!z.end&&z.end!==0)z.end=z.out||Number.MAX_VALUE;if(!p.call(z,"toString"))z.toString=function(){var I=["start: "+z.start,"end: "+z.end,"id: "+(z.id||z._id)];z.target!=null&&I.push("target: "+z.target);return e+" ( "+I.join(", ")+" )"};if(!z.target){G="options"in q&&q.options;z.target=G&&"target"in G&&G.target}z._natives._setup&&z._natives._setup.call(this,z);n.addTrackEvent(this,n.extend(z,z));n.forEach(E,function(I,J){J!=="type"&& -s.indexOf(J)===-1&&this.on(J,I)},this);return this};n.p[e]=t[e]=function(E){E=n.extend({},this.options.defaults&&this.options.defaults[e]||{},E);return B.call(this,u?m.call(this,E):m,E)};var D={fn:t[e],definition:m,base:m,parents:[],name:e};n.registry.push(n.extend(t,D,{type:e}));n.registryByName[e]=D;return t}};n.plugin.errors=[];n.plugin.debug=false;n.removePlugin=function(e,m){if(!m){m=e;e=n.p;if(n.protect.natives.indexOf(m.toLowerCase())>=0){n.error("'"+m+"' is a protected function name");return}var q= -n.registry.length,s;for(s=0;s-1){t=t.split(";");u=0;if(m&&typeof m==="number")u=parseFloat(t[1],10)/m;q[s]=parseInt(t[0],10)+u}s=q[0];return{1:parseFloat(s,10),2:parseInt(s,10)*60+parseFloat(q[1],10),3:parseInt(s,10)*3600+parseInt(q[1],10)*60+parseFloat(q[2],10)}[q.length||1]}};n.p.cue=n.p.exec;n.protect={natives:function(e){return Object.keys?Object.keys(e):function(m){var q,s=[];for(q in m)p.call(m,q)&&s.push(q); -return s}(e)}(n.p).map(function(e){return e.toLowerCase()})};n.forEach({listen:"on",unlisten:"off",trigger:"emit",exec:"cue"},function(e,m){var q=n.p[m];n.p[m]=function(){if(typeof console!=="undefined"&&console.warn){console.warn("Deprecated method '"+m+"', "+(e==null?"do not use.":"use '"+e+"' instead."));n.p[m]=q}return n.p[e].apply(this,[].slice.call(arguments))}});g.Popcorn=n}else{g.Popcorn={isSupported:false};for(a="removeInstance addInstance getInstanceById removeInstanceById forEach extend effects error guid sizeOf isArray nop position disable enable destroyaddTrackEvent removeTrackEvent getTrackEvents getTrackEvent getLastTrackEventId timeUpdate plugin removePlugin compose effect xhr getJSONP getScript".split(/\s+/);a.length;)g.Popcorn[a.shift()]= -function(){}}})(window,window.document);(function(g,b){var d=g.document,a=g.location,c=/:\/\//,f=a.href.replace(a.href.split("/").slice(-1)[0],""),h=function(o,l,i){o=o||0;l=(l||o||0)+1;i=i||1;l=Math.ceil((l-o)/i)||0;var r=0,k=[];for(k.length=l;r= -r["in"]&&o<=r.out)i=k});o+=this.inOuts.ofVideos[i]["in"]-this.inOuts.ofClips[i]["in"];b.addTrackEvent(this.playlist[i],{start:o-1,end:o,_running:false,_natives:{start:l||b.nop,end:b.nop,type:"exec"}});return this},listen:function(o,l){var i=this,r=this.playlist,k=r.length,j=0;if(!l)l=b.nop;if(b.Events.Natives.indexOf(o)>-1)b.forEach(r,function(v){v.listen(o,function(w){w.active=i;if(p.indexOf(o)>-1)l.call(v,w);else++j===k&&l.call(v,w)})});else{this.events[o]||(this.events[o]={});r=l.name||b.guid("__"+ -o);this.events[o][r]=l}return this},unlisten:function(){},trigger:function(o,l){var i=this;if(!(b.Events.Natives.indexOf(o)>-1)){this.events[o]&&b.forEach(this.events[o],function(r){r.call(i,{type:o},l)});return this}}});b.forEach(b.manifest,function(o,l){b.sequence.prototype[l]=function(i){var r={},k=[],j,v,w,n,y;for(j=0;j-1)r[j]=b.extend({},k,{start:v[w],clipIdx:w});if(n>-1)r[j]= -b.extend({},k,{end:v[n],clipIdx:n})}j=Object.keys(r).map(function(e){return+e});k=h(j[0],j[1]);for(j=0;j=0)g.error("'"+d+"' is a protected function name");else{if(typeof a==="function"&&!c){c=a;a=""}if(!(typeof c!=="function"||typeof a!=="string")){var f={};f[d]=function(h,p){if(!h)return this;var o=this;g.xhr({url:h,dataType:a,success:function(l){var i,r,k=0;l=c(l).data||[];if(i=l.length){for(;k=4){i=new Date/1E3;y.dispatchEvent("play");e()}};y.pause=function(){this.paused=true;y.dispatchEvent("pause")}; -g.player.defineProperty(y,"currentTime",{get:function(){return r},set:function(m){r=+m;y.dispatchEvent("timeupdate");return r},configurable:true});g.player.defineProperty(y,"volume",{get:function(){return j},set:function(m){j=+m;y.dispatchEvent("volumechange");return j},configurable:true});g.player.defineProperty(y,"muted",{get:function(){return v},set:function(m){v=+m;y.dispatchEvent("volumechange");return v},configurable:true});g.player.defineProperty(y,"readyState",{get:function(){return k},set:function(m){return k= -m},configurable:true});y.addEventListener=function(m,q){w[m]||(w[m]=[]);w[m].push(q);return q};y.removeEventListener=function(m,q){var s,t=w[m];if(t){for(s=w[m].length-1;s>=0;s--)q===t[s]&&t.splice(s,1);return q}};y.dispatchEvent=function(m){var q,s=m.type;if(!s){s=m;if(m=g.events.getInterface(s)){q=document.createEvent(m);q.initEvent(s,true,true,window,1)}}if(w[s])for(m=w[s].length-1;m>=0;m--)w[s][m].call(this,q,this)};y.src=p||"";y.duration=0;y.paused=true;y.ended=0;o&&o.events&&g.forEach(o.events, -function(m,q){y.addEventListener(q,m,false)});if(c._canPlayType(n.nodeName,p)!==false)if(c._setup)c._setup.call(y,o);else{y.readyState=4;y.dispatchEvent("loadedmetadata");y.dispatchEvent("loadeddata");y.dispatchEvent("canplaythrough")}else y.dispatchEvent("error");y.addEventListener("loadedmetadata",function(){y.currentTime=r;y.volume=j;y.muted=v});y.addEventListener("loadeddata",function(){!y.paused&&y.play()});h=new g.p.init(y,o);if(c._teardown)h.destroy=b(h.destroy,function(){c._teardown.call(y, -o)});return h};f.canPlayType=c._canPlayType=c._canPlayType||g.nop;g[a]=g.player.registry[a]=f}};g.player.registry={};g.player.defineProperty=Object.defineProperty||function(a,c,f){a.__defineGetter__(c,f.get||g.nop);a.__defineSetter__(c,f.set||g.nop)};g.smart=function(a,c,f){var h=d.exec(a);h=h&&h.length&&h[2]?document.getElementById(h[2]):a;if(h.nodeType==="VIDEO"&&!c){if(typeof c==="object")f=c;return g(h,f)}for(var p in g.player.registry)if(g.player.registry.hasOwnProperty(p))if(g.player.registry[p].canPlayType(h.nodeName, -c))return g[p](a,c,f);if(h.nodeType!=="VIDEO"){a=document.createElement("video");h.appendChild(a);h=a}f&&f.events&&f.events.error&&h.addEventListener("error",f.events.error,false);h.src=c;return g(h,f)}})(Popcorn);(function(g){var b=function(d,a){var c=0,f=0,h;g.forEach(a.classes,function(p,o){h=[];if(p==="parent")h[0]=document.querySelectorAll("#"+a.target)[0].parentNode;else h=document.querySelectorAll("#"+a.target+" "+p);c=0;for(f=h.length;c";if(a.nameofwork)c+=a.nameofwork;if(a.nameofworkurl)c+="";if(a.copyrightholderurl)c+="";if(a.copyrightholder)c+=", "+a.copyrightholder;if(a.copyrightholderurl)c+="";if(c==="")c=a.text;if(a.license)if(f)c= -a.licenseurl?" "+c:""+c;else{c+=", license: ";c+=a.licenseurl?""+a.license+" ":a.license}else if(a.licenseurl)c+=", license ";a._container.innerHTML=c;if(!d&&g.plugin.debug)throw Error("target container doesn't exist");d&&d.appendChild(a._container)},start:function(a,c){c._container.style.display="inline"},end:function(a, -c){c._container.style.display="none"},_teardown:function(a){(d=document.getElementById(a.target))&&d.removeChild(a._container)}}}(),{about:{name:"Popcorn Attribution Plugin",version:"0.2",author:"@rwaldron",website:"github.com/rwldrn"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},nameofwork:{elem:"input",type:"text",label:"Name of Work"},nameofworkurl:{elem:"input",type:"url",label:"Url of Work",optional:true},copyrightholder:{elem:"input",type:"text", -label:"Copyright Holder"},copyrightholderurl:{elem:"input",type:"url",label:"Copyright Holder Url",optional:true},license:{elem:"input",type:"text",label:"License type"},licenseurl:{elem:"input",type:"url",label:"License URL",optional:true},target:"attribution-container"}})})(Popcorn);(function(g){g.plugin("code",function(b){var d=false,a=function(){var c=function(f){return function(h){var p=function(){d&&h();d&&f(p)};p()}};return window.webkitRequestAnimationFrame?c(window.webkitRequestAnimationFrame):window.mozRequestAnimationFrame?c(window.mozRequestAnimationFrame):c(function(f){window.setTimeout(f,16)})}();if(!b.onStart||typeof b.onStart!=="function"){if(g.plugin.debug)throw Error("Popcorn Code Plugin Error: onStart must be a function.");b.onStart=g.nop}if(b.onEnd&&typeof b.onEnd!== -"function"){if(g.plugin.debug)throw Error("Popcorn Code Plugin Error: onEnd must be a function.");b.onEnd=undefined}if(b.onFrame&&typeof b.onFrame!=="function"){if(g.plugin.debug)throw Error("Popcorn Code Plugin Error: onFrame must be a function.");b.onFrame=undefined}return{start:function(c,f){f.onStart(f);if(f.onFrame){d=true;a(f.onFrame,f)}},end:function(c,f){if(f.onFrame)d=false;f.onEnd&&f.onEnd(f)}}},{about:{name:"Popcorn Code Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"}, -options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},onStart:{elem:"input",type:"function",label:"onStart"},onFrame:{elem:"input",type:"function",label:"onFrame",optional:true},onEnd:{elem:"input",type:"function",label:"onEnd"}}})})(Popcorn);(function(g){var b=0;g.plugin("flickr",function(d){var a,c=document.getElementById(d.target),f,h,p,o,l=d.numberofimages||4,i=d.height||"50px",r=d.width||"50px",k=d.padding||"5px",j=d.border||"0px";a=document.createElement("div");a.id="flickr"+b;a.style.width="100%";a.style.height="100%";a.style.display="none";b++;if(!c&&g.plugin.debug)throw Error("flickr target container doesn't exist");c&&c.appendChild(a);var v=function(){if(f)setTimeout(function(){v()},5);else{h="http://api.flickr.com/services/rest/?method=flickr.people.findByUsername&"; -h+="username="+d.username+"&api_key="+d.apikey+"&format=json&jsoncallback=flickr";g.getJSONP(h,function(n){f=n.user.nsid;w()})}},w=function(){h="http://api.flickr.com/services/feeds/photos_public.gne?";if(f)h+="id="+f+"&";if(d.tags)h+="tags="+d.tags+"&";h+="lang=en-us&format=json&jsoncallback=flickr";g.xhr.getJSONP(h,function(n){var y=document.createElement("div");y.innerHTML="

"+n.title+"

";g.forEach(n.items,function(C,e){if(e-1))throw Error("Facebook plugin type was invalid.");a._container=document.createElement("div");a._container.id="facebookdiv-"+g.guid();a._facebookdiv=document.createElement("fb:"+f);a._container.appendChild(a._facebookdiv); -a._container.style.display="none";f=f==="activity"?"site":"href";a._facebookdiv.setAttribute(f,a[f]||document.URL);f="width height layout show_faces stream header colorscheme maxrows border_color recommendations font always_post_to_friends xid num_posts".split(" ");g.forEach(f,function(p){a[p]!=null&&a._facebookdiv.setAttribute(p,a[p])});if(!c&&g.plugin.debug)throw Error("Facebook target container doesn't exist");c&&c.appendChild(a._container)},start:function(a,c){c._container.style.display=""},end:function(a, -c){c._container.style.display="none"},_teardown:function(a){var c=document.getElementById(a.target);c&&c.removeChild(a._container)}})})(Popcorn,this);var googleCallback; -(function(g){var b=1,d=false,a=false,c,f;googleCallback=function(h){if(typeof google!=="undefined"&&google.maps&&google.maps.Geocoder&&google.maps.LatLng){c=new google.maps.Geocoder;a=true}else setTimeout(function(){googleCallback(h)},1)};f=function(){if(document.body){d=true;g.getScript("//maps.google.com/maps/api/js?sensor=false&callback=googleCallback")}else setTimeout(function(){f()},1)};g.plugin("googlemap",function(h){var p,o,l,i=document.getElementById(h.target);d||f();p=document.createElement("div"); -p.id="actualmap"+b;p.style.width="100%";p.style.height="100%";b++;if(!i&&g.plugin.debug)throw Error("target container doesn't exist");i&&i.appendChild(p);var r=function(){if(a)if(h.location)c.geocode({address:h.location},function(k,j){if(j===google.maps.GeocoderStatus.OK){h.lat=k[0].geometry.location.lat();h.lng=k[0].geometry.location.lng();l=new google.maps.LatLng(h.lat,h.lng);o=new google.maps.Map(p,{mapTypeId:google.maps.MapTypeId[h.type]||google.maps.MapTypeId.HYBRID});o.getDiv().style.display= -"none"}});else{l=new google.maps.LatLng(h.lat,h.lng);o=new google.maps.Map(p,{mapTypeId:google.maps.MapTypeId[h.type]||google.maps.MapTypeId.HYBRID});o.getDiv().style.display="none"}else setTimeout(function(){r()},5)};r();return{start:function(k,j){var v=this,w,n=function(){if(o){o.getDiv().style.display="block";google.maps.event.trigger(o,"resize");o.setCenter(l);if(j.zoom&&typeof j.zoom!=="number")j.zoom=+j.zoom;j.zoom=j.zoom||8;o.setZoom(j.zoom);if(j.heading&&typeof j.heading!=="number")j.heading= -+j.heading;if(j.pitch&&typeof j.pitch!=="number")j.pitch=+j.pitch;if(j.type==="STREETVIEW"){o.setStreetView(w=new google.maps.StreetViewPanorama(p,{position:l,pov:{heading:j.heading=j.heading||0,pitch:j.pitch=j.pitch||0,zoom:j.zoom}}));var y=function(u,x){var A=google.maps.geometry.spherical.computeHeading;setTimeout(function(){var B=v.media.currentTime;if(typeof j.tween==="object"){for(var D=0,E=u.length;D=z.interval*(D+1)/1E3&&(B<=z.interval*(D+2)/1E3||B>=z.interval*E/1E3)){s.setPosition(new google.maps.LatLng(z.position.lat, -z.position.lng));s.setPov({heading:z.pov.heading||A(z,u[D+1])||0,zoom:z.pov.zoom||0,pitch:z.pov.pitch||0})}}y(u,u[0].interval)}else{D=0;for(E=u.length;D=z*(D+1)/1E3&&(B<=z*(D+2)/1E3||B>=z*E/1E3)){C.setPov({heading:A(u[D],u[D+1])||0,zoom:j.zoom,pitch:j.pitch||0});C.setPosition(e[D])}}y(e,j.interval)}},x)};if(j.location&&typeof j.tween==="string"){var C=w,e=[],m=new google.maps.DirectionsService,q=new google.maps.DirectionsRenderer(C);m.route({origin:j.location,destination:j.tween, -travelMode:google.maps.TravelMode.DRIVING},function(u,x){if(x==google.maps.DirectionsStatus.OK){q.setDirections(u);for(var A=u.routes[0].overview_path,B=0,D=A.length;B";c+="";c+="

"+a.artist.bio.summary+"

";c+="

Tags

    ";g.forEach(a.artist.tags.tag,function(f){c+="
  • "+f.name+"
  • "});c+="

";c+="

Similar

    ";g.forEach(a.artist.similar.artist,function(f){c+="
  • "+f.name+"
  • "});c+="

";b[a.artist.name.toLowerCase()].htmlString=c}};g.plugin("lastfm",function(){return{_setup:function(a){a._container=document.createElement("div");a._container.style.display="none";a._container.innerHTML="";a.artist=a.artist&&a.artist.toLowerCase()||"";var c=document.getElementById(a.target);if(!c&&g.plugin.debug)throw Error("target container doesn't exist");c&&c.appendChild(a._container);if(!b[a.artist]){b[a.artist]={count:0,htmlString:"Unknown Artist"}; -g.getJSONP("//ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+a.artist+"&api_key="+a.apikey+"&format=json&callback=lastFMcallback",d,false)}b[a.artist].count++},start:function(a,c){c._container.innerHTML=b[c.artist].htmlString;c._container.style.display="inline"},end:function(a,c){c._container.style.display="none";c._container.innerHTML=""},_teardown:function(a){--b[a.artist].count||delete b[a.artist];document.getElementById(a.target)&&document.getElementById(a.target).removeChild(a._container)}}}(), -{about:{name:"Popcorn LastFM Plugin",version:"0.1",author:"Steven Weerdenburg",website:"http://sweerdenburg.wordpress.com/"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"lastfm-container",artist:{elem:"input",type:"text",label:"Artist"}}})})(Popcorn);(function(g){g.plugin("lowerthird",{manifest:{about:{name:"Popcorn lowerthird Plugin",version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"lowerthird-container",salutation:{elem:"input",type:"text",label:"Text",optional:true},name:{elem:"input",type:"text",label:"Text"},role:{elem:"input",type:"text",label:"Text",optional:true}}},_setup:function(b){var d=document.getElementById(b.target); -if(!this.container){this.container=document.createElement("div");this.container.style.position="absolute";this.container.style.color="white";this.container.style.textShadow="black 2px 2px 6px";this.container.style.fontSize="24px";this.container.style.fontWeight="bold";this.container.style.paddingLeft="40px";this.container.style.width=this.video.offsetWidth+"px";this.container.style.left=this.position().left+"px";this.video.parentNode.appendChild(this.container)}if(b.target&&b.target!=="lowerthird-container"){b.container= -document.createElement("div");if(!d&&g.plugin.debug)throw Error("target container doesn't exist");d&&d.appendChild(b.container)}else b.container=this.container},start:function(b,d){d.container.innerHTML=(d.salutation?d.salutation+" ":"")+d.name+(d.role?"
"+d.role:"");this.container.style.top=this.position().top+this.video.offsetHeight-(40+this.container.offsetHeight)+"px"},end:function(b,d){for(;d.container.firstChild;)d.container.removeChild(d.container.firstChild)}})})(Popcorn);(function(g){var b=1,d=false;g.plugin("googlefeed",function(a){var c=function(){var o=false,l=0,i=document.getElementsByTagName("link"),r=i.length,k=document.head||document.getElementsByTagName("head")[0],j=document.createElement("link");if(window.GFdynamicFeedControl)d=true;else g.getScript("//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js",function(){d=true});for(;l"+l+"";else if(g.plugin.debug)throw Error("Did not receive data from server."); -},false)};return{_setup:function(f){var h=f.containerid=g.guid(),p=d[h]=document.createElement("div"),o=a[h]=document.getElementById(f.target);if(!o&&g.plugin.debug)throw Error("Target container could not be found.");p.style.display="none";p.innerHTML="";o.appendChild(p);b[h]={htmlString:f.playlist||"Unknown Source"||f.album||"Unknown Source"};c(f)},start:function(f,h){var p=h.containerid,o=d[p];o.innerHTML=b[p].htmlString;o.style.display="inline"},end:function(f,h){container=d[h.containerid];container.style.display= -"none";container.innerHTML=""},_teardown:function(f){f=f.containerid;var h=a[f];b[f]&&delete b[f];h&&h.removeChild(d[f]);delete a[f];delete d[f]}}}(),{manifest:{about:{name:"Popcorn Rdio Plugin",version:"0.1",author:"Denise Rigato"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"rdio",artist:{elem:"input",type:"text",label:"Artist"},album:{elem:"input",type:"text",label:"Album"},person:{elem:"input",type:"text",label:"Person"},id:{elem:"input", -type:"text",label:"Id"},playlist:{elem:"input",type:"text",label:"Playlist"}}}})})(Popcorn);(function(g){var b=0,d=function(a,c){var f=a.container=document.createElement("div"),h=f.style,p=a.media,o=function(){var l=a.position();h.fontSize="18px";h.width=p.offsetWidth+"px";h.top=l.top+p.offsetHeight-f.offsetHeight-40+"px";h.left=l.left+"px";setTimeout(o,10)};f.id=c||g.guid();h.position="absolute";h.color="white";h.textShadow="black 2px 2px 6px";h.fontWeight="bold";h.textAlign="center";o();a.media.parentNode.appendChild(f);return f};g.plugin("subtitle",{manifest:{about:{name:"Popcorn Subtitle Plugin", -version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"subtitle-container",text:{elem:"input",type:"text",label:"Text"}}},_setup:function(a){var c=document.createElement("div");c.id="subtitle-"+b++;c.style.display="none";!this.container&&(!a.target||a.target==="subtitle-container")&&d(this);a.container=a.target&&a.target!=="subtitle-container"?document.getElementById(a.target)|| -d(this,a.target):this.container;document.getElementById(a.container.id)&&document.getElementById(a.container.id).appendChild(c);a.innerContainer=c;a.showSubtitle=function(){a.innerContainer.innerHTML=a.text||""}},start:function(a,c){c.innerContainer.style.display="inline";c.showSubtitle(c,c.text)},end:function(a,c){c.innerContainer.style.display="none";c.innerContainer.innerHTML=""},_teardown:function(a){a.container.removeChild(a.innerContainer)}})})(Popcorn);(function(g){var b=[],d=function(){this.name="";this.contains={};this.toString=function(){var a=[],c;for(c in this.contains)this.contains.hasOwnProperty(c)&&a.push(" "+this.contains[c]);return a.toString()}};g.plugin("tagthisperson",function(){return{_setup:function(a){var c=false;if(!document.getElementById(a.target)&&g.plugin.debug)throw Error("target container doesn't exist");for(var f=0;f ":"";c._p.contains[c.person]+=c.href?" "+c.person+"":c.person;document.getElementById(c.target).innerHTML=c._p.toString()},end:function(a,c){delete c._p.contains[c.person];document.getElementById(c.target).innerHTML=c._p.toString()}}}(),{about:{name:"Popcorn tagthisperson Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"text", -label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"tagthisperson-container",person:{elem:"input",type:"text",label:"Name"},image:{elem:"input",type:"url",label:"Image Src",optional:true},href:{elem:"input",type:"url",label:"URL",optional:true}}})})(Popcorn);(function(g){var b=false;g.plugin("twitter",{manifest:{about:{name:"Popcorn Twitter Plugin",version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"number",label:"In"},end:{elem:"input",type:"number",label:"Out"},src:{elem:"input",type:"text",label:"Source"},target:"twitter-container",height:{elem:"input",type:"number",label:"Height",optional:true},width:{elem:"input",type:"number",label:"Width",optional:true}}},_setup:function(d){if(!window.TWTR&& -!b){b=true;g.getScript("//widgets.twimg.com/j/2/widget.js")}var a=document.getElementById(d.target);d.container=document.createElement("div");d.container.setAttribute("id",g.guid());d.container.style.display="none";if(!a&&g.plugin.debug)throw Error("target container doesn't exist");a&&a.appendChild(d.container);var c=d.src||"";a=d.width||250;var f=d.height||200,h=/^@/.test(c),p={version:2,id:d.container.getAttribute("id"),rpp:30,width:a,height:f,interval:6E3,theme:{shell:{background:"#ffffff",color:"#000000"}, -tweets:{background:"#ffffff",color:"#444444",links:"#1985b5"}},features:{loop:true,timestamp:true,avatars:true,hashtags:true,toptweets:true,live:true,scrollbar:false,behavior:"default"}},o=function(l){if(window.TWTR)if(h){p.type="profile";(new TWTR.Widget(p)).render().setUser(c).start()}else{p.type="search";p.search=c;p.subject=c;(new TWTR.Widget(p)).render().start()}else setTimeout(function(){o(l)},1)};o(this)},start:function(d,a){a.container.style.display="inline"},end:function(d,a){a.container.style.display= -"none"},_teardown:function(d){document.getElementById(d.target)&&document.getElementById(d.target).removeChild(d.container)}})})(Popcorn);(function(g){g.plugin("webpage",{manifest:{about:{name:"Popcorn Webpage Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{id:{elem:"input",type:"text",label:"Id",optional:true},start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},src:{elem:"input",type:"url",label:"Src"},target:"iframe-container"}},_setup:function(b){var d=document.getElementById(b.target);b.src=b.src.replace(/^(https?:)?(\/\/)?/,"//");b._iframe=document.createElement("iframe"); -b._iframe.setAttribute("width","100%");b._iframe.setAttribute("height","100%");b._iframe.id=b.id;b._iframe.src=b.src;b._iframe.style.display="none";if(!d&&g.plugin.debug)throw Error("target container doesn't exist");d&&d.appendChild(b._iframe)},start:function(b,d){d._iframe.src=d.src;d._iframe.style.display="inline"},end:function(b,d){d._iframe.style.display="none"},_teardown:function(b){document.getElementById(b.target)&&document.getElementById(b.target).removeChild(b._iframe)}})})(Popcorn);var wikiCallback; -(function(g){g.plugin("wikipedia",{manifest:{about:{name:"Popcorn Wikipedia Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},lang:{elem:"input",type:"text",label:"Language",optional:true},src:{elem:"input",type:"url",label:"Src"},title:{elem:"input",type:"text",label:"Title",optional:true},numberofwords:{elem:"input",type:"text",label:"Num Of Words",optional:true},target:"wikipedia-container"}}, -_setup:function(b){var d,a=g.guid();if(!b.lang)b.lang="en";b.numberofwords=b.numberofwords||200;window["wikiCallback"+a]=function(c){b._link=document.createElement("a");b._link.setAttribute("href",b.src);b._link.setAttribute("target","_blank");b._link.innerHTML=b.title||c.parse.displaytitle;b._desc=document.createElement("p");d=c.parse.text["*"].substr(c.parse.text["*"].indexOf("

"));d=d.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g,"");d=d.split(" ");b._desc.innerHTML=d.slice(0,d.length>= -b.numberofwords?b.numberofwords:d.length).join(" ")+" ...";b._fired=true};if(b.src)g.getScript("//"+b.lang+".wikipedia.org/w/api.php?action=parse&props=text&page="+b.src.slice(b.src.lastIndexOf("/")+1)+"&format=json&callback=wikiCallback"+a);else if(g.plugin.debug)throw Error("Wikipedia plugin needs a 'src'");},start:function(b,d){var a=function(){if(d._fired){if(d._link&&d._desc)if(document.getElementById(d.target)){document.getElementById(d.target).appendChild(d._link);document.getElementById(d.target).appendChild(d._desc); -d._added=true}}else setTimeout(function(){a()},13)};a()},end:function(b,d){if(d._added){document.getElementById(d.target).removeChild(d._link);document.getElementById(d.target).removeChild(d._desc)}},_teardown:function(b){if(b._added){b._link.parentNode&&document.getElementById(b.target).removeChild(b._link);b._desc.parentNode&&document.getElementById(b.target).removeChild(b._desc);delete b.target}}})})(Popcorn);(function(g){var b={text:function(d){var a=d.post,c=document.createElement("a"),f=document.createTextNode(a.title),h=document.createElement("div");c.setAttribute("href",a.post_url);c.appendChild(f);h.appendChild(c);h.innerHTML+=a.body;d._container.appendChild(h)},photo:function(d){for(var a=d.width||250,c=-1,f=[d.post.photos.length],h=[d.post.photos.length],p=document.createElement("div"),o=document.createElement("img"),l=d.post,i=0,r=l.photos.length;i";o.setAttribute("src",h[a]);o.setAttribute("alt","Pic"+a);p.appendChild(o);p.innerHTML+="
"}p.innerHTML+="
"+l.caption;d._container.appendChild(p)},audio:function(d){var a= -document.createElement("div"),c=document.createElement("a"),f=d.post;if(f.artist){var h=document.createElement("img");a.innerHTML+="Artist: "+f.artist+"
";c.setAttribute("href",f.source_url);h.setAttribute("src",f.album_art);h.setAttribute("alt",f.album);c.appendChild(h);a.appendChild(c);a.innerHTML+="


"+f.track_number+" - "+f.track_name+"
"}else{h=document.createTextNode(f.source_title);c.setAttribute("href",f.source_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="
"}a.innerHTML+= -f.player+" "+f.plays+"plays
"+f.caption;d._container.appendChild(a)},video:function(d){for(var a=d.width||400,c=-1,f=d.post,h=document.createElement("div"),p,o=0,l=f.player.length;o"+f.caption;d._container.appendChild(h)}, -chat:function(d){var a=d.post,c,f=document.createElement("div");f.innerHTML+=""+a.title+"

";for(var h=0,p=a.dialogue.length;h"}d._container.appendChild(f)},quote:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.text);c.setAttribute("href",f.post_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="

Source: "+f.source+""; -d._container.appendChild(a)},link:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.title);c.setAttribute("href",f.post_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="
"+f.description;d._container.appendChild(a)},answer:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.asking_name);a.innerHTML="Inquirer: ";c.setAttribute("href",f.asking_url);c.appendChild(h); -a.appendChild(c);a.innerHTML+="

Question: "+f.question+"
Answer: "+f.answer;d._container.appendChild(a)}};g.plugin("tumblr",{manifest:{about:{name:"Popcorn Tumblr Plugin",version:"0.1",author:"Matthew Schranz, @mjschranz",website:"mschranz.wordpress.com"},options:{requestType:{elem:"select",options:["INFO","AVATAR","BLOGPOST"],label:"Type_Of_Plugin"},target:"tumblr-container",start:{elem:"input",type:"number",label:"Start_Time"},end:{elem:"input",type:"number",label:"End_Time"},base_hostname:{elem:"input", -type:"text",label:"User_Name"},api_key:{elem:"input",type:"text",label:"Application_Key",optional:true},size:{elem:"select",options:[16,24,30,40,48,64,96,128,512],label:"avatarSize",optional:true},blogId:{elem:"input",type:"number",label:"Blog_ID",optional:true},width:{elem:"input",type:"number",label:"Photo_Width",optional:true}}},_setup:function(d){var a=document.getElementById(d.target),c,f,h=this;d.requestType=d.requestType.toLowerCase();(!d.base_hostname||!d.api_key&&(d.requestType==="info"|| -d.requestType==="blogpost"))&&g.error("Must provide a blog URL to the plugin and an api_key for Blog Info and Blog Post requests.");!(["info","avatar","blogpost"].indexOf(d.requestType)>-1)&&g.error("Invalid tumblr plugin type.");d.requestType==="blogpost"&&d.blogId===undefined&&g.error("Error. BlogId required for blogpost requests");!a&&g.plugin.debug&&g.error("Target Tumblr container doesn't exist.");c=d.base_hostname.slice(d.base_hostname.indexOf("/")+2,d.base_hostname.length);f=d.base_hostname.slice(0, -d.base_hostname.indexOf("/")+2);c=f==="http://"||f==="https://"?c:d.base_hostname;if(c.indexOf("/")>-1)c=c.slice(0,c.indexOf("/"));d.base_hostname=c;d._container=document.createElement("div");d._container.id="tumblrdiv-"+g.guid();if(d.requestType==="avatar")d._container.innerHTML="BlogAvatar";else{c=d.requestType==="blogpost"?"posts":"info";c="http://api.tumblr.com/v2/blog/"+d.base_hostname+"/"+c+"?api_key="+d.api_key+ -"&id="+d.blogId+"&jsonp=tumblrCallBack";this.listen("tumblrError",function(p){g.error(p)});g.getJSONP(c,function(p){if(p.meta.msg==="OK"){var o=document.createElement("div");if(d.requestType==="blogpost"){d.post=p.response.posts[0];var l=d.post.type;p=d.post.tags;o.innerHTML="Date Published: "+d.post.date.slice(0,d.post.date.indexOf(" "))+"
";if(p.length!==0){o.innerHTML+="Tags: "+p[0];for(var i=1,r=p.length;iapikey";if(!a&&g.plugin.debug)throw"target container doesn't exist";a&&a.appendChild(b._container)}if(!a&& -g.plugin.debug)throw Error("target container doesn't exist");a&&a.appendChild(b._container);b._container.style.display="none"},start:function(b,d){d._container.style.display="block"},end:function(b,d){d._container.style.display="none"},_teardown:function(b){var d=document.getElementById(b.target);d&&d.removeChild(b._container)}})})(Popcorn);(function(g){g.plugin("mustache",function(b){var d,a,c,f;g.getScript("http://mustache.github.com/extras/mustache.js");var h=!!b.dynamic,p=typeof b.template,o=typeof b.data,l=document.getElementById(b.target);if(!l&&g.plugin.debug)throw Error("target container doesn't exist");b.container=l||document.createElement("div");if(p==="function")if(h)c=b.template;else f=b.template(b);else if(p==="string")f=b.template;else if(g.plugin.debug)throw Error("Mustache Plugin Error: options.template must be a String or a Function."); -else f="";if(o==="function")if(h)d=b.data;else a=b.data(b);else if(o==="string")a=JSON.parse(b.data);else if(o==="object")a=b.data;else if(g.plugin.debug)throw Error("Mustache Plugin Error: options.data must be a String, Object, or Function.");else a="";return{start:function(i,r){var k=function(){if(window.Mustache){if(d)a=d(r);if(c)f=c(r);var j=Mustache.to_html(f,a).replace(/^\s*/mg,"");r.container.innerHTML=j}else setTimeout(function(){k()},10)};k()},end:function(i,r){r.container.innerHTML=""}, -_teardown:function(){d=a=c=f=null}}},{about:{name:"Popcorn Mustache Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"mustache-container",template:{elem:"input",type:"text",label:"Template"},data:{elem:"input",type:"text",label:"Data"},dynamic:{elem:"input",type:"text",label:"Dynamic",optional:true}}})})(Popcorn);(function(g){function b(a,c){if(a.map)a.map.div.style.display=c;else setTimeout(function(){b(a,c)},10)}var d=1;g.plugin("openmap",function(a){var c,f,h,p,o,l,i,r,k=document.getElementById(a.target);c=document.createElement("div");c.id="openmapdiv"+d;c.style.width="100%";c.style.height="100%";d++;if(!k&&g.plugin.debug)throw Error("target container doesn't exist");k&&k.appendChild(c);r=function(){if(window.OpenLayers){if(a.location){location=new OpenLayers.LonLat(0,0);g.getJSONP("//tinygeocoder.com/create-api.php?q="+ -a.location+"&callback=jsonp",function(v){f=new OpenLayers.LonLat(v[1],v[0]);a.map.setCenter(f)})}else f=new OpenLayers.LonLat(a.lng,a.lat);a.type=a.type||"ROADMAP";if(a.type==="SATELLITE"){a.map=new OpenLayers.Map({div:c,maxResolution:0.28125,tileSize:new OpenLayers.Size(512,512)});var j=new OpenLayers.Layer.WorldWind("LANDSAT","//worldwind25.arc.nasa.gov/tile/tile.aspx",2.25,4,{T:"105"});a.map.addLayer(j);p=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326")}else if(a.type=== -"TERRAIN"){p=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326");a.map=new OpenLayers.Map({div:c,projection:h});j=new OpenLayers.Layer.WMS("USGS Terraserver","//terraserver-usa.org/ogcmap.ashx?",{layers:"DRG"});a.map.addLayer(j)}else{h=new OpenLayers.Projection("EPSG:900913");p=new OpenLayers.Projection("EPSG:4326");f=f.transform(p,h);a.map=new OpenLayers.Map({div:c,projection:h,displayProjection:p});j=new OpenLayers.Layer.OSM;a.map.addLayer(j)}if(a.map)a.map.div.style.display= -"none"}else setTimeout(function(){r()},50)};r();return{_setup:function(j){window.OpenLayers||g.getScript("//openlayers.org/api/OpenLayers.js");var v=function(){if(j.map){j.zoom=j.zoom||2;if(j.zoom&&typeof j.zoom!=="number")j.zoom=+j.zoom;j.map.setCenter(f,j.zoom);if(j.markers){var w=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]),n=function(u){clickedFeature=u.feature;if(clickedFeature.attributes.text){i=new OpenLayers.Popup.FramedCloud("featurePopup",clickedFeature.geometry.getBounds().getCenterLonLat(), -new OpenLayers.Size(120,250),clickedFeature.attributes.text,null,true,function(){l.unselect(this.feature)});clickedFeature.popup=i;i.feature=clickedFeature;j.map.addPopup(i)}},y=function(u){feature=u.feature;if(feature.popup){i.feature=null;j.map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null}},C=function(u){g.getJSONP("//tinygeocoder.com/create-api.php?q="+u.location+"&callback=jsonp",function(x){x=(new OpenLayers.Geometry.Point(x[1],x[0])).transform(p,h);var A=OpenLayers.Util.extend({}, -w);if(!u.size||isNaN(u.size))u.size=14;A.pointRadius=u.size;A.graphicOpacity=1;A.externalGraphic=u.icon;x=new OpenLayers.Feature.Vector(x,null,A);if(u.text)x.attributes={text:u.text};o.addFeatures([x])})};o=new OpenLayers.Layer.Vector("Point Layer",{style:w});j.map.addLayer(o);for(var e=0,m=j.markers.length;e
"+d.text+"
"+d.innerHTML;return{start:function(p,o){c.style.display="block";if(o.direction==="down")f.scrollTop=f.scrollHeight},end:function(){c.style.display="none"},_teardown:function(){f&&c&&f.removeChild(c)&&!f.firstChild&&a.removeChild(f)}}},{about:{name:"Popcorn Timeline Plugin",version:"0.1",author:"David Seifried @dcseifried",website:"dseifried.wordpress.com"}, -options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"feed-container",title:{elem:"input",type:"text",label:"title"},text:{elem:"input",type:"text",label:"text"},innerHTML:{elem:"input",type:"text",label:"innerHTML",optional:true},direction:{elem:"input",type:"text",label:"direction",optional:true}}})})(Popcorn);(function(g,b){var d={};g.plugin("documentcloud",{manifest:{about:{name:"Popcorn Document Cloud Plugin",version:"0.1",author:"@humphd, @ChrisDeCairos",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"documentcloud-container",width:{elem:"input",type:"text",label:"Width",optional:true},height:{elem:"input",type:"text",label:"Height",optional:true},src:{elem:"input",type:"text",label:"PDF URL"},preload:{elem:"input", -type:"boolean",label:"Preload",optional:true},page:{elem:"input",type:"number",label:"Page Number",optional:true},aid:{elem:"input",type:"number",label:"Annotation Id",optional:true}}},_setup:function(a){function c(){function i(u){a._key=u.api.getId();a._changeView=function(x){a.aid?x.pageSet.showAnnotation(x.api.getAnnotation(a.aid)):x.api.setCurrentPage(a.page)}}function r(){d[a._key]={num:1,id:a._containerId};h.loaded=true}h.loaded=false;var k=a.url.replace(/\.html$/,".js"),j=a.target,v=b.getElementById(j), -w=b.createElement("div"),n=g.position(v),y=a.width||n.width;n=a.height||n.height;var C=a.sidebar||true,e=a.text||true,m=a.pdf||true,q=a.showAnnotations||true,s=a.zoom||700,t=a.search||true;if(!function(u){var x=false;g.forEach(h.viewers,function(A){if(A.api.getSchema().canonicalURL===u){i(A);A=d[a._key];a._containerId=A.id;A.num+=1;x=true;h.loaded=true}});return x}(a.url)){w.id=a._containerId=g.guid(j);j="#"+w.id;v.appendChild(w);p.trigger("documentready");h.load(k,{width:y,height:n,sidebar:C,text:e, -pdf:m,showAnnotations:q,zoom:s,search:t,container:j,afterLoad:a.page||a.aid?function(u){i(u);a._changeView(u);w.style.visibility="hidden";u.elements.pages.hide();r()}:function(u){i(u);r();w.style.visibility="hidden";u.elements.pages.hide()}})}}function f(){window.DV.loaded?c():setTimeout(f,25)}var h=window.DV=window.DV||{},p=this;if(h.loading)f();else{h.loading=true;h.recordHit="//www.documentcloud.org/pixel.gif";var o=b.createElement("link"),l=b.getElementsByTagName("head")[0];o.rel="stylesheet"; -o.type="text/css";o.media="screen";o.href="//s3.documentcloud.org/viewer/viewer-datauri.css";l.appendChild(o);h.loaded=false;g.getScript("http://s3.documentcloud.org/viewer/viewer.js",function(){h.loading=false;c()})}},start:function(a,c){var f=b.getElementById(c._containerId),h=DV.viewers[c._key];(c.page||c.aid)&&h&&c._changeView(h);if(f&&h){f.style.visibility="visible";h.elements.pages.show()}},end:function(a,c){var f=b.getElementById(c._containerId);if(f&&DV.viewers[c._key]){f.style.visibility= -"hidden";DV.viewers[c._key].elements.pages.hide()}},_teardown:function(a){var c=b.getElementById(a._containerId);if((a=a._key)&&DV.viewers[a]&&--d[a].num===0){for(DV.viewers[a].api.unload();c.hasChildNodes();)c.removeChild(c.lastChild);c.parentNode.removeChild(c)}}})})(Popcorn,window.document);(function(g){g.parser("parseJSON","JSON",function(b){var d={title:"",remote:"",data:[]};g.forEach(b.data,function(a){d.data.push(a)});return d})})(Popcorn);(function(g){g.parser("parseSBV",function(b){var d={title:"",remote:"",data:[]},a=[],c=0,f=0,h=function(k){k=k.split(":");var j=k.length-1,v;try{v=parseInt(k[j-1],10)*60+parseFloat(k[j],10);if(j===2)v+=parseInt(k[0],10)*3600}catch(w){throw"Bad cue";}return v},p=function(k,j){var v={};v[k]=j;return v};b=b.text.split(/(?:\r\n|\r|\n)/gm);for(f=b.length;c");a.push(p("subtitle",o))}catch(r){for(;c< -f&&b[c];)c++}for(;c[\t ]*/);l.start=i(p[0]); -h=p[1].indexOf(" ");if(h!==-1)p[1]=p[1].substr(0,h);for(l.end=i(p[1]);c/g,">");l.text=l.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>");l.text=l.text.replace(/\\N/gi,"
");a.push(r("subtitle",l))}d.data=a;return d})})(Popcorn);(function(g){function b(c,f){var h=c.substr(10).split(","),p;p={start:d(h[f.start]),end:d(h[f.end])};if(p.start===-1||p.end===-1)throw"Invalid time";var o=k.call(i,/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),l=o.replace,i;i=h.length;k=[];for(var r=f.text;r");return p}function d(c){var f=c.split(":");if(c.length!==10||f.length<3)return-1;return parseInt(f[0],10)*3600+parseInt(f[1],10)*60+parseFloat(f[2],10)}function a(c, -f){var h={};h[c]=f;return h}g.parser("parseSSA",function(c){var f={title:"",remote:"",data:[]},h=[],p=0,o;c=c.text.split(/(?:\r\n|\r|\n)/gm);for(o=c.length;p=2)return parseInt(r[0],10)*3600+parseInt(r[k-1],10)*60+parseFloat(r[k],10);for(r=l.length-1;r>=0;r--)if(l[r]<="9"&&l[r]>="0")break;r++;k=l.substr(r);i=i||0;if(k==="h")k=3600;else if(k==="m")k=60;else if(k==="s")k=1;else if(k==="ms")k=0.0010;else return-1;return parseFloat(l.substr(0,r))*k+i},p=function(l,i){var r={};r[l]=i;return r},o=function(l, -i){for(var r=l.firstChild,k;r;){if(r.nodeType===1)if(r.nodeName==="p"){k=r;var j=i,v={};v.text=k.textContent.replace(/^[\s]+|[\s]+$/gm,"").replace(/(?:\r\n|\r|\n)/gm,"
");v.id=k.getAttribute("xml:id")||k.getAttribute("id");v.start=h(k.getAttribute("begin"),j);v.end=h(k.getAttribute("end"),j);v.target=f;if(v.end<0){v.end=h(k.getAttribute("duration"),0);if(v.end>=0)v.end+=v.start;else v.end=Number.MAX_VALUE}k=v;d.data.push(p("subtitle",k));c++}else if(r.nodeName==="div"){k=h(r.getAttribute("begin")); -if(k<0)k=i;o(r,k)}r=r.nextSibling}};if(!b.xml||!b.xml.documentElement||!(a=b.xml.documentElement.firstChild))return d;for(;a.nodeName!=="body";)a=a.nextSibling;f="";o(a,0);return d})})(Popcorn);(function(g){g.parser("parseTTXT",function(b){var d={title:"",remote:"",data:[]},a=function(o){o=o.split(":");var l=0;try{return parseFloat(o[0],10)*60*60+parseFloat(o[1],10)*60+parseFloat(o[2],10)}catch(i){l=0}return l},c=function(o,l){var i={};i[o]=l;return i};b=b.xml.lastChild.lastChild;for(var f=Number.MAX_VALUE,h=[];b;){if(b.nodeType===1&&b.nodeName==="TextSample"){var p={};p.start=a(b.getAttribute("sampleTime"));p.text=b.getAttribute("text");if(p.text){p.end=f-0.0010;h.push(c("subtitle",p))}f= -p.start}b=b.previousSibling}d.data=h.reverse();return d})})(Popcorn);(function(g){function b(a){var c=a.split(":");a=a.length;var f;if(a!==12&&a!==9)throw"Bad cue";a=c.length-1;try{f=parseInt(c[a-1],10)*60+parseFloat(c[a],10);if(a===2)f+=parseInt(c[0],10)*3600}catch(h){throw"Bad cue";}return f}function d(a,c){var f={};f[a]=c;return f}g.parser("parseVTT",function(a){var c={title:"",remote:"",data:[]},f=[],h=0,p=0,o,l;a=a.text.split(/(?:\r\n|\r|\n)/gm);p=a.length;if(p===0||a[0]!=="WEBVTT")return c;for(h++;h")===-1)throw"Bad cue";i=r.replace(/--\>/," --\> ").split(/[\t ]+/);if(i.length<2)throw"Bad cue";k.id=r;k.start=b(i[0]);k.end=b(i[2]);for(l=k;h");f.push(d("subtitle",l))}catch(j){for(h=h;h'+l.user.name+" at "+function(i){var r=h(i/60);i=p(i%60);return r+"."+(i<10?"0":"")+i}(l.start)+" "+function(i){function r(k,j){return k+" "+j+(k>1?"s":"")+" ago"}i=((new Date).getTime()-i.getTime())/1E3;if(i< -60)return r(p(i),"second");i/=60;if(i<60)return r(p(i),"minute");i/=60;if(i<24)return r(p(i),"hour");i/=24;if(i<30)return r(p(i),"day");if(i<365)return r(p(i/30),"month");return r(p(i/365),"year")}(l.date)+"
"+l.text+""}function c(l){if(b.swfobject&&b.soundcloud){var i={enable_api:true,object_id:l._playerId,url:l.src,show_comments:!l._options.api.key&&!l._options.api.commentdiv},r={id:l._playerId,name:l._playerId},k=document.createElement("div");k.setAttribute("id",l._playerId);l._container.appendChild(k); -swfobject.embedSWF("http://player.soundcloud.com/player.swf",l._playerId,l.offsetWidth,l.height,"9.0.0","expressInstall.swf",i,{allowscriptaccess:"always",wmode:"transparent"},r)}else setTimeout(function(){c(l)},15)}var f=Math.abs,h=Math.floor,p=Math.round,o={};g.soundcloud=function(l,i,r){g.getScript("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js");g.getScript("http://popcornjs.org/code/players/soundcloud/lib/soundcloud.player.api.js",function(){var k=1;soundcloud.addEventListener("onPlayerReady", -function(j,v){var w=o[j.api_getFlashId()];w.swfObj=j;w.duration=j.api_getTrackDuration();w.currentTime=j.api_getTrackPosition();w.volume=w.previousVolume=j.api_getVolume()/100;w._mediaId=v.mediaId;w.dispatchEvent("load");w.dispatchEvent("canplay");w.dispatchEvent("durationchange");w.timeupdate()});soundcloud.addEventListener("onMediaStart",function(j){j=o[j.api_getFlashId()];j.played=1;j.dispatchEvent("playing")});soundcloud.addEventListener("onMediaPlay",function(j){if(k)k=0;else o[j.api_getFlashId()].dispatchEvent("play")}); -soundcloud.addEventListener("onMediaPause",function(j){o[j.api_getFlashId()].dispatchEvent("pause")});soundcloud.addEventListener("onMediaBuffering",function(j){j=o[j.api_getFlashId()];j.dispatchEvent("progress");if(j.readyState===0){j.readyState=3;j.dispatchEvent("readystatechange")}});soundcloud.addEventListener("onMediaDoneBuffering",function(j){o[j.api_getFlashId()].dispatchEvent("canplaythrough")});soundcloud.addEventListener("onMediaEnd",function(j){j=o[j.api_getFlashId()];j.paused=1;j.dispatchEvent("ended")}); -soundcloud.addEventListener("onMediaSeek",function(j){var v=o[j.api_getFlashId()];v.setCurrentTime(j.api_getTrackPosition());v.paused&&v.dispatchEvent("timeupdate")});soundcloud.addEventListener("onPlayerError",function(j){o[j.api_getFlashId()].dispatchEvent("error")})});return new g.soundcloud.init(l,i,r)};g.soundcloud.init=function(){function l(i){var r=i._options,k=i._container,j=k.getBoundingClientRect();i.width=r.width||d(k,"width")||"100%";i.height=r.height||d(k,"height")||"81px";i.src=r.src; -i.autoplay=r.autoplay;if(parseFloat(i.height,10)!==81)i.height="81px";i.offsetLeft=j.left;i.offsetTop=j.top;i.offsetHeight=parseFloat(i.height,10);i.offsetWidth=parseFloat(i.width,10);if(/[\d]+%/.test(i.width)){r=d(k,"width");i._container.style.width=i.width;i.offsetWidth=i._container.offsetWidth;i._container.style.width=r}if(/[\d]+%/.test(i.height)){r=d(k,"height");i._container.style.height=i.height;i.offsetHeight=i._container.offsetHeight;i._container.style.height=r}}return function(i,r,k){if(i)if(r){if(/file/.test(location.protocol))throw"Must run from a web server!"; -}else throw"Must supply a source!";else throw"Must supply an id!";if(!(this._container=document.getElementById(i)))throw"Could not find that container in the DOM!";k=k||{};k.api=k.api||{};k.target=i;k.src=r;k.api.commentformat=k.api.commentformat||a;this._mediaId=0;this._listeners={};this._playerId=g.guid(k.target);this._containerId=k.target;this._options=k;this._comments=[];this._popcorn=null;l(this);this.duration=0;this.volume=1;this.ended=this.currentTime=0;this.paused=1;this.readyState=0;this.playbackRate= -1;this.left=this.top=0;this.autoplay=null;this.played=0;this.addEventListener("load",function(){var j=this.getBoundingClientRect();this.top=j.top;this.left=j.left;this.offsetWidth=this.swfObj.offsetWidth;this.offsetHeight=this.swfObj.offsetHeight;this.offsetLeft=this.swfObj.offsetLeft;this.offsetTop=this.swfObj.offsetTop});o[this._playerId]=this;c(this)}}();g.soundcloud.init.prototype=g.soundcloud.prototype;g.extend(g.soundcloud.prototype,{setVolume:function(l){if(!(!l&&l!==0)){if(l<0)l=-l;if(l>1)l%= -1;this.volume=this.previousVolume=l;this.swfObj.api_setVolume(l*100);this.dispatchEvent("volumechange")}},setCurrentTime:function(l){if(!(!l&&l!==0)){this.currentTime=this.previousCurrentTime=l;this.ended=l>=this.duration;this.dispatchEvent("seeked")}},play:function(){if(this.swfObj){if(this.paused){this.paused=0;this.swfObj.api_play()}}else this.addEventListener("load",this.play)},pause:function(){if(this.swfObj){if(!this.paused){this.paused=1;this.swfObj.api_pause()}}else this.addEventListener("load", -this.pause)},mute:function(){if(this.swfObj)if(this.muted())if(this.paused)this.setVolume(this.oldVol);else this.volume=this.oldVol;else{this.oldVol=this.volume;if(this.paused)this.setVolume(0);else this.volume=0}else this.addEventListener("load",this.mute)},muted:function(){return this.volume===0},load:function(){if(this.swfObj){this.play();this.pause()}else this.addEventListener("load",this.load)},addEventListener:function(l,i){this._listeners[l]||(this._listeners[l]=[]);this._listeners[l].push(i); -return i},dispatchEvent:function(l){var i=this;l=l.type||l;l==="play"&&this.paused||l==="pause"&&!this.paused?this[l]():g.forEach(this._listeners[l],function(r){r.call(i)})},timeupdate:function(){var l=this,i=this.swfObj.api_getVolume()/100;if(f(this.currentTime-this.previousCurrentTime)>0.25)this.swfObj.api_seekTo(this.currentTime);else this.previousCurrentTime=this.currentTime=this.swfObj.api_getTrackPosition();if(i!==this.previousVolume)this.setVolume(i);else this.volume!==this.previousVolume&& -this.setVolume(this.volume);this.paused||this.dispatchEvent("timeupdate");l.ended||setTimeout(function(){l.timeupdate.call(l)},33)},getBoundingClientRect:function(){var l;if(this.swfObj){l=this.swfObj.getBoundingClientRect();return{bottom:l.bottom,left:l.left,right:l.right,top:l.top,width:l.width||l.right-l.left,height:l.height||l.bottom-l.top}}else{tmp=this._container.getBoundingClientRect();return{left:tmp.left,top:tmp.top,width:this.offsetWidth,height:this.offsetHeight,bottom:tmp.top+this.width, -right:tmp.top+this.height}}},registerPopcornWithPlayer:function(l){if(this.swfObj){this._popcorn=l;var i=this._options.api;if(i.key&&i.commentdiv){var r=this;g.xhr({url:"http://api.soundcloud.com/tracks/"+r._mediaId+"/comments.js?consumer_key="+i.key,success:function(k){g.forEach(k.json,function(j){r.addComment({start:j.timestamp/1E3,date:new Date(j.created_at),text:j.body,user:{name:j.user.username,profile:j.user.permalink_url,avatar:j.user.avatar_url}})})}})}}else this.addEventListener("load",function(){this.registerPopcornWithPlayer(l)})}}); -g.extend(g.soundcloud.prototype,{addComment:function(l,i){var r=this,k={start:l.start||0,date:l.date||new Date,text:l.text||"",user:{name:l.user.name||"",profile:l.user.profile||"",avatar:l.user.avatar||""},display:function(){return(i||r._options.api.commentformat)(k)}};this._comments.push(k);this._popcorn&&this._popcorn.subtitle({start:k.start,target:this._options.api.commentdiv,display:"inline",language:"en",text:k.display()})}})})(Popcorn,window);(function(){vimeo_player_loaded=function(g){vimeo_player_loaded[g]&&vimeo_player_loaded[g]()};vimeo_player_loaded.seek={};vimeo_player_loaded.loadProgress={};vimeo_player_loaded.play={};vimeo_player_loaded.pause={};Popcorn.player("vimeo",{_canPlayType:function(g,b){return/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(vimeo)/.test(b)&&g.toLowerCase()!=="video"},_setup:function(g){var b=this,d,a=document.createElement("div"),c=0,f=false,h=0,p,o;a.id=b.id+Popcorn.guid();b.appendChild(a);o=b.style.width?""+ -b.offsetWidth:"560";p=b.style.height?""+b.offsetHeight:"315";var l=function(){var i;i=b.src;var r=0,k=false;vimeo_player_loaded[a.id]=function(){d=document.getElementById(a.id);vimeo_player_loaded.seek[a.id]=function(w){if(w!==c){c=w;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate")}};vimeo_player_loaded.play[a.id]=function(){if(b.paused){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing");j()}};vimeo_player_loaded.pause[a.id]=function(){if(!b.paused){b.paused=true;b.dispatchEvent("pause")}}; -vimeo_player_loaded.loadProgress[a.id]=function(w){if(!k){k=true;b.dispatchEvent("loadstart")}w.percent===100&&b.dispatchEvent("canplaythrough")};d.api_addEventListener("seek","vimeo_player_loaded.seek."+a.id);d.api_addEventListener("loadProgress","vimeo_player_loaded.loadProgress."+a.id);d.api_addEventListener("play","vimeo_player_loaded.play."+a.id);d.api_addEventListener("pause","vimeo_player_loaded.pause."+a.id);var j=function(){if(!b.paused){c=d.api_getCurrentTime();b.dispatchEvent("timeupdate"); -setTimeout(j,10)}},v=function(){var w=d.api_getVolume()===0,n=d.api_getVolume();if(f!==w){f=w;b.dispatchEvent("volumechange")}if(h!==n){h=n;b.dispatchEvent("volumechange")}setTimeout(v,250)};b.play=function(){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing");j();d.api_play()};b.pause=function(){if(!b.paused){b.paused=true;b.dispatchEvent("pause");d.api_pause()}};Popcorn.player.defineProperty(b,"currentTime",{set:function(w){if(!w)return c;c=+w;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate"); -d.api_seekTo(c);return c},get:function(){return c}});Popcorn.player.defineProperty(b,"muted",{set:function(w){if(d.api_getVolume()===0!==w)if(w){r=d.api_getVolume();d.api_setVolume(0)}else d.api_setVolume(r)},get:function(){return d.api_getVolume()===0}});Popcorn.player.defineProperty(b,"volume",{set:function(w){if(!w||typeof w!=="number"||w<0||w>1)return d.api_getVolume()/100;if(d.api_getVolume()!==w){d.api_setVolume(w*100);h=d.api_getVolume();b.dispatchEvent("volumechange")}return d.api_getVolume()/ -100},get:function(){return d.api_getVolume()/100}});b.dispatchEvent("loadedmetadata");b.dispatchEvent("loadeddata");b.duration=d.api_getDuration();b.dispatchEvent("durationchange");v();b.readyState=4;b.dispatchEvent("canplaythrough")};i=/\d+$/.exec(i);i={clip_id:i?i[0]:0,api:1,js_swf_id:a.id};Popcorn.extend(i,g);swfobject.embedSWF("//vimeo.com/moogaloop.swf",a.id,o,p,"9.0.0","expressInstall.swf",i,{allowscriptaccess:"always",allowfullscreen:"true",wmode:"transparent"},{})};window.swfobject?l():Popcorn.getScript("//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", -l)}})})();var onYouTubePlayerReady=function(g){onYouTubePlayerReady[g]&&onYouTubePlayerReady[g]()};onYouTubePlayerReady.stateChangeEventHandler={};onYouTubePlayerReady.onErrorEventHandler={}; -Popcorn.player("youtube",{_canPlayType:function(g,b){return/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(youtu)/.test(b)&&g.toLowerCase()!=="video"},_setup:function(g){var b=this,d=false,a=document.createElement("div"),c=0,f=0,h=true,p=false,o=false,l=100;b.paused=undefined;a.id=b.id+Popcorn.guid();g._container=a;b.appendChild(a);var i=function(){var r,k,j,v,w;onYouTubePlayerReady[a.id]=function(){g.youtubeObject=document.getElementById(a.id);onYouTubePlayerReady.stateChangeEventHandler[a.id]=function(C){if(!g.destroyed)if(C=== -2)if(p&&f===c&&f!==g.youtubeObject.getCurrentTime()){p=false;g.youtubeObject.seekTo(c)}else{c=g.youtubeObject.getCurrentTime();b.dispatchEvent("timeupdate");!b.paused&&b.pause()}else if(C===1&&!h)b.paused&&b.play();else if(C===-1)g.youtubeObject.playVideo();else if(C===1&&h){h=false;if(b.paused===true)b.pause();else if(b.paused===false)b.play();else if(d)b.play();else d||b.pause();b.duration=g.youtubeObject.getDuration();b.dispatchEvent("durationchange");y();b.dispatchEvent("loadedmetadata");b.dispatchEvent("loadeddata"); -b.readyState=4;b.dispatchEvent("canplaythrough")}else C===0&&b.dispatchEvent("ended")};onYouTubePlayerReady.onErrorEventHandler[a.id]=function(C){[2,100,101,150].indexOf(C)!==-1&&b.dispatchEvent("error")};g.youtubeObject.addEventListener("onStateChange","onYouTubePlayerReady.stateChangeEventHandler."+a.id);g.youtubeObject.addEventListener("onError","onYouTubePlayerReady.onErrorEventHandler."+a.id);var n=function(){if(!g.destroyed)if(!b.paused){c=g.youtubeObject.getCurrentTime();b.dispatchEvent("timeupdate"); -setTimeout(n,10)}},y=function(){if(!g.destroyed){if(o!==g.youtubeObject.isMuted()){o=g.youtubeObject.isMuted();b.dispatchEvent("volumechange")}if(l!==g.youtubeObject.getVolume()){l=g.youtubeObject.getVolume();b.dispatchEvent("volumechange")}setTimeout(y,250)}};b.play=function(){if(!g.destroyed){if(b.paused!==false||g.youtubeObject.getPlayerState()!==1){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing")}n();g.youtubeObject.playVideo()}};b.pause=function(){if(!g.destroyed)if(b.paused!== -true||g.youtubeObject.getPlayerState()!==2){b.paused=true;b.dispatchEvent("pause");g.youtubeObject.pauseVideo()}};Popcorn.player.defineProperty(b,"currentTime",{set:function(C){c=f=+C;p=true;if(g.destroyed)return c;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate");g.youtubeObject.seekTo(c);return c},get:function(){return c}});Popcorn.player.defineProperty(b,"muted",{set:function(C){if(g.destroyed)return C;if(g.youtubeObject.isMuted()!==C){C?g.youtubeObject.mute():g.youtubeObject.unMute();o= -g.youtubeObject.isMuted();b.dispatchEvent("volumechange")}return g.youtubeObject.isMuted()},get:function(){if(g.destroyed)return 0;return g.youtubeObject.isMuted()}});Popcorn.player.defineProperty(b,"volume",{set:function(C){if(g.destroyed)return C;if(g.youtubeObject.getVolume()/100!==C){g.youtubeObject.setVolume(C*100);l=g.youtubeObject.getVolume();b.dispatchEvent("volumechange")}return g.youtubeObject.getVolume()/100},get:function(){if(g.destroyed)return 0;return g.youtubeObject.getVolume()/100}})}; -g.controls=+g.controls===0||+g.controls===1?g.controls:1;g.annotations=+g.annotations===1||+g.annotations===3?g.annotations:1;r={playerapiid:a.id};k=/^.*(?:\/|v=)(.{11})/.exec(b.src)[1];w=(b.src.split("?")[1]||"").replace(/v=.{11}/,"");d=/autoplay=1/.test(w);j=b.style.width?""+b.offsetWidth:"560";v=b.style.height?""+b.offsetHeight:"315";k={id:a.id,"data-youtube-player":"//www.youtube.com/e/"+k+"?"+w+"&enablejsapi=1&playerapiid="+a.id+"&version=3"};swfobject.embedSWF(k["data-youtube-player"],a.id, -j,v,"8",undefined,r,{wmode:"transparent",allowScriptAccess:"always"},k)};window.swfobject?i():Popcorn.getScript("//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",i)},_teardown:function(g){g.destroyed=true;g.youtubeObject.stopVideo();g.youtubeObject.clearVideo();this.removeChild(document.getElementById(g._container.id))}}); +(function(r,f){function n(a,g){return function(){if(d.plugin.debug)return a.apply(this,arguments);try{return a.apply(this,arguments)}catch(l){d.plugin.errors.push({plugin:g,thrown:l,source:a.toString()});this.emit("pluginerror",d.plugin.errors)}}}if(f.addEventListener){var c=Array.prototype,b=Object.prototype,e=c.forEach,h=c.slice,i=b.hasOwnProperty,j=b.toString,p=r.Popcorn,m=[],o=false,q={events:{hash:{},apis:{}}},s=function(){return r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame|| +r.oRequestAnimationFrame||r.msRequestAnimationFrame||function(a){r.setTimeout(a,16)}}(),d=function(a,g){return new d.p.init(a,g||null)};d.version="1.3";d.isSupported=true;d.instances=[];d.p=d.prototype={init:function(a,g){var l,k=this;if(typeof a==="function")if(f.readyState==="complete")a(f,d);else{m.push(a);if(!o){o=true;var t=function(){f.removeEventListener("DOMContentLoaded",t,false);for(var z=0,C=m.length;z=2?v():k.media.addEventListener("loadeddata",v,false);return this}}};d.p.init.prototype= +d.p;d.byId=function(a){for(var g=d.instances,l=g.length,k=0;k=0;l--){k=a.data.running[g][l];k._natives.end.call(a,null,k)}}return a},enable:function(a,g){if(a.data.disabled[g]){a.data.disabled[g]=false;for(var l=a.data.running[g].length-1,k;l>=0;l--){k=a.data.running[g][l];k._natives.start.call(a,null,k)}}return a},destroy:function(a){var g= +a.data.events,l=a.data.trackEvents,k,t,u,v;for(t in g){k=g[t];for(u in k)delete k[u];g[t]=null}for(v in d.registryByName)d.removePlugin(a,v);l.byStart.length=0;l.byEnd.length=0;if(!a.isDestroyed){a.data.timeUpdate&&a.media.removeEventListener("timeupdate",a.data.timeUpdate,false);a.isDestroyed=true}}});d.guid.counter=1;d.extend(d.p,function(){var a={};d.forEach("load play pause currentTime playbackRate volume duration preload playbackRate autoplay loop controls muted buffered readyState seeking paused played seekable ended".split(/\s+/g), +function(g){a[g]=function(l){var k;if(typeof this.media[g]==="function"){if(l!=null&&/play|pause/.test(g))this.media.currentTime=d.util.toSeconds(l);this.media[g]();return this}if(l!=null){k=this.media[g];this.media[g]=l;k!==l&&this.emit("attrchange",{attribute:g,previousValue:k,currentValue:l});return this}return this.media[g]}});return a}());d.forEach("enable disable".split(" "),function(a){d.p[a]=function(g){return d[a](this,g)}});d.extend(d.p,{roundTime:function(){return Math.round(this.media.currentTime)}, +exec:function(a,g,l){var k=arguments.length,t,u;try{u=d.util.toSeconds(a)}catch(v){}if(typeof u==="number")a=u;if(typeof a==="number"&&k===2){l=g;g=a;a=d.guid("cue")}else if(k===1)g=-1;else if(t=this.getTrackEvent(a)){if(typeof a==="string"&&k===2){if(typeof g==="number")l=t._natives.start;if(typeof g==="function"){l=g;g=t.start}}}else if(k>=2){if(typeof g==="string"){try{u=d.util.toSeconds(g)}catch(z){}g=u}if(typeof g==="number")l=d.nop();if(typeof g==="function"){l=g;g=-1}}d.addTrackEvent(this, +{id:a,start:g,end:g+1,_running:false,_natives:{start:l||d.nop,end:d.nop,type:"cue"}});return this},mute:function(a){a=a==null||a===true?"muted":"unmuted";if(a==="unmuted"){this.media.muted=false;this.media.volume=this.data.state.volume}if(a==="muted"){this.data.state.volume=this.media.volume;this.media.muted=true}this.emit(a);return this},unmute:function(a){return this.mute(a==null?false:!a)},position:function(){return d.position(this.media)},toggle:function(a){return d[this.data.disabled[a]?"enable": +"disable"](this,a)},defaults:function(a,g){if(d.isArray(a)){d.forEach(a,function(l){for(var k in l)this.defaults(k,l[k])},this);return this}if(!this.options.defaults)this.options.defaults={};this.options.defaults[a]||(this.options.defaults[a]={});d.extend(this.options.defaults[a],g);return this}});d.Events={UIEvents:"blur focus focusin focusout load resize scroll unload",MouseEvents:"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave click dblclick",Events:"loadstart progress suspend emptied stalled play pause error loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange"}; +d.Events.Natives=d.Events.UIEvents+" "+d.Events.MouseEvents+" "+d.Events.Events;q.events.apiTypes=["UIEvents","MouseEvents","Events"];(function(a,g){for(var l=q.events.apiTypes,k=a.Natives.split(/\s+/g),t=0,u=k.length;t-1&&this.media.addEventListener(a,function(v){d.forEach(l.data.events[a],function(z){typeof z==="function"&&z.call(l,v)})},false);return this},unlisten:function(a,g){if(this.data.events[a]&&this.data.events[a][g]){delete this.data.events[a][g]; +return this}this.data.events[a]=null;return this}},hooks:{canplayall:{bind:"canplaythrough",add:function(a,g){var l=false;if(this.media.readyState){g.call(this,a);l=true}this.data.hooks.canplayall={fired:l}},handler:function(a,g){if(!this.data.hooks.canplayall.fired){g.call(this,a);this.data.hooks.canplayall.fired=true}}}}};d.forEach([["trigger","emit"],["listen","on"],["unlisten","off"]],function(a){d.p[a[0]]=d.p[a[1]]=d.events.fn[a[0]]});d.addTrackEvent=function(a,g){var l,k;if(g.id)l=a.getTrackEvent(g.id); +if(l){k=true;g=d.extend({},l,g);a.removeTrackEvent(g.id)}if(g&&g._natives&&g._natives.type&&a.options.defaults&&a.options.defaults[g._natives.type])g=d.extend({},a.options.defaults[g._natives.type],g);if(g._natives){g._id=g.id||g._id||d.guid(g._natives.type);a.data.history.push(g._id)}g.start=d.util.toSeconds(g.start,a.options.framerate);g.end=d.util.toSeconds(g.end,a.options.framerate);var t=a.data.trackEvents.byStart,u=a.data.trackEvents.byEnd,v;for(v=t.length-1;v>=0;v--)if(g.start>=t[v].start){t.splice(v+ +1,0,g);break}for(t=u.length-1;t>=0;t--)if(g.end>u[t].end){u.splice(t+1,0,g);break}if(g.end>a.media.currentTime&&g.start<=a.media.currentTime){g._running=true;a.data.running[g._natives.type].push(g);a.data.disabled[g._natives.type]||g._natives.start.call(a,null,g)}v<=a.data.trackEvents.startIndex&&g.start<=a.data.trackEvents.previousUpdateTime&&a.data.trackEvents.startIndex++;t<=a.data.trackEvents.endIndex&&g.end-1;){l=a.data.trackEvents.byStart[v];k=a.data.trackEvents.byEnd[v];if(!l._id){C.push(l); +E.push(k)}if(l._id){l._id!==g&&C.push(l);k._id!==g&&E.push(k);if(l._id===g){z=v;l._natives._teardown&&l._natives._teardown.call(a,l)}}v++}u=a.data.trackEvents.animating.length;v=0;if(u)for(;--u>-1;){l=a.data.trackEvents.animating[v];l._id||B.push(l);l._id&&l._id!==g&&B.push(l);v++}z<=a.data.trackEvents.startIndex&&a.data.trackEvents.startIndex--;z<=a.data.trackEvents.endIndex&&a.data.trackEvents.endIndex--;a.data.trackEvents.byStart=C;a.data.trackEvents.byEnd=E;a.data.trackEvents.animating=B;for(u= +0;ul&&B._running===false){B._running=true;a.data.running[w].push(B);if(!a.data.disabled[w]){k.start.call(a,g,B);a.emit("trackstart",d.extend({},B,{plugin:w,type:"trackstart"}))}}v++}else{d.removeTrackEvent(a,B._id);return}}}else if(k>l){for(;t.byStart[v]&&t.byStart[v].start>l;){B=t.byStart[v];w=(k=B._natives)&& +k.type;if(!k||E[w]||a[w]){if(B._running===true){B._running=false;D=a.data.running[w];D.splice(D.indexOf(B),1);if(!a.data.disabled[w]){k.end.call(a,g,B);a.emit("trackend",d.extend({},B,{plugin:w,type:"trackend"}))}}v--}else{d.removeTrackEvent(a,B._id);return}}for(;t.byEnd[u]&&t.byEnd[u].end>l;){B=t.byEnd[u];w=(k=B._natives)&&k.type;if(!k||E[w]||a[w]){if(B.start<=l&&B._running===false){B._running=true;a.data.running[w].push(B);if(!a.data.disabled[w]){k.start.call(a,g,B);a.emit("trackstart",d.extend({}, +B,{plugin:w,type:"trackstart"}))}}u--}else{d.removeTrackEvent(a,B._id);return}}}t.endIndex=u;t.startIndex=v;t.previousUpdateTime=l;t.byStart.length=0)d.error("'"+a+"' is a protected function name");else{var k=["start","end"],t={},u=typeof g==="function",v=["_setup","_teardown","start","end","frame"],z=function(B,w){B=B||d.nop;w=w|| +d.nop;return function(){B.apply(this,arguments);w.apply(this,arguments)}};d.manifest[a]=l=l||g.manifest||{};v.forEach(function(B){g[B]=n(g[B]||d.nop,a)});var C=function(B,w){if(!w)return this;if(w.ranges&&d.isArray(w.ranges)){d.forEach(w.ranges,function(G){G=d.extend({},w,G);delete G.ranges;this[a](G)},this);return this}var D=w._natives={},F="",I;d.extend(D,B);w._natives.type=a;w._running=false;D.start=D.start||D["in"];D.end=D.end||D.out;if(w.once)D.end=z(D.end,function(){this.removeTrackEvent(w._id)}); +D._teardown=z(function(){var G=h.call(arguments),H=this.data.running[D.type];G.unshift(null);G[1]._running&&H.splice(H.indexOf(w),1)&&D.end.apply(this,G)},D._teardown);w.compose=w.compose&&w.compose.split(" ")||[];w.effect=w.effect&&w.effect.split(" ")||[];w.compose=w.compose.concat(w.effect);w.compose.forEach(function(G){F=d.compositions[G]||{};v.forEach(function(H){D[H]=z(D[H],F[H])})});w._natives.manifest=l;if(!("start"in w))w.start=w["in"]||0;if(!w.end&&w.end!==0)w.end=w.out||Number.MAX_VALUE; +if(!i.call(w,"toString"))w.toString=function(){var G=["start: "+w.start,"end: "+w.end,"id: "+(w.id||w._id)];w.target!=null&&G.push("target: "+w.target);return a+" ( "+G.join(", ")+" )"};if(!w.target){I="options"in l&&l.options;w.target=I&&"target"in I&&I.target}if(w._natives)w._id=d.guid(w._natives.type);w._natives._setup&&w._natives._setup.call(this,w);d.addTrackEvent(this,w);d.forEach(B,function(G,H){H!=="type"&&k.indexOf(H)===-1&&this.on(H,G)},this);return this};d.p[a]=t[a]=function(B,w){var D; +if(B&&!w)w=B;else if(D=this.getTrackEvent(B)){w=d.extend({},D,w);d.addTrackEvent(this,w);return this}else w.id=B;this.data.running[a]=this.data.running[a]||[];D=d.extend({},this.options.defaults&&this.options.defaults[a]||{},w);return C.call(this,u?g.call(this,D):g,D)};l&&d.extend(g,{manifest:l});var E={fn:t[a],definition:g,base:g,parents:[],name:a};d.registry.push(d.extend(t,E,{type:a}));d.registryByName[a]=E;return t}};d.plugin.errors=[];d.plugin.debug=d.version==="1.3";d.removePlugin=function(a, +g){if(!g){g=a;a=d.p;if(d.protect.natives.indexOf(g.toLowerCase())>=0){d.error("'"+g+"' is a protected function name");return}var l=d.registry.length,k;for(k=0;k-1){t=t.split(";");u=0;if(g&&typeof g==="number")u=parseFloat(t[1],10)/g;l[k]=parseInt(t[0],10)+u}k=l[0];return{1:parseFloat(k,10),2:parseInt(k,10)*60+parseFloat(l[1],10),3:parseInt(k,10)*3600+parseInt(l[1],10)*60+parseFloat(l[2],10)}[l.length||1]}};d.p.cue=d.p.exec;d.protect={natives:function(a){return Object.keys?Object.keys(a):function(g){var l,k=[];for(l in g)i.call(g,l)&&k.push(l);return k}(a)}(d.p).map(function(a){return a.toLowerCase()})};d.forEach({listen:"on",unlisten:"off", +trigger:"emit",exec:"cue"},function(a,g){var l=d.p[g];d.p[g]=function(){if(typeof console!=="undefined"&&console.warn){console.warn("Deprecated method '"+g+"', "+(a==null?"do not use.":"use '"+a+"' instead."));d.p[g]=l}return d.p[a].apply(this,[].slice.call(arguments))}});r.Popcorn=d}else{r.Popcorn={isSupported:false};for(c="byId forEach extend effects error guid sizeOf isArray nop position disable enable destroyaddTrackEvent removeTrackEvent getTrackEvents getTrackEvent getLastTrackEventId timeUpdate plugin removePlugin compose effect xhr getJSONP getScript".split(/\s+/);c.length;)r.Popcorn[c.shift()]= +function(){}}})(window,window.document);(function(r,f){var n=r.document,c=r.location,b=/:\/\//,e=c.href.replace(c.href.split("/").slice(-1)[0],""),h=function(j,p,m){j=j||0;p=(p||j||0)+1;m=m||1;p=Math.ceil((p-j)/m)||0;var o=0,q=[];for(q.length=p;o= +o["in"]&&j<=o.out)m=q});j+=this.inOuts.ofVideos[m]["in"]-this.inOuts.ofClips[m]["in"];f.addTrackEvent(this.playlist[m],{start:j-1,end:j,_running:false,_natives:{start:p||f.nop,end:f.nop,type:"exec"}});return this},listen:function(j,p){var m=this,o=this.playlist,q=o.length,s=0;if(!p)p=f.nop;if(f.Events.Natives.indexOf(j)>-1)f.forEach(o,function(d){d.listen(j,function(A){A.active=m;if(i.indexOf(j)>-1)p.call(d,A);else++s===q&&p.call(d,A)})});else{this.events[j]||(this.events[j]={});o=p.name||f.guid("__"+ +j);this.events[j][o]=p}return this},unlisten:function(){},trigger:function(j,p){var m=this;if(!(f.Events.Natives.indexOf(j)>-1)){this.events[j]&&f.forEach(this.events[j],function(o){o.call(m,{type:j},p)});return this}}});f.forEach(f.manifest,function(j,p){f.sequence.prototype[p]=function(m){var o={},q=[],s,d,A,y,x;for(s=0;s-1)o[s]=f.extend({},q,{start:d[A],clipIdx:A});if(y>-1)o[s]= +f.extend({},q,{end:d[y],clipIdx:y})}s=Object.keys(o).map(function(g){return+g});q=h(s[0],s[1]);for(s=0;s=0)r.error("'"+n+"' is a protected function name");else{if(typeof c==="function"&&!b){b=c;c=""}if(!(typeof b!=="function"||typeof c!=="string")){var e={};e[n]=function(h,i){if(!h)return this;var j=this;r.xhr({url:h,dataType:c,success:function(p){var m,o,q=0;p=b(p).data||[];if(m=p.length){for(;q=4){o=new Date/1E3;a.dispatchEvent("play");l()}};a.pause=function(){this.paused= +true;a.dispatchEvent("pause")};r.player.defineProperty(a,"currentTime",{get:function(){return q},set:function(k){q=+k;a.dispatchEvent("timeupdate");return q},configurable:true});r.player.defineProperty(a,"volume",{get:function(){return d},set:function(k){d=+k;a.dispatchEvent("volumechange");return d},configurable:true});r.player.defineProperty(a,"muted",{get:function(){return A},set:function(k){A=+k;a.dispatchEvent("volumechange");return A},configurable:true});r.player.defineProperty(a,"readyState", +{get:function(){return s},set:function(k){return s=k},configurable:true});a.addEventListener=function(k,t){y[k]||(y[k]=[]);y[k].push(t);return t};a.removeEventListener=function(k,t){var u,v=y[k];if(v){for(u=y[k].length-1;u>=0;u--)t===v[u]&&v.splice(u,1);return t}};a.dispatchEvent=function(k){var t,u=k.type;if(!u){u=k;if(k=r.events.getInterface(u)){t=document.createEvent(k);t.initEvent(u,true,true,window,1)}}if(y[u])for(k=y[u].length-1;k>=0;k--)y[u][k].call(this,t,this)};a.src=j||"";a.duration=0;a.paused= +true;a.ended=0;p&&p.events&&r.forEach(p.events,function(k,t){a.addEventListener(t,k,false)});if(e._canPlayType(x.nodeName,j)!==false)if(e._setup)e._setup.call(a,p);else{a.readyState=4;a.dispatchEvent("loadedmetadata");a.dispatchEvent("loadeddata");a.dispatchEvent("canplaythrough")}else setTimeout(function(){a.dispatchEvent("error")},0);i=new r.p.init(a,p);if(e._teardown)i.destroy=f(i.destroy,function(){e._teardown.call(a,p)});return i};h.canPlayType=e._canPlayType=e._canPlayType||r.nop;r[b]=r.player.registry[b]= +h}};r.player.registry={};r.player.defineProperty=Object.defineProperty||function(b,e,h){b.__defineGetter__(e,h.get||r.nop);b.__defineSetter__(e,h.set||r.nop)};r.player.playerQueue=function(){var b=[],e=false;return{next:function(){e=false;b.shift();b[0]&&b[0]()},add:function(h){b.push(function(){e=true;h&&h()});!e&&b[0]()}}};r.smart=function(b,e,h){var i=["AUDIO","VIDEO"],j,p=r.dom.find(b),m;j=document.createElement("video");var o={ogg:"video/ogg",ogv:"video/ogg",oga:"audio/ogg",webm:"video/webm", +mp4:"video/mp4",mp3:"audio/mp3"};if(p){if(i.indexOf(p.nodeName)>-1&&!e){if(typeof e==="object")h=e;return r(p,h)}if(typeof e==="string")e=[e];b=0;for(srcLength=e.length;b"+y.title+"

";r.forEach(y.items,function(a,g){if(g"']/g,function(e){return c[e]||e})}function n(b,e){var h=b.container=document.createElement("div"),i=h.style,j=b.media,p=function(){var m=b.position();i.fontSize="18px";i.width=j.offsetWidth+"px";i.top=m.top+j.offsetHeight-h.offsetHeight-40+"px";i.left=m.left+"px";setTimeout(p,10)};h.id=e||"";i.position="absolute";i.color="white";i.textShadow="black 2px 2px 6px";i.fontWeight="bold";i.textAlign="center";p();b.media.parentNode.appendChild(h); +return h}var c={"&":"&","<":"<",">":">",'"':""","'":"'"};r.plugin("text",{manifest:{about:{name:"Popcorn Text Plugin",version:"0.1",author:"@humphd"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},text:{elem:"input",type:"text",label:"Text","default":"Popcorn.js"},escape:{elem:"input",type:"checkbox",label:"Escape"},multiline:{elem:"input",type:"checkbox",label:"Multiline"}}},_setup:function(b){var e,h,i=b._container=document.createElement("div"); +i.style.display="none";if(b.target)if(e=r.dom.find(b.target)){if(["VIDEO","AUDIO"].indexOf(e.nodeName)>-1)e=n(this,b.target+"-overlay")}else e=n(this,b.target);else e=this.container?this.container:n(this);b._target=e;h=b.escape?f(b.text):b.text;h=b.multiline?h.replace(/\r?\n/gm,"
"):h;i.innerHTML=h||"";e.appendChild(i)},start:function(b,e){e._container.style.display="inline"},end:function(b,e){e._container.style.display="none"},_teardown:function(b){var e=b._target;e&&e.removeChild(b._container)}})})(Popcorn);var googleCallback; +(function(r){function f(i,j,p){i=i.type?i.type.toUpperCase():"HYBRID";var m;if(i==="STAMEN-WATERCOLOR"||i==="STAMEN-TERRAIN"||i==="STAMEN-TONER")m=i.replace("STAMEN-","").toLowerCase();p=new google.maps.Map(p,{mapTypeId:m?m:google.maps.MapTypeId[i],mapTypeControlOptions:{mapTypeIds:[]}});m&&p.mapTypes.set(m,new google.maps.StamenMapType(m));p.getDiv().style.display="none";return p}var n=1,c=false,b=false,e,h;googleCallback=function(i){if(typeof google!=="undefined"&&google.maps&&google.maps.Geocoder&& +google.maps.LatLng){e=new google.maps.Geocoder;r.getScript("//maps.stamen.com/js/tile.stamen.js",function(){b=true})}else setTimeout(function(){googleCallback(i)},1)};h=function(){if(document.body){c=true;r.getScript("//maps.google.com/maps/api/js?sensor=false&callback=googleCallback")}else setTimeout(function(){h()},1)};r.plugin("googlemap",function(i){var j,p,m,o=document.getElementById(i.target);i.type=i.type||"ROADMAP";i.zoom=i.zoom||1;i.lat=i.lat||0;i.lng=i.lng||0;c||h();j=document.createElement("div"); +j.id="actualmap"+n;j.style.width=i.width||"100%";j.style.height=i.height?i.height:o&&o.clientHeight?o.clientHeight+"px":"100%";n++;o&&o.appendChild(j);var q=function(){if(b){if(j)if(i.location)e.geocode({address:i.location},function(s,d){if(j&&d===google.maps.GeocoderStatus.OK){i.lat=s[0].geometry.location.lat();i.lng=s[0].geometry.location.lng();m=new google.maps.LatLng(i.lat,i.lng);p=f(i,m,j)}});else{m=new google.maps.LatLng(i.lat,i.lng);p=f(i,m,j)}}else setTimeout(function(){q()},5)};q();return{start:function(s, +d){var A=this,y,x=function(){if(p){d._map=p;p.getDiv().style.display="block";google.maps.event.trigger(p,"resize");p.setCenter(m);if(d.zoom&&typeof d.zoom!=="number")d.zoom=+d.zoom;p.setZoom(d.zoom);if(d.heading&&typeof d.heading!=="number")d.heading=+d.heading;if(d.pitch&&typeof d.pitch!=="number")d.pitch=+d.pitch;if(d.type==="STREETVIEW"){p.setStreetView(y=new google.maps.StreetViewPanorama(j,{position:m,pov:{heading:d.heading=d.heading||0,pitch:d.pitch=d.pitch||0,zoom:d.zoom}}));var a=function(z, +C){var E=google.maps.geometry.spherical.computeHeading;setTimeout(function(){var B=A.media.currentTime;if(typeof d.tween==="object"){for(var w=0,D=z.length;w=F.interval*(w+1)/1E3&&(B<=F.interval*(w+2)/1E3||B>=F.interval*D/1E3)){u.setPosition(new google.maps.LatLng(F.position.lat,F.position.lng));u.setPov({heading:F.pov.heading||E(F,z[w+1])||0,zoom:F.pov.zoom||0,pitch:F.pov.pitch||0})}}a(z,z[0].interval)}else{w=0;for(D=z.length;w=F*(w+1)/1E3&&(B<=F* +(w+2)/1E3||B>=F*D/1E3)){g.setPov({heading:E(z[w],z[w+1])||0,zoom:d.zoom,pitch:d.pitch||0});g.setPosition(l[w])}}a(l,d.interval)}},C)};if(d.location&&typeof d.tween==="string"){var g=y,l=[],k=new google.maps.DirectionsService,t=new google.maps.DirectionsRenderer(g);k.route({origin:d.location,destination:d.tween,travelMode:google.maps.TravelMode.DRIVING},function(z,C){if(C==google.maps.DirectionsStatus.OK){t.setDirections(z);for(var E=z.routes[0].overview_path,B=0,w=E.length;B-1){b.trackedContainer=f(h);b.trackedContainer.element.appendChild(b.anchor)}else h&&h.appendChild(b.anchor); +e.addEventListener("load",function(){e.style.borderStyle="none";b.anchor.href=b.href||b.src||"#";b.anchor.target="_blank";var i,j;e.style.height=h.style.height;e.style.width=h.style.width;b.anchor.appendChild(e);if(b.text){i=e.height/12+"px";j=document.createElement("div");r.extend(j.style,{color:"black",fontSize:i,fontWeight:"bold",position:"relative",textAlign:"center",width:e.style.width||e.width+"px",zIndex:"10"});j.innerHTML=b.text||"";j.style.top=(e.style.height.replace("px","")||e.height)/ +2-j.offsetHeight/2+"px";b.anchor.insertBefore(j,e)}},false);e.src=b.src},start:function(b,e){e.anchor.style.display="inline";e.trackedContainer&&e.trackedContainer.start()},end:function(b,e){e.anchor.style.display="none";e.trackedContainer&&e.trackedContainer.stop()},_teardown:function(b){if(b.trackedContainer)b.trackedContainer.destroy();else b.anchor.parentNode&&b.anchor.parentNode.removeChild(b.anchor)}})})(Popcorn);(function(r){var f=1,n=false;r.plugin("googlefeed",function(c){var b=function(){var j=false,p=0,m=document.getElementsByTagName("link"),o=m.length,q=document.head||document.getElementsByTagName("head")[0],s=document.createElement("link");if(window.GFdynamicFeedControl)n=true;else r.getScript("//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js",function(){n=true});for(;p")); +n=n.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g,"");n=n.split(" ");f._desc.innerHTML=n.slice(0,n.length>=f.numberofwords?f.numberofwords:n.length).join(" ")+" ...";f._fired=true};f.src&&r.getScript("//"+f.lang+".wikipedia.org/w/api.php?action=parse&props=text&redirects&page="+f.src.slice(f.src.lastIndexOf("/")+1)+"&format=json&callback=wikiCallback"+c)},start:function(f,n){var c=function(){if(n._fired){if(n._link&&n._desc)if(document.getElementById(n.target)){document.getElementById(n.target).appendChild(n._link); +document.getElementById(n.target).appendChild(n._desc);n._added=true}}else setTimeout(function(){c()},13)};c()},end:function(f,n){if(n._added){document.getElementById(n.target).removeChild(n._link);document.getElementById(n.target).removeChild(n._desc)}},_teardown:function(f){if(f._added){f._link.parentNode&&document.getElementById(f.target).removeChild(f._link);f._desc.parentNode&&document.getElementById(f.target).removeChild(f._desc);delete f.target}}})})(Popcorn);(function(r){r.plugin("mustache",function(f){var n,c,b,e;r.getScript("http://mustache.github.com/extras/mustache.js");var h=!!f.dynamic,i=typeof f.template,j=typeof f.data,p=document.getElementById(f.target);f.container=p||document.createElement("div");if(i==="function")if(h)b=f.template;else e=f.template(f);else e=i==="string"?f.template:"";if(j==="function")if(h)n=f.data;else c=f.data(f);else c=j==="string"?JSON.parse(f.data):j==="object"?f.data:"";return{start:function(m,o){var q=function(){if(window.Mustache){if(n)c= +n(o);if(b)e=b(o);var s=Mustache.to_html(e,c).replace(/^\s*/mg,"");o.container.innerHTML=s}else setTimeout(function(){q()},10)};q()},end:function(m,o){o.container.innerHTML=""},_teardown:function(){n=c=b=e=null}}},{about:{name:"Popcorn Mustache Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"mustache-container",template:{elem:"input",type:"text", +label:"Template"},data:{elem:"input",type:"text",label:"Data"},dynamic:{elem:"input",type:"checkbox",label:"Dynamic","default":true}}})})(Popcorn);(function(r){function f(c,b){if(c.map)c.map.div.style.display=b;else setTimeout(function(){f(c,b)},10)}var n=1;r.plugin("openmap",function(c){var b,e,h,i,j,p,m,o,q=document.getElementById(c.target);b=document.createElement("div");b.id="openmapdiv"+n;b.style.width="100%";b.style.height="100%";n++;q&&q.appendChild(b);o=function(){if(window.OpenLayers&&window.OpenLayers.Layer.Stamen){if(c.location){location=new OpenLayers.LonLat(0,0);r.getJSONP("//tinygeocoder.com/create-api.php?q="+c.location+"&callback=jsonp", +function(d){e=new OpenLayers.LonLat(d[1],d[0])})}else e=new OpenLayers.LonLat(c.lng,c.lat);c.type=c.type||"ROADMAP";switch(c.type){case "SATELLITE":c.map=new OpenLayers.Map({div:b,maxResolution:0.28125,tileSize:new OpenLayers.Size(512,512)});var s=new OpenLayers.Layer.WorldWind("LANDSAT","//worldwind25.arc.nasa.gov/tile/tile.aspx",2.25,4,{T:"105"});c.map.addLayer(s);i=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326");break;case "TERRAIN":i=new OpenLayers.Projection("EPSG:4326"); +h=new OpenLayers.Projection("EPSG:4326");c.map=new OpenLayers.Map({div:b,projection:h});s=new OpenLayers.Layer.WMS("USGS Terraserver","//terraserver-usa.org/ogcmap.ashx?",{layers:"DRG"});c.map.addLayer(s);break;case "STAMEN-TONER":case "STAMEN-WATERCOLOR":case "STAMEN-TERRAIN":s=c.type.replace("STAMEN-","").toLowerCase();s=new OpenLayers.Layer.Stamen(s);i=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:900913");e=e.transform(i,h);c.map=new OpenLayers.Map({div:b,projection:h, +displayProjection:i,controls:[new OpenLayers.Control.Navigation,new OpenLayers.Control.PanPanel,new OpenLayers.Control.ZoomPanel]});c.map.addLayer(s);break;default:h=new OpenLayers.Projection("EPSG:900913");i=new OpenLayers.Projection("EPSG:4326");e=e.transform(i,h);c.map=new OpenLayers.Map({div:b,projection:h,displayProjection:i});s=new OpenLayers.Layer.OSM;c.map.addLayer(s)}if(c.map){c.map.setCenter(e,c.zoom||10);c.map.div.style.display="none"}}else setTimeout(function(){o()},50)};o();return{_setup:function(s){window.OpenLayers|| +r.getScript("//openlayers.org/api/OpenLayers.js",function(){r.getScript("//maps.stamen.com/js/tile.stamen.js")});var d=function(){if(s.map){s.zoom=s.zoom||2;if(s.zoom&&typeof s.zoom!=="number")s.zoom=+s.zoom;s.map.setCenter(e,s.zoom);if(s.markers){var A=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]),y=function(v){clickedFeature=v.feature;if(clickedFeature.attributes.text){m=new OpenLayers.Popup.FramedCloud("featurePopup",clickedFeature.geometry.getBounds().getCenterLonLat(), +new OpenLayers.Size(120,250),clickedFeature.attributes.text,null,true,function(){p.unselect(this.feature)});clickedFeature.popup=m;m.feature=clickedFeature;s.map.addPopup(m)}},x=function(v){feature=v.feature;if(feature.popup){m.feature=null;s.map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null}},a=function(v){r.getJSONP("//tinygeocoder.com/create-api.php?q="+v.location+"&callback=jsonp",function(z){z=(new OpenLayers.Geometry.Point(z[1],z[0])).transform(i,h);var C=OpenLayers.Util.extend({}, +A);if(!v.size||isNaN(v.size))v.size=14;C.pointRadius=v.size;C.graphicOpacity=1;C.externalGraphic=v.icon;z=new OpenLayers.Feature.Vector(z,null,C);if(v.text)z.attributes={text:v.text};j.addFeatures([z])})};j=new OpenLayers.Layer.Vector("Point Layer",{style:A});s.map.addLayer(j);for(var g=0,l=s.markers.length;g"+ +n.title+"
"+n.text+"
"+n.innerHTML;return{start:function(i,j){b.style.display="block";if(j.direction==="down")e.scrollTop=e.scrollHeight},end:function(){b.style.display="none"},_teardown:function(){e&&b&&e.removeChild(b)&&!e.firstChild&&c.removeChild(e)}}},{about:{name:"Popcorn Timeline Plugin",version:"0.1",author:"David Seifried @dcseifried",website:"dseifried.wordpress.com"},options:{start:{elem:"input",type:"number",label:"Start"}, +end:{elem:"input",type:"number",label:"End"},target:"feed-container",title:{elem:"input",type:"text",label:"Title"},text:{elem:"input",type:"text",label:"Text"},innerHTML:{elem:"input",type:"text",label:"HTML Code",optional:true},direction:{elem:"select",options:["DOWN","UP"],label:"Direction",optional:true}}})})(Popcorn);(function(r,f){var n={};r.plugin("documentcloud",{manifest:{about:{name:"Popcorn Document Cloud Plugin",version:"0.1",author:"@humphd, @ChrisDeCairos",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"number",label:"Start"},end:{elem:"input",type:"number",label:"End"},target:"documentcloud-container",width:{elem:"input",type:"text",label:"Width",optional:true},height:{elem:"input",type:"text",label:"Height",optional:true},src:{elem:"input",type:"url",label:"PDF URL","default":"http://www.documentcloud.org/documents/70050-urbina-day-1-in-progress.html"}, +preload:{elem:"input",type:"checkbox",label:"Preload","default":true},page:{elem:"input",type:"number",label:"Page Number",optional:true},aid:{elem:"input",type:"number",label:"Annotation Id",optional:true}}},_setup:function(c){function b(){function m(v){c._key=v.api.getId();c._changeView=function(z){c.aid?z.pageSet.showAnnotation(z.api.getAnnotation(c.aid)):z.api.setCurrentPage(c.page)}}function o(){n[c._key]={num:1,id:c._containerId};h.loaded=true}h.loaded=false;var q=c.url.replace(/\.html$/,".js"), +s=c.target,d=f.getElementById(s),A=f.createElement("div"),y=r.position(d),x=c.width||y.width;y=c.height||y.height;var a=c.sidebar||true,g=c.text||true,l=c.pdf||true,k=c.showAnnotations||true,t=c.zoom||700,u=c.search||true;if(!function(v){var z=false;r.forEach(h.viewers,function(C){if(C.api.getSchema().canonicalURL===v){m(C);C=n[c._key];c._containerId=C.id;C.num+=1;z=true;h.loaded=true}});return z}(c.url)){A.id=c._containerId=r.guid(s);s="#"+A.id;d.appendChild(A);i.trigger("documentready");h.load(q, +{width:x,height:y,sidebar:a,text:g,pdf:l,showAnnotations:k,zoom:t,search:u,container:s,afterLoad:c.page||c.aid?function(v){m(v);c._changeView(v);A.style.visibility="hidden";v.elements.pages.hide();o()}:function(v){m(v);o();A.style.visibility="hidden";v.elements.pages.hide()}})}}function e(){window.DV.loaded?b():setTimeout(e,25)}var h=window.DV=window.DV||{},i=this;if(h.loading)e();else{h.loading=true;h.recordHit="//www.documentcloud.org/pixel.gif";var j=f.createElement("link"),p=f.getElementsByTagName("head")[0]; +j.rel="stylesheet";j.type="text/css";j.media="screen";j.href="//s3.documentcloud.org/viewer/viewer-datauri.css";p.appendChild(j);h.loaded=false;r.getScript("http://s3.documentcloud.org/viewer/viewer.js",function(){h.loading=false;b()})}},start:function(c,b){var e=f.getElementById(b._containerId),h=DV.viewers[b._key];(b.page||b.aid)&&h&&b._changeView(h);if(e&&h){e.style.visibility="visible";h.elements.pages.show()}},end:function(c,b){var e=f.getElementById(b._containerId);if(e&&DV.viewers[b._key]){e.style.visibility= +"hidden";DV.viewers[b._key].elements.pages.hide()}},_teardown:function(c){var b=f.getElementById(c._containerId);if((c=c._key)&&DV.viewers[c]&&--n[c].num===0){for(DV.viewers[c].api.unload();b.hasChildNodes();)b.removeChild(b.lastChild);b.parentNode.removeChild(b)}}})})(Popcorn,window.document);(function(r){r.parser("parseJSON","JSON",function(f){var n={title:"",remote:"",data:[]};r.forEach(f.data,function(c){n.data.push(c)});return n})})(Popcorn);(function(r){r.parser("parseSBV",function(f){var n={title:"",remote:"",data:[]},c=[],b=0,e=0,h=function(q){q=q.split(":");var s=q.length-1,d;try{d=parseInt(q[s-1],10)*60+parseFloat(q[s],10);if(s===2)d+=parseInt(q[0],10)*3600}catch(A){throw"Bad cue";}return d},i=function(q,s){var d={};d[q]=s;return d};f=f.text.split(/(?:\r\n|\r|\n)/gm);for(e=f.length;b");c.push(i("subtitle",j))}catch(o){for(;b< +e&&f[b];)b++}for(;b=0&&!c[h];)h--;m=h+1;for(h=0;h[\t ]*/); +o.start=n(j[0]);i=j[1].indexOf(" ");if(i!==-1)j[1]=j[1].substr(0,i);for(o.end=n(j[1]);h/g,">");o.text=o.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>");o.text=o.text.replace(/\\N/gi,"
");e.push(f("subtitle",o))}b.data=e;return b})})(Popcorn);(function(r){function f(b,e){var h=b.substr(10).split(","),i;i={start:n(h[e.start]),end:n(h[e.end])};if(i.start===-1||i.end===-1)throw"Invalid time";var j=q.call(m,/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),p=j.replace,m;m=h.length;q=[];for(var o=e.text;o");return i}function n(b){var e=b.split(":");if(b.length!==10||e.length<3)return-1;return parseInt(e[0],10)*3600+parseInt(e[1],10)*60+parseFloat(e[2],10)}function c(b, +e){var h={};h[b]=e;return h}r.parser("parseSSA",function(b){var e={title:"",remote:"",data:[]},h=[],i=0,j;b=b.text.split(/(?:\r\n|\r|\n)/gm);for(j=b.length;i");m.id=i.getAttribute("xml:id")||i.getAttribute("id");m.start=b(i.getAttribute("begin"),j); +m.end=b(i.getAttribute("end"),j);m.target=n(i,p);if(m.end<0){m.end=b(i.getAttribute("duration"),0);if(m.end>=0)m.end+=m.start;else m.end=Number.MAX_VALUE}return{subtitle:m}}function b(i,j){var p;if(!i)return-1;try{return r.util.toSeconds(i)}catch(m){for(var o=i.length-1;o>=0&&i[o]<="9"&&i[o]>="0";)o--;p=o;o=parseFloat(i.substring(0,p));p=i.substring(p);return o*({h:3600,m:60,s:1,ms:0.0010}[p]||-1)+(j||0)}}var e=/^[\s]+|[\s]+$/gm,h=/(?:\r\n|\r|\n)/gm;r.parser("parseTTML",function(i){var j={title:"", +remote:"",data:[]};if(!i.xml||!i.xml.documentElement)return j;i=i.xml.documentElement.firstChild;if(!i)return j;for(;i.nodeName!=="body";)i=i.nextSibling;if(i)j.data=f(i,0);return j})})(Popcorn);(function(r){r.parser("parseTTXT",function(f){var n={title:"",remote:"",data:[]},c=function(j){j=j.split(":");var p=0;try{return parseFloat(j[0],10)*60*60+parseFloat(j[1],10)*60+parseFloat(j[2],10)}catch(m){p=0}return p},b=function(j,p){var m={};m[j]=p;return m};f=f.xml.lastChild.lastChild;for(var e=Number.MAX_VALUE,h=[];f;){if(f.nodeType===1&&f.nodeName==="TextSample"){var i={};i.start=c(f.getAttribute("sampleTime"));i.text=f.getAttribute("text");if(i.text){i.end=e-0.0010;h.push(b("subtitle",i))}e= +i.start}f=f.previousSibling}n.data=h.reverse();return n})})(Popcorn);(function(r){function f(c){var b=c.split(":");c=c.length;var e;if(c!==12&&c!==9)throw"Bad cue";c=b.length-1;try{e=parseInt(b[c-1],10)*60+parseFloat(b[c],10);if(c===2)e+=parseInt(b[0],10)*3600}catch(h){throw"Bad cue";}return e}function n(c,b){var e={};e[c]=b;return e}r.parser("parseVTT",function(c){var b={title:"",remote:"",data:[]},e=[],h=0,i=0,j,p;c=c.text.split(/(?:\r\n|\r|\n)/gm);i=c.length;if(i===0||c[0]!=="WEBVTT")return b;for(h++;h")===-1)throw"Bad cue";m=o.replace(/--\>/," --\> ").split(/[\t ]+/);if(m.length<2)throw"Bad cue";q.id=o;q.start=f(m[0]);q.end=f(m[2]);for(p=q;h");e.push(n("subtitle",p))}catch(s){for(h=h;h