]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
#485 Fixed code style
authorMohammed Buttu <mohammedbuttu@gmail.com>
Tue, 17 May 2011 17:23:17 +0000 (13:23 -0400)
committerMohammed Buttu <mohammedbuttu@gmail.com>
Tue, 17 May 2011 17:23:17 +0000 (13:23 -0400)
plugins/image/popcorn.image.html
plugins/image/popcorn.image.js
plugins/image/popcorn.image.unit.html
plugins/image/popcorn.image.unit.js

index e045124ebe74f3546108dbe85ffd67c05d666c41..a83045bcb8a718643d7324275057207dd8b6b403 100644 (file)
@@ -6,26 +6,30 @@
   <script src="../../popcorn.js"></script>
   <script src="popcorn.image.js"></script>
   <script>
-    document.addEventListener('DOMContentLoaded', function () {
-      var p = Popcorn('#video')
-      .volume(0)
+    document.addEventListener( "DOMContentLoaded", function() {
+
+      var p = Popcorn( "#video" )
+      .volume( 0 )
       .play() 
       .image({
-        start: 5, // seconds
-        end: 15, // seconds
-        href: 'http://www.drumbeat.org/',
-        src: 'https://www.drumbeat.org/media//images/drumbeat-logo-splash.png',
-        text: 'DRUMBEAT',
-        target: 'imagediv'
-      } )
+       // seconds
+        start: 5,
+        // seconds
+        end: 15,
+        href: "http://www.drumbeat.org/",
+        src: "https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
+        text: "DRUMBEAT",
+        target: "imagediv"
+      })
       .image({
-        start: 5, // seconds
-        end: 45, // seconds
+       // seconds
+        start: 5,
+        // seconds
+        end: 45,
         // no href
-        src: 'http://patriciabergeron.net/wp-content/uploads/web.made_.movie_marquee.gif',
-        target: 'imagediv'
-      } );
-
+        src: "http://patriciabergeron.net/wp-content/uploads/web.made_.movie_marquee.gif",
+        target: "imagediv"
+      });
     }, false);
 
   </script>
   <p> First one (with an overlayed text) will disappear at 15 seconds.</p>
   <p> Second one (without an overlayed text) will disappear at 45 seconds.</p>
   <div>
-    <video id='video' 
+    <video id="video" 
       controls
-      width= '250px'
+      width="250px"
       poster="../../test/poster.png"> 
 
-      <source id='mp4'
+      <source id="mp4"
         src="../../test/trailer.mp4"
         type='video/mp4; codecs="avc1, mp4a"'> 
 
-      <source id='ogv'
+      <source id="ogv"
         src="../../test/trailer.ogv"
         type='video/ogg; codecs="theora, vorbis"'> 
 
index 3d99a3d7713b78ce4d701c0b6c9c56177bca8844..0a25623aa07ff0e2da56f1777975661505010917 100644 (file)
@@ -1,5 +1,7 @@
 // PLUGIN: IMAGE
+
 (function (Popcorn) {
+
 /**
  * Images popcorn plug-in 
  * Shows an image element
       } )
  *
  */
-  
   Popcorn.plugin( "image", {
-
       manifest: {
-
         about:{
-
-          name    : "Popcorn image Plugin",
-          version : "0.1",
-          author  : "Scott Downe",
-          website : "http://scottdowne.wordpress.com/"
+          name: "Popcorn image Plugin",
+          version: "0.1",
+          author: "Scott Downe",
+          website: "http://scottdowne.wordpress.com/"
         },
-
-        options:{
-          start  :  {elem:'input', type:'number', label:'In'},
-          end    :    {elem:'input', type:'number', label:'Out'},
-          href   :   {elem:'input', type:'text',   label:'Link URL'},
-          target : 'Image-container',
-          src    :    {elem:'input', type:'text',   label:'Source URL'},
-          text   :    {elem:'input', type:'text',   label:'TEXT'}
+        options: {
+          start: {
+            elem: "input",
+            type: "number",
+            label: "In"
+          },
+          end: {
+            elem: "input",
+            type: "number",
+            label: "Out"
+          },
+          href: {
+            elem: "input",
+            type: "text",
+            label: "Link URL"
+          },
+          target: "Image-container",
+          src: {
+            elem: "input", 
+            type: "text",   
+            label: "Source URL"
+          },
+          text: {
+            elem: "input",
+            type: "text",
+            label: "TEXT"
+          }
         }
       },
-
       _setup: function( options ) {
-        var img = document.createElement( 'img' );
+        var img = document.createElement( "img" );
 
-        options.link = document.createElement( 'a' );
+        options.link = document.createElement( "a" );
         options.link.style.position = "relative";
         options.link.style.textDecoration = "none";
 
         if ( document.getElementById( options.target ) ) {
-          document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
+          // add the widget's div to the target div
+          document.getElementById( options.target ).appendChild( options.link );
         }
 
         img.addEventListener( "load", function() {
 
-          img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
+          // borders look really bad, if someone wants it they can put it on their div target 
+          img.style.borderStyle = "none"; 
           
           if ( options.href ) {
             options.link.href = options.href;
           }
+
           options.link.target = "_blank";
 
           var fontHeight = ( img.height / 12 ) + "px", 
           
           Popcorn.extend( divText.style, {
 
-            color      : "black",
-            fontSize   : fontHeight,
-            fontWeight : "bold",
-            position   : "relative",
-            textAlign  : "center",
-            width      : img.width + "px",
-            zIndex     : "10"
+            color: "black",
+            fontSize: fontHeight,
+            fontWeight: "bold",
+            position: "relative",
+            textAlign: "center",
+            width: img.width + "px",
+            zIndex: "10"
           });
 
           divText.innerHTML = options.text || "";
           divText.style.top = ( img.height / 2 ) - ( divText.offsetHeight / 2 ) + "px"; 
           options.link.style.display = "none";
         }, false );
+
         img.src = options.src;
       },
 
         options.link.style.display = "none";
       }
   });
-
 })( Popcorn );
index 0e7176375d0350206af6a6ad4035597b102b8610..342f2a5059e6dee15e22735fc25f003b8ab5ddbc 100644 (file)
   <ol id="qunit-tests"></ol>
   <div id="qunit-fixture">  </div>
   
-  <video id='video' 
+  <video id="video" 
     controls
-    width= '250px'
+    width="250px"
     poster="../../test/poster.png"> 
 
-    <source id='mp4'
+    <source id="mp4"
       src="../../test/trailer.mp4"
       type='video/mp4; codecs="avc1, mp4a"'> 
 
-    <source id='ogv'
+    <source id="ogv"
       src="../../test/trailer.ogv"
       type='video/ogg; codecs="theora, vorbis"'> 
 
index f9102a48147fd76cdcfa53a0cfa9f38690b056a7..3d31a10d78f347ecc2ed3ddbcb35390aaae13bde 100644 (file)
@@ -1,9 +1,9 @@
 test("Popcorn Image Plugin", function () {
   
-  var popped = Popcorn("#video"),
+  var popped = Popcorn( "#video" ),
       expects = 5,
       count = 0,
-      imagediv = document.getElementById('imagediv');
+      imagediv = document.getElementById( "imagediv" );
   
   expect( expects );
   
@@ -15,19 +15,21 @@ test("Popcorn Image Plugin", function () {
 
   stop();
  
-  ok('image' in popped, "image is a method of the popped instance");
+  ok( "image" in popped, "image is a method of the popped instance" );
   plus();
 
-  equals ( imagediv.innerHTML, "", "initially, there is nothing inside the imagediv" );
+  equals( imagediv.innerHTML, "", "initially, there is nothing inside the imagediv" );
   plus();
   
   popped.image({
-    start: 1, // seconds
-    end: 3, // seconds
-    href: 'http://www.drumbeat.org/',
-    src: 'https://www.drumbeat.org/media//images/drumbeat-logo-splash.png',
-    text: 'DRUMBEAT',
-    target: 'imagediv'
+    // seconds
+    start: 1,
+    // seconds
+    end: 3,
+    href: "http://www.drumbeat.org/",
+    src: "https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
+    text: "DRUMBEAT",
+    target: "imagediv"
   });
 
   popped.exec( 2, function() {
@@ -41,6 +43,6 @@ test("Popcorn Image Plugin", function () {
       ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" );
       plus();
   });
-  popped.volume(0).play();  
-  
+
+  popped.volume( 0 ).play();  
 });