]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#281] Tags working, port from jQuery nearly done
authorstevenaw <sweerdenburg@gmail.com>
Tue, 15 Feb 2011 16:30:05 +0000 (11:30 -0500)
committerstevenaw <sweerdenburg@gmail.com>
Tue, 15 Feb 2011 16:30:05 +0000 (11:30 -0500)
plugins/flickr/popcorn.flickr.html
plugins/flickr/popcorn.flickr.js

index 0efd2476720255aa9fc275014ae0c1e506c55dd4..b83a2f821c91c87abf0a206693fc8da3f784347f 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',
+        numberofimages: '8',
+        target: 'flickrdiv'
+      } )
+      .flickr({
+        start: 30, // seconds
         end: 45, // seconds
         userid: '78868639@N00',
         target: 'flickrdiv'
index 74b46ce6e7c9a1408e6b73b250b08186467f9bef..cce77a215e9bade175db969ffcfaef6c6c79cc99 100644 (file)
@@ -48,6 +48,7 @@
           start   : {elem:'input', type:'number', label:'In'},
           end     : {elem:'input', type:'number', label:'Out'},
           userid  : {elem:'input', type:'text',   label:'Source'},
+          tags    : {elem:'input', type:'text',   label:'Tags'},
           target  :  'Flickr-container',
           height  : {elem:'input', type:'text', label:'Height'},
           width   : {elem:'input', type:'text', label:'Width'},
       _setup: function( options ) {
         options.container = document.createElement( 'div' );
         options.container.style.display = "none";
+        
         if ( document.getElementById( options.target ) ) {
           document.getElementById( options.target ).appendChild( options.container );
         }
+        
         var height  = options.height || "50px",
             width   = options.width || "50px",
             count   = options.numberofimages || 4,
             padding = options.padding || "5px",
-            border  = options.border || "0px";
+            tags    = options.tags || "",
+            userid  = options.userid || "",
+            border  = options.border || "0px",
+            uri = "http://api.flickr.com/services/feeds/photos_public.gne?";
+        
+        if ( userid ) {
+          uri += "id="+userid+"&";
+        }
+        
+        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;
+              }
+            });
+          }
+        );*/
 
-        $.getJSON( "http://api.flickr.com/services/feeds/photos_public.gne?id=" + options.userid + "&lang=en-us&format=json&jsoncallback=?", function( data ){
+        uri += "lang=en-us&format=json&jsoncallback=?";
+        $.getJSON( uri, function( data ){
           options.container.innerHTML = "<p style='padding:" + padding + ";'>" + data.title + "<p/>";
           $.each( data.items, function( i, item ) {
             if ( i < count ) {