]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#281] Finished. Meta-ticket filedd about jQuery dependency (#347)
authorstevenaw <sweerdenburg@gmail.com>
Wed, 16 Feb 2011 16:17:23 +0000 (11:17 -0500)
committerstevenaw <sweerdenburg@gmail.com>
Wed, 16 Feb 2011 16:17:23 +0000 (11:17 -0500)
plugins/flickr/popcorn.flickr.html
plugins/flickr/popcorn.flickr.js

index b83a2f821c91c87abf0a206693fc8da3f784347f..6988b7acf11dda9b1f52b582d9b0c0ee84b17030 100644 (file)
       var p = Popcorn('#video')
       .flickr({
         start: 5, // seconds
-        end: 10, // seconds
-        userid: '35034346917@N01',
-        numberofimages: '8',
-        target: 'flickrdiv'
-      } )
-      .flickr({
-        start: 10, // seconds
         end: 15, // seconds
         userid: '35034346917@N01',
-        tags: 'georgia',
-        numberofimages: '8',
-        target: 'flickrdiv'
-      } )
-      .flickr({
-        start: 15, // seconds
-        end: 20, // seconds
-        tags: 'georgia',
-        numberofimages: '8',
         target: 'flickrdiv'
       } )
       .flickr({
         start: 20, // seconds
-        end: 25, // seconds
-        tags: 'georgia,fish',
+        end: 30, // seconds
+        tags: 'georgia',
         numberofimages: '8',
         target: 'flickrdiv'
       } )
       .flickr({
-        start: 30, // seconds
+        start: 35, // seconds
         end: 45, // seconds
-        userid: '78868639@N00',
+        userid: '35034346917@N01',
+        tags: 'georgia',
+        numberofimages: '8',
         target: 'flickrdiv'
       } )
       .play();
@@ -52,8 +38,9 @@
 <body>
   <h1 id="qunit-header">Popcorn Flickr Plug-in Demo</h1>
   <p>This plugin requires jquery</p>
-  <p>Flickr images will appear at 5 seconds and disappear at 15 seconds.</p>
-  <p>More Flickr images will appear at 20 seconds and disappear at 45 seconds.</p>
+  <p>Flickr images by '35034346917@N01' will appear at 5 seconds and disappear at 15 seconds.
+  <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' 
       controls
index cce77a215e9bade175db969ffcfaef6c6c79cc99..a6ecce0e4a8c937f105e5f243f6b360977f18582 100644 (file)
@@ -1,7 +1,6 @@
 // PLUGIN: FLICKR
 
 (function (Popcorn) {
-  
   /**
    * Flickr popcorn plug-in 
    * Appends a users Flickr images to an element on the page.
@@ -10,6 +9,7 @@
    * 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
    * Userid is the id of who's Flickr images you wish to show
+   * Tags is a mutually exclusive list of image descriptor tags
    * Target is the id of the document element that the images are
    *  appended to, this target element must exist on the DOM
    * Numberofimages specify the number of images to retreive from flickr, defaults to 8
@@ -25,7 +25,8 @@
         .footnote({
           start:          5,                 // seconds, mandatory
           end:            15,                // seconds, mandatory
-          userid:         '35034346917@N01', // mandatory
+          userid:         '35034346917@N01', // optional
+          tags:           'dogs,cats',       // optional
           numberofimages: '8',               // optional
           height:         '50px',            // optional
           width:          '50px',            // optional
@@ -40,8 +41,8 @@
       manifest: {
         about:{
           name:    "Popcorn Flickr Plugin",
-          version: "0.1",
-          author:  "Scott Downe",
+          version: "0.1.1",
+          author:  "Scott Downe, Steven Weerdenburg",
           website: "http://scottdowne.wordpress.com/"
         },
         options:{
         if ( tags ) {
           uri += "tags="+tags+"&";
         }
-        
-        /*uri += "lang=en-us&format=json&jsoncallback=jsonp";
-        
-        Popcorn.xhr.getJSONP( uri,
-          function( data ) {
-            options.container.innerHTML = "<p style='padding:" + padding + ";'>" + data.title + "<p/>";
-            
-            Popcorn.forEach( data.items, function ( item, i ) {
-              if ( i < count ) {
-                var link = document.createElement('a');
-                link.setAttribute( 'href', item.link );
-                link.setAttribute( "target", "_blank" );
-                var image = document.createElement( 'img' );
-                image.setAttribute( 'src', item.media.m );
-                image.setAttribute( 'height', height );
-                image.setAttribute( 'width', width );
-                image.setAttribute( 'style', 'border:' + border + ';padding:' + padding );
-                link.appendChild( image );
-                
-                options.container.appendChild( link );
-              } else {
-                return false;
-              }
-            });
-          }
-        );*/
 
         uri += "lang=en-us&format=json&jsoncallback=?";
-        $.getJSON( uri, function( data ){
+        
+        $.getJSON( uri, function( data ) {
           options.container.innerHTML = "<p style='padding:" + padding + ";'>" + data.title + "<p/>";
-          $.each( data.items, function( i, item ) {
+          
+          Popcorn.forEach( data.items, function ( item, i ) {
             if ( i < count ) {
               var link = document.createElement('a');
               link.setAttribute( 'href', item.link );