]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
added position and height to a and img elements -#368
authorMinoo <minoo.ziaei@gmail.com>
Mon, 4 Apr 2011 21:32:58 +0000 (17:32 -0400)
committerMinoo <minoo.ziaei@gmail.com>
Mon, 4 Apr 2011 21:32:58 +0000 (17:32 -0400)
plugins/image/popcorn.image.js
plugins/image/popcorn.image.unit.js

index 328a8b517e6696fdb8e8814e2457705305f8c2d6..dd97911007fbeceb2e05b4bcdf9f977436f6c3a9 100644 (file)
 
         options.link = document.createElement( 'a' );
         options.link.style.display = "none"; // display none by default
+        options.link.style.position = "relative";
+        options.link.style.height = "100%";
+        //options.link.style.width = "100%";
+
         if ( options.href ) {
           options.link.href = options.href;
         }
           document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
         }
         
-
-
-        
         var img = document.createElement( 'img' );
         img.src = options.src;
+        img.style.position = "absolute";
+        img.style.height = "100%";
+        //img.style.width = "100%";
         img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
         
+        var fontHeight = ((document.getElementById( options.target ).offsetHeight) / 12) + "px";
+        
         var divText = document.createElement( 'div' );
         divTextStyle = {
-            position: 'absolute',
-            paddingTop: '20px',
-            paddingLeft: '20px',
-            paddingBottom: '0',
-            fontSize: 'large',
-            color: 'black',
-            fontWeight : 'bold',
-            zIndex: '10',
+            position: "absolute",
+            top: "50%",
+            textAlign: "center",
+            left: 0,
+            right: 0,
+            fontSize: fontHeight,
+            color: "black",
+            fontWeight : "bold",
+            zIndex: "10",
         };
         for ( st in divTextStyle ) {
           divText.style[ st ] = divTextStyle[ st ];
@@ -92,7 +99,7 @@
        * options variable
        */
       start: function( event, options ) {
-        options.link.style.display = "inline";
+        options.link.style.display = "block";
       },
       /**
        * @member image 
index 4e395ecb479f2fe4e8431932af44417872935ff6..d6dd8cf75f35381b86bfbeadc582b31bcb978ca8 100644 (file)
@@ -36,7 +36,7 @@ test("Popcorn Image Plugin", function () {
     if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
       ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
       plus();
-      equals (imagediv.children[0].children[0].style.backgroundImage.indexOf ( 'url' ), "0", "An image exists" );
+      ok( /img/.test( imagediv.innerHTML ), "An image exists" );
       plus();
       clearInterval( interval );
     }