]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
added text overlay to the image plugin, made a default size for images -#368
authorMinoo <minoo.ziaei@gmail.com>
Wed, 9 Mar 2011 04:14:21 +0000 (23:14 -0500)
committerMinoo <minoo.ziaei@gmail.com>
Wed, 9 Mar 2011 04:14:21 +0000 (23:14 -0500)
plugins/image/popcorn.image.html
plugins/image/popcorn.image.js

index ec1abcce3f53ed91d144303d84cb7e9d5e4b04e3..168a4e98e9c9e4850aa7089ff4d9a316cbed5fd6 100644 (file)
@@ -15,6 +15,7 @@
         end: 15, // seconds
         href: 'http://www.drumbeat.org/',
         src: 'https://www.drumbeat.org/media//images/drumbeat-logo-splash.png',
+        text: 'DRUMBEAT',
         target: 'imagediv'
       } )
       .image({
@@ -22,6 +23,7 @@
         end: 45, // seconds
         // no href
         src: 'http://patriciabergeron.net/wp-content/uploads/web.made_.movie_marquee.gif',
+        text: 'WEB MADE MOVIES',
         target: 'imagediv'
       } );
 
index c2e43109482903262bff6a4ab234752ea0d0c6b3..9fe50a951e546d098d9bdcb05a27da89e2b32a76 100644 (file)
@@ -22,6 +22,7 @@
           end: 15, // seconds
           href: 'http://www.drumbeat.org/',
           src: 'http://www.drumbeat.org/sites/default/files/domain-2/drumbeat_logo.png',
+          text: 'DRUMBEAT',
           target: 'imagediv'
         } )
    *
@@ -40,7 +41,8 @@
           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'}
+          src :    {elem:'input', type:'text',   label:'Source URL'},
+          text:    {elem:'input', type:'text',   label:'TEXT'}
         }
       },
 
         if ( document.getElementById( options.target ) ) {
           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.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
-
-        options.link.appendChild( img );
+        var div = document.createElement( 'div' );
+        divStyle = {
+          width : '200px',
+          height : '200px',
+          background : "url( " + options.src + " ) no-repeat ",
+          backgroundSize : '100%',
+          MozBackgroundSize: '100%',
+          borderStyle : 'none'
+        }
+        for (s in divStyle) {
+          div.style[s] = divStyle[s];
+        }
+        
+        var divText = document.createElement( 'div' ); // add the inner div for overlaying text
+        divTextStyle = {
+          width : '50%',
+          margin : 'auto',
+          marginTop : '20px',
+          color : 'black',
+          fontWeight : 'bold',
+          textAlign : 'center'
+        }
+        for (st in divTextStyle) {
+          divText.style[st] = divTextStyle[st];
+        }
+        divText.innerHTML = options.text
+        
+        div.appendChild( divText); 
+        options.link.appendChild( div );
         
       },