]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
#516 Fixed code style
authorMohammed Buttu <mohammedbuttu@gmail.com>
Thu, 16 Jun 2011 17:45:10 +0000 (13:45 -0400)
committerMohammed Buttu <mohammedbuttu@gmail.com>
Thu, 16 Jun 2011 17:45:10 +0000 (13:45 -0400)
plugins/flickr/popcorn.flickr.html
plugins/flickr/popcorn.flickr.js
plugins/flickr/popcorn.flickr.unit.js

index 037437b9b98c86f961ebcc3a7ab03a635cdeece7..ca0e25dc99e5b2e99bd81f5475b5cf90a64d10e2 100755 (executable)
   <script src="../../popcorn.js"></script>
   <script src="popcorn.flickr.js"></script>
   <script>
-    document.addEventListener('DOMContentLoaded', function () {
-      var p = Popcorn('#video')
+    document.addEventListener( "DOMContentLoaded", function () {
+
+      var p = Popcorn( "#video" )
       .flickr({
-        start: 0, // seconds
-        end: 5, // seconds
-        username: 'AniaSob',
-        apikey: 'd1d249260dd1673ec8810c8ce5150ae1',
-        target: 'flickrdiv'
-      } )
+        // seconds
+        start: 0,
+        // seconds
+        end: 5,
+        username: "AniaSob",
+        apikey: "d1d249260dd1673ec8810c8ce5150ae1",
+        target: "flickrdiv"
+      })
       .flickr({
-        start: 5, // seconds
-        end: 15, // seconds
-        userid: '35034346917@N01',
-        target: 'flickrdiv'
-      } )
+        // seconds
+        start: 5,
+        // seconds
+        end: 15,
+        userid: "35034346917@N01",
+        target: "flickrdiv"
+      })
       .flickr({
-        start: 20, // seconds
-        end: 30, // seconds
-        tags: 'georgia',
+        // seconds
+        start: 20,
+        // seconds
+        end: 30,
+        tags: "georgia",
         numberofimages: 8,
-        target: 'flickrdiv'
-      } )
+        target: "flickrdiv"
+      })
       .flickr({
-        start: 35, // seconds
-        end: 45, // seconds
-        userid: '35034346917@N01',
-        tags: 'georgia',
+        // seconds
+        start: 35,
+        // seconds
+        end: 45,
+        userid: "35034346917@N01",
+        tags: "georgia",
         numberofimages: 8,
-        target: 'flickrdiv'
-      } )
+        target: "flickrdiv"
+      })
       .play();
-    }, false);
+    }, false );
 
   </script>
 </head>
   <br />Flickr images tagged 'georgia' will appear at 20 seconds and disappear at 30 seconds.
   <br />Flickr images by '35034346917@N01' and tagged 'georgia' will appear at 35 seconds and 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 bf5e9a7d2778091a01c66326b5122194d95d08ef..5f37550ba69f4cd7e4e83dacbb7baf4634d03814 100755 (executable)
     // get the userid from Flickr API by using the username and apikey
     var isUserIDReady = function() {
       if ( !_userid ) {
+
         _uri  = "http://api.flickr.com/services/rest/?method=flickr.people.findByUsername&";        
         _uri += "username=" + options.username + "&api_key=" + options.apikey + "&format=json&jsoncallback=flickr";
         Popcorn.xhr.getJSONP( _uri, function(data) {
           _userid = data.user.nsid;
           getFlickrData();
         });
+
       } else {
+
         setTimeout(function () {
           isUserIDReady();
         }, 5);
         
         Popcorn.forEach( data.items, function ( item, i ) {
           if ( i < _count ) {
+
             _link = document.createElement( 'a' );
             _link.setAttribute( 'href', item.link );
             _link.setAttribute( "target", "_blank" );
             _image.setAttribute( 'style', 'border:' + _border + ';padding:' + _padding );
             _link.appendChild( _image );         
             containerDiv.appendChild( _link );
+
           } else {
+
             return false;
           }
         });
   },
   {
     about:{
-      name:    "Popcorn Flickr Plugin",
+      name: "Popcorn Flickr Plugin",
       version: "0.2",
-      author:  "Scott Downe, Steven Weerdenburg, Annasob",
+      author: "Scott Downe, Steven Weerdenburg, Annasob",
       website: "http://scottdowne.wordpress.com/"
     },
     options:{
-      start          : {elem:'input', type:'number', label:'In'},
-      end            : {elem:'input', type:'number', label:'Out'},
-      userid         : {elem:'input', type:'text',   label:'UserID'},
-      tags           : {elem:'input', type:'text',   label:'Tags'},
-      username       : {elem:'input', type:'text',   label:'Username'},
-      apikey        : {elem:'input', type:'text',   label:'Api_key'},
-      target         :  'flickr-container',
-      height         : {elem:'input', type:'text', label:'Height'},
-      width          : {elem:'input', type:'text', label:'Width'},
-      padding        : {elem:'input', type:'text', label:'Padding'},
-      border         : {elem:'input', type:'text', label:'Border'},
-      numberofimages : {elem:'input', type:'text', label:'Number of Images'}
+      start: {
+        elem: "input", 
+        type: "number", 
+        label: "In"
+      },
+      end: {
+        elem: "input", 
+        type: "number", 
+        label: "Out"
+      },
+      userid: {
+        elem: "input", 
+        type: "text",
+        label: "UserID"
+      },
+      tags: {
+        elem: "input", 
+        type: "text",
+        label: "Tags"
+      },
+      username: {
+        elem: "input", 
+        type: "text",
+        label: "Username"
+      },
+      apikey: {
+        elem: "input", 
+        type: "text",
+        label: "Api_key"
+      },
+      target: "flickr-container",
+      height: {
+        elem: "input", 
+        type: "text", 
+        label: "Height"
+      },
+      width: {
+        elem: "input",
+        type: "text",
+        label: "Width"
+      },
+      padding: {
+        elem: "input", 
+        type: "text",
+        label: "Padding"
+      },
+      border: {
+        elem: "input", 
+        type: "text", 
+        label: "Border"
+      },
+      numberofimages: {
+        elem: "input", 
+        type: "text", 
+        label: "Number of Images"
+      }
     }
   });
 })( Popcorn );
index 7d217f3f59f15373dc5b192f53685dd0bbf6634d..7fc453109649f19906475cbca7f8860eba8ecf65 100755 (executable)
@@ -1,34 +1,36 @@
 test("Popcorn Flickr Plugin", function () {
   
-  var popped = Popcorn("#video"),
+  var popped = Popcorn( "#video" ),
       expects = 10, 
       count = 0,
       setupId,
-      flickrdiv = document.getElementById('flickrdiv');
+      flickrdiv = document.getElementById( "flickrdiv" );
   
   expect( expects );
   
   function plus() {
-    if ( ++count === expects) {
+    if ( ++count === expects ) {
       start();
     }
   }
 
   stop();   
  
-  ok('flickr' in popped, "flickr is a method of the popped instance");
+  ok( "flickr" in popped, "flickr is a method of the popped instance" );
   plus();
 
   equals ( flickrdiv.innerHTML, "", "initially, there is nothing inside the flickrdiv" );
   plus();
   
   popped.flickr({
-    start: 0, // seconds
-    end: 3,   // seconds
-    userid: '35034346917@N01',
+    // seconds
+    start: 0,
+    // seconds
+    end: 3,
+    userid: "35034346917@N01",
     numberofimages: 1,
-    target: 'flickrdiv'
-  } )
+    target: "flickrdiv"
+  })
   .flickr({
     start: 4,
     end: 7,
@@ -37,17 +39,20 @@ test("Popcorn Flickr Plugin", function () {
     target: "flickrdiv"
   })
   .flickr({
-    start: 8, // seconds
-    end: 10,   // seconds
-    username: 'AniaSob',
-    apikey: 'd1d249260dd1673ec8810c8ce5150ae1',
+    // seconds
+    start: 8,
+    // seconds
+    end: 10,
+    username: "AniaSob",
+    apikey: "d1d249260dd1673ec8810c8ce5150ae1",
     numberofimages: 1,
-    target: 'flickrdiv'
+    target: "flickrdiv"
   });
 
   setupId = popped.getLastTrackEventId();
 
   popped.exec( 2, function() {
+
     ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
     plus();
     ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
@@ -55,6 +60,7 @@ test("Popcorn Flickr Plugin", function () {
   });
 
   popped.exec( 5, function() {
+
     var numberOfImages = document.getElementById( "flickrdiv" ).childNodes[1].getElementsByTagName( "a" ).length;
 
     ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
@@ -71,11 +77,12 @@ test("Popcorn Flickr Plugin", function () {
   });
   
   popped.exec( 11, function() {
+
     ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
     plus();
 
     popped.pause().removeTrackEvent( setupId );
-    ok( !flickrdiv.children[2], "removed flickr was properly destroyed"  );
+    ok( !flickrdiv.children[2], "Removed flickr was properly destroyed"  );
     plus();
   });