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 "+n.title+" "+a.artist.bio.summary+"-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
"+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="
";c+="
Tags
";g.forEach(a.artist.tags.tag,function(f){c+="
"));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
"}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+="
")===-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=
+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 "']/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,"'+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
"):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
"+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
");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