From ec6d6d861f80e4612770d15d50e7413d14b39266 Mon Sep 17 00:00:00 2001 From: Anna Sobiepanek Date: Tue, 8 Feb 2011 16:04:07 -0500 Subject: [PATCH] added example.html and removed test/demo.js and demo.html [#313 state:peer-review-requested] --- example.html | 65 +++++++++++++++++++ test/demo.html | 42 ------------- test/demo.js | 165 ------------------------------------------------- 3 files changed, 65 insertions(+), 207 deletions(-) create mode 100644 example.html delete mode 100644 test/demo.html delete mode 100644 test/demo.js diff --git a/example.html b/example.html new file mode 100644 index 0000000..ece9839 --- /dev/null +++ b/example.html @@ -0,0 +1,65 @@ + + + + Popcorn Simple Demo + + + + + + + + + + + + + + +

Popcorn Simple Demo

+

You should see a footnote "This video made exclusively for drumbeat.org" appear right away

+

You should see a subtitle "this is the first subtitle of 2011" appear at 1 sec away

+
+ + +
+ +
+ + diff --git a/test/demo.html b/test/demo.html deleted file mode 100644 index ce2b7dd..0000000 --- a/test/demo.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - Popcorn API Draft DEMO - - - - - - -

Popcorn API Draft

- - - -
- -
- - diff --git a/test/demo.js b/test/demo.js deleted file mode 100644 index c4a5a9b..0000000 --- a/test/demo.js +++ /dev/null @@ -1,165 +0,0 @@ -// EXAMPLE PLUGIN: SUBTITLER - -(function (Popcorn) { - - - - - - - Popcorn.plugin( "complicator", (function () { - - //create your fucking dom elements here. - - - return { - - start: function () { - - }, - - end: function () { - - }, - - timeupdate: function () { - - } - }; - - - })() - ); - - - - - - - Popcorn.plugin( "subtitler" , function ( options ) { - - var subtitles = [], - context = this.video, - div = document.getElementById("subtitle-container"); - - // Check for existing frame - if ( !div ) { - // if no existing frame, create it. - div = document.createElement("div"); - div.id = "subtitle-container"; - - context.parentNode.appendChild(div); - - Popcorn.extend(div.style, { - //border: "1px solid red", - width: context.clientWidth + "px", //offsetWidth - height: context.clientHeight + "px", //offsetHeight - top: context.offsetTop + "px", - left: context.offsetLeft + "px", - position: "absolute", - color: "white", - textShadow: "black 2px 2px 6px", - fontSize: "18px", - fontWeight: "bold", - textAlign: "center" - }); - - - } - - if ( typeof options === "object" && "join" in options ) { - subtitles = options; - } else { - subtitles.push(options); - } - - this.listen("timeupdate", function (event) { - - Popcorn.forEach(subtitles, function ( subtitle ) { - - var temp = div.querySelectorAll( subtitle.id ); - - if ( this.currentTime() >= subtitle.start && !temp.length ) { - div.innerHTML = div.innerHTML + subtitle.html; - } - - if ( temp.length && this.currentTime() >= subtitle.end ) { - - Popcorn.forEach(temp, function ( title ) { - if ( title && title.style ) { - title.style.display = "none"; - } - - }); - - } - }, this); - - }); - }); - -})(Popcorn); - - -// END EXAMPLE - - -$(function () { - - var p = Popcorn('#video'); - - - - - p.play(); - - - p.subtitler({ - id: "#subtitle-a", - start: 2, // seconds - end: 5, // seconds - html: '

Appear at 2 second mark, dissappear at 5 second mark

' - }); - - // Butter would generate the data to populate this api function call's argument - - p.subtitler([ - { - id: "#stays-forever", - start: 5, - html: '

Stays forever!

' - }, - { - id: "#comes-and-goes-1", - start: 10, - end: 12, - html: '

Comes and goes

' - }, - { - id: "#comes-and-goes-2", - start: 12, - end: 14, - html: '

BACK! For the second time...

' - }, - { - id: "#comes-and-goes-3", - start: 14, - end: 16, - html: '

This is the last time. I promise.

' - } - - ]); - - - - - p.complicator({ - start: 1, - end: 10, - wtf: "throws exception?" - }); - - - - -}); -- 2.43.0