]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
#332 Changed api key to make it work on localhost. Made api key optional. Added start...
authorMohammed Buttu <mohammedbuttu@gmail.com>
Fri, 13 May 2011 21:12:58 +0000 (17:12 -0400)
committerMohammed Buttu <mohammedbuttu@gmail.com>
Fri, 13 May 2011 21:12:58 +0000 (17:12 -0400)
plugins/linkedin/popcorn.linkedin.html
plugins/linkedin/popcorn.linkedin.js

index 9eef9674b51ba5143533667898fd91d1c1201a0e..145309ce1074224bf1ccbe79c9e3432cd40e84f1 100644 (file)
@@ -2,10 +2,8 @@
 <html>
 <head>
   <title>Popcorn LinkedIn Plug-in Demo</title>
+  <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
   <script src="../../popcorn.js"></script>
-  <script>
-    var api_key = 'ND1uSIEUBH8MkI8E7g41kgGlWUexzvFL9uB2ihJbIrFuqunFq8aVmUrxyfAqxCBX';
-  </script>
   <script src="popcorn.linkedin.js"></script>
   <script>
     document.addEventListener('DOMContentLoaded', function () {
         type      : 'share',
         counter   : 'right',
         url       : "http://www.google.ca",
-        target    : "sharediv"
+        target    : "sharediv",
+        api_key   : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+        start     : 1,
+        end       : 3
       } )
       .linkedin({
         type      : 'recommendproduct',
         counter   : 'top',
         target    : "recommenddiv",
         companyid : 'LinkedIn',
-        productid : '201714'
+        productid : '201714',
+        api_key   : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+        start     : 4,
+        end       : 7
       } )
       .linkedin({
         type      : 'memberprofile',
         memberid  : '/in/jeffweiner08',
         format    : 'inline',
-        target    : "memberprofilediv"
+        target    : "memberprofilediv",
+        api_key   : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+        start     : 9,
+        end       : 11
       } )
       .linkedin({
         type      : 'companyinsider',
         companyid : '1441',
-        target    : "bottomdiv"
+        target    : "bottomdiv",
+        api_key   : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+        start     : 9,
+        end       : 11
       } )
       .linkedin({
         type      : 'companyprofile',
         companyid : '1441',
         format    : 'inline',
-        target    : "bottomdiv"
+        target    : "bottomdiv",
+        api_key   : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+        start     : 13,
+        end       : 17
       } )
     }, false);
 
   </script>
 </head>
 <body>
-<h1 id="qunit-header">Popcorn Facebook Plug-in Demo</h1>
+<h1 id="qunit-header">Popcorn LinkedIn Plug-in Demo</h1>
   <p>Right of video: share button, recommend button, member profile. <br />
      Below video: company insider, company profile.<br />
      For a description of each plugin's purpose, go to: <a href="http://developer.linkedin.com/community/plugins">LinkedIn Plugins</a></p>
index 35ca14cad03e0a4070e0eb319e283138a6c87808..20ca09b95b73892804bbab357a4894983a623a82 100644 (file)
         type   : {elem:"input", type:'text', label:"Type"},
         target : 'linkedin-container'
       }
-    },  
+    },
     
     _setup: function( options ) {
-      // similar to facebook script load idea
-      if ( !document.getElementById("linkedin-root") ) {
-        var r = document.createElement( 'div' );
-        r.setAttribute( 'div', "linkedin-root" );
-        document.body.appendChild( r );
-        
-        (function() {
-          var s = document.createElement( 'script' );
-          s.setAttribute( 'src', "http://platform.linkedin.com/in.js" );
-          s.setAttribute( 'type', "text/javascript" );
-          s.setAttribute( 'async', 'true' );
-          if ( typeof( api_key ) !== "undefined" ) {
-            s.innerHTML = 'api_key: ' + api_key;
-          }
-          r.appendChild( s );
-        }());
+      var api_key = options.api_key,
+                    target = document.getElementById( options.target );
+   
+      options._container = document.createElement( 'script' );
+      
+      options._container.setAttribute( 'async', 'true' );
+      if ( typeof( api_key ) !== "undefined" ) {
+        options._container.innerHTML = 'api_key: ' + api_key;
       }
       
-      options._container = document.createElement( 'script' );
       options.type = options.type.toLowerCase();
       
       // Replace the LinkedIn plugin's error message to something more helpful
       if ( document.getElementById( options.target ) ) {
         document.getElementById( options.target ).appendChild( options._container );
       }
+      target.style.display = 'none';
+    },
+
+    start: function( event, options ) {
+      options._container.parentNode.style.display = 'block';
+    },
+    
+    end: function( event, options ) {
+      options._container.parentNode.style.display = 'none';
     }
   });