").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("
").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);(function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[c[l].cache]=o[c[l].cache],n=s._rgba=o._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,a.transparent),s):a[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("
")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,o,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(o),o=e);var u=this,d=t.type(n),p=this._rgba=[];return o!==e&&(n=[n,o,r,h],d="array"),"string"===d?this.parse(s(n)||a._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var a=s.cache;f(s.props,function(t,e){if(!u[a]&&s.to){if("alpha"===t||null==n[t])return;u[a]=s.to(u._rgba)}u[a][e.idx]=i(n[t],e,!0)}),u[a]&&0>t.inArray(null,u[a].slice(0,3))&&(u[a][3]=1,s.from&&(u._rgba=s.from(u[a])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),a=c[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(t,n){var a=n.idx,o=r[a],l=s[a],c=u[n.type]||{};null!==l&&(null===o?h[a]=l:(c.mod&&(l-o>c.mod/2?o+=c.mod:o-l>c.mod/2&&(o-=c.mod)),h[a]=i((l-o)*e+o,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,a=t[2]/255,o=t[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==o?1:o]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],a=t[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,e+1/3)),Math.round(255*n(r,o,e)),Math.round(255*n(r,o,e-1/3)),a]},f(c,function(s,n){var a=n.props,o=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===e)return this[o].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[o].slice();return f(a,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[o]=d,n):l(d)},f(a,function(e,i){l.fn[e]||(l.fn[e]=function(n){var a,o=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===o?c:("function"===o&&(n=n.call(this,c),o=t.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=c+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var a,o,r="";if("transparent"!==n&&("string"!==t.type(n)||(a=s(n)))){if(n=l(a||n),!d.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&o&&o.style;)try{r=t.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(o),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},a=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function s(e,i){var s,n,o={};for(s in i)n=i[s],e[s]!==n&&(a[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(o[s]=n));return o}var n=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,a,o,r){var h=t.speed(a,o,r);return this.queue(function(){var a,o=t(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var e=t(this);return{el:e,start:i(this)}}),a=function(){t.each(n,function(t,i){e[i]&&o[i+"Class"](e[i])})},a(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){a(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(o[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,a){return s?t.effects.animateClass.call(this,{add:i},s,n,a):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,a){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,a):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,a,o,r){return"boolean"==typeof n||n===e?a?t.effects.animateClass.call(this,n?{add:s}:{remove:s},a,o,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,a,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,a){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,a)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.3",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,a;for(a=0;s.length>a;a++)null!==s[a]&&(n=t.data(i+s[a]),n===e&&(n=""),t.css(s[a],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return e.wrap(s),(e[0]===a||t.contains(e[0],a))&&t(a).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var a=e.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(a)&&a.call(n[0]),t.isFunction(e)&&e()}var n=t(this),a=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):o.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,a=i.queue,o=t.effects.effect[i.effect];return t.fx.off||!o?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):a===!1?this.each(e):this.queue(a||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()})(jQuery);(function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var a,o,r,h=t(this),l=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(h,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",m=i.test(u),g={},v="show"===c;h.parent().is(".ui-effects-wrapper")?t.effects.save(h.parent(),l):t.effects.save(h,l),h.show(),a=t.effects.createWrapper(h).css({overflow:"hidden"}),o=a[p](),r=parseFloat(a.css(f))||0,g[p]=v?o:0,m||(h.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),g[f]=v?r:o+r),v&&(a.css(p,0),m||a.css(f,r+o)),a.animate(g,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&h.hide(),t.effects.restore(h,l),t.effects.removeWrapper(h),n()}})}})(jQuery);(function(t){t.effects.effect.bounce=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(o,e.mode||"effect"),l="hide"===h,c="show"===h,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||l?1:0),m=e.duration/f,g=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=o.queue(),y=b.length;for((c||l)&&r.push("opacity"),t.effects.save(o,r),o.show(),t.effects.createWrapper(o),d||(d=o["top"===v?"outerHeight":"outerWidth"]()/3),c&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,_?2*-d:2*d).animate(a,m,g)),l&&(d/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,o.animate(n,m,g).animate(a,m,g),d=l?2*d:d/2;l&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),o.dequeue()}})(jQuery);(function(t){t.effects.effect.clip=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(o,e.mode||"hide"),l="show"===h,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(o,r),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[d](),l&&(n.css(d,0),n.css(p,a/2)),f[d]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){l||o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","opacity","height","width"],o=t.effects.setMode(n,e.mode||"hide"),r="show"===o,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,a),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===c?-s:s),u[l]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),m||p.hide(),i()}var a,o,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(a=0;u>a;a++)for(h=g.top+a*_,c=a-(u-1)/2,o=0;d>o;o++)r=g.left+o*v,l=o-(d-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(m?l*v:0),top:h+(m?c*_:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:c*_),opacity:m?1:0},e.duration||500,e.easing,s)}})(jQuery);(function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}})(jQuery);(function(t){t.effects.effect.fold=function(e,i){var s,n,a=t(this),o=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(a,e.mode||"hide"),h="show"===r,l="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=h!==d,f=p?["width","height"]:["height","width"],m=e.duration/2,g={},v={};t.effects.save(a,o),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[l?0:1]),h&&s.css(d?{height:0,width:c}:{height:c,width:0}),g[f[0]]=h?n[0]:c,v[f[1]]=h?n[1]:0,s.animate(g,m,e.easing).animate(v,m,e.easing,function(){l&&a.hide(),t.effects.restore(a,o),t.effects.removeWrapper(a),i()})}})(jQuery);(function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],a=t.effects.setMode(s,e.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(o,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&s.hide(),t.effects.restore(s,n),i()}})}})(jQuery);(function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),a=t.effects.setMode(n,e.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(e.times||5)+(h?1:0),c=e.duration/l,u=0,d=n.queue(),p=d.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;l>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,l+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),a="hide"===n,o=parseInt(e.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),a=t.effects.setMode(s,e.mode||"effect"),o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===a?0:100),r=e.direction||"both",h=e.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=e.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*c.y,width:l.width*c.x,outerHeight:l.outerHeight*c.y,outerWidth:l.outerWidth*c.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(o,e.mode||"effect"),f=e.restore||"effect"!==p,m=e.scale||"both",g=e.origin||["middle","center"],v=o.css("position"),_=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===e.mode&&"show"===p?(o.from=e.to||b,o.to=e.from||s):(o.from=e.from||("show"===p?b:s),o.to=e.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(_=_.concat(u),o.from=t.effects.setTransition(o,u,a.from.y,o.from),o.to=t.effects.setTransition(o,u,a.to.y,o.to)),a.from.x!==a.to.x&&(_=_.concat(d),o.from=t.effects.setTransition(o,d,a.from.x,o.from),o.to=t.effects.setTransition(o,d,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(_=_.concat(c).concat(l),o.from=t.effects.setTransition(o,c,a.from.y,o.from),o.to=t.effects.setTransition(o,c,a.to.y,o.to)),t.effects.save(o,_),o.show(),t.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=t.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),l=r.concat(u).concat(d),o.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=t.effects.setTransition(i,u,a.from.y,i.from),i.to=t.effects.setTransition(i,u,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=t.effects.setTransition(i,d,a.from.x,i.from),i.to=t.effects.setTransition(i,d,a.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),t.effects.restore(o,_),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):t.each(["top","left"],function(t,e){o.css(e,function(e,i){var s=parseInt(i,10),n=t?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","height","width"],o=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",h=e.distance||20,l=e.times||3,c=2*l+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),_=v.length;for(t.effects.save(n,a),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+h,m[d]=(p?"+=":"-=")+2*h,g[d]=(p?"-=":"+=")+2*h,n.animate(f,u,e.easing),s=1;l>s;s++)n.animate(m,u,e.easing).animate(g,u,e.easing);n.animate(m,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","width","height"],o=t.effects.setMode(n,e.mode||"show"),r="show"===o,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u={};t.effects.save(n,a),n.show(),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,c?isNaN(s)?"-"+s:-s:s),u[l]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),a="fixed"===n.css("position"),o=t("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("
").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}})(jQuery);
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/.keepme
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/AdaptivePlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/AdaptivePlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,33 @@
+IriSP.Widgets.AdaptivePlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AdaptivePlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
+ mime_type: "video/mp4",
+ normal_player: "HtmlPlayer",
+ fallback_player: "JwpPlayer"
+};
+
+IriSP.Widgets.AdaptivePlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "autostart", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _canPlayType = document.createElement('video').canPlayType(this.mime_type);
+
+ _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? this.normal_player : this.fallback_player;
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ this.insertSubwidget(this.$, _opts);
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Annotation.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Annotation.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,132 @@
+.Ldt-Annotation-Widget {
+ border-style: none solid solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+ padding: 0 1px 1px;
+ margin: 0;
+}
+
+.Ldt-Annotation-Widget.Ldt-Annotation-ShowTop {
+ border-top-style: solid;
+ padding-top: 1px;
+}
+
+.Ldt-Annotation-Inner {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+}
+
+.Ldt-Annotation-Inner h3 {
+ margin: 5px 0;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+.Ldt-Annotation-Description {
+ max-height: 150px;
+ overflow: auto;
+}
+
+.Ldt-Annotation-Cleared {
+ clear: both;
+}
+
+.Ldt-Annotation-MaxMinButton {
+ float: right; margin: 5px 5px 0; width: 17px; height: 17px;
+ background: url(img/widget-control.png); background-position: 0 -51px; cursor: pointer;
+}
+
+.Ldt-Annotation-Social {
+ float: right;
+}
+
+.Ldt-Annotation-MaxMinButton:hover {
+ background-position: -17px -51px;
+}
+
+.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton {
+ background-position: 0 -34px;
+}
+
+.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton:hover {
+ background-position: -17px -34px;
+}
+
+.Ldt-Annotation-Inner h3.Ldt-Annotation-MashupOrigin {
+ font-size: 12px;
+}
+
+.Ldt-Annotation-Title, .Ldt-Annotation-MashupMedia {
+ color: #0068c4;
+ text-decoration: none;
+}
+
+.Ldt-Annotation-Type {
+ color: #8080A0;
+}
+
+.Ldt-Annotation-Time {
+ color: #ff3b77
+}
+
+.Ldt-Annotation-Inner p {
+ font-size: 12px;
+ line-height: 16px;
+}
+
+.Ldt-Annotation-Label {
+ font-size: 12px; font-weight: bold; max-width: 90px; float: left; clear: left;
+}
+
+.Ldt-Annotation-Labelled {
+ margin: 5px 0 0 90px; clear: right;
+}
+
+.Ldt-Annotation-Tags-Block {
+ font-size: 12px;
+}
+
+ul.Ldt-Annotation-Tags {
+ list-style: none; padding: 0;
+}
+
+li.Ldt-Annotation-TagLabel {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-Annotation-TagLabel span {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-Annotation-TagLabel:hover {
+ background-position: left -23px;
+}
+
+.Ldt-Annotation-TagLabel:hover span {
+ background-position: right -23px;
+}
+
+.Ldt-Annotation-MashupOrigin {
+ display: none;
+}
+
+.Ldt-Annotation-isMashup .Ldt-Annotation-MashupOrigin {
+ display: block;
+}
+
+.Ldt-Annotation-Empty .Ldt-Annotation-HiddenWhenEmpty {
+ display: none;
+}
+
+.Ldt-Annotation-Minimized .Ldt-Annotation-HiddenWhenMinimized {
+ display: none;
+}
+
+.Ldt-Annotation-EmptyBlock {
+ display: none;
+}
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Annotation.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Annotation.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,233 @@
+// TODO: Migrate Timeupdate functions to Extract
+
+IriSP.Widgets.Annotation = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastAnnotation = false;
+ this.minimized = this.start_minimized || false;
+ this.bounds = [ 0, 0 ];
+};
+
+IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Annotation.prototype.messages = {
+ fr: {
+ watching: "Je regarde ",
+ on_site: " sur ",
+ tags_: "Mots-clés\u00a0:",
+ description_: "Description\u00a0:",
+ creator_: "Créé par\u00a0:",
+ excerpt_from: "Extrait de\u00a0:",
+ untitled: "Segment sans titre"
+ },
+ en: {
+ watching: "I'm watching ",
+ on_site: " on ",
+ tags_: "Keywords:",
+ description_: "Description:",
+ creator_: "Created by\u00a0:",
+ excerpt_from: "Excerpt from:",
+ untitled: "Untitled segment"
+ }
+};
+
+IriSP.Widgets.Annotation.prototype.template =
+ '{{#show_arrow}}
{{/show_arrow}}'
+ + '
';
+
+IriSP.Widgets.Annotation.prototype.defaults = {
+ annotation_type : "chap",
+ start_minimized: false,
+ show_arrow : true,
+ show_creator: true,
+ arrow_position: .5,
+ site_name : "Lignes de Temps",
+ search_on_tag_click: true,
+ show_social: true,
+ show_annotation_type: false
+};
+
+IriSP.Widgets.Annotation.prototype.draw = function() {
+
+ var _this = this,
+ currentAnnotation;
+
+ function timeupdate(_time) {
+ var _list = _this.getWidgetAnnotationsAtTime();
+ if (!_list.length) {
+ _this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
+ if (_this.arrow) {
+ _this.arrow.moveToTime(_time);
+ }
+ _this.bounds = [ _time, _time ];
+ _this.sendBounds();
+ }
+ }
+
+ function highlightTitleAndDescription() {
+ if (!currentAnnotation) {
+ return;
+ }
+ var title = currentAnnotation.title,
+ description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''),
+ rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false);
+ _this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx) || "(" + _this.l10n.untitled + ")");
+ if (description) {
+ _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
+ _this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx));
+ } else {
+ _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
+ }
+ }
+
+ function drawAnnotation(_annotation) {
+ currentAnnotation = _annotation;
+ var _url = (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)),
+ _text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''),
+ _tags = _annotation.getTags(),
+ _tagblock = _this.$.find(".Ldt-Annotation-Tags");
+ _tagblock.empty();
+ if (_tags.length) {
+ _this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock");
+ _tags.forEach(function(_tag) {
+ var _trimmedTitle = _tag.title.replace(/(^\s+|\s+$)/g,'');
+ if (_trimmedTitle) {
+ var _el = IriSP.jQuery('
').text(_trimmedTitle));
+ _el.click(function() {
+ if (_this.search_on_tag_click) {
+ _this.source.getAnnotations().search(_trimmedTitle);
+ }
+ _tag.trigger("click");
+ });
+ _tagblock.append(_el);
+ }
+ });
+ } else {
+ _this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
+ }
+ highlightTitleAndDescription();
+ if (_this.show_creator) {
+ _this.$.find(".Ldt-Annotation-Creator").text(_annotation.creator);
+ }
+ if (_this.show_annotation_type) {
+ _this.$.find(".Ldt-Annotation-Type").text(_annotation.getAnnotationType().title);
+ }
+ _this.$.find(".Ldt-Annotation-Begin").text(_annotation.begin.toString());
+ _this.$.find(".Ldt-Annotation-End").text(_annotation.end.toString());
+ if (_annotation.elementType === "mashedAnnotation") {
+ _this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup");
+ _this.$.find(".Ldt-Annotation-MashupMedia").text(_annotation.getMedia().title);
+ _this.$.find(".Ldt-Annotation-MashupBegin").text(_annotation.annotation.begin.toString());
+ _this.$.find(".Ldt-Annotation-MashupEnd").text(_annotation.annotation.end.toString());
+ } else {
+ _this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup");
+ }
+ if (typeof _this.socialWidget !== "undefined") {
+ _this.socialWidget.updateUrls(_url, _text);
+ } else {
+ setTimeout(function() {
+ if (typeof _this.socialWidget !== "undefined") {
+ _this.socialWidget.updateUrls(_url, _text);
+ }
+ },800);
+ }
+ _this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
+ _this.bounds = [ _annotation.begin, _annotation.end ];
+ if (_this.arrow) {
+ _this.arrow.moveToTime((1 - _this.arrow_position) * _annotation.begin + _this.arrow_position * _annotation.end);
+ }
+ _this.sendBounds();
+ }
+
+ this.renderTemplate();
+
+ this.$.find(".Ldt-Annotation-Title").click(function() {
+ if (currentAnnotation) {
+ _this.media.setCurrentTime(currentAnnotation.begin);
+ }
+ return false;
+ });
+
+ if (this.show_social) {
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
+ }
+
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow");
+ }
+ this.onMediaEvent("timeupdate",timeupdate);
+ this.onMdpEvent("Annotation.hide","hide");
+ this.onMdpEvent("Annotation.show","show");
+ this.onMdpEvent("Annotation.minimize","minimize");
+ this.onMdpEvent("Annotation.maximize","maximize");
+ this.onMdpEvent("Annotation.getBounds","sendBounds");
+ this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize"));
+ this.getWidgetAnnotations().forEach(function(_a) {
+ _a.on("enter", function() {
+ drawAnnotation(_a);
+ });
+ });
+ this.source.getAnnotations().on("found", highlightTitleAndDescription);
+ this.source.getAnnotations().on("not-found", highlightTitleAndDescription);
+ this.source.getAnnotations().on("search-cleared", highlightTitleAndDescription);
+ IriSP.attachDndData(this.$.find("h3"), function() {
+ return {
+ title: currentAnnotation.title,
+ description: currentAnnotation.description,
+ image: currentAnnotation.thumbnail,
+ uri: (typeof currentAnnotation.url !== "undefined"
+ ? currentAnnotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + currentAnnotation.id))
+ };
+ });
+};
+
+IriSP.Widgets.Annotation.prototype.sendBounds = function() {
+ this.player.trigger("Annotation.boundsChanged",this.bounds);
+};
+
+IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) {
+ this.lastAnnotation = _annotation.id;
+
+};
+
+IriSP.Widgets.Annotation.prototype.hide = function() {
+ this.$.slideUp();
+};
+
+IriSP.Widgets.Annotation.prototype.show = function() {
+ this.$.slideDown();
+};
+
+IriSP.Widgets.Annotation.prototype.toggleSize = function() {
+ if (this.minimized) {
+ this.maximize();
+ } else {
+ this.minimize();
+ }
+};
+
+IriSP.Widgets.Annotation.prototype.minimize = function() {
+ this.minimized = true;
+ this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-Minimized");
+};
+
+IriSP.Widgets.Annotation.prototype.maximize = function() {
+ this.minimized = false;
+ this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-Minimized");
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/AnnotationsList.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/AnnotationsList.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,109 @@
+/* AnnotationsListWidget */
+
+.Ldt-AnnotationsListWidget {
+ border: none; margin: 0; padding: 0;
+ overflow: auto;
+ max-height: 480px;
+}
+.Ldt-AnnotationsListWidget a {
+ text-decoration: none;
+}
+
+.Ldt-AnnotationsList-Audio {
+ width: 1px; height: 1px;
+}
+
+ul.Ldt-AnnotationsList-ul {
+ list-style: none;
+ padding: 2px;
+ margin: 0;
+}
+li.Ldt-AnnotationsList-li {
+ width: 100%;
+ clear: both;
+ margin: 2px 0;
+ padding: 2px 0;
+ min-height: 60px;
+}
+.Ldt-AnnotationsList-li.selected {
+ background-image: url(img/pinstripe-grey.png);
+}
+.Ldt-AnnotationsList-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+.Ldt-AnnotationsList-Thumbnail {
+ border: none;
+ max-width: 100%;
+ max-height: 100%;
+ margin: 0 auto;
+}
+.Ldt-AnnotationsList-Duration {
+ color: #f7268e;
+ float: right;
+ text-align: right;
+ font-size: 12px;
+ margin: 2px;
+}
+h3.Ldt-AnnotationsList-Title {
+ color: #0068c4;
+ font-size: 13px;
+ margin: 2px 2px 0 82px;
+ font-weight: bold;
+}
+
+.Ldt-AnnotationsList-Title a {
+ color: #0068c4;
+}
+
+p.Ldt-AnnotationsList-Description {
+ margin: 2px 0 2px 82px;
+ font-size: 12px;
+ color: #333333;
+}
+
+.Ldt-AnnotationsList-Description a {
+ color: #0068c4;
+}
+
+.Ldt-AnnotationsList-Description a:hover {
+ text-decoration: underline; color: #800000;
+}
+
+ul.Ldt-AnnotationsList-Tags {
+ list-style: none;
+ padding: 0;
+ margin: 2px 0 0 82px;
+}
+
+li.Ldt-AnnotationsList-Tag-Li {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-AnnotationsList-Tag-Li span {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-AnnotationsList-Tag-Li:hover {
+ background-position: left -23px;
+}
+
+.Ldt-AnnotationsList-Tag-Li:hover span {
+ background-position: right -23px;
+}
+
+.Ldt-AnnotationsList-Play {
+ width: 125px; height: 20px; margin: 2px 0 2px 82px; text-align: center;
+ padding: 3px 5px 0 20px; font-size: 12px; cursor: pointer;
+ background: url(img/voiceannotation.png); color: #333333;
+}
+
+.Ldt-AnnotationsList-Play:hover {
+ background-position: 0 bottom;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/AnnotationsList.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/AnnotationsList.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,391 @@
+IriSP.Widgets.AnnotationsList = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastIds = [];
+ var _this = this;
+ this.throttledRefresh = IriSP._.throttle(function() {
+ _this.refresh(false);
+ }, 800);
+ this.searchString = false;
+ this.lastSearch = false;
+};
+
+IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AnnotationsList.prototype.defaults = {
+ /* URL when the annotations are to be reloaded from an LDT-like segment API
+ * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
+ */
+ ajax_url : false,
+ /* number of milliseconds before/after the current timecode when calling the segment API
+ */
+ ajax_granularity : 600000,
+ default_thumbnail : "",
+ /* URL when the annotation is not in the current project,
+ * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
+ */
+ foreign_url : "",
+ annotation_type : false,
+ refresh_interval : 0,
+ limit_count : 20,
+ newest_first : false,
+ show_audio: true,
+ polemics : [{
+ keyword: "++",
+ background_color: "#c9ecc6"
+ },{
+ keyword: "--",
+ background_color: "#f9c5c6"
+ },{
+ keyword: "??",
+ background_color: "#cec5f9"
+ },{
+ keyword: "==",
+ background_color: "#f9f4c6"
+ }]
+};
+
+IriSP.Widgets.AnnotationsList.prototype.messages = {
+ en: {
+ voice_annotation: "Voice Annotation",
+ now_playing: "Now playing..."
+ },
+ fr: {
+ voice_annotation: "Annotation Vocale",
+ now_playing: "Lecture en cours..."
+ }
+};
+
+IriSP.Widgets.AnnotationsList.prototype.template =
+ '';
+
+IriSP.Widgets.AnnotationsList.prototype.annotationTemplate =
+ ''
+ + ''
+ + '{{begin}} - {{end}}
'
+ + ''
+ + '{{{hdescription}}}
'
+ + '{{#tags.length}}'
+ + ''
+ + '{{/tags.length}}'
+ + '{{#audio}}{{l10n.voice_annotation}}
{{/audio}}'
+ + ' ';
+
+//obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
+
+IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
+ var _currentTime = this.media.getCurrentTime(),
+ _duration = this.media.duration;
+ this.lastAjaxQuery = _currentTime;
+ var _url = Mustache.to_html(this.ajax_url, {
+ media : this.source.currentMedia.id,
+ begin : Math.max(0, _currentTime - this.ajax_granularity),
+ end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity)
+ });
+ this.currentSource = this.player.loadMetadata(IriSP._.defaults({
+ "url" : _url
+ }, this.metadata));
+};
+
+IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() {
+ var _currentTime = this.media.getCurrentTime();
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
+ if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
+ this.lastMashupAnnotation = _currentAnnotation.id;
+ var _currentMedia = _currentAnnotation.getMedia(),
+ _url = Mustache.to_html(this.ajax_url, {
+ media : _currentMedia.id,
+ begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity),
+ end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity)
+ });
+ this.currentSource = this.player.loadMetadata(IriSP._.defaults({
+ "url" : _url
+ }, this.metadata));
+ }
+};
+
+IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) {
+ _forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw);
+ if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) {
+ return 0;
+ }
+ var _this = this,
+ _currentTime = this.media.getCurrentTime();
+ var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations();
+ if (this.mashupMode) {
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
+ if (typeof _currentAnnotation !== "undefined") {
+ _currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin;
+ var _mediaId = _currentAnnotation.getMedia().id;
+ _list = _list.filter(function(_annotation) {
+ return _annotation.getMedia().id === _mediaId;
+ });
+ }
+ }
+ _list = _list.filter(function(_annotation) {
+ return _annotation.found !== false;
+ });
+ if (this.limit_count) {
+ /* Get the n annotations closest to current timecode */
+ _list = _list.sortBy(function(_annotation) {
+ return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime);
+ }).slice(0, this.limit_count);
+ }
+ if (this.newest_first) {
+ _list = _list.sortBy(function(_annotation) {
+ return -_annotation.created.valueOf();
+ });
+ } else {
+ _list = _list.sortBy(function(_annotation) {
+ return _annotation.begin;
+ });
+ }
+
+ var _ids = _list.idIndex;
+
+ if (_forceRedraw || !IriSP._.isEqual(_ids, this.lastIds) || this.searchString !== this.lastSearch) {
+ /* This part only gets executed if the list needs updating */
+ this.lastSearch = this.searchString;
+ this.lastIds = _ids;
+ this.list_$.html("");
+ _list.forEach(function(_annotation) {
+ var _url = (
+ ( typeof _annotation.url !== "undefined" && _annotation.url)
+ ? _annotation.url
+ : (
+ ( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project )
+ ? Mustache.to_html(
+ _this.foreign_url,
+ {
+ project : _annotation.project,
+ media : _annotation.media.id,
+ annotation : _annotation.id,
+ annotationType : _annotation.annotationType.id
+ }
+ )
+ : document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
+ )
+ );
+ var _title = (_annotation.title || "").replace(_annotation.description,''),
+ _description = _annotation.description,
+ _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
+ if (!_annotation.title) {
+ _title = _annotation.creator;
+ }
+ if (!_annotation.description && _annotation.creator) {
+ _description = _annotation.title;
+ _title = _annotation.creator;
+ }
+ var _bgcolor;
+ IriSP._(_this.polemics).each(function(_polemic) {
+ var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true);
+ if (_rgxp.test(_title + " " + _description)) {
+ _bgcolor = _polemic.background_color;
+ }
+ });
+ var _data = {
+ id : _annotation.id,
+ media_id : _annotation.getMedia().id,
+ htitle : IriSP.textFieldHtml(_title),
+ hdescription : IriSP.textFieldHtml(_description),
+ begin : _annotation.begin.toString(),
+ end : _annotation.end.toString(),
+ thumbnail : _thumbnail,
+ url : _url,
+ tags : _annotation.getTagTexts(),
+ specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
+ l10n: _this.l10n
+ };
+ if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") {
+ _data.audio = true;
+ if (!_this.jwplayers[_annotation.id]) {
+ var _audiofile = _annotation.audio.href;
+ if (_this.audio_url_transform) {
+ _audiofile = _this.audio_url_transform(_annotation.audio.href);
+ }
+ var _tmpId = "jwplayer-" + IriSP.Model.getUID();
+ _this.jwplayers[_annotation.id] = _tmpId;
+ _this.$.find(".Ldt-AnnotationsList-Audio").append(IriSP.jQuery("").attr("id", _tmpId));
+ jwplayer(_tmpId).setup({
+ flashplayer: IriSP.getLib("jwPlayerSWF"),
+ file: _audiofile,
+ fallback: false,
+ primary: "flash",
+ controls: false,
+ width: 1,
+ height: 1,
+ events: {
+ onPause: function() {
+ _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation);
+ },
+ onPlay: function() {
+ _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing);
+ }
+ }
+ });
+ }
+ }
+ var _html = Mustache.to_html(_this.annotationTemplate, _data),
+ _el = IriSP.jQuery(_html),
+ _onselect = function() {
+ _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
+ _el.addClass("selected");
+ },
+ _onunselect = function() {
+ _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
+ };
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ })
+ .mouseout(function() {
+ _annotation.trigger("unselect");
+ })
+ .appendTo(_this.list_$);
+ IriSP.attachDndData(_el.find("[draggable]"), {
+ title: _title,
+ description: _description,
+ uri: _url,
+ image: _annotation.thumbnail
+ });
+ _el.on("remove", function() {
+ _annotation.off("select", _onselect);
+ _annotation.off("unselect", _onunselect);
+ });
+ _annotation.on("select", _onselect);
+ _annotation.on("unselect", _onunselect);
+ });
+
+ /* Correct the empty tag bug */
+ this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() {
+ var _el = IriSP.jQuery(this);
+ if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
+ _el.remove();
+ }
+ });
+
+ this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
+ _this.source.getAnnotations().search(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ });
+
+ this.$.find(".Ldt-AnnotationsList-Play").click(function() {
+ var _el = IriSP.jQuery(this),
+ _annid = _el.attr("data-annotation-id");
+ if (_this.jwplayers[_annid]) {
+ jwplayer(_this.jwplayers[_annid]).play();
+ }
+ _this.media.pause();
+ });
+
+ if (this.source.getAnnotations().searching) {
+ var rx = _this.source.getAnnotations().regexp || false;
+ this.$.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description").each(function() {
+ var _$ = IriSP.jQuery(this);
+ _$.html(IriSP.textFieldHtml(_$.text(), rx));
+ });
+ }
+ }
+
+ if (this.ajax_url) {
+ if (this.mashupMode) {
+ this.ajaxMashup();
+ } else {
+ if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity)) {
+ this.ajaxSource();
+ }
+ }
+ }
+ return _list.length;
+};
+
+IriSP.Widgets.AnnotationsList.prototype.draw = function() {
+
+ this.jwplayers = {};
+ this.mashupMode = (this.media.elementType === "mashup");
+
+ this.renderTemplate();
+
+ var _this = this;
+
+ this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
+
+
+ this.source.getAnnotations().on("search", function(_text) {
+ _this.searchString = _text;
+ if (_this.source !== _this.currentSource) {
+ _this.currentSource.getAnnotations().search(_text);
+ _this.throttledRefresh();
+ }
+ });
+ this.source.getAnnotations().on("found", function() {
+ _this.throttledRefresh();
+ });
+ this.source.getAnnotations().on("not-found", function() {
+ _this.throttledRefresh();
+ });
+ this.source.getAnnotations().on("clear-search", function() {
+ _this.searchString = false;
+ if (_this.source !== _this.currentSource) {
+ _this.currentSource.getAnnotations().trigger("clear-search");
+ }
+ });
+ this.source.getAnnotations().on("search-cleared", function() {
+ _this.throttledRefresh();
+ });
+
+ this.onMdpEvent("AnnotationsList.refresh", function() {
+ if (_this.ajax_url) {
+ if (_this.mashupMode) {
+ _this.ajaxMashup();
+ } else {
+ _this.ajaxSource();
+ }
+ }
+ _this.throttledRefresh();
+ });
+
+ if (this.ajax_url) {
+ if (this.mashupMode) {
+ this.ajaxMashup();
+ } else {
+ this.ajaxSource();
+ }
+ } else {
+ this.currentSource = this.source;
+ }
+
+ if (this.refresh_interval) {
+ window.setInterval(function() {
+ _this.currentSource.get();
+ }, this.refresh_interval);
+ }
+
+ this.onMdpEvent("createAnnotationWidget.addedAnnotation");
+ var _events = [
+ "timeupdate",
+ "seeked",
+ "loadedmetadata"
+ ];
+ for (var _i = 0; _i < _events.length; _i++) {
+ this.onMediaEvent(_events[_i], this.throttledRefresh);
+ }
+
+ this.throttledRefresh();
+
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Arrow.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Arrow.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,88 @@
+IriSP.Widgets.Arrow = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.current_pilot_widget = this.pilot_widget
+};
+
+IriSP.Widgets.Arrow.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Arrow.prototype.defaults = {
+ arrow_height : 12,
+ arrow_width : 20,
+ base_height : 0,
+ base_curve : 0,
+ fill_url: IriSP.widgetsDir + '/img/pinstripe.png',
+ fill_color: "#ffffff", //Gradients can be used, e.g. "90-#000-#fff" for vertical white-to-black
+ stroke_color: "#b7b7b7",
+ stroke_width: 1.5,
+ animation_speed: 20
+};
+
+IriSP.Widgets.Arrow.prototype.draw = function() {
+ this.height = this.arrow_height + this.base_height;
+ this.$.addClass("Ldt-Arrow").css({
+ height: (1+this.height) + "px",
+ "margin-top": "1px",
+ overflow: "hidden"
+ });
+ this.paper = new Raphael(this.container, this.width, 1+this.height );
+ window.myArrow = this;
+ this.svgArrow = this.paper.path('M0,' + this.height + 'L' + this.width + ',' + this.height);
+ this.svgArrow.attr({
+ stroke: this.stroke_color,
+ "stroke-width": this.stroke_width,
+ fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color
+ });
+ this.moveToX(0);
+};
+
+IriSP.Widgets.Arrow.prototype.drawAt = function(_x) {
+ _x = Math.max(0, Math.min(_x, this.width));
+ var _d = 'M0,' + this.height
+ + 'L0,' + Math.min( this.height, this.arrow_height + this.base_curve)
+ + 'Q0,' + this.arrow_height
+ + ' ' + Math.max(0, Math.min(this.base_curve, _x - this.arrow_width / 2)) + ',' + this.arrow_height
+ + 'L' + Math.max(0, _x - this.arrow_width / 2) + ',' + this.arrow_height
+ + 'L' + Math.max(0, _x - this.arrow_width / 2) + ',' + Math.min(this.arrow_height, 2 * this.arrow_height * _x / this.arrow_width)
+ + 'L' + _x + ',0'
+ + 'L' + Math.min(this.width, _x + this.arrow_width / 2) + ',' + Math.min(this.arrow_height, 2 * this.arrow_height * ( this.width - _x ) / this.arrow_width)
+ + 'L' + Math.min(this.width, _x + this.arrow_width / 2) + ',' + this.arrow_height
+ + 'L' + Math.min(this.width, Math.max(this.width - this.base_curve, _x + this.arrow_width / 2)) + ',' + this.arrow_height
+ + 'Q' + this.width + ',' + this.arrow_height
+ + ' ' + this.width + ',' + Math.min( this.height, this.arrow_height + this.base_curve)
+ + 'L' + this.width + ',' + this.height;
+ this.svgArrow.attr({
+ path: _d
+ });
+};
+
+IriSP.Widgets.Arrow.prototype.moveToX = function(_x) {
+ this.targetX = Math.max(0, Math.min(_x, this.width));
+ if (typeof this.animInterval === "undefined") {
+ this.animInterval = window.setInterval(
+ this.functionWrapper("increment"),
+ 40
+ );
+ }
+ this.increment();
+};
+
+IriSP.Widgets.Arrow.prototype.moveToTime = function(_t) {
+ this.moveToX(this.width * _t / this.media.duration);
+};
+
+IriSP.Widgets.Arrow.prototype.increment = function() {
+ if (typeof this.currentX === "undefined") {
+ this.currentX = this.targetX;
+ }
+ if (this.currentX < this.targetX) {
+ this.currentX = Math.min(this.targetX, this.currentX + this.animation_speed);
+ }
+ if (this.currentX > this.targetX) {
+ this.currentX = Math.max(this.targetX, this.currentX - this.animation_speed);
+ }
+ if (this.currentX === this.targetX) {
+ window.clearInterval(this.animInterval);
+ this.animInterval = undefined;
+ }
+ this.drawAt(this.currentX);
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/AutoPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/AutoPlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,76 @@
+IriSP.Widgets.AutoPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AutoPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AutoPlayer.prototype.defaults = {
+ default_type: "JwpPlayer"
+};
+
+IriSP.Widgets.AutoPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "live", "provider", "autostart", "streamer", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _types = [
+ {
+ regexp: /^rtmp:\/\//,
+ type: "JwpPlayer"
+ },
+ {
+ regexp: /\.(mp4|m4v)$/,
+ type: "AdaptivePlayer"
+ },
+ {
+ regexp: /\.(ogg|ogv|webm)$/,
+ type: "HtmlPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?vimeo\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?dailymotion\.com/,
+ type: "DailymotionPlayer"
+ }
+ ],
+ _rtmprgx = /^rtmp:\/\//;
+
+ for (var i = 0; i < _types.length; i++) {
+ if (_types[i].regexp.test(this.video)) {
+ _opts.type = _types[i].type;
+ break;
+ }
+ }
+
+ if (typeof _opts.type === "undefined") {
+ _opts.type = this.default_type;
+ }
+
+ if (_opts.type === "AdaptivePlayer") {
+ var _canPlayType = document.createElement('video').canPlayType("video/mp4");
+ _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "HtmlPlayer" : "JwpPlayer";
+ }
+
+ if (_rtmprgx.test(this.video)) {
+ _opts.provider = "rtmp";
+ _opts.live = true;
+ }
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ this.insertSubwidget(this.$, _opts);
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Controller.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Controller.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,176 @@
+/* Player Widget */
+
+.Ldt-Ctrl {
+ font-size: 10px;
+ background:url('img/player_gradient.png') repeat-x transparent ;
+ height: 25px;
+ border: 1px solid #b6b8b8;
+ position: relative;
+}
+
+.Ldt-Ctrl-Left {
+ float:left; width: 300px;
+}
+
+.Ldt-Ctrl-Right {
+ float: right;
+}
+
+.Ldt-Ctrl-button {
+ float: left;
+ width: 30px; height: 25px;
+ background: url('img/player-sprites.png');
+ cursor: pointer;
+}
+
+.Ldt-Ctrl-spacer {
+ float: left; width: 1px; height: 25px; background: #b6b8b8;
+}
+
+.Ldt-Ctrl-Play {
+ margin: 0 15px;
+}
+
+.Ldt-Ctrl-Play-PlayState {
+ background-position: 0 0;
+}
+
+.Ldt-Ctrl-Play-PlayState:hover {
+ background-position: 0 -25px;
+}
+
+.Ldt-Ctrl-Play-PlayState:active {
+ background-position: 0 -50px;
+}
+
+.Ldt-Ctrl-Play-PauseState {
+ background-position: -30px 0;
+}
+
+.Ldt-Ctrl-Play-PauseState:hover {
+ background-position: -30px -25px;
+}
+
+.Ldt-Ctrl-Play-PauseState:active {
+ background-position: -30px -50px;
+}
+
+.Ldt-Ctrl-Annotate {
+ margin: 0 2px;
+ background-position: -60px 0;
+}
+
+.Ldt-Ctrl-Annotate:hover {
+ background-position: -60px -25px;
+}
+
+.Ldt-Ctrl-Annotate:active {
+ background-position: -60px -50px;
+}
+
+.Ldt-Ctrl-SearchBtn {
+ margin: 0 2px;
+ background-position: -90px 0;
+}
+
+.Ldt-Ctrl-SearchBtn:hover {
+ background-position: -90px -25px;
+}
+
+.Ldt-Ctrl-SearchBtn:active {
+ background-position: -90px -50px;
+}
+
+.Ldt-Ctrl-Search {
+ width: 0; float: left; overflow: hidden;
+}
+
+input.Ldt-Ctrl-SearchInput {
+ width: 145px; height: 13px; margin: 2px; padding: 3px;
+ border: 1px solid #8080a0; border-radius: 3px; font-size: 13px;
+}
+
+.Ldt-Ctrl-Time {
+ float: left;
+ margin: 5px;
+ font-size: 12px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.Ldt-Ctrl-Time-Elapsed {
+ float: left;
+ color: #4a4a4a;
+}
+
+.Ldt-Ctrl-Time-Separator {
+ margin: 0 4px;
+ float: left;
+}
+
+.Ldt-Ctrl-Time-Total {
+ float: left;
+ color: #b2b2b2;
+}
+
+.Ldt-Ctrl-Sound {
+ margin: 0 2px;
+}
+
+.Ldt-Ctrl-Sound-Full {
+ background-position: -120px 0;
+}
+
+.Ldt-Ctrl-Sound-Full:hover {
+ background-position: -120px -25px;
+}
+
+.Ldt-Ctrl-Sound-Full:active {
+ background-position: -120px -50px;
+}
+
+.Ldt-Ctrl-Sound-Mute {
+ background-position: -150px 0;
+}
+
+.Ldt-Ctrl-Sound-Mute:hover {
+ background-position: -150px -25px;
+}
+
+.Ldt-Ctrl-Sound-Mute:active {
+ background-position: -150px -50px;
+}
+
+.Ldt-Ctrl-Sound-Half {
+ background-position: -180px 0;
+}
+
+.Ldt-Ctrl-Sound-Half:hover {
+ background-position: -180px -25px;
+}
+
+.Ldt-Ctrl-Sound-Half:active {
+ background-position: -180px -50px;
+}
+
+.Ldt-Ctrl-Volume-Control {
+ display: none;
+ position: absolute;
+ background:url('img/player_gradient.png') repeat-x transparent ;
+ height: 25px;
+ width: 100px; top: 25px; right: -1px; z-index: 100;
+ padding: 0 2px;
+ border: 1px solid #b6b8b8;
+}
+
+.Ldt-Ctrl-Volume-Bar {
+ height: 5px; margin: 9px 3px 0; background: #cccccc; border: 1px solid #999999; border-radius: 2px;
+}
+
+.Ldt-Ctrl-Volume-Control .ui-slider-handle {
+ width: 6px; height: 19px; background: #a8a8a8; border: 1px solid #999999; border-radius: 2px; top: -8px; margin-left: -4px;
+ cursor: pointer;
+}
+
+.Ldt-Ctrl-Volume-Control:hover .ui-slider-handle {
+ background: #F7268E;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Controller.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Controller.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,277 @@
+/* Displays Play and Pause buttons, Search Button and Form, Volume Control */
+
+IriSP.Widgets.Controller = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastSearchValue = "";
+};
+
+IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Controller.prototype.defaults = {
+ disable_annotate_btn: false,
+ disable_search_btn: false,
+ disable_ctrl_f: false
+};
+
+IriSP.Widgets.Controller.prototype.template =
+ '
'
+ + '
'
+ + '
'
+ + '
'
+ + '{{^disable_annotate_btn}}'
+ + '
'
+ + '
'
+ + '{{/disable_annotate_btn}}'
+ + '{{^disable_search_btn}}'
+ + '
'
+ + '
'
+ + '{{/disable_search_btn}}'
+ + '
'
+ + ' '
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
00:00
'
+ + '
/
'
+ + '
00:00
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
';
+
+IriSP.Widgets.Controller.prototype.messages = {
+ en: {
+ play_pause: "Play/Pause",
+ mute_unmute: "Mute/Unmute",
+ play: "Play",
+ pause: "Pause",
+ mute: "Mute",
+ unmute: "Unmute",
+ annotate: "Annotate",
+ search: "Search",
+ elapsed_time: "Elapsed time",
+ total_time: "Total duration",
+ volume: "Volume",
+ volume_control: "Volume control"
+ },
+ fr: {
+ play_pause: "Lecture/Pause",
+ mute_unmute: "Couper/Activer le son",
+ play: "Lecture",
+ pause: "Pause",
+ mute: "Couper le son",
+ unmute: "Activer le son",
+ annotate: "Annoter",
+ search: "Rechercher",
+ elapsed_time: "Temps écoulé",
+ total_time: "Durée totale",
+ volume: "Niveau sonore",
+ volume_control: "Réglage du niveau sonore"
+ }
+};
+
+IriSP.Widgets.Controller.prototype.draw = function() {
+ var _this = this;
+ this.renderTemplate();
+
+ // Define blocks
+ this.$playButton = this.$.find(".Ldt-Ctrl-Play");
+ this.$searchBlock = this.$.find(".Ldt-Ctrl-Search");
+ this.$searchInput = this.$.find(".Ldt-Ctrl-SearchInput");
+ this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar");
+
+ // handle events
+ this.onMediaEvent("play","playButtonUpdater");
+ this.onMediaEvent("pause","playButtonUpdater");
+ this.onMediaEvent("volumechange","volumeUpdater");
+ this.onMediaEvent("timeupdate","timeDisplayUpdater");
+ this.onMediaEvent("loadedmetadata","volumeUpdater");
+
+ // handle clicks
+ this.$playButton.click(this.functionWrapper("playHandler"));
+
+ this.$.find(".Ldt-Ctrl-Annotate").click(function() {
+ _this.player.trigger("CreateAnnotation.toggle");
+ });
+ this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
+
+ this.$searchInput.keyup(this.functionWrapper("searchHandler"));
+
+ var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control");
+ this.$.find('.Ldt-Ctrl-Sound')
+ .click(this.functionWrapper("muteHandler"))
+ .mouseover(function() {
+ _volctrl.show();
+ })
+ .mouseout(function() {
+ _volctrl.hide();
+ });
+ _volctrl.mouseover(function() {
+ _volctrl.show();
+ }).mouseout(function() {
+ _volctrl.hide();
+ });
+
+ // Handle CTRL-F
+ if (!this.disable_ctrl_f) {
+ var _fKey = "F".charCodeAt(0),
+ _lastCtrlFTime = 0;
+ IriSP.jQuery(document).keydown(function(_event) {
+ if (_event.keyCode === _fKey && (_event.ctrlKey || _event.metaKey)) {
+ var _time = IriSP.jQuery.now();
+ if (_time - _lastCtrlFTime > 2000) {
+ _this.searchButtonHandler();
+ }
+ _lastCtrlFTime = _time;
+ return false;
+ }
+ });
+ }
+
+ // Allow Volume Cursor Dragging
+ this.$volumeBar.slider({
+ slide: function(event, ui) {
+ _this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%');
+ _this.media.setVolume(ui.value / 100);
+ },
+ stop: this.functionWrapper("volumeUpdater")
+ });
+
+ // trigger an IriSP.Player.MouseOver to the widgets that are interested (i.e : sliderWidget)
+ this.$.hover(
+ function() {
+ _this.player.trigger("Player.MouseOver");
+ },
+ function() {
+ _this.player.trigger("Player.MouseOut");
+ });
+
+ this.timeDisplayUpdater(new IriSP.Model.Time(0));
+
+ var annotations = this.source.getAnnotations();
+ annotations.on("search", function(_text) {
+ _this.$searchInput.val(_text);
+ _this.showSearchBlock();
+ });
+ annotations.on("found", function(_text) {
+ _this.$searchInput.css('background-color','#e1ffe1');
+ });
+ annotations.on("not-found", function(_text) {
+ _this.$searchInput.css('background-color', "#d62e3a");
+ });
+ annotations.on("search-cleared", function() {
+ _this.hideSearchBlock();
+ });
+
+};
+
+/* Update the elasped time div */
+IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
+
+ // we get it at each call because it may change.
+ var _totalTime = this.media.duration;
+ this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_time.toString());
+ this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString());
+};
+
+/* update the icon of the button - separate function from playHandler
+ because in some cases (for instance, when the user directly clicks on
+ the jwplayer window) we have to change the icon without playing/pausing
+*/
+IriSP.Widgets.Controller.prototype.playButtonUpdater = function() {
+ if (this.media.getPaused()) {
+ /* the background sprite is changed by adding/removing the correct classes */
+ this.$playButton
+ .attr("title", this.l10n.play)
+ .removeClass("Ldt-Ctrl-Play-PauseState")
+ .addClass("Ldt-Ctrl-Play-PlayState");
+ } else {
+ this.$playButton
+ .attr("title", this.l10n.pause)
+ .removeClass("Ldt-Ctrl-Play-PlayState")
+ .addClass("Ldt-Ctrl-Play-PauseState");
+ }
+};
+
+
+IriSP.Widgets.Controller.prototype.playHandler = function() {
+ if (this.media.getPaused()) {
+ this.media.play();
+ } else {
+ this.media.pause();
+ }
+};
+
+IriSP.Widgets.Controller.prototype.muteHandler = function() {
+ this.media.setMuted(!this.media.getMuted());
+};
+
+IriSP.Widgets.Controller.prototype.volumeUpdater = function() {
+ var _muted = this.media.getMuted(),
+ _vol = this.media.getVolume();
+ if (_vol === false) {
+ _vol = .5;
+ }
+ var _soundCtl = this.$.find(".Ldt-Ctrl-Sound");
+ _soundCtl.removeClass("Ldt-Ctrl-Sound-Mute Ldt-Ctrl-Sound-Half Ldt-Ctrl-Sound-Full");
+ if (_muted) {
+ _soundCtl.attr("title", this.l10n.unmute)
+ .addClass("Ldt-Ctrl-Sound-Mute");
+ } else {
+ _soundCtl.attr("title", this.l10n.mute)
+ .addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" );
+ }
+ this.$volumeBar.slider("value", _muted ? 0 : 100 * _vol);
+};
+
+IriSP.Widgets.Controller.prototype.showSearchBlock = function() {
+ this.$searchBlock.animate({ width:"160px" }, 200);
+ this.$searchInput.css('background-color','#fff');
+ this.$searchInput.focus();
+};
+
+IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
+ this.$searchBlock.animate( { width: 0 }, 200);
+};
+
+/** react to clicks on the search button */
+IriSP.Widgets.Controller.prototype.searchButtonHandler = function() {
+ if ( !this.$searchBlock.width() ) {
+ this.showSearchBlock();
+ var _val = this.$searchInput.val();
+ if (_val) {
+ this.source.getAnnotations().search(_val);
+ }
+ } else {
+ this.hideSearchBlock();
+ }
+};
+
+/** this handler is called whenever the content of the search
+ field changes */
+IriSP.Widgets.Controller.prototype.searchHandler = function() {
+ if ( !this.$searchBlock.width() ) {
+ this.$searchBlock.css({ width:"160px" });
+ this.$searchInput.css('background-color','#fff');
+ }
+ var _val = this.$searchInput.val();
+ this._positiveMatch = false;
+
+ // do nothing if the search field is empty, instead of highlighting everything.
+ if (_val !== this.lastSearchValue) {
+ if (_val) {
+ this.source.getAnnotations().search(_val);
+ } else {
+ this.source.getAnnotations().trigger("clear-search");
+ this.$searchInput.css('background-color','');
+ }
+ }
+ this.lastSearchValue = _val;
+};
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/CreateAnnotation.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/CreateAnnotation.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,166 @@
+/*
+ *
+ */
+
+.Ldt-CreateAnnotation {
+ border-style: none solid solid;
+ border-width: 1px;
+ border-color: #b7b7b7;
+ padding: 0 1px 1px;
+ margin: 0;
+}
+
+.Ldt-CreateAnnotation-Inner {
+ background: url(img/pinstripe.png); padding: 5px; margin: 0; position: relative;
+}
+
+.Ldt-CreateAnnotation-Inner h3 {
+ margin: 5px 0; font-size: 14px; font-weight: bold; text-align: right; clear:both; color: #0068c4;
+}
+
+.Ldt-CreateAnnotation-h3Left {
+ float: left;
+}
+
+.Ldt-CreateAnnotation-Main {
+ min-height: 150px;
+}
+
+.Ldt-CreateAnnotation-Title, .Ldt-CreateAnnotation-Creator {
+ font-size: 14px;
+ font-weight: bold;
+ color: #0068c4;
+ border: 1px solid #666666;
+ border-radius: 2px;
+}
+
+.Ldt-CreateAnnotation-Title.empty, .Ldt-CreateAnnotation-Creator.empty {
+ font-style: italic;
+ color: #90b0d0;
+}
+
+.Ldt-CreateAnnotation-Times {
+ color: #ff3b77
+}
+
+.Ldt-CreateAnnotation-Submit {
+ position: absolute;
+ bottom: 7px;
+ right: 7px;
+ color: #ffffff;
+ cursor: pointer;
+ background: url('img/submit_annotation.png');
+ height: 50px;
+ width: 50px;
+ padding: 28px 0 0;
+ font-size: 12px;
+ border: none;
+ text-align: center;
+ cursor: pointer;
+}
+
+.Ldt-CreateAnnotation-Submit:hover {
+ background-position: -50px 0;
+}
+
+.Ldt-CreateAnnotation-Description {
+ height: 56px;
+ padding: 2px;
+ resize: none;
+ width: 460px;
+ border: 1px solid #666666;
+ border-radius: 2px;
+}
+
+.Ldt-CreateAnnotation-Description.empty {
+ font-style: italic; color: #999999;
+}
+
+.Ldt-CreateAnnotation-Avatar {
+ float: right;
+ width: 48px;
+ height: 48px;
+ margin: 5px 0;
+ padding: 0 0 0 15px;
+ background: url('img/profile_arrow.png') left no-repeat;
+}
+
+.Ldt-CreateAnnotation-Avatar img {
+ float: right;
+ display: block;
+ max-width: 100%;
+ max-height: 100%;
+ border: 1px solid #bbbbbb;
+}
+
+.Ldt-CreateAnnotation-RecBlock {
+ width: 220px; float: left;
+}
+
+.Ldt-CreateAnnotation-TagTitle, .Ldt-CreateAnnotation-PolemicTitle, .Ldt-CreateAnnotation-RecLabel {
+ display: block; margin: 5px 0 2px; font-size: 12px;
+}
+
+.Ldt-CreateAnnotation-TagList, .Ldt-CreateAnnotation-PolemicList {
+ list-style: none;
+}
+
+li.Ldt-CreateAnnotation-TagLi {
+ display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px;
+ background: url(img/tag.png) left top no-repeat;
+ cursor: pointer;
+}
+
+.Ldt-CreateAnnotation-TagButton {
+ display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0;
+ background: url(img/tag.png) right top no-repeat;
+}
+
+li.Ldt-CreateAnnotation-TagLi:hover {
+ background-position: left -23px;
+}
+
+.Ldt-CreateAnnotation-TagLi:hover .Ldt-CreateAnnotation-TagButton {
+ background-position: right -23px;
+}
+
+li.Ldt-CreateAnnotation-TagLi.selected {
+ background-position: left -46px;
+}
+
+.Ldt-CreateAnnotation-TagLi.selected .Ldt-CreateAnnotation-TagButton {
+ background-position: right -46px;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi {
+ display: inline-block; border: none; margin: 0 5px 0; height: 21px; width: 26px; padding: 2px 0 0;
+ background: url(img/polemic.png) left top no-repeat; font-size: 14px; font-weight: bold; text-align: center;
+ cursor: pointer;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi:hover {
+ background-position: 0 -23px;
+}
+
+li.Ldt-CreateAnnotation-PolemicLi.selected {
+ background-position: 0 -46px;
+}
+
+.Ldt-CreateAnnotation-InnerBox {
+ margin: 20px 50px;
+ border: 1px solid #CCCCCC;
+ padding: 20px;
+ background: #FFFFFF;
+ color: #FF3B77; text-align: center;
+ font-size: 13px; font-weight: bold;
+}
+
+a.Ldt-CreateAnnotation-Close {
+ position: absolute; top: 2px; right: 2px;
+ display: inline-block; width: 17px; height: 17px; margin: 2px;
+ background: url(img/widget-control.png);
+}
+
+a.Ldt-CreateAnnotation-Close:hover {
+ background-position: -17px 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/CreateAnnotation.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/CreateAnnotation.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,494 @@
+/* TODO: Add Social Network Sharing */
+
+IriSP.Widgets.CreateAnnotation = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.CreateAnnotation.prototype.defaults = {
+ show_title_field : true,
+ show_creator_field : true,
+ start_visible : true,
+ always_visible : false,
+ show_slice : true,
+ show_arrow : true,
+ show_mic_record: false,
+ show_mic_play: false,
+ minimize_annotation_widget : true,
+ creator_name : "",
+ creator_avatar : "",
+ tags : false,
+ tag_titles : false,
+ pause_on_write : true,
+ max_tags : 8,
+ polemics : [{
+ keyword: "++",
+ background_color: "#00a000",
+ text_color: "#ffffff"
+ },{
+ keyword: "--",
+ background_color: "#c00000",
+ text_color: "#ffffff"
+ },{
+ keyword: "??",
+ background_color: "#0000e0",
+ text_color: "#ffffff"
+ },{
+ keyword: "==",
+ background_color: "#f0e000",
+ text_color: "#000000"
+ }],
+ slice_annotation_type: "chap",
+ annotation_type: "Contributions",
+ api_serializer: "ldt_annotate",
+ api_endpoint_template: "",
+ api_method: "POST",
+ after_send_timeout: 0,
+ close_after_send: false,
+ tag_prefix: "#"
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.messages = {
+ en: {
+ from_time: "from",
+ to_time: "to",
+ at_time: "at",
+ submit: "Submit",
+ add_keywords_: "Add keywords:",
+ add_polemic_keywords_: "Add polemic attributes :",
+ your_name_: "Your name:",
+ annotate_video: "Annotate this video",
+ type_title: "Annotation title",
+ type_description: "Type the full contents of your annotation here.",
+ wait_while_processing: "Please wait while your annotation is being processed...",
+ error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
+ annotation_saved: "Thank you, your annotation has been saved.",
+ share_annotation: "Would you like to share it on social networks ?",
+ close_widget: "Hide the annotation form",
+ "polemic++": "Agree",
+ "polemic--": "Disagree",
+ "polemic??": "Question",
+ "polemic==": "Reference"
+ },
+ fr: {
+ from_time: "de",
+ to_time: "à",
+ at_time: "à",
+ submit: "Envoyer",
+ add_keywords_: "Ajouter des mots-clés\u00a0:",
+ add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:",
+ your_name_: "Votre nom\u00a0:",
+ annotate_video: "Annoter cette vidéo",
+ type_title: "Titre de l'annotation",
+ type_description: "Rédigez ici le contenu de votre annotation.",
+ wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...",
+ error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.",
+ annotation_saved: "Merci, votre annotation a été enregistrée.",
+ share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
+ close_widget: "Cacher le formulaire de création d'annotations",
+ "polemic++": "Accord",
+ "polemic--": "Désaccord",
+ "polemic??": "Question",
+ "polemic==": "Référence"
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.template =
+ '{{#show_slice}}
{{/show_slice}}'
+ + '{{^show_slice}}{{#show_arrow}}
{{/show_arrow}}{{/show_slice}}'
+ + '
'
+ + '
'
+ + '
{{l10n.wait_while_processing}}
'
+ + '
{{^always_visible}}
{{/always_visible}}
{{l10n.error_while_contacting}}
'
+ + '
{{^always_visible}}
{{/always_visible}}
{{l10n.annotation_saved}}
'
+ + '
';
+
+IriSP.Widgets.CreateAnnotation.prototype.draw = function() {
+ var _this = this;
+
+ this.begin = new IriSP.Model.Time();
+ this.end = this.source.getDuration();
+
+ this.tag_prefix = this.tag_prefix || "";
+
+ if (this.tag_titles && !this.tags) {
+ if(!(this.tag_titles.length==1 && this.tag_titles[0]=="")){
+ this.tags = IriSP._(this.tag_titles).map(function(_tag_title) {
+ var _tag,
+ _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+ if (_tags.length) {
+ _tag = _tags[0];
+ } else {
+ _tag = new IriSP.Model.Tag(false, _this.source);
+ _this.source.getTags().push(_tag);
+ _tag.title = _tag_title;
+ }
+ return _tag;
+ });
+ }
+ else{
+ // we forced no tags if this.tag_titles = [''] (and not false)
+ this.tags = true;
+ }
+ }
+ if (!this.tags) {
+ this.tags = this.source.getTags()
+ .sortBy(function (_tag) {
+ return -_tag.getAnnotations().length;
+ })
+ .slice(0, this.max_tags)
+ .map(function(_tag) {
+ return _tag;
+ });
+ /* We have to use the map function because Mustache doesn't like our tags object */
+ }
+ this.record_swf = IriSP.getLib("recordMicSwf");
+ this.renderTemplate();
+ if (this.show_mic_record) {
+ this.recorder = this.$.find("embed")[0];
+
+ window.setAudioUrl = function(_url) {
+ _this.audio_url = _url;
+ }
+ }
+ if (this.show_slice) {
+ this.insertSubwidget(
+ this.$.find(".Ldt-CreateAnnotation-Slice"),
+ {
+ type: "Slice",
+ show_arrow: this.show_arrow,
+ annotation_type: this.slice_annotation_type,
+ onBoundsChanged: function(_from, _to) {
+ _this.begin = new IriSP.Model.Time(_from || 0);
+ _this.end = new IriSP.Model.Time(_to || 0);
+ _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+ _this.$.find(".Ldt-CreateAnnotation-End").html(_this.end.toString());
+ }
+ },
+ "slice"
+ );
+ } else {
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow");
+ }
+ this.onMediaEvent("timeupdate", function(_time) {
+ _this.begin = new IriSP.Model.Time(_time || 0);
+ _this.end = new IriSP.Model.Time(_time || 0);
+ _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+ if (_this.arrow) {
+ _this.arrow.moveToTime(_time);
+ }
+ });
+ }
+ this.$.find(".Ldt-CreateAnnotation-Close").click(function() {
+ _this.close_after_send
+ ? _this.hide()
+ : _this.showScreen("Main");
+ return false;
+ });
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").click(function() {
+ _this.addKeyword(IriSP.jQuery(this).attr("data-text"));
+ return false;
+ });
+ this.$.find(".Ldt-CreateAnnotation-PolemicLi").each(function() {
+ var _el = IriSP.jQuery(this),
+ _kw = _el.attr("data-text"),
+ _msg = _this.l10n["polemic" + _kw];
+ if (_msg) {
+ _el.attr("title",_msg);
+ }
+ });
+ this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange"));
+ if (this.show_title_field) {
+ this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange"));
+ }
+ if (this.show_creator_field) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").bind("change keyup input paste", this.functionWrapper("onCreatorChange"));
+ }
+
+ if (this.start_visible) {
+ this.show();
+ } else {
+ this.$.hide();
+ this.hide();
+ }
+
+ this.onMdpEvent("CreateAnnotation.toggle","toggle");
+ this.$.find("form").submit(this.functionWrapper("onSubmit"));
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) {
+ this.$.find('.Ldt-CreateAnnotation-' + _screenName).show()
+ .siblings().hide();
+}
+
+IriSP.Widgets.CreateAnnotation.prototype.show = function() {
+ this.visible = true;
+ this.showScreen('Main');
+ this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty");
+ if (this.show_title_field) {
+ this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty");
+ }
+ if (this.show_creator_field) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666");
+ if (!this.creator_name) {
+ this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty");
+ }
+ }
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
+ this.$.slideDown();
+ if (this.minimize_annotation_widget) {
+ this.player.trigger("Annotation.minimize");
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
+ if (this.recorder) {
+ this.recorder.stopRecord();
+ }
+ if (!this.always_visible) {
+ this.visible = false;
+ this.$.slideUp();
+ if (this.minimize_annotation_widget) {
+ this.player.trigger("Annotation.maximize");
+ }
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.toggle = function() {
+ if (!this.always_visible) {
+ if (this.visible) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Description"),
+ _rx = IriSP.Model.regexpFromTextOrArray(_keyword),
+ _contents = _field.val();
+ _contents = ( !!_contents.match(_rx)
+ ? _contents.replace(_rx,"")
+ : _contents + " " + _keyword
+ );
+ _field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,''));
+ this.onDescriptionChange();
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() {
+ if (this.pause_on_write && !this.media.getPaused()) {
+ this.media.pause();
+ }
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Description"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() {
+ var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).attr("data-text"));
+ if (_contents.match(_rx)) {
+ IriSP.jQuery(this).addClass("selected");
+ } else {
+ IriSP.jQuery(this).removeClass("selected");
+ }
+ });
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Title"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+
+IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() {
+ var _field = this.$.find(".Ldt-CreateAnnotation-Creator"),
+ _contents = _field.val();
+ _field.css("border-color", !!_contents ? "#666666" : "#ff0000");
+ if (!!_contents) {
+ _field.removeClass("empty");
+ } else {
+ _field.addClass("empty");
+ }
+ this.pauseOnWrite();
+ return !!_contents;
+};
+
+/* Fonction effectuant l'envoi des annotations */
+IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() {
+ /* Si les champs obligatoires sont vides, on annule l'envoi */
+ if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) {
+ return false;
+ }
+
+ if (this.recorder) {
+ this.recorder.stopRecord();
+ }
+
+ var _this = this,
+ _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */
+ _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */
+ _annotation = new IriSP.Model.Annotation(false, _export), /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */
+ _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */
+ _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */
+ _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* Génération de l'URL à laquelle l'annotation doit être envoyée, qui doit inclure l'ID du projet */
+
+ /* Si nous avons dû générer un ID d'annotationType à la volée... */
+ if (!_annotationTypes.length) {
+ /* Il ne faudra pas envoyer l'ID généré au serveur */
+ _annotationType.dont_send_id = true;
+ /* Il faut inclure le titre dans le type d'annotation */
+ _annotationType.title = this.annotation_type;
+ }
+
+ /*
+ * Nous remplissons les données de l'annotation générée à la volée
+ * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE
+ * */
+ _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */
+ _annotation.setBegin(this.begin); /*Timecode de début */
+ _annotation.setEnd(this.end); /* Timecode de fin */
+
+ _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */
+ if (this.show_title_field) {
+ /* Champ titre, seulement s'il est visible */
+ _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val();
+ }
+ _annotation.created = new Date(); /* Date de création de l'annotation */
+ _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */
+
+ var tagIds = Array.prototype.map.call(
+ this.$.find(".Ldt-CreateAnnotation-TagLi.selected"),
+ function(el) { return IriSP.jQuery(el).attr("tag-id")}
+ );
+
+ IriSP._(_annotation.description.match(/#[^\s#.,;]+/g)).each(function(_tt) {
+ var _tag,
+ _tag_title = _tt.replace(/^#/,''),
+ _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+ if (_tags.length) {
+ _tag = _tags[0];
+ } else {
+ _tag = new IriSP.Model.Tag(false, _this.source);
+ _this.source.getTags().push(_tag);
+ _tag.title = _tag_title;
+ }
+ if (tagIds.indexOf(_tag.id) === -1) {
+ tagIds.push(_tag.id);
+ }
+
+ })
+
+ _annotation.setTags(IriSP._(tagIds).uniq()); /*Liste des ids de tags */
+ if (this.audio_url) {
+ _annotation.audio = {
+ src: "mic",
+ mimetype: "audio/mp3",
+ href: this.audio_url
+ };
+ }
+ if (this.show_creator_field) {
+ _annotation.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val();
+ } else {
+ _annotation.creator = this.creator_name;
+ }
+ _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */
+ _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */
+
+ var _this = this;
+ /* Envoi de l'annotation via AJAX au serveur ! */
+ IriSP.jQuery.ajax({
+ url: _url,
+ type: this.api_method,
+ contentType: 'application/json',
+ data: _export.serialize(), /* L'objet Source est sérialisé */
+ success: function(_data) {
+ _this.showScreen('Saved'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */
+ if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */
+ window.setTimeout(
+ function() {
+ _this.close_after_send
+ ? _this.hide()
+ : _this.show();
+ },
+ _this.after_send_timeout
+ );
+ }
+ _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
+ _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
+ _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */
+ if (_this.pause_on_write && _this.media.getPaused()) {
+ _this.media.play();
+ }
+ _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
+ },
+ error: function(_xhr, _error, _thrown) {
+ IriSP.log("Error when sending annotation", _thrown);
+ _export.getAnnotations().removeElement(_annotation, true);
+ _this.showScreen('Error');
+ window.setTimeout(function(){
+ _this.showScreen("Main")
+ },
+ (_this.after_send_timeout || 5000));
+ }
+ });
+ this.showScreen('Wait');
+
+ return false;
+};
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/DailymotionPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/DailymotionPlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,104 @@
+IriSP.Widgets.DailymotionPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.DailymotionPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ this.height = this.height || Math.floor(this.width / this.aspect_ratio);
+
+ var _media = this.media,
+ _this = this,
+ _pauseState = true;
+
+ /* Dailymotion utilise un système de fonctions référencées dans
+ * des variables globales pour la gestion des événements.
+ */
+
+ window.onDailymotionPlayerReady = function() {
+
+ var _player = document.getElementById(_this.container);
+
+ _media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getCurrentTime());
+ };
+ _media.getVolume = function() {
+ return _player.getVolume() / 100;
+ };
+ _media.getPaused = function() {
+ return _pauseState;
+ };
+ _media.getMuted = function() {
+ return _player.isMuted();
+ };
+ _media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seekTo(_milliseconds / 1000);
+ };
+ _media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ };
+ _media.mute = function() {
+ return _player.mute();
+ };
+ _media.unmute = function() {
+ return _player.unMute();
+ };
+ _media.play = function() {
+ return _player.playVideo();
+ };
+ _media.pause = function() {
+ return _player.pauseVideo();
+ };
+
+ _player.addEventListener("onStateChange", "onDailymotionStateChange");
+ _player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
+
+ _player.cueVideoByUrl(_this.video);
+
+ _media.trigger("loadedmetadata");
+ };
+
+ window.onDailymotionStateChange = function(_state) {
+ switch(_state) {
+ case 1:
+ _media.trigger("play");
+ _pauseState = false;
+ break;
+
+ case 2:
+ _media.trigger("pause");
+ _pauseState = true;
+ break;
+
+ case 3:
+ _media.trigger("seeked");
+ break;
+ }
+ };
+
+ window.onDailymotionVideoProgress = function(_progress) {
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.mediaTime * 1000));
+ };
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque"
+ };
+
+ var atts = {
+ id : this.container
+ };
+
+ swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, this.width, this.height, "8", null, null, params, atts);
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/HelloWorld.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/HelloWorld.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,3 @@
+.Ldt-HelloWorld p {
+ text-align: center; font-size: 12px; margin: 2px 0;
+}
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/HelloWorld.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/HelloWorld.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,33 @@
+/* Shows an example of a widget, with :
+ * - Use of source data
+ * - Use of templating
+ * - Use of internationalization
+ */
+
+IriSP.Widgets.HelloWorld = function(player, config) {
+ console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.HelloWorld.prototype.defaults = {
+ text: "world"
+};
+
+IriSP.Widgets.HelloWorld.prototype.template =
+ '
{{l10n.Hello}} {{text}}
Looks like we have {{source.contents.annotation.length}} annotations in this feed
';
+
+IriSP.Widgets.HelloWorld.prototype.messages = {
+ "fr": {
+ "Hello" : "Bonjour,"
+ },
+ "en" : {
+ "Hello" : "Hello,"
+ }
+};
+
+IriSP.Widgets.HelloWorld.prototype.draw = function() {
+ this.renderTemplate();
+ console.log("HelloWorldWidget was drawn");
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/HtmlPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/HtmlPlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,15 @@
+IriSP.Widgets.HtmlPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.HtmlPlayer.prototype = new IriSP.Widgets.Widget();
+
+
+IriSP.Widgets.HtmlPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.HtmlPlayer.prototype.draw = function() {
+
+ IriSP.htmlPlayer(this.media, this.$, this);
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/JwpPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/JwpPlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,122 @@
+IriSP.Widgets.JwpPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.JwpPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.JwpPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.JwpPlayer.prototype.draw = function() {
+
+ var _opts = {},
+ _player = jwplayer(this.$[0]),
+ _seekPause = false,
+ _pauseState = true;
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ _opts.file = this.video;
+ _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
+ _opts.primary = "flash";
+ _opts.fallback = false;
+ _opts.controls = false;
+ _opts.width = this.width;
+ if (this.height) {
+ _opts.height = this.height;
+ }
+
+ if (this.autostart) { // There seems to be an autostart bug
+ //_opts.autostart = true;
+ //_pauseState = false;
+ //this.media.trigger("play");
+ }
+
+ if (this.url_transform) {
+ _opts.file = this.url_transform(_opts.file);
+ }
+
+ // Binding functions to jwplayer
+
+ var _media = this.media;
+
+ _media.on("setcurrenttime", function(_milliseconds) {
+ _seekPause = _pauseState;
+ _player.seek(_milliseconds / 1000);
+ });
+
+ _media.on("setvolume", function(_vol) {
+ _player.setVolume(Math.floor(_vol*100));
+ _media.volume = _vol;
+ });
+
+ _media.on("setmuted", function(_muted) {
+ _player.setMute(_muted);
+ _media.muted = _muted;
+ });
+
+ _media.on("setplay", function() {
+ _player.play(true);
+ _media.paused = false;
+ });
+
+ _media.on("setpause", function() {
+ _player.pause(true);
+ _media.paused = true;
+ });
+
+ // Binding jwplater events to media
+
+ function getVolume() {
+ _media.muted = _player.getMute();
+ _media.volume = _player.getVolume() / 100;
+ }
+
+ _opts.events = {
+ onReady: function() {
+ getVolume();
+ _media.currentTime = new IriSP.Model.Time(1000*_player.getPosition() || 0);
+ _media.trigger("loadedmetadata");
+ },
+ onTime: function(_progress) {
+ if (_seekPause) {
+ _player.pause(true);
+ _seekPause = false;
+ } else {
+ if (_pauseState && _player.getState() === "PLAYING") {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ }
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.position * 1000));
+ },
+ onPlay: function() {
+ if (!_seekPause) {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ },
+ onPause: function() {
+ _pauseState = true;
+ _media.trigger("pause");
+ },
+ onSeek: function() {
+ _media.trigger("seeked");
+ },
+ onMute: function(_event) {
+ _media.muted = _event.mute;
+ _media.trigger("volumechange");
+ },
+ onVolume: function(_event) {
+ _media.volume = _event.volume / 100;
+ _media.trigger("volumechange");
+ }
+ };
+
+ _player = _player.setup(_opts);
+
+ this.jwplayer = _player;
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/KnowledgeConcierge.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/KnowledgeConcierge.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,97 @@
+.Ldt-Kc-Slider {
+ width: 100%; height: 8px; margin: 3px 0; font-size: 8px;
+}
+
+.Ldt-Kc-Canvas {
+ border: 1px solid #999999;
+}
+
+.Ldt-Kc-Related {
+ display: none;
+}
+
+.Ldt-Kc-Related-Empty {
+ text-align: center; font-weight: bold; font-style: italic;
+ font-size: 14px; color: #999999; margin: 5px 0;
+}
+
+.Ldt-Kc-Related h2 {
+ border: none;
+ color: #330099;
+ font-size: 18px;
+ margin: 8px 0 2px;
+ padding: 0 5px;
+}
+
+h3.Ldt-Kc-For-Keywords {
+ border-bottom: 1px solid #666666;
+ color: #000000;
+ font-size: 12px;
+ margin: 2px 0 5px;
+ padding: 0 5px 5px;
+ text-align: right;
+}
+
+.Ldt-Kc-Keywords {
+ color: #d000c0; font-weight: bold;
+}
+
+.Ldt-Kc-Related-Item {
+ width: 235px; float: left; margin: 4px 0; padding: 4px 0;
+}
+
+.Ldt-Kc-Related-Item:hover {
+ background: #e8e8e8;
+}
+
+.Ldt-Kc-Related-Item:nth-child(even) {
+ margin-left: 10px;
+}
+
+.Ldt-Kc-Related-Item a {
+ text-decoration: none;
+}
+
+.Ldt-Kc-Related-Item img {
+ max-width: 80px; max-height: 60px; float: left;
+}
+
+.Ldt-Kc-Related-Item h3, .Ldt-Kc-Related-Item p {
+ margin: 0 0 5px 85px;
+}
+
+.Ldt-Kc-Related-Item h3 {
+ font-size: 14px; font-weight: 600;
+}
+
+.Ldt-Kc-Related-Item h3 a {
+ color: #330099;
+}
+
+.Ldt-Kc-Related-Item h3 a:hover {
+ text-decoration: underline;
+}
+
+.Ldt-Kc-Related-Item p {
+ font-size: 12px;
+}
+
+.Ldt-Kc-Item-Duration {
+ color: #c00000;
+}
+
+.Ldt-Kc-Row {
+ border-bottom: 1px solid #CCCCCC;
+ clear: both; float: left; width: 100%;
+}
+
+.Ldt-Kc-Clearer {
+ clear: both;
+}
+
+.Ldt-Kc-Waiting {
+ display: none;
+ height: 128px;
+ width: 100%;
+ background:url(img/loader.gif) center no-repeat;
+}
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/KnowledgeConcierge.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/KnowledgeConcierge.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,333 @@
+IriSP.Widgets.KnowledgeConcierge = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.KnowledgeConcierge.prototype.defaults = {
+ width: 600,
+ height: 500,
+ sketch_path: "tmgraph",
+ sketch_files: [ "tmgraph.pde", "physics.pde", "model.pde", "javascript.pde", "menu.pde", "event.pde", "constants.pde", "initialdata.pde"],
+ kc_api_root: "/kn-concierge/",
+ related_api_endpoint: "",
+ use_word_boundaries: false,
+ related_data_type: 'json', // SET TO "jsonp" FOR CROSS-DOMAIN OPERATION
+ related_count: 8,
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype.messages = {
+ "fr": {
+ related_videos: "Vidéos liées",
+ duration_: "Durée\u00a0:",
+ for_keywords_: "pour le(s) mots-clé(s)\u00a0:",
+ no_matching_videos: "Pas de vidéos correspondantes"
+ },
+ "en": {
+ related_videos: "Related Videos",
+ duration_: "Duration:",
+ for_keywords_: "for keyword(s):",
+ no_matching_videos: "No matching videos"
+ }
+};
+
+IriSP.Widgets.KnowledgeConcierge.prototype.template =
+ '
'
+ + '
';
+
+IriSP.Widgets.KnowledgeConcierge.prototype.draw = function() {
+ this.renderTemplate();
+ var _canvasHeight = this.height - 16,
+ _canvasWidth = this.width - 2,
+ _canvas = this.$.find(".Ldt-Kc-Canvas"),
+ _tmpId = IriSP._.uniqueId("Processing-"),
+ _slider = this.$.find(".Ldt-Kc-Slider"),
+ radius = .375 * Math.min(_canvasHeight, _canvasWidth);
+ _canvas.attr({
+ width: _canvasWidth,
+ height: _canvasHeight,
+ id: _tmpId
+ }).css({
+ width: _canvasWidth,
+ height: _canvasHeight
+ });
+ var _this = this,
+ _pjsfiles = IriSP._(this.sketch_files).map(function(_f) { return _this.sketch_path + "/" + _f; }),
+ _selectedText = "",
+ currentNodesList = "",
+ relatedCache = {},
+ relatedRequests = {},
+ relatedTemplate = '
';
+
+ Processing.loadSketchFromSources(_canvas[0],_pjsfiles);
+
+ function renderRelated() {
+ var keywords = currentNodesList;
+ _this.$.find(".Ldt-Kc-Related").show();
+ if (typeof relatedCache[keywords] === "undefined") {
+ return;
+ }
+ _this.$.find(".Ldt-Kc-Waiting").hide();
+ if (relatedCache[keywords].length) {
+ var _html = '
';
+ IriSP._(relatedCache[keywords]).each(function(media, i) {
+ var _tmpldata = {
+ widget: _this,
+ media: media,
+ description: media.description.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
+ duration: new IriSP.Model.Time(media.duration).toString(),
+ escaped_keyword: encodeURIComponent(keywords.split(",")[0])
+ };
+ _html += Mustache.to_html(relatedTemplate, _tmpldata);
+ if (i % 2) {
+ _html += '
';
+ }
+ });
+ _html += '
';
+ _this.$.find(".Ldt-Kc-Related-List").html(_html);
+ } else {
+ _this.$.find(".Ldt-Kc-Related-List").html("
" + _this.l10n.no_matching_videos + "
");
+ }
+ }
+
+ function triggerSearch(text) {
+ if (_selectedText !== text) {
+ _selectedText = text;
+ _this.source.getAnnotations().search(text);
+ }
+ }
+
+ function searchNodes(tags) {
+ var _tlist = (_this.use_word_boundaries ? IriSP._(tags).map(function(t) { return "\\\\y" + t + "\\\\y" }) : tags),
+ _q = "(?i)(" + _tlist.join("|") + ")";
+ jQuery.getJSON(
+ _this.kc_api_root + "topics.jsp",
+ {
+ proj: _this.project_id,
+ q: _q
+ },
+ function(data) {
+ if (data && data.items && data.items.length) {
+ for (var i=0, l=data.items.length; i
1) {
+ node.position(Math.floor(radius*Math.sin(2 * Math.PI * i / l)),Math.floor(radius*Math.cos(2 * Math.PI * i / l)));
+ }
+ }
+ }
+ }
+ );
+ }
+
+ function showRelated(nodetexts) {
+ currentNodesList = nodetexts;
+ _this.$.find(".Ldt-Kc-Related-List").html("");
+ _this.$.find(".Ldt-Kc-Keywords").html(nodetexts.replace(/\,/g,", "));
+ if (typeof relatedCache[nodetexts] === "undefined") {
+ _this.$.find(".Ldt-Kc-Waiting").show();
+ if (relatedRequests[nodetexts]) {
+ return;
+ }
+ relatedRequests[nodetexts] = true;
+ IriSP.jQuery.ajax({
+ url: _this.related_api_endpoint,
+ data: {
+ format: _this.related_data_type,
+ keywords: nodetexts
+ },
+ dataType: _this.related_data_type,
+ success: function(data) {
+ relatedCache[nodetexts] = IriSP._(data.objects)
+ .chain()
+ .filter(function(o) {
+ return o.iri_id !== _this.media.id;
+ })
+ .sortBy(function(o) {
+ return - o.score;
+ })
+ .first(_this.related_count)
+ .value();
+ renderRelated();
+ }
+ });
+ } else {
+ renderRelated();
+ }
+ }
+
+ function rootNode(id, proj) {
+ jQuery.getJSON(
+ _this.kc_api_root + "topic.jsp",
+ {
+ id: id,
+ proj: proj
+ },
+ function(response) {
+ if (response != null && response.items.length > 0){
+ item = response.items[0];
+ _pjs.initNode(item.id, item.name, item.grp, item.uid, item.proj);
+ _fns.countassoc(item.id, item.proj);
+ }
+ }
+ );
+ }
+
+ function bindJavascript() {
+ _pjs = Processing.getInstanceById(_tmpId);
+ if (_pjs && typeof _pjs.bindJavascript === "function") {
+ setTimeout(function() {
+ _pjs.bindJavascript(_fns);
+ _pjs.setSize(_canvasWidth,_canvasHeight);
+ var _edit = false,
+ _teamMode = true;
+ _pjs.saveMode("en",false,_teamMode,false,"both",_edit);
+ rootNode(_this.topic_id, _this.project_id);
+ _slider.slider({
+ min: -20,
+ max: 20,
+ value: 0,
+ range: "min",
+ slide: function(event, ui) {
+ _pjs.zoom(Math.exp(ui.value / 10));
+ }
+ });
+ }, 1000);
+ } else {
+ setTimeout(bindJavascript, 1000);
+ }
+ }
+ var currentSelection = null;
+ var _fns = {
+ adjacentnodes: function(id, proj, adj, both) {
+ jQuery.ajax({
+ url: _this.kc_api_root + "associations-bd.jsp",
+ cache: false,
+ data: {
+ id: id,
+ proj: proj,
+ both: both,
+ adj: adj
+ },
+ success: function(response) {
+ if (response.items.length > 0){
+ for(i = 0, end = response.items.length; i < end; i++) {
+ item = response.items[i];
+ _pjs.addEdge(item.asc_id, item.id, item.from_proj, item.to_id, item.to_proj,
+ item.r_name, item.r_from, item.r_to, item.uid, item.proj);
+ _pjs.setNodeName( item.id, item.from_proj,item.name);
+ _pjs.setNodeValue(item.id, item.from_proj,item.name, item.grp, item.abst, item.from_uid);
+ if (item.from_assoc!=null) {
+ _pjs.setNodeAssoc(item.id, item.from_proj, item.from_assoc);
+ }
+ _pjs.setNodeName( item.to_id,item.to_proj, item.to_name);
+ _pjs.setNodeValue(item.to_id,item.to_proj, item.to_name,item.to_grp,item.to_abst,item.to_uid);
+ if (item.to_assoc!=null) {
+ _pjs.setNodeAssoc(item.to_id, item.to_proj, item.to_assoc);
+ }
+ }
+ return response;
+ } else {
+ //.debug('No such topic.');
+ return null;
+ }
+ }
+ });
+ },
+ setscale: function(scl){
+ _slider.slider("value", 10*Math.log(scl));
+ },
+ countassoc: function(id, proj) {
+ jQuery.ajax({
+ url: _this.kc_api_root + "count-assoc.jsp",
+ data: {
+ id: id,
+ proj: proj
+ },
+ success: function(response) {
+ if (response.items.length > 0){
+ for(i = 0, end = response.items.length; i < end; i++) {
+ item = response.items[i];
+ _pjs.setNodeValue(item.id, item.proj, item.name, item.grp, item.abst);
+ if (item.assoc!=null) _pjs.setNodeAssoc(item.id, item.proj, item.assoc);
+ if (item.mass!=null) _pjs.setNodeMass( item.id, item.proj, item.mass);
+ }
+ }
+ }
+ });
+ },
+ username: function() {
+ var nodes = _pjs.getNodes().values().toArray(),
+ nodetexts = IriSP._(nodes).chain().pluck("name").sortBy().value().join(",");
+ showRelated(nodetexts);
+ },
+ mousemove: function(selection) {
+ if (selection !== currentSelection) {
+ if (selection) {
+ triggerSearch(selection.name);
+ }
+ currentSelection = selection;
+ }
+ },
+ click: function(selection) {
+ if (selection) {
+ triggerSearch(selection.name);
+ showRelated(selection.name);
+ } else {
+ triggerSearch();
+ }
+ }
+ };
+ var uselessfuncts = [
+ "selectnode", "selectedge", "topicnode","group_shapes",
+ "allbackup", "allretrieve", "new_topic", "pedia", "set_mode",
+ "new_relation", "startexpand", "endexpand", "new_select" //, "mouseover" //, "username"
+ ];
+
+ IriSP._(uselessfuncts).each(function(funcname) {
+ _fns[funcname] = function() {
+// console.log("Function", funcname, "called with arguments", arguments);
+ }
+ });
+
+ this.getWidgetAnnotations().forEach(function(annotation) {
+ annotation.on("click", function() {
+ var _tags = annotation.getTagTexts();
+ if (_tags.length) {
+ searchNodes(_tags);
+ }
+ });
+ });
+
+ this.source.getTags().forEach(function(tag) {
+ tag.on("click", function() {
+ if (tag.title) {
+ searchNodes([tag.title]);
+ }
+ });
+ });
+
+ var keywmatch = document.location.hash.match(/keyword=([^#?&]+)/);
+ if (keywmatch) {
+ this.player.on("widgets-loaded", function() {
+ triggerSearch(decodeURIComponent(keywmatch[1]));
+ });
+ }
+
+ bindJavascript();
+
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/LdtPlayer-core.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/LdtPlayer-core.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,19 @@
+/* Base classes */
+
+.Ldt-Loader {
+ min-height: 128px;
+ background:url(img/loader.gif) center no-repeat;
+ text-indent: -9999px;
+ position: absolute;
+ width: 100%;
+}
+
+.Ldt-Widget {
+/* font-family: Arial, Helvetica, sans-serif; */
+ color: black;
+ font-size: 12px;
+}
+
+.Ldt-Highlight {
+ background: #ffa0fc;
+}
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/LdtPlayer-core.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/LdtPlayer-core.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,2523 @@
+/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
+ v2.0.3 (c) Kyle Simpson
+ MIT License
+*/
+(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b0){for(var a=0;a=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
+/*
+ *
+ __ __ _ _ _ _
+ | \/ | ___| |_ __ _ __| | __ _| |_ __ _ _ __ | | __ _ _ _ ___ _ __
+ | |\/| |/ _ \ __/ _` |/ _` |/ _` | __/ _` | '_ \| |/ _` | | | |/ _ \ '__|
+ | | | | __/ || (_| | (_| | (_| | || (_| | |_) | | (_| | |_| | __/ |
+ |_| |_|\___|\__\__,_|\__,_|\__,_|\__\__,_| .__/|_|\__,_|\__, |\___|_|
+ |_| |___/
+
+ * Copyright 2010-2012 Institut de recherche et d'innovation
+ * contributor(s) : Karim Hamidou, Samuel Huron, Raphael Velt, Thibaut Cavalie
+ *
+ * contact@iri.centrepompidou.fr
+ * http://www.iri.centrepompidou.fr
+ *
+ * This software is a computer program whose purpose is to show and add annotations on a video .
+ * This software is governed by the CeCILL-C license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL-C
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL-C license and that you accept its terms.
+*/
+/* Initialization of the namespace */
+
+if (typeof window.IriSP === "undefined") {
+ window.IriSP = {
+ VERSION: "0.3.2"
+ };
+}
+
+if (typeof IriSP.jQuery === "undefined" && typeof window.jQuery !== "undefined") {
+ var jvp = window.jQuery().jquery.split("."),
+ jv = 100 * parseInt(jvp[0]) + parseInt(jvp[1]);
+ if (jv > 170) {
+ IriSP.jQuery = window.jQuery;
+ }
+}
+
+if (typeof IriSP._ === "undefined" && typeof window._ !== "undefined" && parseFloat(window._.VERSION) >= 1.4) {
+ IriSP._ = window._;
+}
+/* utils.js - various utils that don't belong anywhere else */
+
+IriSP.jqEscape = function(_text) {
+ return _text.replace(/(:|\.)/g,'\\$1');
+};
+
+IriSP.getLib = function(lib) {
+ if (IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string") {
+ return IriSP.libFiles.cdn[lib];
+ }
+ if (typeof IriSP.libFiles.locations[lib] == "string") {
+ return IriSP.libFiles.locations[lib];
+ }
+ if (typeof IriSP.libFiles.inDefaultDir[lib] == "string") {
+ return IriSP.libFiles.defaultDir + '/' + IriSP.libFiles.inDefaultDir[lib];
+ }
+};
+
+IriSP._cssCache = [];
+
+IriSP.loadCss = function(_cssFile) {
+ if (IriSP._(IriSP._cssCache).indexOf(_cssFile) === -1) {
+ IriSP.jQuery(" ", {
+ rel : "stylesheet",
+ type : "text/css",
+ href : _cssFile
+ }).appendTo('head');
+ IriSP._cssCache.push(_cssFile);
+ }
+};
+
+IriSP.textFieldHtml = function(_text, _regexp, _extend) {
+ var list = [],
+ positions = [],
+ text = _text.replace(/(^\s+|\s+$)/g,'');
+
+ function addToList(_rx, _startHtml, _endHtml) {
+ while(true) {
+ var result = _rx.exec(text);
+ if (!result) {
+ break;
+ }
+ var end = _rx.lastIndex,
+ start = result.index;
+ list.push({
+ start: start,
+ end: end,
+ startHtml: (typeof _startHtml === "function" ? _startHtml(result) : _startHtml),
+ endHtml: (typeof _endHtml === "function" ? _endHtml(result) : _endHtml)
+ });
+ positions.push(start);
+ positions.push(end);
+ }
+ }
+
+ if (_regexp) {
+ addToList(_regexp, '', ' ');
+ }
+
+ addToList(/(https?:\/\/)?[\w\d\-]+\.[\w\d\-]+\S+/gm, function(matches) {
+ return '';
+ }, ' ');
+ addToList(/@([\d\w]{1,15})/gm, function(matches) {
+ return '';
+ }, ' ');
+ addToList(/\*[^*]+\*/gm, '', ' ');
+ addToList(/[\n\r]+/gm, '', ' ');
+
+ IriSP._(_extend).each(function(x) {
+ addToList.apply(null, x);
+ });
+
+ positions = IriSP._(positions)
+ .chain()
+ .uniq()
+ .sortBy(function(p) { return parseInt(p); })
+ .value();
+
+ var res = "", lastIndex = 0;
+
+ for (var i = 0; i < positions.length; i++) {
+ var pos = positions[i];
+ res += text.substring(lastIndex, pos);
+ for (var j = list.length - 1; j >= 0; j--) {
+ var item = list[j];
+ if (item.start < pos && item.end >= pos) {
+ res += item.endHtml;
+ }
+ }
+ for (var j = 0; j < list.length; j++) {
+ var item = list[j];
+ if (item.start <= pos && item.end > pos) {
+ res += item.startHtml;
+ }
+ }
+ lastIndex = pos;
+ }
+
+ res += text.substring(lastIndex);
+
+ return res;
+
+};
+
+IriSP.log = function() {
+ if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
+ console.log.apply(console, arguments);
+ }
+};
+
+IriSP.attachDndData = function(jqSel, data) {
+ jqSel.attr("draggable", "true").on("dragstart", function(_event) {
+ var d = (typeof data === "function" ? data.call(this) : data);
+ try {
+ IriSP._(d).each(function(v, k) {
+ if (v) {
+ _event.originalEvent.dataTransfer.setData("text/x-iri-" + k, v);
+ }
+ });
+ } catch(err) {
+ _event.originalEvent.dataTransfer.setData("Text", JSON.stringify(d));
+ }
+ });
+};
+
+IriSP.FakeClass = function(properties) {
+ var _this = this,
+ noop = (function() {});
+ IriSP._(properties).each(function(p) {
+ _this[p] = noop;
+ });
+};
+
+/* js is where data is stored in a standard form, whatever the serializer */
+
+//TODO: Separate Project-specific data from Source
+
+IriSP.Model = (function (ns) {
+
+ function pad(n, x, b) {
+ b = b || 10;
+ var s = (x).toString(b);
+ while (s.length < n) {
+ s = "0" + s;
+ }
+ return s;
+ }
+
+ function rand16(n) {
+ return pad(n, Math.floor(Math.random()*Math.pow(16,n)), 16);
+ }
+
+ var uidbase = rand16(8) + "-" + rand16(4) + "-", uidincrement = Math.floor(Math.random()*0x10000);
+
+ var charsub = [
+ '[aáàâä]',
+ '[cç]',
+ '[eéèêë]',
+ '[iíìîï]',
+ '[oóòôö]',
+ '[uùûü]'
+ ];
+
+ var removeChars = [
+ String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),
+ "{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ",
+ ",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/"
+ ];
+
+var Model = {},
+ _SOURCE_STATUS_EMPTY = Model._SOURCE_STATUS_EMPTY = 0,
+ _SOURCE_STATUS_WAITING = Model._SOURCE_STATUS_WAITING = 1,
+ _SOURCE_STATUS_READY = Model._SOURCE_STATUS_READY = 2,
+ extendPrototype = Model.extendPrototype = function(toClass, fromClass) {
+ var fromP = fromClass.prototype,
+ toP = toClass.prototype;
+ for (var k in fromP) {
+ if (fromP.hasOwnProperty(k)) {
+ toP[k] = fromP[k];
+ }
+ }
+ },
+ getUID = Model.getUID = function() {
+ return uidbase + pad(4, (++uidincrement % 0x10000), 16) + "-" + rand16(4) + "-" + rand16(6) + rand16(6);
+ },
+ isLocalURL = Model.isLocalURL = function(url) {
+ var matches = url.match(/^(\w+:)\/\/([^/]+)/);
+ if (matches) {
+ return(matches[1] === document.location.protocol && matches[2] === document.location.host);
+ }
+ return true;
+ },
+ regexpFromTextOrArray = Model.regexpFromTextOrArray = function(_textOrArray, _testOnly, _iexact) {
+ var _testOnly = _testOnly || false,
+ _iexact = _iexact || false;
+ function escapeText(_text) {
+ return _text.replace(/([\\\*\+\?\|\{\[\}\]\(\)\^\$\.\#\/])/gm, '\\$1');
+ }
+ var _source =
+ typeof _textOrArray === "string"
+ ? escapeText(_textOrArray)
+ : ns._(_textOrArray).map(escapeText).join("|"),
+ _flags = 'im';
+ if (!_testOnly) {
+ _source = '(' + _source + ')';
+ _flags += 'g';
+ }
+ if (_iexact) {
+ _source = '^' + _source + '$';
+ }
+ return new RegExp( _source, _flags);
+ },
+ fullTextRegexps = Model.fullTextRegexps = function(_text) {
+ var remsrc = "[\\" + removeChars.join("\\") + "]",
+ remrx = new RegExp(remsrc,"gm"),
+ txt = _text.toLowerCase().replace(remrx,""),
+ res = [],
+ charsrx = ns._(charsub).map(function(c) {
+ return new RegExp(c);
+ }),
+ src = "";
+ for (var j = 0; j < txt.length; j++) {
+ if (j) {
+ src += remsrc + "*";
+ }
+ var l = txt[j];
+ ns._(charsub).each(function(v, k) {
+ l = l.replace(charsrx[k], v);
+ });
+ src += l;
+ }
+ return "(" + src + ")";
+ },
+ isoToDate = Model.isoToDate = function(_str) {
+ // http://delete.me.uk/2005/03/iso8601.html
+ var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
+ var d = _str.match(new RegExp(regexp));
+
+ var offset = 0;
+ var date = new Date(d[1], 0, 1);
+
+ if (d[3]) { date.setMonth(d[3] - 1); }
+ if (d[5]) { date.setDate(d[5]); }
+ if (d[7]) { date.setHours(d[7]); }
+ if (d[8]) { date.setMinutes(d[8]); }
+ if (d[10]) { date.setSeconds(d[10]); }
+ if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
+ if (d[14]) {
+ offset = (Number(d[16]) * 60) + Number(d[17]);
+ offset *= ((d[15] == '-') ? 1 : -1);
+ }
+
+ offset -= date.getTimezoneOffset();
+ time = (Number(date) + (offset * 60 * 1000));
+ var _res = new Date();
+ _res.setTime(Number(time));
+ return _res;
+ },
+ dateToIso = Model.dateToIso = function(_d) {
+ var d = _d ? new Date(_d) : new Date();
+ return d.getUTCFullYear()+'-'
+ + pad(2, d.getUTCMonth()+1)+'-'
+ + pad(2, d.getUTCDate())+'T'
+ + pad(2, d.getUTCHours())+':'
+ + pad(2, d.getUTCMinutes())+':'
+ + pad(2, d.getUTCSeconds())+'Z' ;
+ };
+
+/*
+ * List is a class for a list of elements (e.g. annotations, medias, etc. that each have a distinct ID)
+ */
+var List = Model.List = function(_directory) {
+ Array.call(this);
+ this.directory = _directory;
+ this.idIndex = [];
+ this.__events = {};
+ if (typeof _directory == "undefined") {
+ console.trace();
+ throw "Error : new List(directory): directory is undefined";
+ }
+ var _this = this;
+ this.on("clear-search", function() {
+ _this.searching = false;
+ _this.regexp = undefined;
+ _this.forEach(function(_element) {
+ _element.found = undefined;
+ });
+ _this.trigger("search-cleared");
+ });
+};
+
+List.prototype = new Array();
+
+List.prototype.hasId = function(_id) {
+ return ns._(this.idIndex).include(_id);
+};
+
+/* On recent browsers, forEach and map are defined and do what we want.
+ * Otherwise, we'll use the Underscore.js functions
+ */
+if (typeof Array.prototype.forEach === "undefined") {
+ List.prototype.forEach = function(_callback) {
+ var _this = this;
+ ns._(this).forEach(function(_value, _key) {
+ _callback(_value, _key, _this);
+ });
+ };
+};
+
+if (typeof Array.prototype.map === "undefined") {
+ List.prototype.map = function(_callback) {
+ var _this = this;
+ return ns._(this).map(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ });
+ };
+};
+
+List.prototype.pluck = function(_key) {
+ return this.map(function(_value) {
+ return _value[_key];
+ });
+};
+
+/* We override Array's filter function because it doesn't return an List
+ */
+List.prototype.filter = function(_callback) {
+ var _this = this,
+ _res = new List(this.directory);
+ _res.addElements(ns._(this).filter(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ }));
+ return _res;
+};
+
+List.prototype.slice = function(_start, _end) {
+ var _res = new List(this.directory);
+ _res.addElements(Array.prototype.slice.call(this, _start, _end));
+ return _res;
+};
+
+List.prototype.splice = function(_start, _end) {
+ var _res = new List(this.directory);
+ _res.addElements(Array.prototype.splice.call(this, _start, _end));
+ this.idIndex.splice(_start, _end);
+ return _res;
+};
+
+/* Array has a sort function, but it's not as interesting as Underscore.js's sortBy
+ * and won't return a new List
+ */
+List.prototype.sortBy = function(_callback) {
+ var _this = this,
+ _res = new List(this.directory);
+ _res.addElements(ns._(this).sortBy(function(_value, _key) {
+ return _callback(_value, _key, _this);
+ }));
+ return _res;
+};
+
+/* Title and Description are basic information for (almost) all element types,
+ * here we can search by these criteria
+ */
+List.prototype.searchByTitle = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ return _rgxp.test(_element.title);
+ });
+};
+
+List.prototype.searchByDescription = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ return _rgxp.test(_element.description);
+ });
+};
+
+List.prototype.searchByTextFields = function(_text, _iexact) {
+ var _iexact = _iexact || false,
+ _rgxp = regexpFromTextOrArray(_text, true, _iexact);
+ return this.filter(function(_element) {
+ var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
+ return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
+ });
+};
+
+List.prototype.search = function(_text) {
+ if (!_text) {
+ this.trigger("clear-search");
+ return this;
+ }
+ this.searching = true;
+ this.trigger("search", _text);
+ var rxsource = fullTextRegexps(_text),
+ rgxp = new RegExp(rxsource,"im");
+ this.regexp = new RegExp(rxsource,"gim");
+ var res = this.filter(function(_element, _k) {
+ var titlematch = rgxp.test(_element.title),
+ descmatch = rgxp.test(_element.description),
+ _isfound = !!(titlematch || descmatch);
+ _element.found = _isfound;
+ _element.trigger(_isfound ? "found" : "not-found");
+ return _isfound;
+ });
+ this.trigger(res.length ? "found" : "not-found",res);
+ return res;
+};
+
+List.prototype.getTitles = function() {
+ return this.map(function(_el) {
+ return _el.title;
+ });
+};
+
+List.prototype.addId = function(_id) {
+ var _el = this.directory.getElement(_id);
+ if (!this.hasId(_id) && typeof _el !== "undefined") {
+ this.idIndex.push(_id);
+ Array.prototype.push.call(this, _el);
+ }
+};
+
+List.prototype.push = function(_el) {
+ if (typeof _el === "undefined") {
+ return;
+ }
+ var _index = (ns._(this.idIndex).indexOf(_el.id));
+ if (_index === -1) {
+ this.idIndex.push(_el.id);
+ Array.prototype.push.call(this, _el);
+ } else {
+ this[_index] = _el;
+ }
+};
+
+List.prototype.addIds = function(_array) {
+ var _l = _array.length,
+ _this = this;
+ ns._(_array).forEach(function(_id) {
+ _this.addId(_id);
+ });
+};
+
+List.prototype.addElements = function(_array) {
+ var _this = this;
+ ns._(_array).forEach(function(_el) {
+ _this.push(_el);
+ });
+};
+
+List.prototype.removeId = function(_id, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _index = (ns._(this.idIndex).indexOf(_id));
+ if (_index !== -1) {
+ this.splice(_index,1);
+ }
+ if (_deleteFromDirectory) {
+ delete this.directory.elements[_id];
+ }
+};
+
+List.prototype.removeElement = function(_el, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false;
+ this.removeId(_el.id);
+};
+
+List.prototype.removeIds = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
+ ns._(_list).forEach(function(_id) {
+ _this.removeId(_id);
+ });
+};
+
+List.prototype.removeElements = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
+ ns._(_list).forEach(function(_el) {
+ _this.removeElement(_el);
+ });
+};
+
+List.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+List.prototype.off = function(_event, _callback) {
+ if (typeof this.__events[_event] !== "undefined") {
+ this.__events[_event] = ns._(this.__events[_event]).reject(function(_fn) {
+ return _fn === _callback;
+ });
+ }
+};
+
+List.prototype.trigger = function(_event, _data) {
+ var _list = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_list, _data);
+ });
+};
+
+/* A simple time management object, that helps converting millisecs to seconds and strings,
+ * without the clumsiness of the original Date object.
+ */
+
+var Time = Model.Time = function(_milliseconds) {
+ this.milliseconds = 0;
+ this.setMilliseconds(_milliseconds);
+};
+
+Time.prototype.setMilliseconds = function(_milliseconds) {
+ var _ante = this.milliseconds;
+ switch(typeof _milliseconds) {
+ case "string":
+ this.milliseconds = parseInt(_milliseconds);
+ break;
+ case "number":
+ this.milliseconds = Math.floor(_milliseconds);
+ break;
+ case "object":
+ this.milliseconds = parseInt(_milliseconds.valueOf());
+ break;
+ default:
+ this.milliseconds = 0;
+ }
+ if (this.milliseconds === NaN) {
+ this.milliseconds = _ante;
+ }
+};
+
+Time.prototype.setSeconds = function(_seconds) {
+ this.milliseconds = 1000 * _seconds;
+};
+
+Time.prototype.getSeconds = function() {
+ return this.milliseconds / 1000;
+};
+
+Time.prototype.getHMS = function() {
+ var _totalSeconds = Math.abs(Math.floor(this.getSeconds()));
+ return {
+ hours : Math.floor(_totalSeconds / 3600),
+ minutes : (Math.floor(_totalSeconds / 60) % 60),
+ seconds : _totalSeconds % 60,
+ milliseconds: this.milliseconds % 1000
+ };
+};
+
+Time.prototype.add = function(_milliseconds) {
+ this.milliseconds += new Time(_milliseconds).milliseconds;
+};
+
+Time.prototype.valueOf = function() {
+ return this.milliseconds;
+};
+
+Time.prototype.toString = function(showCs) {
+ var _hms = this.getHMS(),
+ _res = '';
+ if (_hms.hours) {
+ _res += _hms.hours + ':';
+ }
+ _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
+ if (showCs) {
+ _res += "." + Math.floor(_hms.milliseconds / 100);
+ }
+ return _res;
+};
+
+/* Reference handles references between elements
+ */
+
+var Reference = Model.Reference = function(_source, _idRef) {
+ this.source = _source;
+ this.id = _idRef;
+ if (typeof _idRef === "object") {
+ this.isList = true;
+ } else {
+ this.isList = false;
+ }
+ this.refresh();
+};
+
+Reference.prototype.refresh = function() {
+ if (this.isList) {
+ this.contents = new List(this.source.directory);
+ this.contents.addIds(this.id);
+ } else {
+ this.contents = this.source.getElement(this.id);
+ }
+
+};
+
+Reference.prototype.getContents = function() {
+ if (typeof this.contents === "undefined" || (this.isList && this.contents.length != this.id.length)) {
+ this.refresh();
+ }
+ return this.contents;
+};
+
+Reference.prototype.isOrHasId = function(_idRef) {
+ if (this.isList) {
+ return (ns._(this.id).indexOf(_idRef) !== -1);
+ } else {
+ return (this.id == _idRef);
+ }
+};
+
+/* */
+
+var BaseElement = Model.Element = function(_id, _source) {
+ this.elementType = 'element';
+ this.title = "";
+ this.description = "";
+ this.__events = {};
+ if (typeof _source === "undefined") {
+ return;
+ }
+ if (typeof _id === "undefined" || !_id) {
+ _id = getUID();
+ }
+ this.id = _id;
+ this.source = _source;
+ if (_source !== this) {
+ this.source.directory.addElement(this);
+ }
+};
+
+BaseElement.prototype.toString = function() {
+ return this.elementType + (this.elementType !== 'element' ? ', id=' + this.id + ', title="' + this.title + '"' : '');
+};
+
+BaseElement.prototype.setReference = function(_elementType, _idRef) {
+ this[_elementType] = new Reference(this.source, _idRef);
+};
+
+BaseElement.prototype.getReference = function(_elementType) {
+ if (typeof this[_elementType] !== "undefined") {
+ return this[_elementType].getContents();
+ }
+};
+
+BaseElement.prototype.getRelated = function(_elementType, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ var _this = this;
+ return this.source.getList(_elementType, _global).filter(function(_el) {
+ var _ref = _el[_this.elementType];
+ return _ref && _ref.isOrHasId(_this.id);
+ });
+};
+
+BaseElement.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+BaseElement.prototype.off = function(_event, _callback) {
+ if (typeof this.__events[_event] !== "undefined") {
+ this.__events[_event] = ns._(this.__events[_event]).reject(function(_fn) {
+ return _fn === _callback;
+ });
+ }
+};
+
+BaseElement.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
+};
+
+/* */
+
+var Playable = Model.Playable = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ if (typeof _source === "undefined") {
+ return;
+ }
+ this.elementType = 'playable';
+ this.currentTime = new Time();
+ this.volume = .5;
+ this.paused = true;
+ this.muted = false;
+ this.loadedMetadata = false;
+ var _this = this;
+ this.on("play", function() {
+ _this.paused = false;
+ });
+ this.on("pause", function() {
+ _this.paused = true;
+ });
+ this.on("timeupdate", function(_time) {
+ _this.currentTime = _time;
+ _this.getAnnotations().filter(function(_a) {
+ return (_a.end <= _time || _a.begin > _time) && _a.playing;
+ }).forEach(function(_a) {
+ _a.playing = false;
+ _a.trigger("leave");
+ _this.trigger("leave-annotation",_a);
+ });
+ _this.getAnnotations().filter(function(_a) {
+ return _a.begin <= _time && _a.end > _time && !_a.playing;
+ }).forEach(function(_a) {
+ _a.playing = true;
+ _a.trigger("enter");
+ _this.trigger("enter-annotation",_a);
+ });
+ });
+ this.on("loadedmetadata", function() {
+ _this.loadedMetadata = true;
+ });
+};
+
+extendPrototype(Playable, BaseElement);
+
+Playable.prototype.getCurrentTime = function() {
+ return this.currentTime;
+};
+
+Playable.prototype.getVolume = function() {
+ return this.volume;
+};
+
+Playable.prototype.getPaused = function() {
+ return this.paused;
+};
+
+Playable.prototype.getMuted = function() {
+ return this.muted;
+};
+
+Playable.prototype.setCurrentTime = function(_time) {
+ this.trigger("setcurrenttime",_time);
+};
+
+Playable.prototype.setVolume = function(_vol) {
+ this.trigger("setvolume",_vol);
+};
+
+Playable.prototype.setMuted = function(_muted) {
+ this.trigger("setmuted",_muted);
+};
+
+Playable.prototype.play = function() {
+ this.trigger("setplay");
+};
+
+Playable.prototype.pause = function() {
+ this.trigger("setpause");
+};
+
+Playable.prototype.show = function() {};
+
+Playable.prototype.hide = function() {};
+
+/* */
+
+var Media = Model.Media = function(_id, _source) {
+ Playable.call(this, _id, _source);
+ this.elementType = 'media';
+ this.duration = new Time();
+ this.video = '';
+ var _this = this;
+};
+
+extendPrototype(Media, Playable);
+
+/* Default functions to be overriden by players */
+
+Media.prototype.setDuration = function(_durationMs) {
+ this.duration.setMilliseconds(_durationMs);
+};
+
+Media.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+Media.prototype.getAnnotationsByTypeTitle = function(_title) {
+ var _annTypes = this.source.getAnnotationTypes().searchByTitle(_title).pluck("id");
+ if (_annTypes.length) {
+ return this.getAnnotations().filter(function(_annotation) {
+ return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
+ });
+ } else {
+ return new List(this.source.directory);
+ }
+};
+
+/* */
+
+var Tag = Model.Tag = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'tag';
+};
+
+extendPrototype(Tag, BaseElement);
+
+Tag.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+/* */
+var AnnotationType = Model.AnnotationType = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'annotationType';
+};
+
+extendPrototype(AnnotationType, BaseElement);
+
+AnnotationType.prototype.getAnnotations = function() {
+ return this.getRelated("annotation");
+};
+
+/* Annotation
+ * */
+
+var Annotation = Model.Annotation = function(_id, _source) {
+ BaseElement.call(this, _id, _source);
+ this.elementType = 'annotation';
+ this.begin = new Time();
+ this.end = new Time();
+ this.tag = new Reference(_source, []);
+ this.playing = false;
+ var _this = this;
+ this.on("click", function() {
+ _this.getMedia().setCurrentTime(_this.begin);
+ });
+};
+
+extendPrototype(Annotation, BaseElement);
+
+Annotation.prototype.setBegin = function(_beginMs) {
+ this.begin.setMilliseconds(Math.max(0,_beginMs));
+ this.trigger("change-begin");
+ if (this.end < this.begin) {
+ this.setEnd(this.begin);
+ }
+};
+
+Annotation.prototype.setEnd = function(_endMs) {
+ this.end.setMilliseconds(Math.min(_endMs, this.getMedia().duration.milliseconds));
+ this.trigger("change-end");
+ if (this.end < this.begin) {
+ this.setBegin(this.end);
+ }
+};
+
+Annotation.prototype.setDuration = function(_durMs) {
+ this.setEnd(_durMs + this.begin.milliseconds);
+};
+
+Annotation.prototype.setMedia = function(_idRef) {
+ this.setReference("media", _idRef);
+};
+
+Annotation.prototype.getMedia = function() {
+ return this.getReference("media");
+};
+
+Annotation.prototype.setAnnotationType = function(_idRef) {
+ this.setReference("annotationType", _idRef);
+};
+
+Annotation.prototype.getAnnotationType = function() {
+ return this.getReference("annotationType");
+};
+
+Annotation.prototype.setTags = function(_idRefs) {
+ this.setReference("tag", _idRefs);
+};
+
+Annotation.prototype.getTags = function() {
+ return this.getReference("tag");
+};
+
+Annotation.prototype.getTagTexts = function() {
+ return this.getTags().getTitles();
+};
+
+Annotation.prototype.getDuration = function() {
+ return new Time(this.end.milliseconds - this.begin.milliseconds);
+};
+
+/* */
+
+var MashedAnnotation = Model.MashedAnnotation = function(_mashup, _annotation) {
+ BaseElement.call(this, _mashup.id + "_" + _annotation.id, _annotation.source);
+ this.elementType = 'mashedAnnotation';
+ this.annotation = _annotation;
+ this.begin = new Time();
+ this.end = new Time();
+ this.duration = new Time();
+ this.title = this.annotation.title;
+ this.description = this.annotation.description;
+ this.color = this.annotation.color;
+ var _this = this;
+ this.on("click", function() {
+ _mashup.setCurrentTime(_this.begin);
+ });
+ this.on("enter", function() {
+ _this.annotation.trigger("enter");
+ });
+ this.on("leave", function() {
+ _this.annotation.trigger("leave");
+ });
+};
+
+extendPrototype(MashedAnnotation, BaseElement);
+
+MashedAnnotation.prototype.getMedia = function() {
+ return this.annotation.getReference("media");
+};
+
+MashedAnnotation.prototype.getAnnotationType = function() {
+ return this.annotation.getReference("annotationType");
+};
+
+MashedAnnotation.prototype.getTags = function() {
+ return this.annotation.getReference("tag");
+};
+
+MashedAnnotation.prototype.getTagTexts = function() {
+ return this.annotation.getTags().getTitles();
+};
+
+MashedAnnotation.prototype.getDuration = function() {
+ return this.annotation.getDuration();
+};
+
+MashedAnnotation.prototype.setBegin = function(_begin) {
+ this.begin.setMilliseconds(_begin);
+ this.duration.setMilliseconds(this.annotation.getDuration());
+ this.end.setMilliseconds(_begin + this.duration);
+};
+
+/* */
+
+var Mashup = Model.Mashup = function(_id, _source) {
+ Playable.call(this, _id, _source);
+ this.elementType = 'mashup';
+ this.duration = new Time();
+ this.segments = new List(_source.directory);
+ this.loaded = false;
+ var _this = this;
+ this._updateTimes = function() {
+ _this.updateTimes();
+ _this.trigger("change");
+ };
+ this.on("add", this._updateTimes);
+ this.on("remove", this._updateTimes);
+};
+
+extendPrototype(Mashup, Playable);
+
+Mashup.prototype.updateTimes = function() {
+ var _time = 0;
+ this.segments.forEach(function(_segment) {
+ _segment.setBegin(_time);
+ _time = _segment.end;
+ });
+ this.duration.setMilliseconds(_time);
+};
+
+Mashup.prototype.addAnnotation = function(_annotation, _defer) {
+ var _mashedAnnotation = new MashedAnnotation(this, _annotation),
+ _defer = _defer || false;
+ this.segments.push(_mashedAnnotation);
+ _annotation.on("change-begin", this._updateTimes);
+ _annotation.on("change-end", this._updateTimes);
+ if (!_defer) {
+ this.trigger("add");
+ }
+};
+
+Mashup.prototype.addAnnotationById = function(_elId, _defer) {
+ var _annotation = this.source.getElement(_elId),
+ _defer = _defer || false;
+ if (typeof _annotation !== "undefined") {
+ this.addAnnotation(_annotation, _defer);
+ }
+};
+
+Mashup.prototype.addAnnotations = function(_segments) {
+ var _this = this;
+ ns._(_segments).forEach(function(_segment) {
+ _this.addAnnotation(_segment, true);
+ });
+ this.trigger("add");
+};
+
+Mashup.prototype.addAnnotationsById = function(_segments) {
+ var _this = this;
+ ns._(_segments).forEach(function(_segment) {
+ _this.addAnnotationById(_segment, true);
+ });
+ this.trigger("add");
+};
+
+Mashup.prototype.removeAnnotation = function(_annotation, _defer) {
+ var _defer = _defer || false;
+ _annotation.off("change-begin", this._updateTimes);
+ _annotation.off("change-end", this._updateTimes);
+ this.segments.removeId(this.id + "_" + _annotation.id);
+ if (!_defer) {
+ this.trigger("remove");
+ }
+};
+
+Mashup.prototype.removeAnnotationById = function(_annId, _defer) {
+ var _defer = _defer || false;
+ var _annotation = this.source.getElement(_annId);
+
+ if (_annotation) {
+ this.removeAnnotation(_annotation, _defer);
+ }
+ if (!_defer) {
+ this.trigger("remove");
+ }
+};
+
+Mashup.prototype.setAnnotations = function(_segments) {
+ while (this.segments.length) {
+ this.removeAnnotation(this.segments[0].annotation, true);
+ }
+ this.addAnnotations(_segments);
+};
+
+Mashup.prototype.setAnnotationsById = function(_segments) {
+ while (this.segments.length) {
+ this.removeAnnotation(this.segments[0].annotation, true);
+ }
+ this.addAnnotationsById(_segments);
+};
+
+Mashup.prototype.hasAnnotation = function(_annotation) {
+ return !!ns._(this.segments).find(function(_s) {
+ return _s.annotation === _annotation;
+ });
+};
+
+Mashup.prototype.getAnnotation = function(_annotation) {
+ return ns._(this.segments).find(function(_s) {
+ return _s.annotation === _annotation;
+ });
+};
+
+Mashup.prototype.getAnnotationById = function(_id) {
+ return ns._(this.segments).find(function(_s) {
+ return _s.annotation.id === _id;
+ });
+};
+
+Mashup.prototype.getAnnotations = function() {
+ return this.segments;
+};
+
+Mashup.prototype.getOriginalAnnotations = function() {
+ var annotations = new List(this.source.directory);
+ this.segments.forEach(function(_s) {
+ annotations.push(_s.annotation);
+ });
+ return annotations;
+};
+
+Mashup.prototype.getMedias = function() {
+ var medias = new List(this.source.directory);
+ this.segments.forEach(function(_annotation) {
+ medias.push(_annotation.getMedia());
+ });
+ return medias;
+};
+
+Mashup.prototype.getAnnotationsByTypeTitle = function(_title) {
+ var _annTypes = this.source.getAnnotationTypes().searchByTitle(_title).pluck("id");
+ if (_annTypes.length) {
+ return this.getAnnotations().filter(function(_annotation) {
+ return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
+ });
+ } else {
+ return new List(this.source.directory);
+ }
+};
+
+Mashup.prototype.getAnnotationAtTime = function(_time) {
+ var _list = this.segments.filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ });
+ if (_list.length) {
+ return _list[0];
+ } else {
+ return undefined;
+ }
+};
+
+Mashup.prototype.getMediaAtTime = function(_time) {
+ var _annotation = this.getAnnotationAtTime(_time);
+ if (typeof _annotation !== "undefined") {
+ return _annotation.getMedia();
+ } else {
+ return undefined;
+ }
+};
+
+/* */
+
+var Source = Model.Source = function(_config) {
+ BaseElement.call(this, false, this);
+ this.status = _SOURCE_STATUS_EMPTY;
+ this.elementType = "source";
+ if (typeof _config !== "undefined") {
+ var _this = this;
+ ns._(_config).forEach(function(_v, _k) {
+ _this[_k] = _v;
+ });
+ this.callbackQueue = [];
+ this.contents = {};
+ this.get();
+ }
+};
+
+extendPrototype(Source, BaseElement);
+
+Source.prototype.addList = function(_listId, _contents) {
+ if (typeof this.contents[_listId] === "undefined") {
+ this.contents[_listId] = new List(this.directory);
+ }
+ this.contents[_listId].addElements(_contents);
+};
+
+Source.prototype.getList = function(_listId, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ if (_global) {
+ return this.directory.getGlobalList().filter(function(_e) {
+ return (_e.elementType === _listId);
+ });
+ } else {
+ if (typeof this.contents[_listId] === "undefined") {
+ this.contents[_listId] = new List(this.directory);
+ }
+ return this.contents[_listId];
+ }
+};
+
+Source.prototype.forEach = function(_callback) {
+ var _this = this;
+ ns._(this.contents).forEach(function(_value, _key) {
+ _callback.call(_this, _value, _key);
+ });
+};
+
+Source.prototype.getElement = function(_elId) {
+ return this.directory.getElement(_elId);
+};
+
+Source.prototype.get = function() {
+ this.status = _SOURCE_STATUS_WAITING;
+ this.handleCallbacks();
+};
+
+/* We defer the callbacks calls so they execute after the queue is cleared */
+Source.prototype.deferCallback = function(_callback) {
+ var _this = this;
+ ns._.defer(function() {
+ _callback.call(_this);
+ });
+};
+
+Source.prototype.handleCallbacks = function() {
+ this.status = _SOURCE_STATUS_READY;
+ while (this.callbackQueue.length) {
+ this.deferCallback(this.callbackQueue.splice(0,1)[0]);
+ }
+};
+Source.prototype.onLoad = function(_callback) {
+ if (this.status === _SOURCE_STATUS_READY) {
+ this.deferCallback(_callback);
+ } else {
+ this.callbackQueue.push(_callback);
+ }
+};
+
+Source.prototype.serialize = function() {
+ return this.serializer.serialize(this);
+};
+
+Source.prototype.deSerialize = function(_data) {
+ this.serializer.deSerialize(_data, this);
+};
+
+Source.prototype.getAnnotations = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("annotation", _global);
+};
+
+Source.prototype.getMedias = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("media", _global);
+};
+
+Source.prototype.getTags = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("tag", _global);
+};
+
+Source.prototype.getMashups = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("mashup", _global);
+};
+
+Source.prototype.getAnnotationTypes = function(_global) {
+ _global = (typeof _global !== "undefined" && _global);
+ return this.getList("annotationType", _global);
+};
+
+Source.prototype.getAnnotationsByTypeTitle = function(_title, _global) {
+ _global = (typeof _global !== "undefined" && _global);
+ var _res = new List(this.directory),
+ _annTypes = this.getAnnotationTypes(_global).searchByTitle(_title);
+ _annTypes.forEach(function(_annType) {
+ _res.addElements(_annType.getAnnotations(_global));
+ });
+ return _res;
+};
+
+Source.prototype.getDuration = function() {
+ var _m = this.currentMedia;
+ if (typeof _m !== "undefined") {
+ return this.currentMedia.duration;
+ }
+};
+
+Source.prototype.getCurrentMedia = function(_opts) {
+ if (typeof this.currentMedia === "undefined") {
+ if (_opts.is_mashup) {
+ var _mashups = this.getMashups();
+ if (_mashups.length) {
+ this.currentMedia = _mashups[0];
+ }
+ } else {
+ var _medias = this.getMedias();
+ if (_medias.length) {
+ this.currentMedia = _medias[0];
+ }
+ }
+ }
+ return this.currentMedia;
+};
+
+Source.prototype.merge = function(_source) {
+ var _this = this;
+ _source.forEach(function(_value, _key) {
+ _this.getList(_key).addElements(_value);
+ });
+};
+
+/* */
+
+var RemoteSource = Model.RemoteSource = function(_config) {
+ Source.call(this, _config);
+};
+
+extendPrototype(RemoteSource, Source);
+
+RemoteSource.prototype.get = function() {
+ this.status = _SOURCE_STATUS_WAITING;
+ var _this = this,
+ urlparams = this.url_params || {},
+ dataType = (isLocalURL(this.url) ? "json" : "jsonp");
+ urlparams.format = dataType;
+ ns.jQuery.ajax({
+ url: this.url,
+ dataType: dataType,
+ data: urlparams,
+ traditional: true,
+ success: function(_result) {
+ _this.deSerialize(_result);
+ _this.handleCallbacks();
+ }
+ });
+};
+
+/* */
+
+var Directory = Model.Directory = function() {
+ this.remoteSources = {};
+ this.elements = {};
+};
+
+Directory.prototype.remoteSource = function(_properties) {
+ if (typeof _properties !== "object" || typeof _properties.url === "undefined") {
+ throw "Error : Directory.remoteSource(configuration): configuration.url is undefined";
+ }
+ var _config = ns._({ directory: this }).extend(_properties);
+ _config.url_params = _config.url_params || {};
+ var _hash = _config.url + "?" + ns.jQuery.param(_config.url_params);
+ if (typeof this.remoteSources[_hash] === "undefined") {
+ this.remoteSources[_hash] = new RemoteSource(_config);
+ }
+ return this.remoteSources[_hash];
+};
+
+Directory.prototype.newLocalSource = function(_properties) {
+ var _config = ns._({ directory: this }).extend(_properties),
+ _res = new Source(_config);
+ return _res;
+};
+
+Directory.prototype.getElement = function(_id) {
+ return this.elements[_id];
+};
+
+Directory.prototype.addElement = function(_element) {
+ this.elements[_element.id] = _element;
+};
+
+Directory.prototype.getGlobalList = function() {
+ var _res = new List(this);
+ _res.addIds(ns._(this.elements).keys());
+ return _res;
+};
+return Model;
+
+})(IriSP);
+
+/* END js */
+
+/* HTML player, to be reused in a widget, or elsewhere */
+
+IriSP.htmlPlayer = function(media, jqselector, options) {
+
+ var opts = options || {},
+ videoURL = opts.video || media.video;
+
+ if (typeof opts.url_transform === "function") {
+ videoURL = opts.url_transform(videoURL);
+ }
+
+ var videoEl = IriSP.jQuery('');
+
+ videoEl.attr({
+ width : opts.width || undefined,
+ height : opts.height || undefined,
+ controls : opts.controls || undefined,
+ autoplay : opts.autostart || opts.autoplay || undefined
+ });
+
+ if(typeof videoURL === "string"){
+ videoEl.attr("src",videoURL);
+ } else {
+ for (var i = 0; i < videoURL.length; i++) {
+ var _srcNode = IriSP.jQuery('');
+ _srcNode.attr({
+ src: videoURL[i].src,
+ type: videoURL[i].type
+ });
+ videoEl.append(_srcNode);
+ }
+ }
+
+ jqselector.html(videoEl);
+
+ var mediaEl = videoEl[0];
+
+ // Binding HTML video functions to media events
+ media.on("setcurrenttime", function(_milliseconds) {
+ try {
+ mediaEl.currentTime = (_milliseconds / 1000);
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setvolume", function(_vol) {
+ media.volume = _vol;
+ try {
+ mediaEl.volume = _vol;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setmuted", function(_muted) {
+ media.muted = _muted;
+ try {
+ mediaEl.muted = _muted;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setplay", function() {
+ try {
+ mediaEl.play();
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setpause", function() {
+ try {
+ mediaEl.pause();
+ } catch (err) {
+
+ }
+ });
+
+ // Binding DOM events to media
+ function getVolume() {
+ media.muted = mediaEl.muted;
+ media.volume = mediaEl.volume;
+ }
+
+ videoEl.on("loadedmetadata", function() {
+ getVolume();
+ media.trigger("loadedmetadata");
+ media.trigger("volumechange");
+ });
+
+ videoEl.on("timeupdate", function() {
+ media.trigger("timeupdate", new IriSP.Model.Time(1000*mediaEl.currentTime));
+ });
+
+ videoEl.on("volumechange", function() {
+ getVolume();
+ media.trigger("volumechange");
+ });
+
+ videoEl.on("play", function() {
+ media.trigger("play");
+ });
+
+ videoEl.on("pause", function() {
+ media.trigger("pause");
+ });
+
+ videoEl.on("seeking", function() {
+ media.trigger("seeking");
+ });
+
+ videoEl.on("seeked", function() {
+ media.trigger("seeked");
+ });
+
+
+};
+/* START contentapi-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.content = {
+ deSerialize : function(_data, _source) {
+ var _medialist = new IriSP.Model.List(_source.directory);
+
+ function deserializeObject(_m, i) {
+ var _media = new IriSP.Model.Media(_m.iri_id, _source);
+ _media.video = _m.media_url;
+ _media.title = _m.title;
+ _media.description = _m.description;
+ _media.setDuration(_m.duration);
+ _media.thumbnail = _m.image;
+ _media.color = IriSP.vizcolors[i % IriSP.vizcolors.length];
+ _media.keywords = _m.tags;
+ _medialist.push(_media);
+ }
+
+ if (typeof _data.objects !== "undefined") {
+ IriSP._(_data.objects).each(deserializeObject);
+ } else {
+ deserializeObject(_data, 0);
+ }
+
+ _source.addList("media", _medialist);
+ }
+};
+
+/* END contentapi-serializer.js */
+/* Start ldt-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.ldt = {
+ types : {
+ media : {
+ serialized_name : "medias",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Media(_data.id, _source);
+ _res.video = (
+ typeof _data.url !== "undefined"
+ ? _data.url
+ : (
+ typeof _data.href !== "undefined"
+ ? _data.href
+ : null
+ )
+ );
+ if (typeof _data.meta.item !== "undefined" && _data.meta.item.name === "streamer") {
+ _res.streamer = _data.meta.item.value;
+ }
+ _res.title = _data.meta["dc:title"];
+ _res.description = _data.meta["dc:description"];
+ _res.setDuration(_data.meta["dc:duration"]);
+ _res.url = _data.meta.url;
+ if (typeof _data.meta.img !== "undefined" && _data.meta.img.src !== "undefined") {
+ _res.thumbnail = _data.meta.img.src;
+ }
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ id : _data.id,
+ url : _data.video,
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ "dc:duration" : _data.duration.milliseconds
+ }
+ };
+ _dest.medias.push(_res);
+ var _list = {
+ id: IriSP.Model.getUID(),
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ "id-ref": _data.id
+ },
+ items: _source.getAnnotationTypes().filter(function(_at) {
+ switch (typeof _at.media) {
+ case "object":
+ return (_at.media === _data);
+ case "string":
+ return (_at.media === _data.id);
+ default:
+ var _ann = _at.getAnnotations();
+ if (_ann) {
+ for (var i = 0; i < _ann.length; i++) {
+ if (_ann[i].getMedia() === _data) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }).map(function(_at) {
+ return {
+ "id-ref": _at.id
+ };
+ })
+ };
+ _dest.lists.push(_list);
+ _dest.views[0].contents.push(_data.id);
+ }
+ },
+ tag : {
+ serialized_name : "tags",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Tag(_data.id, _source);
+ _res.title = _data.meta["dc:title"];
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ if (_source.regenerateTags && !_data.regenerated) {
+ return;
+ }
+ var _res = {
+ id : _data.id,
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ }
+ };
+ _dest.tags.push(_res);
+ }
+ },
+ annotationType : {
+ serialized_name : "annotation-types",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.AnnotationType(_data.id, _source);
+ _res.title = _data["dc:title"];
+ _res.description = _data["dc:description"];
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ id : _data.id,
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ };
+ _dest["annotation-types"].push(_res);
+ _dest.views[0].annotation_types.push(_data.id);
+ }
+ },
+ annotation : {
+ serialized_name : "annotations",
+ deserializer : function(_data, _source) {
+ var _res = new IriSP.Model.Annotation(_data.id, _source);
+ _res.title = _data.content.title || "";
+ _res.description = _data.content.description || "";
+ if (typeof _data.content.img !== "undefined" && _data.content.img.src !== "undefined") {
+ _res.thumbnail = _data.content.img.src;
+ }
+ _res.created = IriSP.Model.isoToDate(_data.meta["dc:created"]);
+ if (typeof _data.color !== "undefined") {
+ var _c = parseInt(_data.color).toString(16);
+ while (_c.length < 6) {
+ _c = '0' + _c;
+ }
+ _res.color = '#' + _c;
+ }
+ _res.content = _data.content;
+ _res.setMedia(_data.media);
+ _res.setAnnotationType(_data.meta["id-ref"]);
+ _res.setTags(IriSP._(_data.tags).pluck("id-ref"));
+ _res.keywords = _res.getTagTexts();
+ _res.setBegin(_data.begin);
+ _res.setEnd(_data.end);
+ _res.creator = _data.meta["dc:creator"] || "";
+ _res.project = _data.meta.project || "";
+ if (typeof _data.meta["dc:source"] !== "undefined" && typeof _data.meta["dc:source"].content !== "undefined") {
+ _res.source = JSON.parse(_data.meta["dc:source"].content);
+ }
+ if (typeof _data.content.audio !== "undefined" && _data.content.audio.href) {
+ _res.audio = _data.content.audio;
+ }
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _color = parseInt(_data.color.replace(/^#/,''),16).toString();
+ var _res = {
+ id : _data.id,
+ begin : _data.begin.milliseconds,
+ end : _data.end.milliseconds,
+ content : IriSP._.defaults(
+ {},
+ {
+ title : _data.title,
+ description : _data.description,
+ audio : _data.audio,
+ img: {
+ src: _data.thumbnail
+ }
+ },
+ _data.content,
+ {
+ title: "",
+ description: ""
+ }
+ ),
+ color: _color,
+ media : _data.media.id,
+ meta : {
+ "id-ref" : _data.getAnnotationType().id,
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+// project : _source.projectId
+ }
+ };
+ if (_source.regenerateTags) {
+ _res.tags = IriSP._(_data.keywords).map(function(_kw) {
+ return {
+ "id-ref": _source.__keywords[_kw.toLowerCase()].id
+ };
+ });
+ } else {
+ _res.tags = IriSP._(_data.tag.id).map(function(_id) {
+ return {
+ "id-ref" : _id
+ };
+ });
+ }
+ _res.content.title = _data.title || _res.content.title || "";
+ _dest.annotations.push(_res);
+ }
+ },
+ mashup : {
+ serialized_name : "lists",
+ deserializer : function(_data, _source) {
+ if (typeof _data.meta !== "object" || typeof _data.meta.listtype !== "string" || _data.meta.listtype !== "mashup") {
+ return undefined;
+ }
+ var _res = new IriSP.Model.Mashup(_data.id, _source);
+ _res.title = _data.meta["dc:title"];
+ _res.description = _data.meta["dc:description"];
+ _res.creator = _data.meta["dc:creator"];
+ _res.setAnnotationsById(_data.items);
+ return _res;
+ },
+ serializer : function(_data, _source, _dest) {
+ var _res = {
+ meta : {
+ "dc:title": _data.title || "",
+ "dc:description": _data.description || "",
+ "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
+ "dc:creator" : _data.creator || _source.creator,
+ "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
+ listtype: "mashup"
+ },
+ items: _data.segments.map(function(_annotation) {
+ return _annotation.annotation.id;
+ }),
+ id: _data.id
+ };
+ _dest.lists.push(_res);
+ }
+ }
+ },
+ serialize : function(_source) {
+ var _res = {
+ meta: {
+ "dc:creator": _source.creator,
+ "dc:contributor" : _source.contributor || _source.creator,
+ "dc:created": IriSP.Model.dateToIso(_source.created),
+ "dc:modified" : IriSP.Model.dateToIso(_source.modified),
+ "dc:title": _source.title || "",
+ "dc:description": _source.description || "",
+ id: _source.projectId || _source.id
+ },
+ views: [
+ {
+ id: IriSP.Model.getUID(),
+ contents: [],
+ annotation_types: []
+ }
+ ],
+ lists: [],
+ "annotation-types": [],
+ medias: [],
+ tags: [],
+ annotations: []
+ },
+ _this = this;
+ if (_source.regenerateTags) {
+ _source.__keywords = {};
+ _source.getAnnotations().forEach(function(a) {
+ IriSP._(a.keywords).each(function(kw) {
+ var lkw = kw.toLowerCase();
+ if (typeof _source.__keywords[lkw] === "undefined") {
+ _source.__keywords[lkw] = {
+ id: IriSP.Model.getUID(),
+ title: kw,
+ regenerated: true
+ };
+ }
+ });
+ });
+ IriSP._(_source.__keywords).each(function(kw) {
+ _this.types.tag.serializer(kw, _source, _res);
+ });
+ }
+ _source.forEach(function(_list, _typename) {
+ if (typeof _this.types[_typename] !== "undefined") {
+ _list.forEach(function(_el) {
+ _this.types[_typename].serializer(_el, _source, _res);
+ });
+ }
+ });
+ return JSON.stringify(_res);
+ },
+ deSerialize : function(_data, _source) {
+ if (typeof _data !== "object" || _data === null) {
+ return;
+ }
+ IriSP._(this.types).forEach(function(_type, _typename) {
+ var _listdata = _data[_type.serialized_name],
+ _list = new IriSP.Model.List(_source.directory);
+ if (typeof _listdata !== "undefined" && _listdata !== null) {
+ if (_listdata.hasOwnProperty("length")) {
+ var _l = _listdata.length;
+ for (var _i = 0; _i < _l; _i++) {
+ var _element = _type.deserializer(_listdata[_i], _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
+ }
+ } else {
+ var _element = _type.deserializer(_listdata, _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
+ }
+ }
+ _source.addList(_typename, _list);
+ });
+
+ if (typeof _data.meta !== "undefined") {
+ _source.projectId = _data.meta.id;
+ _source.title = _data.meta["dc:title"] || _data.meta.title || "";
+ _source.description = _data.meta["dc:description"] || _data.meta.description || "";
+ _source.creator = _data.meta["dc:creator"] || _data.meta.creator || "";
+ _source.contributor = _data.meta["dc:contributor"] || _data.meta.contributor || _source.creator;
+ _source.created = IriSP.Model.isoToDate(_data.meta["dc:created"] || _data.meta.created);
+ }
+
+ if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") {
+ _source.currentMedia = _source.getElement(_data.meta.main_media["id-ref"]);
+ }
+ }
+};
+
+/* End of LDT Platform Serializer *//* ldt_annotate serializer: Used when Putting annotations on the platform */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.ldt_annotate = {
+ serializeAnnotation : function(_data, _source) {
+ var _annType = _data.getAnnotationType();
+ return {
+ begin: _data.begin.milliseconds,
+ end: _data.end.milliseconds,
+ content: {
+ description: _data.description,
+ title: _data.title,
+ audio: _data.audio
+ },
+ tags: _data.getTagTexts(),
+ media: _data.getMedia().id,
+ type_title: _annType.title,
+ type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ),
+ meta: {
+ created: _data.created,
+ creator: _data.creator
+ }
+ };
+ },
+ deserializeAnnotation : function(_anndata, _source) {
+ var _ann = new IriSP.Model.Annotation(_anndata.id, _source);
+ _ann.description = _anndata.content.description || "";
+ _ann.title = _anndata.content.title || "";
+ _ann.creator = _anndata.meta.creator || "";
+ _ann.created = new Date(_anndata.meta.created);
+ _ann.setMedia(_anndata.media, _source);
+ var _anntype = _source.getElement(_anndata.type);
+ if (!_anntype) {
+ _anntype = new IriSP.Model.AnnotationType(_anndata.type, _source);
+ _anntype.title = _anndata.type_title;
+ _source.getAnnotationTypes().push(_anntype);
+ }
+ _ann.setAnnotationType(_anntype.id);
+ var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
+ var _tags = _source.getTags(true).searchByTitle(_title, true);
+ if (_tags.length) {
+ var _tag = _tags[0];
+ }
+ else {
+ _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'),_source);
+ _tag.title = _title;
+ _source.getTags().push(_tag);
+ }
+ return _tag.id;
+ });
+ _ann.setTags(_tagIds);
+ _ann.setBegin(_anndata.begin);
+ _ann.setEnd(_anndata.end);
+ if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
+ _ann.audio = _anndata.content.audio;
+ }
+ _source.getAnnotations().push(_ann);
+ },
+ serialize : function(_source) {
+ return JSON.stringify(this.serializeAnnotation(_source.getAnnotations()[0], _source));
+ },
+ deSerialize : function(_data, _source) {
+ if (typeof _data == "string") {
+ _data = JSON.parse(_data);
+ }
+
+ _source.addList('tag', new IriSP.Model.List(_source.directory));
+ _source.addList('annotationType', new IriSP.Model.List(_source.directory));
+ _source.addList('annotation', new IriSP.Model.List(_source.directory));
+ this.deserializeAnnotation(_data, _source);
+ }
+};
+
+/* End ldt_annotate serializer *//* START segmentapi-serializer.js */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {};
+}
+
+IriSP.serializers.segmentapi = {
+ deSerialize : function(_data, _source) {
+ var _annotationlist = new IriSP.Model.List(_source.directory),
+ _medialist = new IriSP.Model.List(_source.directory);
+ _source.addList("media", _medialist);
+
+ function deserializeObject(_s) {
+ var _ann = new IriSP.Model.Annotation(_s.element_id, _source),
+ _media = _source.getElement(_s.iri_id);
+ if (!_media) {
+ _media = new IriSP.Model.Media(_s.iri_id, _source);
+ _source.getMedias().push(_media);
+ }
+ _ann.setMedia(_s.iri_id);
+ _ann.title = _s.title;
+ _ann.description = _s.abstract;
+ _ann.begin = new IriSP.Model.Time(_s.start_ts);
+ _ann.end = new IriSP.Model.Time(_s.start_ts + _s.duration);
+ _ann.keywords = (_s.tags ? _s.tags.split(",") : []);
+ _ann.project_id = _s.project_id;
+ _annotationlist.push(_ann);
+ }
+
+ if (typeof _data.objects !== "undefined") {
+ IriSP._(_data.objects).each(deserializeObject);
+ } else {
+ deserializeObject(_data);
+ }
+ _source.addList("annotation", _annotationlist);
+ }
+};
+
+/* END segmentapi-serializer.js */
+/* Start of defaults.js */
+
+IriSP.language = 'en';
+
+IriSP.libFiles = {
+ defaultDir : "js/libs/",
+ inDefaultDir : {
+ underscore : "underscore-min.js",
+ Mustache : "mustache.js",
+ jQuery : "jquery.min.js",
+ jQueryUI : "jquery-ui.min.js",
+ swfObject : "swfobject.js",
+ cssjQueryUI : "jquery-ui.css",
+ popcorn : "popcorn-complete.min.js",
+ jwplayer : "jwplayer.js",
+ raphael : "raphael-min.js",
+ tracemanager : "tracemanager.js",
+ jwPlayerSWF : "player.swf",
+ json : "json2.js",
+ zeroClipboardJs: "ZeroClipboard.js",
+ zeroClipboardSwf: "ZeroClipboard.swf",
+ backbone: "backbone.js",
+ backboneRelational: "backbone-relational.js",
+ paper: "paper.js",
+ jqueryMousewheel: "jquery.mousewheel.min.js",
+ renkanPublish: "renkan.js",
+ processing: "processing-1.3.6.min.js",
+ recordMicSwf: "record_mic.swf"
+ },
+ locations : {
+ // use to define locations outside default_dir
+ },
+ cdn : {
+ jQuery : "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js",
+ jQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.min.js",
+ swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
+ cssjQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/themes/ui-lightness/jquery-ui.css",
+ underscore : "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js",
+ Mustache : "http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.5.0-dev/mustache.min.js",
+ raphael : "http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js",
+ json : "http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js",
+ popcorn: "http://cdn.popcornjs.org/code/dist/popcorn-complete.min.js"
+ },
+ useCdn : false
+};
+
+IriSP.widgetsDir = 'widgets';
+
+IriSP.widgetsRequirements = {
+ PopcornPlayer: {
+ noCss: true,
+ requires: [ "popcorn" ]
+ },
+ HtmlPlayer: {
+ noCss: true
+ },
+ JwpPlayer: {
+ noCss: true,
+ requires: [ "jwplayer" ]
+ },
+ DailymotionPlayer: {
+ noCss: true,
+ requires: [ "swfObject" ]
+ },
+ AdaptivePlayer: {
+ noCss: true
+ },
+ AutoPlayer: {
+ noCss: true
+ },
+ AnnotationsList: {
+ requires: [ "jwplayer" ]
+ },
+ Sparkline: {
+ noCss: true,
+ requires: [ "raphael" ]
+ },
+ Arrow: {
+ noCss: true,
+ requires: [ "raphael" ]
+ },
+ Mediafragment: {
+ noCss: true
+ },
+ Trace : {
+ noCss: true,
+ requires: [ "tracemanager" ]
+ },
+ Slideshare: {
+ requires: [ "swfObject" ]
+ },
+ Social: {
+ requires: [ "zeroClipboardJs" ]
+ },
+ Renkan: {
+ requires: [ "backbone", "backboneRelational", "paper", "jqueryMousewheel", "renkanPublish" ]
+ },
+ KnowledgeConcierge: {
+ requires: [ "processing" ]
+ },
+ MultiSegments: {
+ noCss: true
+ }
+};
+
+IriSP.guiDefaults = {
+ width : 640,
+ container : 'LdtPlayer',
+ spacer_div_height : 0,
+ widgets: []
+};
+
+/* End of defaults.js */
+/* widgets-container/metadataplayer.js - initialization and configuration of the widgets
+*/
+
+/* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */
+
+(function(ns) {
+
+var formerJQuery, formerUnderscore, former$;
+
+var Metadataplayer = ns.Metadataplayer = function(config) {
+ ns.log("IriSP.Metadataplayer constructor");
+ for (var key in ns.guiDefaults) {
+ if (ns.guiDefaults.hasOwnProperty(key) && !config.hasOwnProperty(key)) {
+ config[key] = ns.guiDefaults[key]
+ }
+ }
+ var _container = document.getElementById(config.container);
+ _container.innerHTML = 'Loading... Chargement... ';
+ this.sourceManager = new ns.Model.Directory();
+ this.config = config;
+ this.__events = {};
+ this.loadLibs();
+};
+
+Metadataplayer.prototype.toString = function() {
+ return 'Metadataplayer in #' + this.config.container;
+};
+
+Metadataplayer.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
+};
+
+Metadataplayer.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ ns._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
+};
+
+Metadataplayer.prototype.loadLibs = function() {
+ ns.log("IriSP.Metadataplayer.prototype.loadLibs");
+ var $L = $LAB
+ .script(ns.getLib("Mustache"));
+
+ formerJQuery = !!window.jQuery;
+ former$ = !!window.$;
+ formerUnderscore = !!window._;
+
+ if (typeof ns.jQuery === "undefined") {
+ $L.script(ns.getLib("jQuery"));
+ }
+
+ if (typeof ns._ === "undefined") {
+ $L.script(ns.getLib("underscore"));
+ }
+
+ if (typeof window.JSON == "undefined") {
+ $L.script(ns.getLib("json"));
+ }
+
+ $L.wait()
+ .script(ns.getLib("jQueryUI"));
+
+ /* widget specific requirements */
+ for(var _i = 0; _i < this.config.widgets.length; _i++) {
+ var _t = this.config.widgets[_i].type;
+ if (typeof ns.widgetsRequirements[_t] !== "undefined" && typeof ns.widgetsRequirements[_t].requires !== "undefined" ) {
+ for (var _j = 0; _j < ns.widgetsRequirements[_t].requires.length; _j++) {
+ $L.script(ns.getLib(ns.widgetsRequirements[_t].requires[_j]));
+ }
+ }
+ }
+
+ var _this = this;
+
+ $L.wait(function() {
+ _this.onLibsLoaded();
+ });
+};
+
+Metadataplayer.prototype.onLibsLoaded = function() {
+ ns.log("IriSP.Metadataplayer.prototype.onLibsLoaded");
+ if (typeof ns.jQuery === "undefined" && typeof window.jQuery !== "undefined") {
+ ns.jQuery = window.jQuery;
+ if (former$ || formerJQuery) {
+ window.jQuery.noConflict(formerJQuery);
+ }
+ }
+ if (typeof ns._ === "undefined" && typeof window._ !== "undefined") {
+ ns._ = window._;
+ if (formerUnderscore) {
+ _.noConflict();
+ }
+ }
+ ns.loadCss(ns.getLib("cssjQueryUI"));
+ ns.loadCss(this.config.css);
+
+ this.$ = ns.jQuery('#' + this.config.container);
+ this.$.css({
+ "width": this.config.width,
+ "clear": "both"
+ });
+ if (typeof this.config.height !== "undefined") {
+ this.$.css("height", this.config.height);
+ }
+
+ this.widgets = [];
+ var _this = this;
+ ns._(this.config.widgets).each(function(widgetconf, key) {
+ _this.widgets.push(null);
+ _this.loadWidget(widgetconf, function(widget) {
+ _this.widgets[key] = widget;
+ if (widget.isLoaded()) {
+ _this.trigger("widget-loaded");
+ }
+ });
+ });
+ this.$.find('.Ldt-Loader').detach();
+
+ this.widgetsLoaded = false;
+
+ this.on("widget-loaded", function() {
+ if (_this.widgetsLoaded) {
+ return;
+ }
+ var isloaded = !ns._(_this.widgets).any(function(w) {
+ return !(w && w.isLoaded());
+ });
+ if (isloaded) {
+ _this.widgetsLoaded = true;
+ _this.trigger("widgets-loaded");
+ }
+ });
+};
+
+Metadataplayer.prototype.loadMetadata = function(_metadataInfo) {
+ if (_metadataInfo.elementType === "source") {
+ return _metadataInfo;
+ }
+ if (typeof _metadataInfo.serializer === "undefined" && typeof _metadataInfo.format !== "undefined") {
+ _metadataInfo.serializer = ns.serializers[_metadataInfo.format];
+ }
+ if (typeof _metadataInfo.url !== "undefined" && typeof _metadataInfo.serializer !== "undefined") {
+ return this.sourceManager.remoteSource(_metadataInfo);
+ } else {
+ return this.sourceManager.newLocalSource(_metadataInfo);
+ }
+};
+
+Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
+ /* Creating containers if needed */
+ if (typeof _widgetConfig.container === "undefined") {
+ var _divs = this.layoutDivs(_widgetConfig.type);
+ _widgetConfig.container = _divs[0];
+ }
+
+ var _this = this;
+
+ if (typeof ns.Widgets[_widgetConfig.type] !== "undefined") {
+ ns._.defer(function() {
+ _callback(new ns.Widgets[_widgetConfig.type](_this, _widgetConfig));
+ });
+ } else {
+ /* Loading Widget CSS */
+ if (typeof ns.widgetsRequirements[_widgetConfig.type] === "undefined" || typeof ns.widgetsRequirements[_widgetConfig.type].noCss === "undefined" || !ns.widgetsRequirements[_widgetConfig.type].noCss) {
+ ns.loadCss(ns.widgetsDir + '/' + _widgetConfig.type + '.css');
+ }
+ /* Loading Widget JS */
+ $LAB.script(ns.widgetsDir + '/' + _widgetConfig.type + '.js').wait(function() {
+ _callback(new ns.Widgets[_widgetConfig.type](_this, _widgetConfig));
+ });
+ }
+};
+
+/** create a subdiv with an unique id, and a spacer div as well.
+ @param widgetName the name of the widget.
+ @return an array of the form [createdivId, spacerdivId].
+*/
+Metadataplayer.prototype.layoutDivs = function(_name, _height) {
+ if (typeof(_name) === "undefined") {
+ _name = "";
+ }
+ var newDiv = ns._.uniqueId(this.config.container + "_widget_" + _name + "_"),
+ spacerDiv = ns._.uniqueId("LdtPlayer_spacer_"),
+ divHtml = ns.jQuery('')
+ .attr("id",newDiv)
+ .css({
+ width: this.config.width + "px",
+ position: "relative",
+ clear: "both"
+ }),
+ spacerHtml = ns.jQuery('
')
+ .attr("id",spacerDiv)
+ .css({
+ width: this.config.width + "px",
+ height: this.config.spacer_div_height + "px",
+ position: "relative",
+ clear: "both"
+ });
+ if (typeof _height !== "undefined") {
+ divHtml.css("height", _height);
+ }
+
+ this.$.append(divHtml);
+ this.$.append(spacerHtml);
+
+ return [newDiv, spacerDiv];
+};
+
+})(IriSP);
+
+/* End of widgets-container/metadataplayer.js *//* widgetsDefinition of an ancestor for the Widget classes */
+
+if (typeof IriSP.Widgets === "undefined") {
+ IriSP.Widgets = {};
+}
+
+/**
+ * @class IriSP.Widget is an "abstract" class. It's mostly used to define some properties common to every widget.
+ *
+ * Note that widget constructors are never called directly by the user. Instead, the widgets are instantiated by functions
+ * defined in init.js
+ *
+ * @constructor
+ * @param player - a reference to the player widget
+ * @param config - configuration options for the widget
+ */
+
+
+IriSP.Widgets.Widget = function(player, config) {
+
+ if( typeof player === "undefined") {
+ /* Probably an abstract call of the class when
+ * individual widgets set their prototype */
+ return;
+ }
+
+ this.__subwidgets = [];
+
+ /* Setting all the configuration options */
+ var _type = config.type || "(unknown)",
+ _config = IriSP._.defaults({}, config, (player && player.config ? player.config.default_options : {}), this.defaults),
+ _this = this;
+
+ IriSP._(_config).forEach(function(_value, _key) {
+ _this[_key] = _value;
+ });
+
+ this.$ = IriSP.jQuery('#' + this.container);
+
+ if (typeof this.width === "undefined") {
+ this.width = this.$.width();
+ } else {
+ this.$.css("width", this.width);
+ }
+
+ if (typeof this.height !== "undefined") {
+ this.$.css("height", this.height);
+ }
+
+ /* Setting this.player at the end in case it's been overriden
+ * by a configuration option of the same name :-(
+ */
+ this.player = player || new IriSP.FakeClass(["on","trigger","off","loadWidget","loadMetadata"]);
+
+ /* Adding classes and html attributes */
+ this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
+
+ this.l10n = (
+ typeof this.messages[IriSP.language] !== "undefined"
+ ? this.messages[IriSP.language]
+ : (
+ IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
+ ? this.messages[IriSP.language.substr(0,2)]
+ : this.messages["en"]
+ )
+ );
+
+ /* Loading Metadata if required */
+
+ function onsourceloaded() {
+ if (_this.media_id) {
+ _this.media = this.getElement(_this.media_id);
+ } else {
+ var _mediaopts = {
+ is_mashup: _this.is_mashup || false
+ };
+ _this.media = _this.source.getCurrentMedia(_mediaopts);
+ }
+
+ _this.draw();
+ _this.player.trigger("widget-loaded");
+ }
+
+ if (this.metadata) {
+ /* Getting metadata */
+ this.source = player.loadMetadata(this.metadata);
+
+ /* Call draw when loaded */
+ this.source.onLoad(onsourceloaded);
+ } else {
+ if (this.source) {
+ onsourceloaded();
+ }
+ }
+
+
+};
+
+IriSP.Widgets.Widget.prototype.defaults = {};
+
+IriSP.Widgets.Widget.prototype.template = '';
+
+IriSP.Widgets.Widget.prototype.messages = {"en":{}};
+
+IriSP.Widgets.Widget.prototype.toString = function() {
+ return "Widget " + this.type;
+};
+
+IriSP.Widgets.Widget.prototype.templateToHtml = function(_template) {
+ return Mustache.to_html(_template, this);
+};
+
+IriSP.Widgets.Widget.prototype.renderTemplate = function() {
+ this.$.append(this.templateToHtml(this.template));
+};
+
+IriSP.Widgets.Widget.prototype.functionWrapper = function(_name) {
+ var _this = this,
+ _function = this[_name];
+ if (typeof _function !== "undefined") {
+ return function() {
+ return _function.apply(_this, Array.prototype.slice.call(arguments, 0));
+ };
+ } else {
+ console.log("Error, Unknown function IriSP.Widgets." + this.type + "." + _name);
+ }
+};
+
+IriSP.Widgets.Widget.prototype.getFunctionOrName = function(_functionOrName) {
+ switch (typeof _functionOrName) {
+ case "function":
+ return _functionOrName;
+ case "string":
+ return this.functionWrapper(_functionOrName);
+ default:
+ return undefined;
+ }
+};
+
+IriSP.Widgets.Widget.prototype.onMdpEvent = function(_eventName, _functionOrName) {
+ this.player.on(_eventName, this.getFunctionOrName(_functionOrName));
+};
+
+IriSP.Widgets.Widget.prototype.onMediaEvent = function(_eventName, _functionOrName) {
+ this.media.on(_eventName, this.getFunctionOrName(_functionOrName));
+};
+
+IriSP.Widgets.Widget.prototype.getWidgetAnnotations = function() {
+ if (typeof this.annotation_type === "undefined") {
+ return this.media.getAnnotations();
+ }
+ if (this.annotation_type.elementType === "annotationType") {
+ return this.annotation_type.getAnnotations();
+ }
+ return this.media.getAnnotationsByTypeTitle(this.annotation_type);
+};
+
+IriSP.Widgets.Widget.prototype.getWidgetAnnotationsAtTime = function() {
+ var _time = this.media.getCurrentTime();
+ return this.getWidgetAnnotations().filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ });
+};
+
+IriSP.Widgets.Widget.prototype.isLoaded = function() {
+ var isloaded = !IriSP._(this.__subwidgets).any(function(w) {
+ return !(w && w.isLoaded());
+ });
+ return isloaded;
+};
+
+IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _widgetoptions, _propname) {
+ var _id = _selector.attr("id"),
+ _this = this,
+ _type = _widgetoptions.type,
+ $L = $LAB,
+ key = this.__subwidgets.length;
+ this.__subwidgets.push(null);
+ if (typeof _id == "undefined") {
+ _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
+ _selector.attr("id", _id);
+ }
+ _widgetoptions.container = _id;
+ if (typeof IriSP.widgetsRequirements[_type] !== "undefined" && typeof IriSP.widgetsRequirements[_type].requires !== "undefined" ) {
+ for (var _j = 0; _j < IriSP.widgetsRequirements[_type].requires.length; _j++) {
+ $L.script(IriSP.getLib(IriSP.widgetsRequirements[_type].requires[_j]));
+ }
+ }
+ $L.wait(function() {
+ _this.player.loadWidget(_widgetoptions, function(_widget) {
+ if (_propname) {
+ _this[_propname] = _widget;
+ }
+ _this.__subwidgets[key] = _widget;
+ });
+ });
+};
+
+/**
+ * This method responsible of drawing a widget on screen.
+ */
+IriSP.Widgets.Widget.prototype.draw = function() {
+ /* implemented by "sub-classes" */
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/MediaList.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/MediaList.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,102 @@
+.Ldt-MediaListWidget a {
+ text-decoration: none;
+}
+
+.Ldt-MediaListWidget h2 {
+ clear: both;
+}
+
+.Ldt-MediaList-NowContainer {
+ min-height: 60px;
+ margin: 2px 0;
+}
+
+h3.Ldt-MediaList-Now-Title {
+ font-size: 13px;
+ margin: 2px 2px 0 82px;
+ font-weight: bold;
+}
+
+.Ldt-MediaListWidget h3 a {
+ color: #0068c4;
+}
+
+p.Ldt-MediaList-Now-Description {
+ margin: 2px 0 2px 82px;
+ font-size: 12px;
+ color: #666666;
+}
+
+ul.Ldt-MediaList-OtherList {
+ list-style: none;
+ padding: 2px;
+ margin: 0;
+}
+
+li.Ldt-MediaList-OtherList-li {
+ width: 100%;
+ clear: both;
+ margin: 2px 0;
+ padding: 2px 0;
+ min-height: 48px;
+}
+
+.Ldt-MediaList-OtherList-li:hover, .Ldt-MediaList-NowContainer:hover {
+ background: url(img/pinstripe-grey.png);
+}
+
+.Ldt-MediaList-Now-ThumbContainer, .Ldt-MediaList-Other-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+
+.Ldt-MediaList-Now-ThumbContainer {
+ float: left;
+ width: 80px;
+ height: 50px;
+ text-align: center;
+ margin: 2px 0;
+}
+
+.Ldt-MediaList-Other-ThumbContainer {
+ width: 60px;
+ height: 38px;
+}
+
+.Ldt-MediaList-Now-Thumbnail, .Ldt-MediaList-Other-Thumbnail {
+ border: none;
+ max-width: 100%;
+ max-height: 100%;
+ margin: 0 auto;
+}
+
+h3.Ldt-MediaList-Other-Title {
+ font-size: 12px;
+ margin: 2px 2px 0 62px;
+ font-weight: bold;
+}
+
+p.Ldt-MediaList-Other-Description {
+ margin: 2px 0 2px 62px;
+ font-size: 10px;
+ color: #666666;
+}
+
+.Ldt-MediaList-Now-MediaView {
+ clear: both; width: 100%; height: 12px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-Other-MediaView {
+ clear: both; width: 100%; height: 6px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-MediaView-Background {
+ position: absolute; top: 0; left: 0; width: 100%; height: 100%; filter: alpha(opacity=50); opacity: 0.5; background: #999999;
+}
+
+.Ldt-MediaList-Segment {
+ position: absolute; top: 0; height: 100%; border-style: none solid; margin-left: -1px; border-color: #ffffff; border-width: 1px;
+}
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/MediaList.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/MediaList.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,130 @@
+IriSP.Widgets.MediaList = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastMedia = false;
+};
+
+IriSP.Widgets.MediaList.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.MediaList.prototype.messages = {
+ "fr": {
+ now_playing: "Vidéo en cours",
+ all_media: "Toutes les vidéos",
+ other_media: "Autres vidéos"
+ },
+ "en": {
+ now_playing: "Now playing",
+ all_media: "All videos",
+ other_media: "Other videos"
+ }
+};
+
+IriSP.Widgets.MediaList.prototype.defaults = {
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
+ media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/",
+ default_color : "#000080"
+};
+
+IriSP.Widgets.MediaList.prototype.template =
+ '
'
+ + '
';
+
+IriSP.Widgets.MediaList.prototype.mediaViewTemplate =
+ '
{{#segments}}
{{/segments}}';
+
+IriSP.Widgets.MediaList.prototype.mediaTemplate =
+ '
'
+ + ''
+ + '{{description}}
'
+ + IriSP.Widgets.MediaList.prototype.mediaViewTemplate + '
';
+
+
+IriSP.Widgets.MediaList.prototype.onSearch = function(searchString) {
+ this.searchString = typeof searchString !== "undefined" ? searchString : '';
+ var _n = this.refresh(true);
+ if (this.searchString) {
+ if (_n) {
+ this.player.trigger("search.matchFound");
+ } else {
+ this.player.trigger("search.noMatchFound");
+ }
+ }
+};
+
+IriSP.Widgets.MediaList.prototype.draw = function() {
+ this.$.addClass("Ldt-MediaListWidget")
+ this.renderTemplate();
+ var _this = this;
+ if (typeof this.media.getMedias === "function") {
+ this.media.on("enter-annotation", function(_a) {
+ _this.redraw(_a.getMedia());
+ });
+ }
+ this.redraw();
+};
+
+IriSP.Widgets.MediaList.prototype.getSegments = function(_media) {
+ var _this = this,
+ _scale = this.$.width()/_media.duration.milliseconds;
+ return this.getWidgetAnnotations()
+ .filter(function(_annotation) {
+ return _annotation.getMedia().id == _media.id;
+ })
+ .map(function(_a) {
+ var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a );
+ return {
+ left: _scale * _annotation.begin,
+ width: _scale * (_annotation.end - _annotation.begin),
+ color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color )
+ };
+ });
+};
+
+IriSP.Widgets.MediaList.prototype.redraw = function(_media) {
+ if (typeof _media !== "undefined") {
+ this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media);
+ this.$.find('.Ldt-MediaList-NowPlaying').show();
+ this.$.find('.Ldt-MediaList-Now-Thumbnail').attr("src", _media.thumbnail || this.default_thumbnail);
+ this.$.find('.Ldt-MediaList-Now-Title a').html(_media.title);
+ this.$.find('.Ldt-MediaList-Now-Description').html(_media.description);
+ var _url = _media.url || Mustache.to_html(
+ this.media_url_template, {
+ media: _media.id
+ });
+ this.$.find('.Ldt-MediaList-NowContainer a').attr("href", _url);
+ var _mediaView = Mustache.to_html( this.mediaViewTemplate, {
+ segments: this.getSegments(_media)
+ });
+ this.$.find('.Ldt-MediaList-Now-MediaView').html(_mediaView);
+ } else {
+ this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.all_media);
+ this.$.find('.Ldt-MediaList-NowPlaying').hide();
+ }
+ var _this = this,
+ _otherlist = this.source.getMedias().filter(function(_m) {
+ return (_m.id !== _this.lastMedia)
+ });
+ if (_otherlist.length) {
+ this.$.find('.Ldt-MediaList-Other').show();
+ var _html = _otherlist.map(function(_media) {
+ return Mustache.to_html(_this.mediaTemplate, {
+ thumbnail: _media.thumbnail || _this.default_thumbnail,
+ url: _media.url || Mustache.to_html(
+ _this.media_url_template, {
+ media: _media.id
+ }),
+ title: _media.title,
+ description: _media.description,
+ segments: _this.getSegments(_media)
+ });
+ }).join("");
+ this.$.find('.Ldt-MediaList-OtherList').html(_html);
+ } else {
+ this.$.find('.Ldt-MediaList-Other').hide();
+ }
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Mediafragment.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Mediafragment.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,112 @@
+IriSP.Widgets.Mediafragment = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.last_hash_key = "";
+ this.last_hash_value = "";
+ window.onhashchange = this.functionWrapper("goToHash");
+ if (typeof window.addEventListener !== "undefined") {
+ var _this = this;
+ window.addEventListener('message', function(_msg) {
+ if (/^#/.test(_msg.data)) {
+ _this.setWindowHash(_msg.data);
+ }
+ });
+ };
+ this.onMdpEvent("Mediafragment.setHashToAnnotation","setHashToAnnotation");
+ this.blocked = false;
+};
+
+IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Mediafragment.prototype.draw = function() {
+ this.onMediaEvent("setpause","setHashToTime");
+ var _this = this;
+ this.getWidgetAnnotations().forEach(function(_annotation) {
+ _annotation.on("click", function() {
+ _this.setHashToAnnotation(_annotation.id);
+ });
+ });
+ if (this.media.loadedMetadata) {
+ this.goToHash();
+ } else {
+ this.onMediaEvent("loadedmetadata","goToHash");
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
+ if (typeof window.history !== "undefined" && typeof window.history.replaceState !== "undefined") {
+ window.history.replaceState({}, "", _hash);
+ } else {
+ document.location.hash = _hash;
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.getLastHash = function() {
+ var _tab = document.location.hash.replace(/^#/,'').split('&');
+ _tab = IriSP._(_tab).filter(function(_el) {
+ return _el && !/^(id|t)=/.test(_el);
+ });
+ if (this.last_hash_key) {
+ _tab.push(this.last_hash_key + '=' + this.last_hash_value);
+ }
+ return '#' + _tab.join('&');
+};
+
+IriSP.Widgets.Mediafragment.prototype.goToHash = function() {
+ if (document.location.hash !== this.getLastHash()) {
+ var _tab = document.location.hash.replace(/^#/,'').split('&');
+ for (var _i = 0; _i < _tab.length; _i++) {
+ var _subtab = _tab[_i].split("=");
+ if (_subtab[0] == "id" || _subtab[0] == "t") {
+ this.last_hash_key = _subtab[0];
+ this.last_hash_value = _subtab[1];
+ if (this.last_hash_key == "id") {
+ var _annotation = this.source.getElement(this.last_hash_value);
+ if (typeof _annotation !== "undefined") {
+ this.media.setCurrentTime(_annotation.begin);
+ }
+ }
+ if (this.last_hash_key == "t") {
+ this.media.setCurrentTime(1000*this.last_hash_value);
+ }
+ break;
+ }
+ }
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHashToAnnotation = function(_annotationId) {
+ this.setHash( 'id', _annotationId );
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHashToTime = function() {
+ this.setHash( 't', this.media.getCurrentTime().getSeconds() );
+};
+
+IriSP.Widgets.Mediafragment.prototype.setHash = function(_key, _value) {
+ if (!this.blocked && (this.last_hash_key !== _key || this.last_hash_value !== _value)) {
+ this.last_hash_key = _key;
+ this.last_hash_value = _value;
+ var _hash = this.getLastHash();
+ this.setWindowHash(_hash);
+ if (window.parent !== window) {
+ window.parent.postMessage(_hash,"*");
+ }
+ this.block();
+ }
+};
+
+IriSP.Widgets.Mediafragment.prototype.unblock = function() {
+ if (typeof this.blockTimeout !== "undefined") {
+ window.clearTimeout(this.blockTimeout);
+ }
+ this.blockTimeout = undefined;
+ this.blocked = false;
+};
+
+IriSP.Widgets.Mediafragment.prototype.block = function() {
+ if (typeof this.blockTimeout !== "undefined") {
+ window.clearTimeout(this.blockTimeout);
+ }
+ this.blocked = true;
+ this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1500);
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/MultiSegments.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/MultiSegments.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,122 @@
+IriSP.Widgets.MultiSegments = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.MultiSegments.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.MultiSegments.prototype.defaults = {
+ annotation_show_arrow: true,
+ annotation_start_minimized: true,
+ annotation_show_annotation_type: true,
+ show_all: false
+};
+
+IriSP.Widgets.MultiSegments.prototype.draw = function() {
+ var _this = this,
+ lines = [],
+ currentLine = null,
+ segmentsopts = {},
+ annotationopts = {};
+ IriSP._(this).each(function(_v,_k) {
+ if (/^segments_/.test(_k)) {
+ segmentsopts[_k.replace(/^segments_/,"")] = _v;
+ }
+ if (/^annotation_/.test(_k)) {
+ annotationopts[_k.replace(/^annotation_/,"")] = _v;
+ }
+ });
+ this.source.getAnnotationTypes().forEach(function(_anntype) {
+ var segments = _anntype.getAnnotations().filter(function(_ann) {
+ return _ann.getDuration() > 0;
+ });
+ if (segments.length) {
+
+ var visible = false;
+
+ var line = {
+ segmentWidget: IriSP.jQuery("
"),
+ annotationWidget: IriSP.jQuery("
"),
+ hasSegmentsNow: function() {
+ var _time = _this.media.getCurrentTime();
+ return !!segments.filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ }).length;
+ },
+ hide: function() {
+ if (visible) {
+ visible = false;
+ this.annotationWidget.slideUp();
+ }
+ },
+ show: function() {
+ if (!visible) {
+ visible = true;
+ this.annotationWidget.slideDown();
+ }
+ }
+ };
+
+
+ line.segmentWidget
+ .addClass("Ldt-MultiSegments-Segment")
+ .appendTo(_this.$);
+
+ if (!_this.show_all) {
+ line.segmentWidget.mouseenter(function() {
+ if (line.hasSegmentsNow()) {
+ currentLine = line;
+ checkVisibilities();
+ }
+ });
+ }
+
+ line.annotationWidget
+ .addClass("Ldt-MultiSegments-Annotation")
+ .appendTo(_this.$)
+ .hide();
+
+ _this.insertSubwidget(
+ line.segmentWidget,
+ IriSP._({
+ type: "Segments",
+ annotation_type: _anntype,
+ width: _this.width
+ }).extend(segmentsopts)
+ );
+
+ _this.insertSubwidget(
+ line.annotationWidget,
+ IriSP._({
+ type: "Annotation",
+ annotation_type: _anntype,
+ width: _this.width
+ }).extend(annotationopts)
+ );
+
+ lines.push(line);
+ }
+ });
+ var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation");
+
+ function checkVisibilities(_time) {
+ if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
+ currentLine = undefined;
+ }
+ IriSP._(lines).each(function(line) {
+ if (line.hasSegmentsNow()) {
+ if (!_this.show_all && !currentLine) {
+ currentLine = line;
+ }
+ if (_this.show_all || line === currentLine) {
+ line.show();
+ } else {
+ line.hide();
+ }
+ } else {
+ line.hide();
+ }
+ });
+ }
+
+ this.onMediaEvent("timeupdate", checkVisibilities);
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Polemic.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Polemic.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,22 @@
+/*
+ * Polemic Widget CSS
+ */
+
+.Ldt-Polemic {
+ border-style: solid none; border-color: #cccccc; border-width: 1px;
+}
+
+.Ldt-Polemic-Position {
+ background: #fc00ff;
+ position: absolute;
+ top: 0;
+ left: 0;
+ margin-left: -1px;
+ width: 2px;
+ height: 100%;
+}
+
+.Ldt-Polemic-TweetDiv {
+ position: absolute;
+}
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Polemic.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Polemic.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,332 @@
+IriSP.Widgets.Polemic = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Polemic.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Polemic.prototype.messages = {
+ fr: {
+ from_: "de ",
+ _to_: " à ",
+ _annotations: " annotation(s)"
+ },
+ en: {
+ from_: "from ",
+ _to_: " to ",
+ _annotations: " annotation(s)"
+ }
+};
+
+IriSP.Widgets.Polemic.prototype.defaults = {
+ element_width : 5,
+ element_height : 5,
+ max_elements: 20,
+ annotation_type : "tweet",
+ defaultcolor : "#585858",
+ foundcolor : "#fc00ff",
+ polemics : [
+ {
+ "name" : "OK",
+ "keywords" : [ "++" ],
+ "color" : "#1D973D"
+ },
+ {
+ "name" : "KO",
+ "keywords" : [ "--" ],
+ "color" : "#CE0A15"
+ },
+ {
+ "name" : "REF",
+ "keywords" : [ "==", "http://" ],
+ "color" : "#C5A62D"
+ },
+ {
+ "name" : "Q",
+ "keywords" : [ "?" ],
+ "color" : "#036AAE"
+ }
+ ]
+};
+
+IriSP.Widgets.Polemic.prototype.draw = function() {
+
+ this.onMediaEvent("timeupdate", "onTimeupdate");
+ this.$zone = IriSP.jQuery('
');
+ this.$zone.addClass("Ldt-Polemic");
+ this.$.append(this.$zone);
+
+ this.$elapsed = IriSP.jQuery('
')
+ .css({
+ background: '#cccccc',
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: 0,
+ height: "100%"
+ });
+
+ this.$zone.append(this.$elapsed);
+
+ var _slices = [],
+ _slice_count = Math.floor( this.width / this.element_width ),
+ _duration = this.source.getDuration(),
+ _max = 0,
+ _list = this.getWidgetAnnotations().filter(function(_a) {
+ return !_a.getDuration().milliseconds;
+ }),
+ _this = this;
+
+ for (var _i = 0; _i < _slice_count; _i++) {
+ var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ),
+ _end = new IriSP.Model.Time( ( _i + 1 ) * _duration / _slice_count ),
+ _count = 0,
+ _res = {
+ begin : _begin.toString(),
+ end : _end.toString(),
+ annotations : _list.filter(function(_annotation) {
+ return _annotation.begin >= _begin && _annotation.begin < _end;
+ }),
+ polemicStacks : []
+ };
+
+ for (var _j = 0; _j < this.polemics.length; _j++) {
+ var _polemic = _res.annotations.searchByDescription(this.polemics[_j].keywords);
+ _count += _polemic.length;
+ _res.polemicStacks.push(_polemic);
+ }
+ for (var _j = 0; _j < this.polemics.length; _j++) {
+ _res.annotations.removeElements(_res.polemicStacks[_j]);
+ }
+ _count += _res.annotations.length;
+ _max = Math.max(_max, _count);
+ _slices.push(_res);
+ }
+ if (_max < this.max_elements) {
+ this.is_stackgraph = false;
+ if (_max) {
+
+ this.height = (2 + _max) * this.element_height;
+ this.$zone.css({
+ width: this.width + "px",
+ height: this.height + "px",
+ position: "relative"
+ });
+
+ var _x = 0;
+
+ function displayAnnotation(_elx, _ely, _pol, _col, _annotation) {
+ var _html = Mustache.to_html(
+ '',
+ {
+ id: _annotation.id,
+ media_id: _this.source.currentMedia.id,
+ polemic: _pol,
+ left: _elx,
+ top: _ely,
+ color: _col,
+ width: (_this.element_width-1),
+ height: _this.element_height,
+ title: _annotation.title,
+ time: _annotation.begin.toString()
+ });
+ var _el = IriSP.jQuery(_html);
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ }).mouseout(function() {
+ _annotation.trigger("unselect");
+ }).click(function() {
+ _annotation.trigger("click");
+ return false;
+ });
+ IriSP.attachDndData(_el, {
+ title: _annotation.title,
+ description: _annotation.description,
+ image: _annotation.thumbnail,
+ uri: (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id))
+ });
+ _annotation.on("select", function() {
+ if (_this.tooltip) {
+ _this.tooltip.show(
+ + Math.floor(_elx + (_this.element_width - 1) / 2),
+ + _ely,
+ _annotation.title,
+ _col
+ );
+ }
+ _this.$tweets.each(function() {
+ var _e = IriSP.jQuery(this);
+ _e.css(
+ "opacity",
+ ( _e.attr("annotation-id") == _annotation.id ? 1 : .3 )
+ );
+ });
+ });
+ _annotation.on("unselect", function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ _this.$tweets.css("opacity",1);
+ });
+ _annotation.on("found", function() {
+ _el.css({
+ "background" : _this.foundcolor,
+ "opacity" : 1
+ });
+ });
+ _annotation.on("not-found", function() {
+ _el.css({
+ "background" : _col,
+ "opacity" : .3
+ });
+ });
+ _this.$zone.append(_el);
+ }
+
+ IriSP._(_slices).forEach(function(_slice) {
+ var _y = _this.height;
+ _slice.annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayAnnotation(_x, _y, "none", _this.defaultcolor, _annotation);
+ });
+ IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
+ var _color = _this.polemics[_j].color,
+ _polemic = _this.polemics[_j].name;
+ _annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayAnnotation(_x, _y, _polemic, _color, _annotation);
+ });
+ });
+ _x += _this.element_width;
+ });
+
+ this.$zone.append(_html);
+
+ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
+
+ this.source.getAnnotations().on("search-cleared", function() {
+ _this.$tweets.each(function() {
+ var _el = IriSP.jQuery(this);
+ _el.css({
+ "background" : _el.attr("polemic-color"),
+ "opacity" : 1
+ });
+ });
+ });
+
+ } else {
+ this.$zone.hide();
+ }
+ } else {
+ this.is_stackgraph = true;
+
+ this.height = (2 + this.max_elements) * this.element_height;
+ this.$zone.css({
+ width: this.width + "px",
+ height: this.height + "px",
+ position: "relative"
+ });
+
+ var _x = 0,
+ _html = '',
+ _scale = this.max_elements * this.element_height / _max;
+
+ function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) {
+ _html += Mustache.to_html(
+ '',
+ {
+ nums: _nums,
+ posx: Math.floor(_x + (_this.element_width - 1) / 2),
+ media_id: _this.source.currentMedia.id,
+ polemic: _polemic,
+ left: _x,
+ top: _y,
+ color: _color,
+ width: (_this.element_width-1),
+ height: _h,
+ begin: _begin,
+ end: _end
+ });
+ }
+
+ IriSP._(_slices).forEach(function(_slice) {
+ var _y = _this.height,
+ _nums = _slice.annotations.length + "," + IriSP._(_slice.polemicStacks).map(function(_annotations) {
+ return _annotations.length;
+ }).join(",");
+ if (_slice.annotations.length) {
+ var _h = Math.ceil(_scale * _slice.annotations.length);
+ _y -= _h;
+ displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none");
+ }
+ IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
+ if (_annotations.length) {
+ var _color = _this.polemics[_j].color,
+ _polemic = _this.polemics[_j].name,
+ _h = Math.ceil(_scale * _annotations.length);
+ _y -= _h;
+ displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic);
+ }
+ });
+ _x += _this.element_width;
+ });
+
+ this.$zone.append(_html);
+
+ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
+
+ this.$tweets
+ .mouseover(function() {
+ var _el = IriSP.jQuery(this),
+ _nums = _el.attr("annotation-counts").split(","),
+ _html = '
' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '
';
+ for (var _i = 0; _i <= _this.polemics.length; _i++) {
+ var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor;
+ _html += '
' + _nums[_i] + _this.l10n._annotations + '
';
+ }
+ if (_this.tooltip) {
+ _this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html);
+ }
+ })
+ .mouseout(function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ });
+
+ };
+
+ this.$position = IriSP.jQuery('
').addClass("Ldt-Polemic-Position");
+
+ this.$zone.append(this.$position);
+
+ this.$zone.click(function(_e) {
+ var _x = _e.pageX - _this.$zone.offset().left;
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
+ });
+
+ this.$.append('
');
+
+ this.insertSubwidget(
+ this.$.find(".Ldt-Polemic-Tooltip"),
+ {
+ type: "Tooltip",
+ min_x: 0,
+ max_x: this.width
+ },
+ "tooltip"
+ );
+};
+
+IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.$elapsed.css({
+ width: _x + "px"
+ });
+ this.$position.css({
+ left: _x + "px"
+ });
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/PopcornPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/PopcornPlayer.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,138 @@
+IriSP.Widgets.PopcornPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget();
+
+/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
+
+IriSP.Widgets.PopcornPlayer.prototype.defaults = {
+};
+
+IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
+
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (this.url_transform) {
+ this.video = this.url_transform(this.video);
+ }
+
+ if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) {
+
+ /* VIMEO */
+
+ var _popcorn = Popcorn.vimeo(this.container, this.video);
+
+ } else if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) {
+
+ /* YOUTUBE */
+
+ var _urlparts = this.video.split(/[?&]/),
+ _params = {};
+ for (var i = 1; i < _urlparts.length; i++) {
+ var _ppart = _urlparts[i].split('=');
+ _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
+ }
+ _params.controls = 0;
+ _params.modestbranding = 1;
+ if (this.autostart || this.autoplay) {
+ _params.autoplay = 1;
+ }
+ _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
+
+ var _popcorn = Popcorn.youtube(this.container, _url);
+
+ } else {
+
+ /* DEFAULT HTML5 */
+
+ var _tmpId = IriSP._.uniqueId("popcorn"),
+ _videoEl = IriSP.jQuery('
');
+ _videoEl.attr({
+ id : _tmpId,
+ width : this.width,
+ height : this.height || undefined
+ });
+ if(typeof this.video === "string"){
+ _videoEl.attr("src",this.video);
+ } else {
+ for (var i = 0; i < this.video.length; i++) {
+ var _srcNode = IriSP.jQuery('');
+ _srcNode.attr({
+ src: this.video[i].src,
+ type: this.video[i].type
+ });
+ _videoEl.append(_srcNode);
+ }
+ }
+ this.$.html(_videoEl);
+ var _popcorn = Popcorn("#" + _tmpId);
+ if (this.autostart || this.autoplay) {
+ _popcorn.autoplay(true);
+ }
+ }
+
+ var _media = this.media;
+
+ // Binding functions to Popcorn
+
+ _media.on("setcurrenttime", function(_milliseconds) {
+ _popcorn.currentTime(_milliseconds / 1000);
+ });
+
+ _media.on("setvolume", function(_vol) {
+ _popcorn.volume(_vol);
+ _media.volume = _vol;
+ });
+
+ _media.on("setmuted", function(_muted) {
+ _popcorn.muted(_muted);
+ _media.muted = _muted;
+ });
+
+ _media.on("setplay", function() {
+ _popcorn.play();
+ });
+
+ _media.on("setpause", function() {
+ _popcorn.pause();
+ });
+
+ // Binding Popcorn events to media
+
+ function getVolume() {
+ _media.muted = _popcorn.muted();
+ _media.volume = _popcorn.volume();
+ }
+
+ _popcorn.on("loadedmetadata", function() {
+ getVolume();
+ _media.trigger("loadedmetadata");
+ _media.trigger("volumechange");
+ });
+
+ _popcorn.on("timeupdate", function() {
+ _media.trigger("timeupdate", new IriSP.Model.Time(1000*_popcorn.currentTime()));
+ });
+
+ _popcorn.on("volumechange", function() {
+ getVolume();
+ _media.trigger("volumechange");
+ });
+
+ _popcorn.on("play", function() {
+ _media.trigger("play");
+ });
+
+ _popcorn.on("pause", function() {
+ _media.trigger("pause");
+ });
+
+ _popcorn.on("seeked", function() {
+ _media.trigger("seeked");
+ });
+
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Segments.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Segments.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,18 @@
+/*
+ * Segments Widget
+ */
+
+.Ldt-Segments-Segment {
+ position: absolute; margin-left: -1px; border: 1px solid #ffffff;
+}
+
+.Ldt-Segments-Position {
+ background: #fc00ff;
+ position: absolute;
+ top: -1px;
+ left: 0;
+ margin-left: -1px;
+ width: 2px;
+ bottom: -1px;
+ z-index: 80000;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Segments.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Segments.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,175 @@
+// TODO: Trigger IriSP.SegmentsWidget.click
+
+IriSP.Widgets.Segments = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Segments.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Segments.prototype.defaults = {
+ annotation_type : "chap",
+ colors: ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],
+ line_height: 8,
+ background: "#e0e0e0",
+ overlap: .25,
+ found_color: "#FF00FC",
+ faded_found_color: "#ff80fc"
+};
+
+IriSP.Widgets.Segments.prototype.template =
+ '
'
+ + '
'
+ + '
';
+
+IriSP.Widgets.Segments.prototype.annotationTemplate =
+ '
';
+
+
+IriSP.Widgets.Segments.prototype.draw = function() {
+ this.onMediaEvent("timeupdate", "onTimeupdate");
+ this.renderTemplate();
+
+ var _list = this.getWidgetAnnotations().filter(function(_ann) {
+ return _ann.getDuration() > 0;
+ }),
+ _this = this,
+ _scale = this.width / this.source.getDuration(),
+ list_$ = this.$.find('.Ldt-Segments-List'),
+ lines = [],
+ zindex = 1,
+ searching = false;
+
+ function saturate(r, g, b, s) {
+ function satcomp(c) {
+ return Math.floor(240 * (1 - s) + c * s);
+ }
+ var res = ( 0x10000 * satcomp(r) + 0x100 * satcomp(g) + satcomp(b)).toString(16);
+ while (res.length < 6) {
+ res = "0" + res;
+ }
+ return "#" + res;
+ }
+
+ _list.forEach(function(_annotation, _k) {
+ var _left = _annotation.begin * _scale,
+ _width = ( _annotation.getDuration() ) * _scale,
+ _center = Math.floor( _left + _width / 2 ),
+ _fulltext = _annotation.title + ( _annotation.description ? ( ' ' + _annotation.description ) : '' ),
+ line = IriSP._(lines).find(function(line) {
+ return !IriSP._(line.annotations).find(function(a) {
+ return a.begin < _annotation.end && a.end > _annotation.begin;
+ });
+ });
+ if (!line) {
+ line = { index: lines.length, annotations: []};
+ lines.push(line);
+ }
+ line.annotations.push(_annotation);
+ var _top = ((1 - _this.overlap) * line.index) * _this.line_height,
+ color = ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
+ r = parseInt(color.substr(1,2),16),
+ g = parseInt(color.substr(3,2),16),
+ b = parseInt(color.substr(5,2),16),
+ medcolor = saturate(r, g, b, .5),
+ lowcolor = saturate(r, g, b, .2);
+ var _data = {
+ color : color,
+ medcolor: medcolor,
+ lowcolor: lowcolor,
+ text: _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
+ left : _left,
+ width : _width,
+ top: _top,
+ height: _this.line_height - 1,
+ id : _annotation.id,
+ media_id : _annotation.getMedia().id,
+ from: _annotation.begin.toString(),
+ to: _annotation.end.toString()
+ };
+ var _html = Mustache.to_html(_this.annotationTemplate, _data),
+ _el = IriSP.jQuery(_html);
+ _el.mouseover(function() {
+ _annotation.trigger("select");
+ })
+ .mouseout(function() {
+ _annotation.trigger("unselect");
+ })
+ .click(function() {
+ _annotation.trigger("click");
+ })
+ .appendTo(list_$);
+ IriSP.attachDndData(_el, {
+ title: _annotation.title,
+ description: _annotation.description,
+ uri: (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)),
+ image: _annotation.thumbnail
+ });
+ _annotation.on("select", function() {
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css({
+ background: _segment.hasClass("found") ? _this.faded_found_color : _segment.attr("data-low-color")
+ });
+ });
+ _el.css({
+ background: _el.hasClass("found") ? _this.found_color: color,
+ "z-index": ++zindex
+ });
+ if (_this.tooltip) {
+ _this.tooltip.show( _center, _top, _data.text, _data.color );
+ }
+ });
+ _annotation.on("unselect", function() {
+ if (_this.tooltip) {
+ _this.tooltip.hide();
+ }
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color"));
+ });
+ });
+ _annotation.on("found", function() {
+ _el.css("background", _this.found_color).addClass("found");
+ });
+ _annotation.on("not-found", function() {
+ _el.css("background", lowcolor).removeClass("found");
+ });
+ });
+
+ this.$.css({
+ width : this.width + "px",
+ height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px",
+ background : this.background,
+ margin: "1px 0"
+ });
+ this.insertSubwidget(
+ this.$.find(".Ldt-Segments-Tooltip"),
+ {
+ type: "Tooltip",
+ min_x: 0,
+ max_x: this.width
+ },
+ "tooltip"
+ );
+ this.$segments = this.$.find('.Ldt-Segments-Segment');
+ this.source.getAnnotations().on("search", function() {
+ searching = true;
+ });
+ this.source.getAnnotations().on("search-cleared", function() {
+ searching = false;
+ _this.$segments.each(function() {
+ var _segment = IriSP.jQuery(this);
+ _segment.css("background", _segment.attr("data-medium-color")).removeClass("found");
+ });
+ });
+};
+
+IriSP.Widgets.Segments.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.$.find('.Ldt-Segments-Position').css({
+ left: _x + "px"
+ });
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slice.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slice.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,23 @@
+/* Slider Widget */
+
+.Ldt-Slice {
+ border-radius: 0; border: none; padding: 0; margin: 12px 0 12px; background: #B6B8B8; height: 8px;
+}
+
+.Ldt-Slice .ui-slider-handle {
+ width: 7px; height: 20px; top: 0; border: none; margin: 0; padding: 0;
+ background: url(img/slice-handles.png); border-radius: 0; cursor: pointer;
+}
+
+.ui-slider-handle.Ldt-Slice-left-handle {
+ margin-left: -7px;
+}
+
+.ui-slider-handle.Ldt-Slice-right-handle {
+ margin-left: 0; background-position: -7px 0;
+}
+
+.Ldt-Slice .ui-slider-range {
+ background: url(img/pinstripe-purple.png);
+}
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slice.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slice.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,81 @@
+/*
+ The Slider Widget shows time position and allows seek
+ */
+
+IriSP.Widgets.Slice = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.sliding = false;
+};
+
+IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slice.prototype.defaults = {
+ show_arrow: false
+};
+
+IriSP.Widgets.Slice.prototype.template =
+ '
'
+ + '{{#show_arrow}}
{{/show_arrow}}';
+
+IriSP.Widgets.Slice.prototype.draw = function() {
+
+ this.renderTemplate();
+
+ this.$slider = this.$.find(".Ldt-Slice");
+
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-Slice-Arrow"), { type: "Arrow" },"arrow");
+ }
+
+ this.min = 0;
+ this.max = this.media.duration.valueOf();
+
+ var _this = this,
+ _currentTime;
+
+ this.$slider.slider({
+ range: true,
+ values: [0, this.max],
+ min: 0,
+ max: this.max,
+ change: function(event, ui) {
+ if (_this.arrow) {
+ _this.arrow.moveToTime((ui.values[0]+ui.values[1])/2);
+ }
+ if (_this.onBoundsChanged) {
+ _this.onBoundsChanged(ui.values[0],ui.values[1]);
+ }
+ },
+ start: function() {
+ _this.sliding = true;
+ if (!_this.media.getPaused()) {
+ _this.media.pause();
+ }
+ _currentTime = _this.media.getCurrentTime();
+ },
+ slide: function(event, ui) {
+ _this.media.setCurrentTime(ui.value);
+ },
+ stop: function() {
+ _this.sliding = false;
+ _this.media.setCurrentTime(_currentTime);
+ }
+ });
+
+ this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
+ this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle");
+
+ this.getWidgetAnnotations().forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.$slider.slider("values",[_a.begin, _a.end]);
+ });
+ });
+};
+
+IriSP.Widgets.Slice.prototype.show = function() {
+ this.$slider.show();
+};
+
+IriSP.Widgets.Slice.prototype.hide = function() {
+ this.$slider.hide();
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slider.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slider.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,19 @@
+/* Slider Widget */
+
+.Ldt-Slider {
+ border: none; border-radius: 0; padding: 0; margin: 0; background: #B6B8B8;
+}
+
+.Ldt-Slider .ui-slider-handle {
+ border-radius: 8px; top: -2px; background: #fc00ff; border: 1px solid #ffffff;
+}
+
+.Ldt-Slider .ui-slider-range {
+ background: #747474;
+}
+
+.Ldt-Slider-Time {
+ position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8;
+ font-size: 10px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px;
+ display: none; text-align: center; font-weight: bold;
+}
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slider.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slider.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,133 @@
+/*
+ The Slider Widget fits right under the video
+ */
+
+IriSP.Widgets.Slider = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Slider.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slider.prototype.defaults = {
+ minimized_height : 4,
+ maximized_height : 10,
+ minimize_timeout : 1500 /* time before minimizing slider after mouseout,
+ set to zero for fixed slider */
+};
+
+IriSP.Widgets.Slider.prototype.template =
+ '
00:00
';
+
+IriSP.Widgets.Slider.prototype.draw = function() {
+
+ this.renderTemplate();
+
+ this.$time = this.$.find(".Ldt-Slider-Time");
+
+ this.$slider = this.$.find(".Ldt-Slider");
+
+ var _this = this;
+
+ this.$slider.slider({
+ range: "min",
+ value: 0,
+ min: 0,
+ max: this.source.getDuration().milliseconds,
+ slide: function(event, ui) {
+ _this.media.setCurrentTime(ui.value);
+ _this.player.trigger("Mediafragment.setHashToTime");
+ }
+ });
+
+ this.$handle = this.$slider.find('.ui-slider-handle');
+
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("Player.MouseOver","onMouseover");
+ this.onMdpEvent("Player.MouseOut","onMouseout");
+
+ if (this.minimize_timeout) {
+ this.$slider.css(this.calculateSliderCss(this.minimized_height));
+ this.$handle.css(this.calculateHandleCss(this.minimized_height));
+
+ this.maximized = false;
+ this.timeoutId = false;
+ }
+
+ this.$
+ .mouseover(function() {
+ _this.$time.show();
+ _this.onMouseover();
+ })
+ .mouseout(this.functionWrapper("onMouseout"))
+ .mousemove(function(_e) {
+ var _x = _e.pageX - _this.$.offset().left,
+ _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width);
+ _this.$time.text(_t.toString()).css("left",_x);
+ });
+};
+
+IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
+ this.$slider.slider("value",_time);
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
+};
+
+IriSP.Widgets.Slider.prototype.onMouseover = function() {
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ if (!this.maximized) {
+ this.animateToHeight(this.maximized_height);
+ this.maximized = true;
+ }
+ }
+};
+
+IriSP.Widgets.Slider.prototype.onMouseout = function() {
+ this.$time.hide();
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ var _this = this;
+ this.timeoutId = window.setTimeout(function() {
+ if (_this.maximized) {
+ _this.animateToHeight(_this.minimized_height);
+ _this.maximized = false;
+ }
+ _this.timeoutId = false;
+ }, this.minimize_timeout);
+ }
+};
+
+IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) {
+ this.$slider.stop().animate(
+ this.calculateSliderCss(_height),
+ 500,
+ function() {
+ IriSP.jQuery(this).css("overflow","visible");
+ });
+ this.$handle.stop().animate(
+ this.calculateHandleCss(_height),
+ 500,
+ function() {
+ IriSP.jQuery(this).css("overflow","visible");
+ });
+};
+
+IriSP.Widgets.Slider.prototype.calculateSliderCss = function(_size) {
+ return {
+ height: _size + "px",
+ "margin-top": (this.minimized_height - _size) + "px"
+ };
+};
+
+IriSP.Widgets.Slider.prototype.calculateHandleCss = function(_size) {
+ return {
+ height: (2 + _size) + "px",
+ width: (2 + _size) + "px",
+ "margin-left": -Math.ceil(2 + _size / 2) + "px"
+ };
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slideshare.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slideshare.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,2 @@
+/* Slideshare widget */
+
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Slideshare.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Slideshare.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,117 @@
+/* TODO: Add Slide synchronization */
+
+IriSP.Widgets.Slideshare = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slideshare.prototype.defaults = {
+ annotation_type: "slide",
+ sync: true,
+};
+
+IriSP.Widgets.Slideshare.prototype.messages = {
+ fr: {
+ slides_ : "Diapositives"
+ },
+ en: {
+ slides_ : "Slides"
+ }
+};
+
+IriSP.Widgets.Slideshare.prototype.template =
+ '';
+
+IriSP.Widgets.Slideshare.prototype.draw = function() {
+
+ function insertSlideshare(_presentation, _slide) {
+ if (_lastEmbedded === _presentation) {
+ if (_embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ } else {
+ _lastEmbedded = _presentation;
+ var _id = IriSP.Model.getUID(),
+ _params = {
+ allowScriptAccess: "always"
+ },
+ _atts = {
+ id: _id
+ },
+ _flashvars = {
+ doc : _presentation,
+ startSlide : _slide
+ };
+ $container.html('
');
+ swfobject.embedSWF(
+ "http://static.slidesharecdn.com/swf/ssplayer2.swf",
+ _id,
+ _this.embed_width,
+ _this.embed_height,
+ "8",
+ null,
+ _flashvars,
+ _params,
+ _atts
+ );
+ _embedObject = document.getElementById(_id);
+ }
+ $container.show();
+ }
+
+ var _annotations = this.getWidgetAnnotations();
+ if (!_annotations.length) {
+ this.$.hide();
+ } else {
+ this.renderTemplate();
+ var _lastPres = "",
+ _embedObject = null,
+ _oembedCache = {},
+ _lastEmbedded = "",
+ _this = this,
+ $container = this.$.find(".Ldt-SlideShare-Container");
+
+ this.embed_width = this.embed_width || $container.innerWidth();
+ this.embed_height = this.embed_height || Math.floor(this.embed_width * 3/4);
+
+ _annotations.forEach(function(_a) {
+ _a.on("leave", function() {
+ $container.hide();
+ _lastPres = "";
+ });
+ _a.on("enter", function() {
+ var _description = _a.description,
+ _isurl = /^https?:\/\//.test(_description),
+ _presentation = _description.replace(/#.*$/,''),
+ _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
+ _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1);
+ if (_presentation !== _lastPres) {
+ if (_isurl) {
+ if (typeof _oembedCache[_presentation] === "undefined") {
+ var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
+ + encodeURIComponent(_presentation)
+ + "&format=jsonp&callback=?";
+ IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
+ var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
+ if (_presmatch && _presmatch.length > 1) {
+ _oembedCache[_presentation] = _presmatch[1];
+ insertSlideshare(_presmatch[1], _slide);
+ }
+ });
+ } else {
+ insertSlideshare(_oembedCache[_presentation], _slide);
+ }
+ } else {
+ insertSlideshare(_presentation, _slide);
+ }
+ }
+ if (_this.sync && _embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ _lastPres = _presentation;
+
+ });
+ });
+ }
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Social.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Social.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,78 @@
+.Ldt-Social a {
+ display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; background: url(img/socialbuttons.png);
+}
+
+.Ldt-Social-Url-Container {
+ display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; position: relative;
+}
+
+a.Ldt-Social-Url {
+ margin: 0; background-position: -96px 0;
+}
+
+a.Ldt-Social-Url:hover {
+ background-position: -96px -24px;
+}
+
+.Ldt-Social-UrlPop {
+ position: absolute; left: 20px; top: -2px; background: url(img/socialcopy.png);
+ padding: 3px 0 0 12px; width: 218px; height: 27px;
+ display: none;
+}
+
+.Ldt-Social-Input, .Ldt-Social-CopyBtn {
+ font-size: 11px; margin: 1px; border: 1px solid #ccc; height: 16px;
+ padding: 1px; border-radius: 2px; display: inline-block;
+}
+
+.Ldt-Social-Input:hover, .Ldt-Social-CopyBtn.hover {
+ border-color: #8080ff;
+}
+
+.Ldt-Social-Input {
+ width: 150px;
+}
+
+.Ldt-Social-CopyBtn {
+ font-weight: bold; width: 50px; text-align: center; background: #f0f0ff;
+}
+
+.Ldt-Social-CopyBtn.hover {
+ background: #ffe0a0;
+}
+
+.Ldt-Social-CopyBtn.active {
+ background: #ff8000;
+}
+
+a.Ldt-Social-Twitter {
+ background-position: 0 0;
+}
+
+a.Ldt-Social-Twitter:hover {
+ background-position: 0 -24px;
+}
+
+a.Ldt-Social-Fb {
+ background-position: -24px 0;
+}
+
+a.Ldt-Social-Fb:hover {
+ background-position: -24px -24px;
+}
+
+a.Ldt-Social-Gplus {
+ background-position: -48px 0;
+}
+
+a.Ldt-Social-Gplus:hover {
+ background-position: -48px -24px;
+}
+
+a.Ldt-Social-Mail {
+ background-position: -72px 0;
+}
+
+a.Ldt-Social-Mail:hover {
+ background-position: -72px -24px;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Social.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Social.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,97 @@
+// TODO: Open share links in a small window
+
+IriSP.Widgets.Social = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ ZeroClipboard.setMoviePath( IriSP.getLib('zeroClipboardSwf') );
+};
+
+IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Social.prototype.defaults = {
+ text: "",
+ url: "",
+ show_url: true,
+ show_twitter: true,
+ show_fb: true,
+ show_gplus: true,
+ show_mail: true
+};
+
+IriSP.Widgets.Social.prototype.template =
+ '{{#show_url}}{{/show_url}}'
+ + '{{#show_fb}} {{/show_fb}}'
+ + '{{#show_twitter}}{{/show_twitter}}'
+ + '{{#show_gplus}} {{/show_gplus}}'
+ + '{{#show_mail}} {{/show_mail}} ';
+
+IriSP.Widgets.Social.prototype.messages = {
+ "fr": {
+ share_on: "Partager sur",
+ share_mail: "Envoyer par courriel",
+ share_link: "Partager le lien hypertexte",
+ copy: "Copier"
+ },
+ "en" : {
+ share_on: "Share on",
+ share_mail: "Share by e-mail",
+ share_link: "Share hypertext link",
+ copy: "Copy"
+ }
+};
+
+IriSP.Widgets.Social.prototype.draw = function() {
+ this.renderTemplate();
+ this.clipId = IriSP._.uniqueId("Ldt-Social-CopyBtn-");
+ this.$.find(".Ldt-Social-CopyBtn").attr("id", this.clipId);
+ var _this = this;
+ this.$.find(".Ldt-Social-Url").click(function() {
+ _this.toggleCopy();
+ return false;
+ }).on("dragstart", function(e) {
+ e.originalEvent.dataTransfer.setData("text/x-iri-title",_this.text);
+ e.originalEvent.dataTransfer.setData("text/x-iri-uri",_this.url);
+ });
+ this.$.find(".Ldt-Social-Input").focus(function() {
+ this.select();
+ });
+ this.$.find(".Ldt-Social-Ext").click(function() {
+ window.open(
+ IriSP.jQuery(this).attr("href"),
+ "_blank",
+ "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
+ return false;
+ });
+ this.updateUrls(this.url, this.text);
+};
+
+IriSP.Widgets.Social.prototype.toggleCopy = function() {
+ var _pop = this.$.find(".Ldt-Social-UrlPop");
+ _pop.toggle();
+ if (_pop.is(":visible")) {
+ if (typeof this.clip == "undefined") {
+ this.clip = new ZeroClipboard.Client();
+ this.clip.setHandCursor( true );
+ this.clip.glue(this.clipId);
+ var _this = this;
+ this.clip.addEventListener( 'onMouseUp', function() {
+ _pop.hide();
+ _this.clip.hide();
+ });
+ }
+ this.clip.show();
+ this.clip.setText( this.url );
+ this.$.find(".Ldt-Social-Input").val(this.url).focus();
+ } else {
+ this.clip.hide();
+ }
+};
+
+IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {
+ this.url = _url;
+ this.text = _text;
+ this.$.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
+ this.$.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
+ this.$.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + IriSP.jQuery.param({ url: _url, title: _text }));
+ this.$.find(".Ldt-Social-Mail").attr("href", "mailto:?" + IriSP.jQuery.param({ subject: _text, body: _text + ": " + _url }));
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Sparkline.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Sparkline.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,91 @@
+IriSP.Widgets.Sparkline = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Sparkline.prototype.defaults = {
+ lineColor : "#7492b4",
+ fillColor : "#aeaeb8",
+ lineWidth : 2,
+ slice_count : 20,
+ height : 50,
+ margin : 5
+};
+
+IriSP.Widgets.Sparkline.prototype.draw = function() {
+ var _slices = [],
+ _duration = this.source.getDuration(),
+ _max = 0,
+ _list = this.getWidgetAnnotations();
+ for (var _i = 0; _i < this.slice_count; _i++) {
+ var _begin = (_i*_duration/this.slice_count),
+ _end = ((_i+1)*_duration/this.slice_count),
+ _volume = 0;
+ _list.forEach(function(_annotation) {
+ if (_annotation.begin < _end && _annotation.end >= _begin) {
+ var _d = _annotation.getDuration().milliseconds;
+ if (!_d) {
+ _volume += 1;
+ } else {
+ _volume += (Math.min(_annotation.end, _end) - Math.max(_annotation.begin, _begin)) / _d;
+ }
+ }
+ });
+ _max = Math.max(_max, _volume);
+ _slices.push(_volume);
+ }
+ if (!_max) {
+ return;
+ }
+ this.paper = new Raphael(this.$[0], this.width, this.height);
+ var _scale = (this.height - this.margin) / _max,
+ _width = this.width / this.slice_count,
+ _this = this,
+ _y = IriSP._(_slices).map(function(_v) {
+ return _this.margin + _this.height - (_scale * _v);
+ }),
+ _d = IriSP._(_y).reduce(function(_memo, _v, _k) {
+ return _memo + ( _k
+ ? 'C' + (_k * _width) + ' ' + _y[_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v
+ : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v );
+ },'') + 'L' + this.width + ' ' + _y[_y.length - 1],
+ _d2 = _d + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height;
+
+ this.paper.path(_d2).attr({
+ "stroke" : "none",
+ "fill" : this.fillColor
+ });
+
+ this.paper.path(_d).attr({
+ "fill" : "none",
+ "stroke" : this.lineColor,
+ "stroke-width" : this.lineWidth
+ });
+
+ this.rectangleProgress = this.paper.rect(0,0,0,this.height)
+ .attr({
+ "stroke" : "none",
+ "fill" : "#808080",
+ "opacity" : .3
+ });
+
+ this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2});
+
+ this.$.click(function(_e) {
+ var _x = _e.pageX - _this.$.offset().left;
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
+ });
+
+ this.onMediaEvent("timeupdate","onTimeupdate");
+};
+
+IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
+ this.rectangleProgress.attr({
+ "width" : _x
+ });
+ this.ligneProgress.attr({
+ "path" : "M" + _x + " 0L" + _x + " " + this.height
+ });
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tagcloud.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tagcloud.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,31 @@
+/*
+ *
+ */
+.Ldt-Tagcloud-Container {
+ border: 1px solid #b7b7b7;
+ padding: 1px;
+ margin: 0;
+}
+
+ul.Ldt-Tagcloud-List {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+ list-style: none;
+ text-align: center;
+}
+
+li.Ldt-Tagcloud-item {
+ display: inline-block;
+ margin: 2px;
+ cursor: pointer;
+}
+
+li.Ldt-Tagcloud-item:hover {
+ color: #0099ff;
+}
+
+.Ldt-Tagcloud-active {
+ color: #c000c0;
+ padding: 0; margin: 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tagcloud.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tagcloud.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,128 @@
+IriSP.Widgets.Tagcloud = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.stopwords = IriSP._.uniq([].concat(this.custom_stopwords).concat(this.stopword_lists[this.stopword_language]));
+};
+
+IriSP.Widgets.Tagcloud.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tagcloud.prototype.template =
+ ''
+ + '{{#words}}{{word}} {{/words}}'
+ + ' ';
+
+IriSP.Widgets.Tagcloud.prototype.defaults = {
+ include_titles: true,
+ include_descriptions: true,
+ include_tag_texts: true,
+ tag_count: 30,
+ stopword_language: "fr",
+ custom_stopwords: [],
+ exclude_pattern: false,
+ annotation_type: false,
+ segment_annotation_type: false,
+ min_font_size: 10,
+ max_font_size: 26
+};
+
+IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
+ "fr" : [
+ 'aussi', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'des', 'donc', 'dont', 'elle', 'encore', 'entre', 'est',
+ 'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre',
+ 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'quand', 'que', 'qui', 'quoi', 'sans',
+ 'ses' ,'son', 'sont', 'sur', 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous'
+ ],
+ "en" : [
+ 'about', 'again', 'are', 'and', 'because', 'being', 'but', 'can', 'done', 'have', 'for', 'from',
+ 'get', 'here', 'http', 'like', 'more', 'one', 'our', 'she', 'that', 'the', 'their', 'then', 'there',
+ 'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your'
+ ]
+};
+
+IriSP.Widgets.Tagcloud.prototype.draw = function() {
+
+ if (this.segment_annotation_type) {
+ var _this = this;
+ this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.redraw(_a.begin, _a.end);
+ });
+ });
+ } else {
+ this.redraw();
+ }
+};
+
+IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
+ var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
+ _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
+ _words = {},
+ _this = this,
+ _annotations = this.getWidgetAnnotations();
+
+ if (typeof _from !== "undefined" && typeof _to !== "undefined") {
+ _annotations = _annotations.filter(function(_annotation) {
+ return _annotation.begin >= _from && _annotation.end <= _to;
+ });
+ }
+
+ _annotations.forEach(function(_annotation) {
+ var _txt =
+ (_this.include_titles ? _annotation.title : '')
+ + ' '
+ + (_this.include_descriptions ? _annotation.description : '')
+ + ' '
+ + (_this.include_tag_texts ? _annotation.getTagTexts() : '');
+ IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_word) {
+ if (IriSP._(_this.stopwords).indexOf(_word) == -1 && (!_this.exclude_pattern || !_this.exclude_pattern.test(_word))) {
+ _words[_word] = 1 + (_words[_word] || 0);
+ }
+ });
+ });
+ _words = IriSP._(_words)
+ .chain()
+ .map(function(_v, _k) {
+ return {
+ "word" : _k,
+ "count" : _v
+ };
+ })
+ .filter(function(_v) {
+ return _v.count > 2;
+ })
+ .sortBy(function(_v) {
+ return - _v.count;
+ })
+ .first(this.tag_count)
+ .value();
+ if (_words.length) {
+ var _max = _words[0].count,
+ _min = Math.min(_words[_words.length - 1].count, _max - 1),
+ _scale = (this.max_font_size - this.min_font_size) / Math.sqrt(_max - _min);
+ IriSP._(_words).each(function(_word) {
+ _word.size = Math.floor( _this.min_font_size + _scale * Math.sqrt(_word.count - _min) );
+ });
+ }
+ this.$.html(Mustache.to_html(this.template, {words: _words }));
+ this.$.find(".Ldt-Tagcloud-item").click(function() {
+ var _txt = IriSP.jQuery(this).attr("content");
+ _this.source.getAnnotations().search(_txt);
+ });
+ this.source.getAnnotations().on("search", this.functionWrapper("onSearch"));
+ this.source.getAnnotations().on("search-cleared", this.functionWrapper("onSearch"));
+};
+
+IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) {
+ searchString = typeof searchString !== "undefined" ? searchString : '';
+ if (searchString) {
+ var _rgxp = IriSP.Model.regexpFromTextOrArray(searchString);
+ }
+ this.$.find(".Ldt-Tagcloud-item").each(function() {
+ var _el = IriSP.jQuery(this),
+ _txt = _el.attr("content");
+ if (searchString) {
+ _el.html(_txt.replace(_rgxp, '$1 '));
+ } else {
+ _el.html(_txt);
+ }
+ });
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tooltip.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tooltip.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,123 @@
+.Ldt-Tooltip {
+ position: absolute;
+ height: 0; width: 0;
+ z-index: 100000;
+}
+
+.Ldt-Tooltip-Main {
+ position: absolute; bottom: 0; left: -96px;
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-NE,
+.Ldt-Tooltip-Corner-SW,
+.Ldt-Tooltip-Corner-SE {
+ position: absolute; width: 6px; height: 6px; background: url(img/tooltip-corners.png);
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-SW {
+ left: 0;
+}
+
+.Ldt-Tooltip-Corner-NE,
+.Ldt-Tooltip-Corner-SE {
+ right: 0;
+}
+
+.Ldt-Tooltip-Corner-NW,
+.Ldt-Tooltip-Corner-NE {
+ top: 0;
+}
+
+.Ldt-Tooltip-Corner-SW,
+.Ldt-Tooltip-Corner-SE {
+ bottom: 10px;
+}
+
+.Ldt-Tooltip-Corner-NW {
+ background-position: top left;
+}
+
+.Ldt-Tooltip-Corner-NE {
+ background-position: top right;
+}
+
+.Ldt-Tooltip-Corner-SW {
+ background-position: bottom left;
+}
+
+.Ldt-Tooltip-Corner-SE {
+ background-position: bottom right;
+}
+
+.Ldt-Tooltip-Border-Top,
+.Ldt-Tooltip-Border-SW,
+.Ldt-Tooltip-Border-SE {
+ position: absolute; height: 6px; background: url(img/tooltip-h-borders.png);
+}
+
+.Ldt-Tooltip-Border-Top {
+ left: 6px; right: 6px;
+}
+
+.Ldt-Tooltip-Border-SW,
+.Ldt-Tooltip-Border-SE {
+ bottom: 10px; background-position: bottom;
+}
+
+.Ldt-Tooltip-Border-SW {
+ left: 6px;
+}
+
+.Ldt-Tooltip-Border-SE {
+ right: 6px;
+}
+
+.Ldt-Tooltip-Tip {
+ position: absolute; height: 16px; width: 22px;
+ background: url(img/tooltip-tip.png);
+ bottom: 0;
+}
+
+.Ldt-Tooltip-Border-Left,
+.Ldt-Tooltip-Border-Right {
+ position: absolute; width: 6px; background: url(img/tooltip-v-borders.png);
+ top: 6px; bottom: 16px;
+}
+
+.Ldt-Tooltip-Border-Left {
+ left: 0; background-position: left;
+}
+
+.Ldt-Tooltip-Border-Right {
+ right: 0; background-position: right;
+}
+
+.Ldt-Tooltip-Inner {
+ min-height: 30px;
+ max-height: 140px;
+ width: 180px;
+ overflow: hidden;
+ margin: 6px 6px 16px;
+ background: url(img/tooltip-gradient.png) bottom;
+}
+
+
+.Ldt-Tooltip-Color {
+ float: left; margin: 8px 2px 2px 8px; width: 10px; height: 10px;
+}
+
+.Ldt-Tooltip-AltColor {
+ float: left; margin: 2px 2px 2px 3px; width: 10px; height: 10px;
+}
+
+.Ldt-Tooltip img {
+ max-width: 140px; max-height: 80px; margin: 2px 20px;
+}
+
+.Ldt-Tooltip p {
+ margin: 6px 8px;
+ font-size: 12px;
+ line-height: 14px;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tooltip.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tooltip.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,80 @@
+/* this widget displays a small tooltip */
+IriSP.Widgets.Tooltip = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.Tooltip.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tooltip.prototype.defaults = {
+
+};
+
+IriSP.Widgets.Tooltip.prototype.template =
+ '';
+
+IriSP.Widgets.Tooltip.prototype.draw = function() {
+ _this = this;
+ this.renderTemplate();
+ this.$.parent().css({
+ "position" : "relative"
+ });
+ this.$tooltip = this.$.find(".Ldt-Tooltip");
+ this.$tip = this.$.find(".Ldt-Tooltip-Tip");
+ this.$sw = this.$.find(".Ldt-Tooltip-Border-SW");
+ this.$se = this.$.find(".Ldt-Tooltip-Border-SE");
+ this.__halfWidth = Math.floor(this.$.find(".Ldt-Tooltip-Main").width()/2);
+ this.__borderWidth = this.$.find(".Ldt-Tooltip-Border-Left").width();
+ this.__tipDelta = this.__halfWidth - Math.floor(this.$tip.width()/2);
+ this.__maxShift = this.__tipDelta - this.__borderWidth;
+ this.$.mouseover(function() {
+ _this.$tooltip.hide();
+ });
+ this.hide();
+};
+
+IriSP.Widgets.Tooltip.prototype.show = function(x, y, text, color) {
+
+ if (typeof color !== "undefined") {
+ this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+ } else {
+ this.$.find(".Ldt-Tooltip-Color").hide();
+ }
+
+ this.$.find(".Ldt-Tooltip-Text").html(text);
+
+ this.$tooltip.show();
+
+ var shift = 0;
+
+ if (typeof this.min_x !== "undefined" && (x - this.__halfWidth < this.min_x)) {
+ shift = Math.max(x - this.__halfWidth - this.min_x, - this.__maxShift);
+ }
+
+ if (typeof this.max_x !== "undefined" && (+x + this.__halfWidth > this.max_x)) {
+ shift = Math.min(+ x + this.__halfWidth - this.max_x, this.__maxShift);
+ }
+
+ this.$tooltip.css({
+ "left" : (x - shift) + "px",
+ "top" : y + "px"
+ });
+ this.$tip.css({
+ "left": (this.__tipDelta + shift) + "px"
+ });
+ this.$sw.css({
+ "width": (this.__tipDelta + shift - this.__borderWidth) + "px"
+ });
+ this.$se.css({
+ "width": (this.__tipDelta - shift - this.__borderWidth) + "px"
+ });
+};
+
+IriSP.Widgets.Tooltip.prototype.hide = function() {
+ this.$tooltip.hide();
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Trace.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Trace.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,130 @@
+IriSP.Widgets.Trace = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+
+};
+
+IriSP.Widgets.Trace.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Trace.prototype.defaults = {
+ js_console : false,
+ url: "http://traces.advene.org:5000/",
+ requestmode: 'GET',
+ syncmode: "sync",
+ default_subject: "IRI",
+ tracer: null,
+ extend: false
+};
+
+IriSP.Widgets.Trace.prototype.draw = function() {
+ if (typeof window.tracemanager === "undefined") {
+ console.log("Tracemanager not found");
+ return;
+ }
+ var _this = this,
+ _medialisteners = {
+ "play" : 0,
+ "pause" : 0,
+ "volumechange" : 0,
+ "seeked" : 0,
+ "play" : 0,
+ "pause" : 0,
+ "timeupdate" : 10000
+ },
+ _annlisteners = {
+ search: 0,
+ "search-cleared": 0
+ };
+ IriSP._(_medialisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ };
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _this.media.on(_listener, _f);
+ });
+ var _annotations = this.source.getAnnotations();
+ IriSP._(_annlisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ };
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _annotations.on(_listener, _f);
+ });
+
+ if (!this.tracer) {
+
+ this.tracer = window.tracemanager.init_trace("test", {
+ url: this.url,
+ requestmode: this.requestmode,
+ syncmode: this.syncmode,
+ default_subject: this.default_subject
+ });
+
+ }
+
+
+
+ this.tracer.trace("TraceWidgetInit", {});
+
+ this.mouseLocation = '';
+ IriSP.jQuery(".Ldt-Widget").on("click mouseenter mouseleave", ".Ldt-TraceMe", function(_e) {
+ var _target = IriSP.jQuery(this);
+
+ var _widget = _target.attr("widget-type") || _target.parents(".Ldt-Widget").attr("widget-type"),
+ _data = {
+ "type": _e.type,
+ "widget": _widget
+ },
+ _targetEl = _target[0],
+ _class = _targetEl.className,
+ _name = _targetEl.localName,
+ _id = _targetEl.id,
+ _value = _target.val(),
+ _traceInfo = _target.attr("trace-info");
+ _data.target = _name + (_id && _id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class && _class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : '');
+ if (typeof _traceInfo == "string" && _traceInfo) {
+ _data.traceInfo = _traceInfo;
+ }
+ if (typeof _value == "string" && _value.length) {
+ _data.value = _value;
+ }
+ _this.eventHandler('UIEvent', _data);
+ });
+};
+
+IriSP.Widgets.Trace.prototype.eventHandler = function(_listener, _arg) {
+ var _traceName = 'Mdp_';
+ if (typeof _arg == "string" || typeof _arg == "number") {
+ _arg = { "value" : _arg };
+ }
+ if (typeof _arg == "undefined") {
+ _arg = {};
+ }
+ switch(_listener) {
+ case 'UIEvent':
+ _traceName += _arg.widget + '_' + _arg.type;
+ delete _arg.widget;
+ delete _arg.type;
+ break;
+ case 'play':
+ case 'pause':
+ _arg.milliseconds = this.media.getCurrentTime().milliseconds;
+ case 'timeupdate':
+ case 'seeked':
+ case 'volumechange':
+ _traceName += 'media_' + _listener;
+ break;
+ default:
+ _traceName += _listener.replace('.','_');
+ }
+ if (typeof this.extend === "object" && this.extend) {
+ IriSP._(_arg).extend(this.extend);
+ }
+ this.tracer.trace(_traceName, _arg);
+ if (this.js_console && typeof window.console !== "undefined" && typeof console.log !== "undefined") {
+ console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");");
+ }
+};
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tweet.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tweet.css Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,109 @@
+.Ldt-Tweet-Widget {
+ border: 1px solid #b7b7b7;
+ padding: 1px;
+ margin: 0;
+}
+
+.Ldt-Tweet-Widget a {
+ color: #0068C4;
+}
+
+.Ldt-Tweet-Widget a:hover {
+ color: #003366;
+}
+
+.Ldt-Tweet-Inner {
+ background: url(img/pinstripe.png);
+ padding: 5px;
+ margin: 0;
+ min-height: 50px;
+}
+
+.Ldt-Tweet-PinClose-Buttons {
+ float: right;
+}
+
+.Ldt-Tweet-PinClose-Buttons a {
+ display: inline-block; width: 17px; height: 17px; margin: 2px;
+ background: url(img/widget-control.png);
+}
+
+a.Ldt-Tweet-Pin {
+ background-position: 0 -17px;
+}
+
+a.Ldt-Tweet-Pin:hover, a.Ldt-Tweet-Pin.active {
+ background-position: -17px -17px;
+}
+
+a.Ldt-Tweet-Pin.active:hover {
+ background-position: 0 -17px;
+}
+
+a.Ldt-Tweet-Close:hover {
+ background-position: -17px 0;
+}
+
+.Ldt-Tweet-AvatarContainer {
+ float: left; width: 48px; height: 48px; margin: 2px 4px 2px 0;
+}
+
+.Ldt-Tweet-Avatar {
+ border: none; width: 48px; height: 48px;
+}
+
+.Ldt-Tweet-Inner h3 {
+ margin: 2px 0 5px 52px;
+ font-size: 14px;
+}
+
+a.Ldt-Tweet-ScreenName {
+ text-decoration: none;
+}
+
+a.Ldt-Tweet-ScreenName:hover {
+ text-decoration: underline;
+}
+
+p.Ldt-Tweet-Contents {
+ margin: 5px 0 5px 52px;
+ font-size: 12px;
+}
+
+.Ldt-Tweet-Bottom {
+ margin: 5px 0 0;
+ font-size: 12px;
+ text-align: right;
+}
+
+.Ldt-Tweet-Time {
+ display: inline-block;
+}
+
+.Ldt-Tweet-Bottom a {
+ display: inline-block;
+ margin-left: 12px;
+ text-decoration: none;
+}
+
+.Ldt-Tweet-Bottom a:hover {
+ text-decoration: underline;
+}
+
+.Ldt-Tweet-Icon {
+ display: inline-block; width: 16px; height: 16px;
+ margin: 0 2px -2px;
+ background: url(img/twitter_sprites.png);
+}
+
+.Ldt-Tweet-Retweet .Ldt-Tweet-Icon {
+ background-position: -80px 0;
+}
+
+.Ldt-Tweet-Retweet:hover .Ldt-Tweet-Icon {
+ background-position: -96px 0;
+}
+
+.Ldt-Tweet-Reply:hover .Ldt-Tweet-Icon {
+ background-position: -16px 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/Tweet.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/metadataplayer/Tweet.js Fri Oct 18 17:54:44 2013 +0200
@@ -0,0 +1,168 @@
+IriSP.Widgets.Tweet = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastAnnotation = false;
+};
+
+IriSP.Widgets.Tweet.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Tweet.prototype.defaults = {
+ hide_timeout: 10000,
+ polemics : [
+ {
+ "keywords" : [ "++" ],
+ "color" : "#30d765"
+ },
+ {
+ "keywords" : [ "--" ],
+ "color" : "#f51123"
+ },
+ {
+ "keywords" : [ "==" ],
+ "color" : "#f1e24a"
+ },
+ {
+ "keywords" : [ "??" ],
+ "color" : "#05aae6"
+ }
+ ],
+ annotation_type: "tweet",
+ pin_at_start: false
+};
+
+IriSP.Widgets.Tweet.prototype.messages = {
+ "fr": {
+ retweet: "Retweeter",
+ reply: "Répondre",
+ keep_visible: "Empêcher la fermeture automatique",
+ dont_keep_visible: "Permettre la fermeture automatique",
+ close_widget: "Fermer l'affichage du tweet",
+ original_time: "Heure d'envoi\u00a0: ",
+ video_time: "Temps de la vidéo\u00a0: ",
+ show_original: "Voir l'original"
+ },
+ "en": {
+ retweet: "Retweet",
+ reply: "Reply",
+ keep_visible: "Keep visible",
+ dont_keep_visible: "Don't keep visible",
+ close_widget: "Close tweet display",
+ original_time: "Tweet sent at: ",
+ video_time: "Video time: ",
+ show_original: "Show original"
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.template =
+ '';
+
+
+IriSP.Widgets.Tweet.prototype.draw = function() {
+ this.renderTemplate();
+ this.pinned = this.pin_at_start;
+ var _this = this;
+ this.$.find(".Ldt-Tweet-Pin").click(function() {
+ _this.pinned = !_this.pinned;
+ var _el = IriSP.jQuery(this);
+ if (_this.pinned) {
+ _el.addClass("active").attr("title",_this.l10n.dont_keep_visible);
+ _this.cancelTimeout();
+ } else {
+ _el.removeClass("active").attr("title",_this.l10n.keep_visible);
+ _this.hideTimeout();
+ }
+ });
+ this.$.find(".Ldt-Tweet-Close").click(function() {
+ _this.hide();
+ });
+ this.$.hide();
+ this.getWidgetAnnotations().forEach(function(_annotation) {
+ _annotation.on("click", function() {
+ _this.show(_annotation);
+ });
+ });
+};
+
+IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
+ if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
+ var extend = [
+ [
+ /#(\w+)/gm,
+ function(matches) {
+ return '';
+ },
+ ' '
+ ]
+ ];
+ var _urls = IriSP._(_tweet.source.entities.urls).sortBy(function(_entity) {
+ return _entity.indices[0];
+ });
+
+ var _currentPos = 0,
+ _txt = '';
+ IriSP._(_urls).each(function(_url) {
+ if (_url.indices[0] >= _currentPos) {
+ _txt += _tweet.source.text.substring(_currentPos, _url.indices[0]);
+ _txt += (typeof _url.expanded_url !== "undefined" && _url.expanded_url !== null ? _url.expanded_url : _url.url);
+ _currentPos = _url.indices[1];
+ }
+ });
+ _txt += _tweet.source.text.substring(_currentPos);
+
+ for (var _i = 0; _i < this.polemics.length; _i++) {
+ var rx = IriSP.Model.regexpFromTextOrArray(this.polemics[_i].keywords);
+ extend.push([
+ rx,
+ '',
+ ' '
+ ]);
+ }
+ var rx = (_tweet.found ? (_this.source.getAnnotations().regexp || false) : false),
+ profile_url = _tweet.source.user ? _tweet.source.user.profile_image_url : _tweet.source.profile_image_url,
+ screen_name = _tweet.source.user ? _tweet.source.user.screen_name :_tweet.source.from_user,
+ user_name = _tweet.source.user ? _tweet.source.user.name :_tweet.source.from_user_name;
+ this.$.find(".Ldt-Tweet-Avatar").attr("src", profile_url);
+ this.$.find(".Ldt-Tweet-ScreenName").html('@' + screen_name);
+ this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + screen_name);
+ this.$.find(".Ldt-Tweet-FullName").html(user_name);
+ this.$.find(".Ldt-Tweet-Contents").html(IriSP.textFieldHtml(_txt, rx, extend));
+ this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
+ this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + screen_name + "/status/" + _tweet.source.id_str);
+ this.player.trigger("Annotation.minimize");
+ this.$.slideDown();
+ this.cancelTimeout();
+ if (!this.pinned) {
+ this.hideTimeout();
+ }
+ } else {
+ this.hide();
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.hide = function() {
+ this.player.trigger("Annotation.maximize");
+ this.$.slideUp();
+ this.cancelTimeout();
+};
+
+IriSP.Widgets.Tweet.prototype.cancelTimeout = function() {
+ if (typeof this.hide_timer !== "undefined") {
+ window.clearTimeout(this.hide_timer);
+ this.hide_timer = undefined;
+ }
+};
+
+IriSP.Widgets.Tweet.prototype.hideTimeout = function() {
+ this.cancelTimeout();
+ this.hide_timer = window.setTimeout(this.functionWrapper("hide"), this.hide_timeout);
+};
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/loader.gif
Binary file web/lib/metadataplayer/img/loader.gif has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/pinstripe-grey.png
Binary file web/lib/metadataplayer/img/pinstripe-grey.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/pinstripe-purple.png
Binary file web/lib/metadataplayer/img/pinstripe-purple.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/pinstripe.png
Binary file web/lib/metadataplayer/img/pinstripe.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/player-sprites.png
Binary file web/lib/metadataplayer/img/player-sprites.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/player_gradient.png
Binary file web/lib/metadataplayer/img/player_gradient.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/polemic.png
Binary file web/lib/metadataplayer/img/polemic.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/profile_arrow.png
Binary file web/lib/metadataplayer/img/profile_arrow.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/slice-handles.png
Binary file web/lib/metadataplayer/img/slice-handles.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/socialbuttons.png
Binary file web/lib/metadataplayer/img/socialbuttons.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/socialcopy.png
Binary file web/lib/metadataplayer/img/socialcopy.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/submit_annotation.png
Binary file web/lib/metadataplayer/img/submit_annotation.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tag.png
Binary file web/lib/metadataplayer/img/tag.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tooltip-corners.png
Binary file web/lib/metadataplayer/img/tooltip-corners.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tooltip-gradient.png
Binary file web/lib/metadataplayer/img/tooltip-gradient.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tooltip-h-borders.png
Binary file web/lib/metadataplayer/img/tooltip-h-borders.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tooltip-tip.png
Binary file web/lib/metadataplayer/img/tooltip-tip.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/tooltip-v-borders.png
Binary file web/lib/metadataplayer/img/tooltip-v-borders.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/twitter_sprites.png
Binary file web/lib/metadataplayer/img/twitter_sprites.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/voiceannotation.png
Binary file web/lib/metadataplayer/img/voiceannotation.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/white_arrow_long.png
Binary file web/lib/metadataplayer/img/white_arrow_long.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/widget-control.png
Binary file web/lib/metadataplayer/img/widget-control.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/lib/metadataplayer/img/zoombuttons.png
Binary file web/lib/metadataplayer/img/zoombuttons.png has changed
diff -r 000000000000 -r 7f8907368bd5 web/player.swf
Binary file web/player.swf has changed