]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#t366] redflash effect plugin
authorScottDowne <sdowne@learn.senecac.on.ca>
Mon, 20 Jun 2011 20:08:50 +0000 (16:08 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Mon, 20 Jun 2011 20:08:50 +0000 (16:08 -0400)
effects/flash/popcorn.flash.html [new file with mode: 0755]
effects/flash/popcorn.flash.js [new file with mode: 0755]
effects/flash/popcorn.flash.unit.html [moved from effects/redflash/popcorn.redflash.unit.html with 100% similarity]
effects/flash/popcorn.flash.unit.js [moved from effects/redflash/popcorn.redflash.unit.js with 100% similarity]
effects/redflash/popcorn.redflash.html [deleted file]
effects/redflash/popcorn.redflash.js [deleted file]

diff --git a/effects/flash/popcorn.flash.html b/effects/flash/popcorn.flash.html
new file mode 100755 (executable)
index 0000000..ca26d8b
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Popcorn flash effect Demo</title>
+  
+  <script src="../../popcorn.js"></script>
+  <script src="../../plugins/footnote/popcorn.footnote.js"></script>
+  <script src="popcorn.flash.js"></script>
+  <script>
+    document.addEventListener('DOMContentLoaded', function () {
+
+      var p = Popcorn('#video')
+      .play() 
+      .footnote({
+        start: 5, // seconds
+        end: 15, // seconds
+        target: "footenotediv",
+        text: 'This video made exclusively for drumbeat.org',
+        effect: "flash"
+      })
+      .footnote({
+        start: 20, // seconds
+        end: 45, // seconds
+        target: "footenotediv",
+        text: 'Visit webmademovies.org for more details',
+        effect: "flash",
+        flashcolor: "green"
+      })
+
+    }, false);
+
+  </script>
+</head>
+<body>
+  <h1 id="qunit-header">Popcorn flash effect Demo</h1>
+  <p> A footnote with a red flash displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.</p>
+  <p> A footnote with a green flash displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.</p>
+  <div>
+    <video id='video' 
+      controls preload='none' 
+      width= '250px'
+      poster="../../test/poster.png"> 
+
+      <source id='mp4'
+        src="../../test/trailer.mp4"
+        type='video/mp4; codecs="avc1, mp4a"'> 
+
+      <source id='ogv'
+        src="../../test/trailer.ogv"
+        type='video/ogg; codecs="theora, vorbis"'> 
+
+      <p>Your user agent does not support the HTML5 Video element.</p> 
+
+    </video> 
+  </div>
+  <div id="footenotediv"></div>
+</body>
+</html>
diff --git a/effects/flash/popcorn.flash.js b/effects/flash/popcorn.flash.js
new file mode 100755 (executable)
index 0000000..6c77e09
--- /dev/null
@@ -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/redflash/popcorn.redflash.html b/effects/redflash/popcorn.redflash.html
deleted file mode 100755 (executable)
index db84806..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title>Popcorn footnote Plug-in Demo</title>
-  
-  <script src="../../popcorn.js"></script>
-  <script src="popcorn.redflash.js"></script>
-  <script>
-    document.addEventListener('DOMContentLoaded', function () {
-
-      Popcorn.plugin( "test" , {
-        
-        manifest: {
-          about:{
-            name: "Popcorn Redflash Effect",
-            version: "0.1",
-            author: "@scottdowne",
-            website: "scottdowne.wordpress.com"
-          },
-          options:{
-            plugin: true
-          }
-        },
-        _setup: function( options ) {
-
-          console.log( "in test setup " );
-        },
-        start: function( event, options ){
-
-          console.log( "in test start" );
-        },
-        end: function( event, options ){
-
-          console.log( "in test end" );
-        },
-        _teardown: function( options ) {
-
-          console.log( "in test teardown" );
-        }
-      });
-
-      var p = Popcorn('#video')
-      .play() 
-      .test({
-        start: 5, // seconds
-        end: 15, // seconds
-        text: 'This video made exclusively for drumbeat.org',
-        compose: "redflash redflash2"
-      })
-      .test({
-        start: 20, // seconds
-        end: 45, // seconds
-        text: 'Visit webmademovies.org for more details'
-      })
-
-    }, false);
-
-  </script>
-</head>
-<body>
-  <h1 id="qunit-header">Popcorn Footnote Plug-in Demo</h1>
-  <p> A footnote displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.</p>
-  <p> A footnote displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.</p>
-  <div>
-    <video id='video' 
-      controls preload='none' 
-      width= '250px'
-      poster="../../test/poster.png"> 
-
-      <source id='mp4'
-        src="../../test/trailer.mp4"
-        type='video/mp4; codecs="avc1, mp4a"'> 
-
-      <source id='ogv'
-        src="../../test/trailer.ogv"
-        type='video/ogg; codecs="theora, vorbis"'> 
-
-      <p>Your user agent does not support the HTML5 Video element.</p> 
-
-    </video> 
-  </div>
-  </div>
-</body>
-</html>
diff --git a/effects/redflash/popcorn.redflash.js b/effects/redflash/popcorn.redflash.js
deleted file mode 100755 (executable)
index 5e242cf..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// EFFECT: Redflash
-
-(function (Popcorn) {
-  
-  /**
-   * Footnote popcorn plug-in 
-   * Adds text to an element on the page.
-   * Options parameter will need a start, end, target and text.
-   * 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 
-   * Text is the text that you want to appear in the target
-   * Target is the id of the document element that the text needs to be 
-   * attached to, this target element must exist on the DOM
-   * 
-   * @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'
-        } )
-   *
-   */
-  Popcorn.compose( "redflash" , {
-    
-    manifest: {
-      about:{
-        name: "Popcorn Redflash Effect",
-        version: "0.1",
-        author: "@scottdowne",
-        website: "scottdowne.wordpress.com"
-      },
-      options:{
-        effect: true
-      }
-    },
-    _setup: function( options ) {
-
-      console.log( "in effect setup" );
-    },
-    start: function( event, options ){
-
-      console.log( "in effect start" );
-    },
-    end: function( event, options ){
-
-      console.log( "in effect end" );
-    },
-    _teardown: function( options ) {
-
-      console.log( "in effect teardown" );
-    }
-  });
-})( Popcorn );