<html>
<head>
<title>Popcorn LinkedIn Plug-in Demo</title>
+ <!--
+ ATTENTION
+
+ This demo uses an API key obtained for testing the LinkedIn Popcorn.js
+ plugin. Please do not use it for other purposes. This API key is meant
+ to be used on localhost (port 80). For other purposes, please obtain an API key
+ from https://www.linkedin.com/secure/developer.
+ -->
<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script src="../../popcorn.js"></script>
<script src="popcorn.linkedin.js"></script>
counter : 'right',
url : "http://www.google.ca",
target : "sharediv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 1,
end : 3
} )
target : "recommenddiv",
companyid : 'LinkedIn',
productid : '201714',
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 4,
end : 7
} )
memberid : '/in/jeffweiner08',
format : 'inline',
target : "memberprofilediv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 9,
end : 11
} )
type : 'companyinsider',
companyid : '1441',
target : "bottomdiv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 9,
end : 11
} )
companyid : '1441',
format : 'inline',
target : "bottomdiv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 13,
end : 17
} )
<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>
+ For a description of each plugin's purpose, go to: <a href="http://developer.linkedin.com/community/plugins">LinkedIn Plugins</a><br/>
+ </p>
<div>
<video id='video'
//PLUGIN: linkedin
(function (Popcorn){
/**
- * LinkedIn Popcorn plug-in
- * An api_key must be specified before the linkedin.js script
+ * LinkedIn Popcorn plug-in
* Places a LinkedIn plugin inside a div ( http://developers.facebook.com/docs/plugins/ )
- * Sets options according to user input or default values
- * Options parameter will need a target and a type
- * Type is the name of the plugin. Either share, memberprofile, companyinsider, companyprofile, or recommendproduct
- * Target is the id of the document element that the plugin needs to be
- * attached to, this target element must exist on the DOM
- *
+ * Options parameter will need a start, end, target, type, and an api key
+ * 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
+ * Target is the id of the document element that the plugin needs to be attached to, this target element must exist on the DOM
+ * Type is the name of the plugin: share, memberprofile, companyinsider, companyprofile, or recommendproduct
+ * Apikey is your own api key from obtained from https://www.linkedin.com/secure/developer
+ *
* @param {Object} options
*
* Example:
- * // This api_key is valid for the matrix.senecac.on.ca domain
- * <script>
- * var api_key = 'ND1uSIEUBH8MkI8E7g41kgGlWUexzvFL9uB2ihJbIrFuqunFq8aVmUrxyfAqxCBX';
- * </script>
* <script src="popcorn.linkedin.js"></script>
* ...
* var p = Popcorn('#video')
* url : "http://www.google.ca",
* counter : "right",
* target : 'sharediv'
+ * api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ * start : 1,
+ * end : 3
* } )
*
- * This will show how many people have "shared" Google (default url is current page, if non specified) via LinkedIn.
+ * This will show how many people have "shared" Google (default url is current page, if none specified) via LinkedIn.
* Will show number of people (counter) to the right of the share plugin.
*/
},
_setup: function( options ) {
- var api_key = options.api_key,
+ var api_key = options.apikey,
target = document.getElementById( options.target );
options._container = document.createElement( 'script' );
}
target.style.display = 'none';
},
-
+
+ /**
+ * @member linkedin
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
start: function( event, options ) {
options._container.parentNode.style.display = 'block';
},
+ /**
+ * @member linkedin
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
end: function( event, options ) {
options._container.parentNode.style.display = 'none';
}
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.linkedin.js"></script>
+
+ <script src="popcorn.linkedin.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Image Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="linkedindiv"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn LinkedIn Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 5,
+ count = 0,
+ linkedin = document.getElementById('linkedindiv');
+
+ expect( expects );
+
+ function plus() {
+ if ( ++count === expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok('linkedin' in popped, "linkedin is a method of the popped instance");
+ plus();
+
+ equals ( linkedin.innerHTML, "", "initially, there is nothing inside the linkedin div" );
+ plus();
+
+
+ popped.linkedin({
+ type : 'share',
+ counter : 'right',
+ url : "http://www.google.ca",
+ target : "linkedindiv",
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ start : 1,
+ end : 3
+ } );
+
+ popped.exec( 2, function() {
+ ok( /block/.test( linkedin.style.display ), "Div contents are displayed" );
+ plus();
+ ok( /script/.test( linkedin.innerHTML ), "LinkedIn plugin exists" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ ok( /none/.test( linkedin.style.display ), "Div contents are hidden again" );
+ plus();
+ });
+ popped.volume(0).play();
+
+});