From 0856684b024fc2e5a3a6a5b0d1b8baa5d90ffab1 Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Tue, 21 Jun 2011 10:22:59 -0400 Subject: [PATCH] [#t366] added new files for expand effect --- effects/expand/popcorn.expand.html | 58 ++++++++++++++++++++++ effects/expand/popcorn.expand.js | 71 +++++++++++++++++++++++++++ effects/flash/popcorn.flash.html | 0 effects/flash/popcorn.flash.js | 0 effects/flash/popcorn.flash.unit.html | 43 ---------------- effects/flash/popcorn.flash.unit.js | 64 ------------------------ 6 files changed, 129 insertions(+), 107 deletions(-) create mode 100755 effects/expand/popcorn.expand.html create mode 100755 effects/expand/popcorn.expand.js mode change 100755 => 100644 effects/flash/popcorn.flash.html mode change 100755 => 100644 effects/flash/popcorn.flash.js delete mode 100755 effects/flash/popcorn.flash.unit.html delete mode 100755 effects/flash/popcorn.flash.unit.js diff --git a/effects/expand/popcorn.expand.html b/effects/expand/popcorn.expand.html new file mode 100755 index 0000000..ca26d8b --- /dev/null +++ b/effects/expand/popcorn.expand.html @@ -0,0 +1,58 @@ + + + + Popcorn flash effect Demo + + + + + + + +

Popcorn flash effect Demo

+

A footnote with a red flash displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.

+

A footnote with a green flash displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.

+
+ +
+
+ + diff --git a/effects/expand/popcorn.expand.js b/effects/expand/popcorn.expand.js new file mode 100755 index 0000000..6c77e09 --- /dev/null +++ b/effects/expand/popcorn.expand.js @@ -0,0 +1,71 @@ +// EFFECT: flash + +(function (Popcorn) { + + /** + * Flash effect + * Adds a coloured flash to the background of plugins. + * Optional parameters are flashcolor, which accepts a css colour. Defaults to red. + * + * @param {Object} options + * + * Example: + var p = Popcorn('#video') + .footnote({ + start: 5, // seconds + end: 15, // seconds + text: 'This video made exclusively for drumbeat.org', + target: 'footnotediv', + effect: 'flash', + flashcolor: "green" + } ) + * + */ + + var startFunction = Popcorn.nop, + endFunction = Popcorn.nop; + + Popcorn.getScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() { + startFunction = function( event, options ) { + + $( options.redDiv ).css( "display", "inline" ).css( "left", 0 ).fadeOut( 250 ); + }; + }); + + Popcorn.compose( "flash" , { + + manifest: { + about:{ + name: "Popcorn flash Effect", + version: "0.1", + author: "@scottdowne", + website: "scottdowne.wordpress.com" + }, + options:{ + effect: true + } + }, + _setup: function( options ) { + + options.redDiv = document.createElement( "span" ); + options.redDiv.style.position = "absolute"; + options.redDiv.style.opacity = 0.8; + options.redDiv.style.backgroundColor = options.flashcolor || "red"; + options.redDiv.style.height = "100%"; + options.redDiv.style.width = "100%"; + options.redDiv.style.zindex = options._container.style.zIndex + 1; + options.redDiv.style.display = "none"; + + options._container.style.position = "relative"; + options._container.appendChild( options.redDiv ); + }, + start: function( event, options ) { + + startFunction.call( this, event, options ); + }, + _teardown: function( options ) { + + options.redDiv.parentNode && options._container.removeChild( options.redDiv ); + } + }); +})( Popcorn ); diff --git a/effects/flash/popcorn.flash.html b/effects/flash/popcorn.flash.html old mode 100755 new mode 100644 diff --git a/effects/flash/popcorn.flash.js b/effects/flash/popcorn.flash.js old mode 100755 new mode 100644 diff --git a/effects/flash/popcorn.flash.unit.html b/effects/flash/popcorn.flash.unit.html deleted file mode 100755 index 6777a99..0000000 --- a/effects/flash/popcorn.flash.unit.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - Popcorn API - - - - - - - - - - -

Popcorn Footnote Plugin

-

-
-

-
    -
    - - -
    - - diff --git a/effects/flash/popcorn.flash.unit.js b/effects/flash/popcorn.flash.unit.js deleted file mode 100755 index 2539c6d..0000000 --- a/effects/flash/popcorn.flash.unit.js +++ /dev/null @@ -1,64 +0,0 @@ -test("Popcorn Footnote Plugin", function () { - - var popped = Popcorn("#video"), - expects = 8, - count = 0, - setupId, - footnotediv = document.getElementById('footnotediv'); - - expect(expects); - - function plus() { - if ( ++count===expects) { - start(); - } - } - - stop(); - - ok ('footnote' in popped, "footnote is a mehtod of the popped instance"); - plus(); - - equals ( footnotediv.childElementCount, 0, "initially, there is nothing inside the footnotediv" ); - plus(); - - popped.footnote({ - start: 0, // seconds - end: 2, // seconds - text: 'This video made exclusively for drumbeat.org', - target: 'footnotediv' - }) - .footnote({ - start: 2, // seconds - end: 4, // seconds - text: 'Visit webmademovies.org for more details', - target: 'footnotediv' - }); - - setupId = popped.getLastTrackEventId(); - - popped.exec( 0, function() { - equals ( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" ); - plus(); - equals (footnotediv.children[0].innerHTML , "This video made exclusively for drumbeat.org", "footnote displaing correct information" ); - plus(); - equals (footnotediv.children[0].style.display , "inline", "footnote is visible on the page" ); - plus(); - }); - - popped.exec( 3, function() { - equals (footnotediv.children[1].style.display , "inline", "second footnote is visible on the page" ); - plus(); - }); - - popped.exec( 4, function() { - ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" ); - plus(); - - popped.pause().removeTrackEvent( setupId ); - ok( !footnotediv.children[1], "removed footnote was properly destroyed" ); - plus(); - }); - popped.play().volume(0); - -}); -- 2.43.0