# HG changeset patch # User veltr # Date 1346330572 -7200 # Node ID 7d9f6fd6f9047924b284410361140002b6f3c35c # Parent 8a6c9e3d01588b2734b30324b12585a53f967c8d Post-merge corrections diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/css/LdtPlayer.css --- a/src/css/LdtPlayer.css Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1015 +0,0 @@ -/* Some general styling classes */ - -.Ldt-floatClear { - display: block; width: 100%; height: 0; clear: both; -} - -ul.Ldt-floatList { - padding: 0; margin: 0; list-style: none; -} - -.Ldt-floatList li { - float: left; -} - - -/* */ - -#demo-frame > div.demo { padding: 5px !important; }; - -button.ui-button-icon-only { - height:1.5em; - width:1.5em; -} - -#Ldt-loader { - background:url(imgs/loader.gif) center no-repeat; - text-indent: -9999px; - position: absolute; -} - -/* general class for all buttons */ -.Ldt-button { - -} - -.Ldt-SegmentsWidget { - /* overflow: auto; /* clear the floats */ - margin-top: 1px; - padding-bottom: 8px; /* FIXME: only a temporary fix. This should be put into the layout manager. */ -} - -.Ldt-iri-chapter { - position: absolute; - height: 10px; - border-right: 1px solid white; -} - -.Ldt-SegmentPositionMarker { - position: absolute; - z-index: 100; - width: 1px; - height: 10px; - background-color: white; -} -.tooltip { - display:none; - background:transparent url(imgs/white_arrow_mini.png); - font-size:12px; - height:55px; - width:180px; - padding:10px; - padding-left:15px; - padding-top:15px; - padding-right:15px; - color:#000; - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; -} -#Ldt-Root{ - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; -} -#Ldt-Hat{ - height:3px; -} - -.Ldt-AnnotationsWidget { - font-size: 12px; - font-family: "Arial", "Verdana", "sans-serif"; - background-color:#eeeeee; - background:url('imgs/wire_pattern.png') repeat scroll transparent ; - border: 1px solid #b6b8b8; -} - -.Ldt-Annotation-DoubleBorder { - border: 1px solid white; - overflow: auto; -} - -.Ldt-AnnotationContent { - padding:5px; - padding-left: 12px; - -} - -.Ldt-fbShare { - display: block; - float: left; - width: 24px; - height: 24px; - background:url('imgs/facebook.png'); -} - -.Ldt-TwShare { - display: block; - float: left; - width: 24px; - height: 24px; - background:url('imgs/twitter.png'); -} - -.Ldt-GplusShare { - display: block; - float: left; - width: 24px; - height: 24px; - background:url('imgs/google.png'); -} - -.Ldt-SaTitle{ - padding-top:2px; - padding-bottom:3px; - font-size: 12pt; - color : #0068c4; -} - -.Ldt-SaDescription{ - font-size:12px; -} - -.Ldt-SaKeywords { - font-weight:bold; - font-size:10px; -} - -.Ldt-AnnotationShareIcons { - float:right; - position: relative; -} - - -#Ldt-PlaceHolder{ - position:absolue; - float:none; -} - -.Ldt-Segments{ - float:left; - font-size: 62.5%; -} - -.Ldt-mode-radio{ - visibility:hidden; - height:0px; - display:none -} - -/* player */ -.Ldt-controler { - font-size: 10px; - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; - background:url('imgs/player_gradient.png') repeat-x transparent ; - height: 25px; - border: 1px solid #b6b8b8; - position: relative; -} - - -.Ldt-LeftPlayerControls { - float:left; -} - -.Ldt-RightPlayerControls { - float: right; -} - -.Ldt-Ctrl-button { - float: left; - width: 30px; height: 25px; - background: url('imgs/player-sprites.png'); - cursor: pointer; -} - -.Ldt-Ctrl-spacer { - float: left; width: 1px; height: 25px; background: #b6b8b8; -} - -.Ldt-CtrlPlay { - margin: 0 15px; -} - -.Ldt-CtrlPlay-PlayState { - background-position: 0 0; -} - -.Ldt-CtrlPlay-PlayState:hover { - background-position: 0 -25px; -} - -.Ldt-CtrlPlay-PlayState:active { - background-position: 0 -50px; -} - -.Ldt-CtrlPlay-PauseState { - background-position: -30px 0; -} - -.Ldt-CtrlPlay-PauseState:hover { - background-position: -30px -25px; -} - -.Ldt-CtrlPlay-PauseState:active { - background-position: -30px -50px; -} - - -.Ldt-CtrlAnnotate { - margin: 0 2px; - background-position: -60px 0; -} - -.Ldt-CtrlAnnotate:hover { - background-position: -60px -25px; -} - -.Ldt-CtrlAnnotate:active { - background-position: -60px -50px; -} - -.Ldt-CtrlSearch { - margin: 0 2px; - background-position: -90px 0; -} - -.Ldt-CtrlSearch:hover { - background-position: -90px -25px; -} - -.Ldt-CtrlSearch:active { - background-position: -90px -50px; -} - -.LdtSearch { - display: none; - width: 165px; - height: 25px; - border: 1px; - border-color: #CFCFCF; - float: left; - text-align: center; -} - -.Ldt-Time { - float: left; - margin: 5px; - font-size: 12px; - font-family: Arial, Verdana, sans-serif; -} - -.Ldt-ElapsedTime { - float: left; - color: #4a4a4a; -} - -.Ldt-TimeSeparator { - margin: 0 4px; - float: left; -} - -.Ldt-TotalTime { - float: left; - color: #b2b2b2; -} - -.Ldt-CtrlSound { - margin: 0 2px; -} - -.Ldt-CtrlSound-Full { - background-position: -120px 0; -} - -.Ldt-CtrlSound-Full:hover { - background-position: -120px -25px; -} - -.Ldt-CtrlSound-Full:active { - background-position: -120px -50px; -} - -.Ldt-CtrlSound-Mute { - background-position: -150px 0; -} - -.Ldt-CtrlSound-Mute:hover { - background-position: -150px -25px; -} - -.Ldt-CtrlSound-Mute:active { - background-position: -150px -50px; -} - -.Ldt-CtrlSound-Half { - background-position: -180px 0; -} - -.Ldt-CtrlSound-Half:hover { - background-position: -180px -25px; -} - -.Ldt-CtrlSound-Half:active { - background-position: -180px -50px; -} - -.Ldt-Ctrl-Volume-Control { - display: none; - position: absolute; - background:url('imgs/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-Cursor { - position: absolute; top: 2px; width: 6px; height: 19px; background: #a8a8a8; border: 1px solid #999999; border-radius: 2px; - cursor: pointer; -} - -.Ldt-Ctrl-Volume-Control:hover .Ldt-Ctrl-Volume-Cursor { - background: #F7268E; -} - -.Ldt-cleaner { - clear:both; -} - -/* Arrow Widget */ -.Ldt-arrowWidget { - position: relative; - - height:16px; - width:27px; - margin-bottom: -3px; - z-index: 4; - left: 0%; -} - -.Ldt-arrowLeftEdge { - background:url('imgs/left_edge_arrow.png') no-repeat scroll 0 0 transparent ; -} - -.Ldt-arrowCenter { - background:url('imgs/arrow.png') no-repeat scroll 0 0 transparent ; -} - -.Ldt-arrowRightEdge { - background:url('imgs/right_edge_arrow.png') no-repeat scroll 0 0 transparent ; -} - -.cleaner { - clear:both; -} - -.share { - background:url('imgs/widget20.png') no-repeat scroll 0 0 transparent ; - display:block; - height:16px; - line-height:16px !important; - overflow:hidden; - width:16px; - float:left; - cursor:pointer; - margin:2px; -} -.shareFacebook{ - background-position:0 -704px; -} -.shareMySpace{ - background-position:0 -736px; -} -.shareTwitter{ - background-position:0 -1072px; -} -.shareGoogle{ - background-position:0 -752px; -} -.shareDelicious{ - background-position:0 -672px; -} -.shareJamesPot{ - background-position:0 -1808px; -} - -.tip{ - position: absolute; - padding : 3px; - z-index: 10000000000; - max-width: 200px; - background: transparent url("imgs/white_arrow_long.png"); - font-size: 12px; - height: 115px; - width: 180px; - padding: 15px 15px 20px; - color: black; - font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; - overflow:hidden; -} - -.tipcolor { - float: left; margin: 2px 4px 2px 0; -} - -.tip img { - max-width: 140px; max-height: 70px; margin: 0 20px; -} - -/* slider */ -.Ldt-SliderMinimized { - height: 6px; -} - -.Ldt-SliderMaximized { - height: 11px; -} - -.Ldt-sliderElementMinimized { - width: 100%; - height: 5px; -} - -.Ldt-sliderElementMaximized { - width: 100%; - height: 10px; -} - -.Ldt-sliderBackground { - background-color: #B6B8B8; - position: absolute; - z-index: 2; - bottom: 1px; - width: 100%; - height: 5px; - -} - -.Ldt-sliderForeground { - background-color: #747474; - z-index: 2; - width: 0px; - position: absolute; - bottom: 1px; - height: 5px; -} - -.Ldt-sliderPositionMarker { - position: absolute; - z-index: 100; - background-color: #f7268e; - height: 5px; - width: 5px; - bottom: 1px; - border-left: 1px solid white; - border-right: 1px solid white; -} - -/* tweet Widget */ -.Ldt-tweetWidget { - font-size: 12px; - font-family: "Arial", "Verdana", "sans-serif"; - background:url('imgs/wire_pattern.png') repeat scroll transparent ; - border: 1px solid #b6b8b8; - border-top: none; - overflow: auto; -} - -.Ldt-tweet-DoubleBorder { - border: 1px solid white; - padding: 5px; - overflow: auto; -} - -.Ldt-tweetAvatar { - float: left; -} - -.Ldt-tweetAvatar-profileArrow { - float: left; - height: 48px; - margin-left: 5px; - margin-right: 5px; - background:url('imgs/profile_arrow.png'); - background-position: 7 10px; -} - -.Ldt-tweet_userHandle { - float: left; - color: #5c8df1; -} - -.Ldt-tweet_realName { - float: left; - margin-left: 3px; -} - -.Ldt-tweetContents { -} - -.Ldt-tweet_date { - float: left; -} - -.Ldt-tweetWidgetKeepOpen { - position: relative; - float: right; - height: 17px; - width: 17px; - margin-right: 1px; - background:url('imgs/minimize.png'); -} - -.Ldt-tweetWidgetMinimize { - position: relative; - float: right; - height: 17px; - width: 17px; - right: 9px; - background:url('imgs/minimize.png'); -} - -.Ldt-tweetWidget * a:link { - color: #729efa; - -} - -.Ldt-TweetReply { - float: left; - margin-left: 16px; -} - -.Ldt-TweetReplyIcon { - background:url('imgs/reply_sprite.png') no-repeat scroll 0 0 transparent ; - width: 14px; - height: 11px; - float: left; - margin-top: 2px; -} - -.Ldt-TweetReplyIcon:hover { - background-position: 0 -11px; -} - -.Ldt-TweetReplyIcon:active { - background-position: 0 -22px; -} - -.Ldt-Retweet { - float: left; - margin-left: 16px; -} - -.Ldt-RetweetIcon { - background:url('imgs/retweet_sprite.png') no-repeat scroll 0 0 transparent ; - width: 14px; - height: 8px; - float: left; - margin-top: 3px; -} - -.Ldt-RetweetIcon:hover { - background-position: 0 -8px; -} - -.Ldt-RetweetIcon:active { - background-position: 0 -16px; -} - -/* styling of a "++" in a tweet */ -.Ldt-PolemicPlusPlus { - background-color: #1d973d; -} - -/* styling of a "==" in a tweet */ -.Ldt-PolemicEqualEqual { - background-color: #5c8df1 -} - -/* styling of a "--" in a tweet */ -.Ldt-PolemicMinusMinus { - background-color: #ce0a15; -} - -/* styling of a "??" in a tweet */ -.Ldt-PolemicQuestion { - background-color: #c5a62d; -} - -/* the styling of a spacer div */ -.Ldt-spacer { - background-color:#eeeeee; -} - -/* sparkline widget */ -.Ldt-sparklineWidget { - position: relative; - margin-bottom: 5px; -} - -.Ldt-sparkLinePositionMarker { - position: absolute; - top: 0px; - width: 0px; - background-color: #333333; - border-right: solid 1px pink; - z-index: 3; - opacity: 0.2; -} - -.Ldt-sparkLine { - position: absolute; - top: 0px; -} - -.Ldt-sparkLineClickOverlay { - position: absolute; - width: 640px; - height: 60px; - z-index: 4; - top: 0px; - opacity: 0.3; -} - -.Ldt-sliceWidget { - position: relative; - width: 100%; - height: 25px; - margin-top: 3px; -} - -.Ldt-sliceBackground { - width: 100%; - background-color: #b6b8b8; - height: 12px; -} - -.Ldt-sliceZone { - position: absolute; - top: 0px; - background:url('imgs/wire_pattern.png') repeat scroll transparent; - height: 12px; - z-index: 2; -} - -.Ldt-sliceLeftHandle { - position: absolute; - top: 0px; - height: 25px; - width: 7px; - background:url('imgs/left_handle.gif') no-repeat scroll transparent; - z-index: 2; -} - -.Ldt-sliceRightHandle { - position: absolute; - top: 0px; - height: 25px; - width: 7px; - background:url('imgs/right_handle.gif') no-repeat scroll transparent; - z-index: 2; -} - -.Ldt-createAnnotationWidget { - font-size: 12px; - font-family: "Arial", "Verdana", "sans-serif"; - background-color:#eeeeee; - background:url('imgs/wire_pattern.png') repeat scroll transparent ; - border: 1px solid #b6b8b8; -} - -.Ldt-createAnnotation-DoubleBorder { - border: 1px solid white; - overflow: auto; - padding: 7px; -} - -.Ldt-createAnnotation-Title { - font-size: 12pt; - color : #0068c4; - float: left; - margin-right: 5px; -} - -.Ldt-createAnnotation-TimeFrame { - font-size: 12pt; - color : #ff5589; - float: left; -} - -.Ldt-createAnnotation-Container { - float: left; width: 100%; clear: both; -} - -.Ldt-createAnnotation-userAvatar { - float: right; - width: 48px; - height: 48px; - margin: 7px 0; - border: 1px solid #babcbc; -} - -.Ldt-createAnnotation-userAvatar img { - float: right; - display: block; - max-width: 100%; - max-height: 100%; -} - -.Ldt-createAnnotation-profileArrow { - float: right; - vertical-align: top; - height: 48px; - width: 15px; - margin: 7px 5px; - background:url('imgs/profile_arrow.png') center no-repeat; -} - -.Ldt-createAnnotation-Description { - float: left; - width: 520px; - height: 56px; padding: 2px; - resize: none; -} - -.Ldt-createAnnotation-btnblock { - float: left; width: 450px; margin: 5px 0; -} - -.Ldt-createAnnotation-btnblock label { - float: left; margin-left: 12px; margin: 2px 8px 2px 0; font-size: 12px; -} - -.Ldt-createAnnotation-keyword-button { - border: 1px solid #ffffff; - background-color: #217bcb; - color: #ffffff; - padding: 3px 4px; - cursor: pointer; -} - -.Ldt-createAnnotation-active-button .Ldt-createAnnotation-keyword-button { - background-color: #d93c71; -} - -.Ldt-createAnnotation-submitButton { - float: right; - background-color: #d93c71; - color: #ffffff; - cursor: pointer; - background-image: url('imgs/submit_annotation.png'); - background-repeat: no-repeat; - height: 48px; - width: 48px; - position: relative; - margin-top: 3px; - padding: 28px 0 0; - font-size: 13px; - border: none; - text-align: center; -} - -.Ldt-createAnnotation-endScreen { - background-color: #ffffff; - margin-left: 5px; - margin-right: 5px; - border: 1px solid #d6d6d6; - padding: 10px; - font-size: 13px; - font-weight: bold; - color : #f7268e; - text-align: center; -} - -.Ldt-createAnnotation-errorMessage { - color: #D93C71; -} - -.Ldt-createAnnotation-Minimize { - position: relative; - float: right; - height: 17px; - width: 17px; - right: 0px; - background:url('imgs/minimize.png'); -} - -/* polemic tweet annotation buttons */ - -.Ldt-createAnnotation-polemic-button { - margin: 0; - border: 0; - padding: 0; - margin-right: 2px; - width: 38px; - height: 26px; - text-indent: -999px; - background: url(imgs/polemic_buttons_sprite.png); - cursor: pointer; -} - -.Ldt-createAnnotation-polemic-positive:hover { - background-position: 0 -26px; -} -.Ldt-createAnnotation-active-button .Ldt-createAnnotation-polemic-positive { - background-position: 0 -52px; -} - -.Ldt-createAnnotation-polemic-negative { - background-position: -38px 0; -} -.Ldt-createAnnotation-polemic-negative:hover { - background-position: -38px -26px; -} -.Ldt-createAnnotation-active-button .Ldt-createAnnotation-polemic-negative { - background-position: -38px -52px; -} - -.Ldt-createAnnotation-polemic-reference { - background-position: -76px 0; -} -.Ldt-createAnnotation-polemic-reference:hover { - background-position: -76px -26px; -} -.Ldt-createAnnotation-active-button .Ldt-createAnnotation-polemic-reference { - background-position: -76px -52px; -} - -.Ldt-createAnnotation-polemic-question { - background-position: -114px 0; -} -.Ldt-createAnnotation-polemic-question:hover { - background-position: -114px -26px; -} -.Ldt-createAnnotation-active-button .Ldt-createAnnotation-polemic-question { - background-position: -114px -52px; -} - -.Ldt-createAnnotation-spinner { - display: inline; - width: 16px; - height: 16px; - background-image('imgs/spinner.gif'); -} - -.Ldt-createAnnotation-endScreen-linkList { - margin: 12px auto; -} - -.Ldt-createAnnotation-endScreen-link { - display: inline-block; - height: 20px; -} - -.Ldt-createAnnotation-endScreen-TweetLink { - width: 54px; - background: url('imgs/tweet_button.png'); -} - -.Ldt-createAnnotation-endScreen-FbLink { - width: 55px; - background: url('imgs/facebook_button.png'); -} - -.Ldt-createAnnotation-endScreen-GplusLink { - width: 50px; - background: url('imgs/gplus_button.png'); -} -/* AnnotationsListWidget */ - -.Ldt-AnnotationsListWidget { - font-size: 12px; - font-family: "Arial", "Verdana", "sans-serif"; - border: 1px solid #b6b8b8; - overflow: auto; - max-height: 480px; -} - -ul.Ldt-AnnotationsList-ul { - list-style: none; - padding: 0 3px; -} - -li.Ldt-AnnotationsList-li { - cursor: pointer; - float: left; width: 100%; clear: both; - margin: 2px 0; padding: 2px 0; -} - -.Ldt-AnnotationsList-li:hover { - background-color: #e9e9e9; -} - -.Ldt-AnnotationsList-highlight { - background: #F7268E; color: #ffffff; -} - -.Ldt-AnnotationsListWidget a { - text-decoration: none; -} - -.Ldt-AnnotationsList-Thumb-Placeholder { - float: left; - height: 64px; - width: 64px; - background-image: url('imgs/video_sequence.png'); -} - -.Ldt-AnnotationsList-Thumbnail { - border: none; - float: left; - max-width: 64px; - max-height: 64px; -} - -.Ldt-AnnotationsList-Duration { - color : #f7268e; - float: right; text-align: right; -} - -.Ldt-AnnotationsList-Title { - color: #0068c4; - font-size: 13px; - margin: 0 0 2px 64px; -} - -.Ldt-AnnotationsList-Description { - clear: both; - margin: 2px 0; -} - -ul.Ldt-AnnotationsList-Tags { - width: 100%; list-style: none; clear: both; padding: 0; margin: 2px 0; -} - -li.Ldt-AnnotationsList-Tag-Li { - float: left; margin: 2px; background: #0068c4; color: #fff; padding: 4px; -} - -li.Ldt-AnnotationsList-Tag-Li:hover { - background: #F7268E; -} - -/* Tagcloud */ - -.Ldt-TagCloud { - font-family: "PT Sans", Arial, Helvetica, sans-serif; -} - -.Ldt-TagCloud ul { - list-style: none; padding: 0; margin: 5px; text-align: center; -} - -.Ldt-TagCloud li { - display: inline-block; margin: 2px; cursor:pointer; cursor:hand; -} - -.Ldt-TagCloud li:hover { - color: #0099ff; -} - -.Ldt-TagCloud-actif { - color: #c000c0; -} - -/* SlideShare Widget css */ -.Ldt-SlideShare { - font-size: 14px; -} -.Ldt-SlideShare .SlideShareButtons{ - background: url("./imgs/slideshare_btn_bg.png") repeat-x scroll 0 0 #F8F6F7; - height: 25px; - margin-top: -4px; - border-bottom: 1px solid #bababa; - border-left: 1px solid #bababa; - border-right: 1px solid #bababa; -} -.Ldt-SlideShare .SlideShareButtons ul{ - margin-top: 2px; - padding-left: 0px; -} -.Ldt-SlideShare .SlideShareButtons ul, .Ldt-SlideShare .SlideShareButtons ul li{ - float: left; - list-style: none; -} -.SlideShareButtons .ss_sync_on, .SlideShareButtons .ss_sync_off, .SlideShareButtons .ss_link, .SlideShareButtons .ss_tooltip{ - width: 30px; - height: 20px; -} -.Ldt-SlideShare .SlideShareButtons .ss_sync_on{ - background: url("./imgs/slideshare_btn_sync_violet.png") center no-repeat; - border-right: 1px solid #BABABA; -} -.Ldt-SlideShare .SlideShareButtons .ss_sync_off{ - background: url("./imgs/slideshare_btn_sync_grey.png") center no-repeat; - border-right: 1px solid #BABABA; -} -.Ldt-SlideShare .SlideShareButtons .ss_link{ - background: url("./imgs/slideshare_btn_link.png") center no-repeat; - border-right: 1px solid #BABABA; -} -.Ldt-SlideShare .SlideShareButtons .ss_tooltip{ - background: url("./imgs/slideshare_btn_info.png") center no-repeat; - border-left: 1px solid #BABABA; -} diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/data.js --- a/src/js/data.js Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* data.js - this file deals with how the players gets and sends data */ - -IriSP.DataLoader = function() { - this._cache = {}; - - /* - A structure to hold callbacks for specific urls. We need it because - ajax calls are asynchronous, so it means that sometimes we ask - multiple times for a ressource because the first call hasn't been - received yet. - */ - this._callbacks = {}; -}; - -IriSP.DataLoader.prototype.get = function(url, callback, force_reload) { - var base_url = url.split("&")[0]; - if (typeof force_reload != "undefined" && force_reload && this._cache.hasOwnProperty(base_url)) { - delete this._cache[base_url] - } - if (this._cache.hasOwnProperty(base_url)) { - callback(this._cache[base_url]); - } else { - if (!this._callbacks.hasOwnProperty(base_url)) { - this._callbacks[base_url] = [callback]; - /* we need a closure because this gets lost when it's called back */ - - // uncomment you don't want to use caching. - // IriSP.jQuery.get(url, callback); - - var func = function(data) { - this._cache[base_url] = data; - var i = 0; - - for (i = 0; i < this._callbacks[base_url].length; i++) { - this._callbacks[base_url][i](this._cache[base_url]); - } - delete this._callbacks[base_url]; - }; - - /* automagically choose between json and jsonp */ - if (url.indexOf(document.location.hostname) === -1 && - url.indexOf("http://") !== -1 /* not a relative url */ ) { - // we contacting a foreign domain, use JSONP - - IriSP.jQuery.get(url, {}, IriSP.wrap(this, func), "jsonp"); - } else { - - // otherwise, hey, whatever rows your boat - IriSP.jQuery.get(url, IriSP.wrap(this, func)); - } - - } else { - /* simply push the callback - it'll get called when the ressource - has been received */ - - this._callbacks[base_url].push(callback); - - } - } -} - -/* the base abstract "class" */ -IriSP.Serializer = function(DataLoader, url) { - this._DataLoader = DataLoader; - this._url = url; - this._data = []; -}; - -IriSP.Serializer.prototype.serialize = function(data) { }; -IriSP.Serializer.prototype.deserialize = function(data) {}; - -IriSP.Serializer.prototype.currentMedia = function() { -}; - -IriSP.Serializer.prototype.getDuration = function() { -}; - -IriSP.Serializer.prototype.sync = function(callback) { - callback.call(this, this._data); -}; - -IriSP.SerializerFactory = function(DataLoader) { - this._dataloader = DataLoader; -}; - -IriSP.SerializerFactory.prototype.getSerializer = function(metadataOptions) { - /* This function returns serializer set-up with the correct - configuration - takes a metadata struct describing the metadata source - */ - if (metadataOptions === undefined) - /* return an empty serializer */ - return IriSP.Serializer("", ""); - - switch(metadataOptions.type) { - case "json": - return new IriSP.JSONSerializer(this._dataloader, metadataOptions.src); - break; - - case "dummy": /* only used for unit testing - not defined in production */ - return new IriSP.MockSerializer(this._dataloader, metadataOptions.src); - break; - - case "empty": - return new IriSP.Serializer("", "empty"); - break; - - default: - return undefined; - } -}; diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/init.js --- a/src/js/init.js Thu Aug 30 13:16:33 2012 +0200 +++ b/src/js/init.js Thu Aug 30 14:42:52 2012 +0200 @@ -2,7 +2,7 @@ */ if (typeof window.IriSP === "undefined") { - IriSP = {}; + window.IriSP = {}; } /* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */ diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/main.js --- a/src/js/main.js Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* main file */ -// Why is it called main ? It only loads the libs ! - -if ( window.IriSP === undefined && window.__IriSP === undefined ) { - /** - @class - the object under which everything goes. - */ - IriSP = {}; - - /** Alias to IriSP for backward compatibility */ - __IriSP = IriSP; -} - -/* underscore comes bundled with the player and we need - it ASAP, so load it that way -*/ - -IriSP._ = window._.noConflict(); -IriSP.underscore = IriSP._; - -IriSP.getLib = function(lib) { - return ( - IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string" - ? IriSP.libFiles.cdn[lib] - : ( - typeof IriSP.libFiles.locations[lib] == "string" - ? IriSP.libFiles.locations[lib] - : ( - typeof IriSP.libFiles.inDefaultDir[lib] == "string" - ? IriSP.libFiles.defaultDir + IriSP.libFiles.inDefaultDir[lib] - : null - ) - ) - ) -} - -IriSP._cssCache = []; - -IriSP.loadCss = function(_cssFile) { - if (typeof _cssFile === "string" && _cssFile && IriSP._(IriSP._cssCache).indexOf(_cssFile) === -1) { - IriSP.jQuery("", { - rel : "stylesheet", - type : "text/css", - href : _cssFile - }).appendTo('head'); - IriSP._cssCache.push(_cssFile); - } -} - -IriSP.loadLibs = function( config, metadata_url, callback ) { - var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait() - .script(IriSP.getLib("jQueryUI")); - - if (config.player.type === "jwplayer" || config.player.type === "allocine") { - // load our popcorn.js lookalike - $L.script(IriSP.getLib("jwplayer")); - } else { - // load the real popcorn - $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code")); - if (config.player.type === "youtube") { - $L.script(IriSP.getLib("popcorn.youtube")); - } - if (config.player.type === "vimeo") - $L.script(IriSP.getLib("popcorn.vimeo")); - - /* do nothing for html5 */ - } - - /* widget specific requirements */ - for (var idx in config.gui.widgets) { - if (config.gui.widgets[idx].type === "PolemicWidget" || - config.gui.widgets[idx].type === "StackGraphWidget" || - config.gui.widgets[idx].type === "SparklineWidget") { - $L.script(IriSP.getLib("raphael")); - } - } - - // same for modules - /* - for (var idx in config.modules) { - if (config.modules[idx].type === "PolemicWidget") - $L.script(IriSP.getLib("raphaelJs")); - } - */ - $L.wait(function() { - if (typeof IriSP.jQuery === "undefined" && typeof window.jQuery !== "undefined") { - IriSP.jQuery = window.jQuery.noConflict(); - } - IriSP.loadCss(IriSP.getLib("cssjQueryUI")); - IriSP.loadCss(config.gui.css); - - IriSP.setupDataLoader(); - IriSP.__dataloader.get(metadata_url, - function(data) { - /* save the data so that we could re-use it to - configure the video - */ - IriSP.__jsonMetadata = data; - callback.call(window) }); - }); -}; \ No newline at end of file diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/serializers/JSONSerializer.js --- a/src/js/serializers/JSONSerializer.js Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,458 +0,0 @@ -/** @class This class implement a serializer for the JSON-Cinelab format - @params DataLoader a dataloader reference - @url the url from which to get our cinelab - */ -IriSP.JSONSerializer = function(DataLoader, url) { - IriSP.Serializer.call(this, DataLoader, url); -}; - -IriSP.JSONSerializer.prototype = new IriSP.Serializer(); - -/** serialize data */ -IriSP.JSONSerializer.prototype.serialize = function(data) { - return JSON.stringify(data); -}; - -/** deserialize data */ -IriSP.JSONSerializer.prototype.deserialize = function(data) { - return JSON.parse(data); -}; - -/** load JSON-cinelab data and also sort the annotations by start time - @param callback function to call when the data is ready. - */ -IriSP.JSONSerializer.prototype.sync = function(callback, force_refresh) { - /* we don't have to do much because jQuery handles json for us */ - - var self = this; - - var fn = function(data) { - //TODO: seems taht data can be null here - if (data !== null) { - self._data = data; - if (typeof(self._data["annotations"]) === "undefined" || - self._data["annotations"] === null) - self._data["annotations"] = []; - - // sort the data too - self._data["annotations"].sort(function(a, b) - { var a_begin = +a.begin; - var b_begin = +b.begin; - return a_begin - b_begin; - }); - } - callback(data); - }; - this._DataLoader.get(this._url, fn, force_refresh); -}; - -/** @return the metadata about the media being read FIXME: always return the first media. */ -IriSP.JSONSerializer.prototype.currentMedia = function() { - return (typeof this._data.medias == "object" && this._data.medias.length) ? this._data.medias[0] : IriSP.__jsonMetadata.medias[0]; -}; - -IriSP.JSONSerializer.prototype.getDuration = function() { - var _m = this.currentMedia(); - if (_m === null || typeof _m.meta == "undefined") { - return 0; - } - return +(IriSP.get_aliased(_m.meta, ["dc:duration", "duration"]) || 0); -} - - -/** searches for an annotation which matches title, description and keyword - "" matches any field. - Note: it ignores tweets. - @return a list of matching ids. -*/ -IriSP.JSONSerializer.prototype.searchAnnotations = function(title, description, keyword) { - /* we can have many types of annotations. We want search to only look for regular segments */ - /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either - null or undefined. - */ - var view; - - if (typeof(this._data.views) !== "undefined" && this._data.views !== null) - view = this._data.views[0]; - - var searchViewType = ""; - - if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { - searchViewType = view.annotation_types[0]; - } - - var filterfn = function(annotation) { - if( searchViewType != "" && - typeof(annotation.meta) !== "undefined" && - typeof(annotation.meta["id-ref"]) !== "undefined" && - annotation.meta["id-ref"] !== searchViewType) { - return true; // don't pass - } else { - return false; - } - }; - - return this.searchAnnotationsFilter(title, description, keyword, filterfn); - -}; - -/* only look for tweets */ -IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { - /* we can have many types of annotations. We want search to only look for regular segments */ - /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either - null or undefined. - */ - - var searchViewType = this.getTweets(); - if (typeof(searchViewType) === "undefined") { - var view; - - if (typeof(this._data.views) !== "undefined" && this._data.views !== null) - view = this._data.views[0]; - - if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { - searchViewType = view.annotation_types[0]; - } - } - var filterfn = function(annotation) { - if( searchViewType != "" && - typeof(annotation.meta) !== "undefined" && - typeof(annotation.meta["id-ref"]) !== "undefined" && - annotation.meta["id-ref"] === searchViewType) { - return false; // pass - } else { - return true; - } - }; - - return this.searchAnnotationsFilter(title, description, keyword, filterfn); - -}; - -/** - search an annotation according to its title, description and keyword - @param filter a function to filter the results with. Used to select between annotation types. - */ -IriSP.JSONSerializer.prototype.searchAnnotationsFilter = function(title, description, keyword, filter) { - - var rTitle; - var rDescription; - var rKeyword; - /* match anything if given the empty string */ - if (title == "") - title = ".*"; - if (description == "") - description = ".*"; - if (keyword == "") - keyword = ".*"; - - rTitle = new RegExp(title, "i"); - rDescription = new RegExp(description, "i"); - rKeyword = new RegExp(keyword, "i"); - - var ret_array = []; - - var i; - for (i in this._data.annotations) { - var annotation = this._data.annotations[i]; - - /* filter the annotations whose type is not the one we want */ - if (filter(annotation)) { - continue; - } - - if (rTitle.test(annotation.content.title) && - rDescription.test(annotation.content.description)) { - /* FIXME : implement keyword support */ - ret_array.push(annotation); - } - } - - return ret_array; -}; - -/** breaks a string in words and searches each of these words. Returns an array - of objects with the id of the annotation and its number of occurences. - - @param searchString a string of words. - FIXME: optimize ? seems to be n^2 in the worst case. -*/ -IriSP.JSONSerializer.prototype.searchOccurences = function(searchString) { - var ret = { }; - var keywords = searchString.split(/\s+/); - - for (var i in keywords) { - var keyword = keywords[i]; - - // search this keyword in descriptions and title - var found_annotations = [] - found_annotations = found_annotations.concat(this.searchAnnotations(keyword, "", "")); - found_annotations = found_annotations.concat(this.searchAnnotations("", keyword, "")); - - for (var j in found_annotations) { - var current_annotation = found_annotations[j]; - - if (!ret.hasOwnProperty(current_annotation.id)) { - ret[current_annotation.id] = 1; - } else { - ret[current_annotation.id] += 1; - } - - } - - }; - - return ret; -}; - -/** breaks a string in words and searches each of these words. Returns an array - of objects with the id of the annotation and its number of occurences. - - FIXME: optimize ? seems to be n^2 in the worst case. -*/ -IriSP.JSONSerializer.prototype.searchTweetsOccurences = function(searchString) { - var ret = { }; - var keywords = searchString.split(/\s+/); - - for (var i in keywords) { - var keyword = keywords[i]; - - // search this keyword in descriptions and title - var found_annotations = [] - found_annotations = found_annotations.concat(this.searchTweets(keyword, "", "")); - found_annotations = found_annotations.concat(this.searchTweets("", keyword, "")); - - for (var j in found_annotations) { - var current_annotation = found_annotations[j]; - - if (!ret.hasOwnProperty(current_annotation.id)) { - ret[current_annotation.id] = 1; - } else { - ret[current_annotation.id] += 1; - } - - } - - }; - - return ret; -}; - -/** returns all the annotations that are displayable at the moment - NB: only takes account the first type of annotations - ignores tweets - currentTime is in seconds. - - @param currentTime the time at which we search. - @param (optional) the if of the type of the annotations we want to get. - */ - -IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime, id) { - var view; - var currentTimeMs = 1000 * currentTime; - - if (typeof(id) === "undefined") { - var legal_ids = this.getNonTweetIds(); - } else { - legal_ids = [id]; - } - - var ret_array = []; - - var i; - - for (i in this._data.annotations) { - var annotation = this._data.annotations[i]; - - if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) && - annotation.begin <= currentTimeMs && - annotation.end >= currentTimeMs) - ret_array.push(annotation); - } - - if (ret_array == []) { - console.log("ret_array empty, ", legal_ids); - } - - return ret_array; -}; - -/** return the current chapitre - @param currentTime the current time, in seconds. -*/ -IriSP.JSONSerializer.prototype.currentChapitre = function(currentTime) { - return this.currentAnnotations(currentTime, this.getChapitrage())[0]; -}; - -/** returns a list of ids of tweet lines (aka: groups in cinelab) */ -IriSP.JSONSerializer.prototype.getTweetIds = function() { - if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || - IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) - return []; - - - /* Get the displayable types - We've got to jump through a few hoops because the json sometimes defines - fields with underscores and sometimes with dashes - */ - var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); - if (annotation_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - if (available_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var potential_types = []; - - // Get the list of types which contain "Tw" in their content - for (var i = 0; i < available_types.length; i++) { - if (/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title']))) { - potential_types.push(available_types[i].id); - } - } - - // Get the intersection of both. - var tweetsId = IriSP.underscore.intersection(annotation_types, potential_types); - - return tweetsId; -}; - -/** this function returns a list of lines which are not tweet lines */ -IriSP.JSONSerializer.prototype.getNonTweetIds = function() { - if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || - IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) - return []; - - /* Get the displayable types - We've got to jump through a few hoops because the json sometimes defines - fields with underscores and sometimes with dashes - */ - var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); - if (annotation_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - if (available_types === null) { - console.log("neither view.annotation_types nor view.annotation-types are defined"); - return; - } - - var potential_types = []; - - // Get the list of types which do not contain "Tw" in their content - for (var i = 0; i < available_types.length; i++) { - if (!(/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title'])))) { - potential_types.push(available_types[i].id); - } - } - - // Get the intersection of both. - var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types); - - return nonTweetsId; - -}; - -/** return the id of the ligne de temps which contains name - @param name of the ligne de temps -*/ -IriSP.JSONSerializer.prototype.getId = function(name) { - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - - if (available_types == null) - return; - - name = name.toUpperCase(); - var e; - e = IriSP.underscore.find(available_types, - function(entry) { - if (IriSP.get_aliased(entry, ['dc:title', 'title']) === null) - return false; - return (entry["dc:title"].toUpperCase().indexOf(name) !== -1); - }); - - if (typeof(e) === "undefined") - return; - - var id = e.id; - - return id; -}; - -/** return the list of id's of the ligne de temps which contains name - @param name of the ligne de temps -*/ -IriSP.JSONSerializer.prototype.getIds = function(name) { - var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); - - if (available_types == null) - return; - - name = name.toUpperCase(); - var e = []; - e = IriSP.underscore.filter(available_types, - function(entry) { return (IriSP.get_aliased(entry, ['dc:title', 'title']).toUpperCase().indexOf(name) !== -1) }); - return IriSP.underscore.pluck(e, "id"); -}; - -/** return the id of the ligne de temps named "Chapitrage" */ -IriSP.JSONSerializer.prototype.getChapitrage = function() { - var val = this.getId("Chapitrage"); - if (typeof(val) === "undefined") - val = this.getId("Chapter"); - if (typeof(val) === "undefined") - val = this.getId("Chapit"); - if (typeof(val) === "undefined") - val = this.getId("Chap"); - - return val; -}; - -/** return the id of the ligne de temps named "Tweets" */ -IriSP.JSONSerializer.prototype.getTweets = function() { - var val = this.getId("Tweets"); - if (typeof(val) === "undefined") - val = this.getId("Tweet"); - if (typeof(val) === "undefined") - val = this.getId("Twitter"); - if (typeof(val) === "undefined") - val = this.getId("twit"); - if (typeof(val) === "undefined") - val = this.getId("Polemic"); - - return val; -}; - -/** return the id of the ligne de temps named "Contributions" */ -IriSP.JSONSerializer.prototype.getContributions = function() { - var val = this.getId("Contribution"); - if (typeof(val) === "undefined") - val = this.getId("Particip"); - if (typeof(val) === "undefined") - val = this.getId("Contr"); - if (typeof(val) === "undefined") - val = this.getId("Publ"); - - return val; -}; - -/** return the id of the ligne de temps named "Slideshare" */ -IriSP.JSONSerializer.prototype.getSlideShareType = function() { - var val = this.getId("slideshare"); - if (typeof(val) === "undefined") - val = this.getId("Slides"); - if (typeof(val) === "undefined") - val = this.getId("Slide"); - if (typeof(val) === "undefined") - val = this.getId("slide-Share"); - if (typeof(val) === "undefined") - val = this.getId("slide Share"); - - return val; -}; \ No newline at end of file diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/widgets/sparklineWidget.js --- a/src/js/widgets/sparklineWidget.js Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/** @class The constructor for the sparkline widget */ -IriSP.SparklineWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - - this._oldAnnotation = null; - this._results = []; - - this.slices = this._config.slices || Math.floor(this.width/20); - if (!this.width) { - this.width = this.selector.width(); - } - if (!this.height) { - this.height = 40; - } - this.selector.css("height", this.height + "px"); - if (this._config.background) { - this.selector.css("background", this._config.background); - } -}; - - -IriSP.SparklineWidget.prototype = new IriSP.Widget(); - -IriSP.SparklineWidget.prototype.clear = function() { - -}; - -/** draw the sparkline using jquery sparkline */ -IriSP.SparklineWidget.prototype.draw = function() { - this.duration = this.getDuration(); - this.paper = new Raphael(this.selector[0], this.width, this.height); - var _this = this; - - var views = this._serializer._data.views; - var stat_view; - if (!IriSP.null_or_undefined(views)) { - for (var i = 0; i < views.length; i++) { - var view = views[i]; - if (view.id === "stat") { - stat_view = view; - break; - } - } - } - - var _ = IriSP.underscore; - // If we've found the correct view, feed the directly the data from the view - // to jquery sparkline. Otherwise, compute it ourselves. - if (!IriSP.null_or_undefined(stat_view)) { - //console.log("sparklinewidget : using stats embedded in the json"); - var _results = stat_view.meta.stat.split(","); - } else { - var _annotations = this._serializer._data.annotations; - if (this.cinecast_version) { - _annotations = _(_annotations).filter(function(_a) { - return _a.type !== "cinecast:MovieExtract"; - }); - } - var _sliceDuration = Math.floor( this.duration / this.slices), - _results = _(_.range(this.slices)).map(function(_i) { - return _(_annotations).filter(function(_a){ - return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration) - }).length; - }); - } - var _max = Math.max(1, _(_results).max()), - _h = this.height, - _scale = (_h - this.lineWidth) / _max, - _width = this.width / this.slices, - _y = _(_results).map(function(_v) { - return _h - (_scale * _v); - }), - _d = _(_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}); - // save the results in an array so that we can re-use them when a new annotation - // is added. - this._results = _results; - - this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); -// this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.handleNewAnnotation)); - - this.selector.click(IriSP.wrap(this, this.clickHandler)); -}; - -/** react to a timeupdate event */ -IriSP.SparklineWidget.prototype.timeUpdateHandler = function() { - var _currentTime = this._Popcorn.currentTime(), - _x = (1000 * _currentTime / this.duration) * this.width; - this.rectangleProgress.attr({ - "width" : _x - }); - this.ligneProgress.attr({ - "path" : "M" + _x + " 0L" + _x + " " + this.height - }); - -} - -/** handle clicks on the widget */ -IriSP.SparklineWidget.prototype.clickHandler = function(event) { - var relX = event.pageX - this.selector.offset().left; - var newTime = ((relX / this.width) * this.duration/1000).toFixed(2); - - this._Popcorn.trigger("IriSP.SparklineWidget.clicked", newTime); - this._Popcorn.currentTime(newTime); -}; - -/** react when a new annotation is added */ -IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) { -// var num_columns = this._results.length; -// var duration = this._serializer.getDuration(); -// var time_step = Math.round(duration / num_columns); /* the time interval between two columns */ -// var begin = +annotation.begin; -// var end = +annotation.end; -// -// /* increment all the values between the beginning and the end of the annotation */ -// var index_begin = Math.floor(begin / time_step); -// var index_end = Math.floor(end / time_step); -// -// for (var i = index_begin; i < Math.min(index_end, this._results.length); i++) { -// this._results[i]++; -// } -// -// this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", -// spotColor: "#b70056", -// width: this.width, height: this.height}); -}; \ No newline at end of file diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/js/widgets/traceWidget.js --- a/src/js/widgets/traceWidget.js Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -IriSP.TraceWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this.lastEvent = ""; - var _this = this, - _listeners = { - "IriSP.createAnnotationWidget.addedAnnotation" : 0, - "IriSP.search.open" : 0, - "IriSP.search.closed" : 0, - "IriSP.search" : 0, - "IriSP.search.cleared" : 0, - "IriSP.search.matchFound" : 0, - "IriSP.search.noMatchFound" : 0, - "IriSP.search.triggeredSearch" : 0, - "IriSP.TraceWidget.MouseEvents" : 0, - "play" : 0, - "pause" : 0, - "volumechange" : 0, - "seeked" : 0, - "play" : 0, - "pause" : 0, - "timeupdate" : 2000 - }; - IriSP._(_listeners).each(function(_ms, _listener) { - var _f = function(_arg) { - _this.eventHandler(_listener, _arg); - } - if (_ms) { - _f = IriSP.underscore.throttle(_f, _ms); - } - _this._Popcorn.listen(_listener, _f); - }); - - if (typeof window.tracemanager === "undefined") { - $LAB.script(IriSP.getLib("tracemanager")).wait(function() { - _this.onTmLoaded(); - }); - } else { - this.onTmLoaded(); - } - -} - -IriSP.TraceWidget.prototype = new IriSP.Widget(); - -IriSP.TraceWidget.prototype.onTmLoaded = function() { - this.tracer = window.tracemanager.init_trace("test", this._config); - this.tracer.trace("StartTracing", { "hello": "world" }); -} - -IriSP.TraceWidget.prototype.draw = function() { - this.mouseLocation = ''; - var _this = this; - IriSP.jQuery(".Ldt-Widget").bind("click mouseover mouseout dragstart dragstop", function(_e) { - var _widget = IriSP.jQuery(this).attr("widget-type"), - _class = _e.target.className; - var _data = { - "type": _e.type, - "x": _e.clientX, - "y": _e.clientY, - "widget": _widget - } - if (typeof _class == "string" && _class.indexOf('Ldt-TraceMe') != -1) { - var _name = _e.target.localName, - _id = _e.target.id, - _text = _e.target.textContent.trim(), - _title = _e.target.title, - _value = _e.target.value; - _data.target = _name + (_id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : ''); - if (typeof _title == "string" && _title.length && _title.length < 140) { - _data.title = _title; - } - if (typeof _text == "string" && _text.length && _text.length < 140) { - _data.text = _text; - } - if (typeof _value == "string" && _value.length) { - _data.value = _value; - } - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } else { - //console.log(_e.type+','+_this.mouseLocation+','+_widget); - if (_e.type == "mouseover") { - if (_this.mouseLocation != _widget) { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } else { - if (typeof _this.moTimeout != "undefined") { - clearTimeout(_this.moTimeout); - delete _this.moTimeout; - } - } - } - if (_e.type == "click") { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } - if (_e.type == "mouseout") { - if (typeof _this.moTimeout != "undefined") { - clearTimeout(_this.moTimeout); - } - _this.moTimeout = setTimeout(function() { - if (_data.widget != _this.mouseLocation) { - _this._Popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data); - } - },100); - } - } - _this.mouseLocation = _widget; - }); -} - -IriSP.TraceWidget.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 'IriSP.TraceWidget.MouseEvents': - _traceName += _arg.widget + '_' + _arg.type; - delete _arg.widget; - delete _arg.type; - break; - case 'timeupdate': - case 'play': - case 'pause': - _arg.time = this._Popcorn.currentTime() * 1000; - case 'seeked': - case 'volumechange': - _traceName += 'Popcorn_' + _listener; - break; - default: - _traceName += _listener.replace('IriSP.','').replace('.','_'); - } - this.lastEvent = _traceName; - this.tracer.trace(_traceName, _arg); - if (this._config.js_console) { - console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");"); - } -} diff -r 8a6c9e3d0158 -r 7d9f6fd6f904 src/templates/createAnnotationWidget.html --- a/src/templates/createAnnotationWidget.html Thu Aug 30 13:16:33 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -{{! template for the annotation creation widget }} -
- {{/user_avatar}}
- {{#user_avatar}}