From: unknown Date: Tue, 22 Mar 2011 15:45:28 +0000 (-0400) Subject: Adding timeline stuff X-Git-Tag: v0.6~14^2~3^2~2^2~7 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=0c4f786407c773031474cdc9e26742e509fb67f4;p=popcorn-js.git Adding timeline stuff --- diff --git a/plugins/timeline/asdf.css b/plugins/timeline/asdf.css new file mode 100644 index 0000000..46e5e66 --- /dev/null +++ b/plugins/timeline/asdf.css @@ -0,0 +1,48 @@ +@charset "UTF-8"; +body { + font-family: "Helvetica Neue", Helvetica, Arial; + font-size:12px; + } + +#footer { + width: 100%; + height: 20px; + position: fixed; + text-align:right; + right: 0px; + overflow: hidden; + background-color:#000000; + color: white; + top: 0; + border-bottom: 1px solid #333; + padding: 10px; +} +#playback { + width: 700px; + left: 0px; + top: 0px; + z-index:100; +} + +#details2 { + color: #fff; + padding: 7px; + right: 0px; + top: 0px; + line-height: 180%; +} +#details3 { + padding: 7px; + right: 0px; + top: 0px; + line-height: 180%; + border-top: 1px solid #333; +} +#big { +font-size:24px; +line-height: 130%; +} +#mid { +font-size: 16px; +} + diff --git a/plugins/timeline/popcorn.timeline.html b/plugins/timeline/popcorn.timeline.html new file mode 100644 index 0000000..1aed87d --- /dev/null +++ b/plugins/timeline/popcorn.timeline.html @@ -0,0 +1,89 @@ + + + + Popcorn Google Feed Plug-in Demo + + + + + + +

Popcorn Timeline Plug-in Demo

+

Continuos timeline elements will be added to the div throughout the video

+
+ +
+
+

Vertical Feed:

+
+ + \ No newline at end of file diff --git a/plugins/timeline/popcorn.timeline.js b/plugins/timeline/popcorn.timeline.js new file mode 100644 index 0000000..53ec5fe --- /dev/null +++ b/plugins/timeline/popcorn.timeline.js @@ -0,0 +1,96 @@ +// PLUGIN: Timeline +(function (Popcorn) { + + /** + * googlefeed popcorn plug-in + * Adds a feed from the specified blog url at the target div + * Options parameter will need a start, end, target, url and title + * -Start is the time that you want this plug-in to execute + * -End is the time that you want this plug-in to stop executing + * -Target is the id of the DOM element that you want the map to appear in. This element must be in the DOM + * -Url is the url of the blog's feed you are trying to access + * -Title is the title of the blog you want displayed above the feed + * -Orientation is the orientation of the blog, accepts either Horizontal or Vertical, defaults to Vertical + * @param {Object} options + * + * Example: + var p = Popcorn("#video") + .googlefeed({ + start: 5, // seconds + end: 15, // seconds + target: "map", + url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml", + title: "Planet Feed" + } ) + * + */ + + var i = 0; + + var head = document.getElementsByTagName("head")[0]; + var css = document.createElement('link'); + css.type = "text/css"; + css.rel = "stylesheet"; + css.href = "asdf.css"; + head.insertBefore( css, head.firstChild ); + + + Popcorn.plugin( "timeline" , function( options ) { + // create a new div and append it to the parent div so nothing + // that already exists in the parent div gets overwritten + var newdiv = document.createElement( "div" ); + newdiv.style.display = "none"; + newdiv.id = "asdf"+i; + + if ( document.getElementById( options.target ) ) { + document.getElementById( options.target ).appendChild( newdiv ); + // if this isnt the first div added to the target div + if( i ){ + // insert the current div before the previous div inserted + document.getElementById( options.target ).insertBefore( newdiv, document.getElementById( "asdf" + ( i - 1 ) ) ); + } + } + + i++; + + newdiv.innerHTML = "

" + options.title + "
" + + "" + options.text + "
" + +"
" + options.links + "

"; + + return { + /** + * @member webpage + * The start function will be executed when the currentTime + * of the video reaches the start time provided by the + * options variable + */ + start: function( event, options ){ + newdiv.setAttribute( "style", "display:block" ); + }, + /** + * @member webpage + * The end function will be executed when the currentTime + * of the video reaches the end time provided by the + * options variable + */ + end: function(event, options){ + newdiv.setAttribute( "style", "display:none" ); + } + }; + }, + { + about: { + name: "Popcorn Timeline Plugin", + version: "0.1", + author: "David Seifried", + website: "dseifried.wordpress.com" + }, + options: { + start : { elem:"input", type:"text", label:"In" }, + end : { elem:"input", type:"text", label:"Out" }, + target : "feed-container", + text : { elem:"input", type:"text", label:"text" } + } + }); + +})( Popcorn ); diff --git a/plugins/timeline/popcorn.timeline.unit.html b/plugins/timeline/popcorn.timeline.unit.html new file mode 100644 index 0000000..15ad19a --- /dev/null +++ b/plugins/timeline/popcorn.timeline.unit.html @@ -0,0 +1,44 @@ + + + + Popcorn API + + + + + + + + + + +

Popcorn Google Feed Plugin

+

+
+

+
    +
    + + +
    +
    + + diff --git a/plugins/timeline/popcorn.timeline.unit.js b/plugins/timeline/popcorn.timeline.unit.js new file mode 100644 index 0000000..83369b5 --- /dev/null +++ b/plugins/timeline/popcorn.timeline.unit.js @@ -0,0 +1,66 @@ +test("Popcorn Google Feed Plugin", function () { + + var popped = Popcorn("#video"), + expects = 10, + count = 0; + + expect(expects); + + function plus() { + if ( ++count===expects) { + start(); + } + } + + stop(); + + ok ('googlefeed' in popped, "googlefeed is a method of the popped instance"); + plus(); + ok ( document.getElementById('feed').innerHTML === "", "initially, there is nothing inside the feed" ); + plus(); + ok ( document.getElementById('feed1').innerHTML === "", "initially, there is nothing inside the feed1" ); + plus(); + + popped.googlefeed({ + start: 0, // seconds + end: 5, // seconds + target: "feed", + url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml", + title: "Planet Feed", + orientation: "Vertical" + } ) + .googlefeed({ + start: 0, // seconds + end: 5, // seconds + target: "feed1", + url: "http://blog.pikimal.com/geek/feed/", + title: "pikiGeek", + orientation: "Horizontal" + } ) + .volume(0); + + popped.exec( 1, function() { + ok(google.load, "Google Feed is available"); + plus(); + ok(GFdynamicFeedControl, "Dynamic Feed Control Available"); + plus(); + ok (document.getElementById('_feed1'), "First feed is on the page" ); + plus(); + equals (document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" ); + plus(); + }); + popped.exec( 2, function() { + ok (document.getElementById('_feed2'), "Second feed is on the page" ); + plus(); + equals (document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" ); + plus(); + }); + popped.exec( 6, function() { + ok (document.getElementById('_feed2').style.display === "none" && + document.getElementById('_feed1').style.display === "none", "Both feeds are no lnger visible" ); + plus(); + }); + + popped.play(); + +});