target: "sharediv",
apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start: 1,
- end: 3
+ end: 4
})
.linkedin({
type: "recommendproduct",
companyid: "LinkedIn",
productid: "201714",
apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
- start: 4,
- end: 7
+ start: 5,
+ end: 8
})
.linkedin({
type: "memberprofile",
target: "memberprofilediv",
apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start: 9,
- end: 11
+ end: 15
})
.linkedin({
type: "companyinsider",
companyid: "1441",
- target: "bottomdiv",
+ target: "companyinsiderdiv",
apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start: 9,
- end: 11
+ end: 15
})
.linkedin({
type: "companyprofile",
companyid: "1441",
format: "inline",
- target: "bottomdiv",
+ target: "companyprofilediv",
apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
- start: 13,
- end: 17
+ start: 16,
+ end: 27
});
}, false );
</script>
</head>
<body>
<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 />
+ Right of video:
+ <ul>
+ <li>share button: between 1 and 4 seconds</li>
+ <li>recommend button: between 5 and 8 seconds</li>
+ <li>member profile: between 9 and 15 seconds</li>
+ </ul>
+ Below video:
+ <ul>
+ <li>company insider: between 9 and 15 seconds</li>
+ <li>company profile: between 16 and 27 seconds</li>
+ </ul>
+ <p>
For a description of each plugin's purpose, go to: <a href="http://developer.linkedin.com/community/plugins">LinkedIn Plugins</a><br/>
</p>
</video>
</div>
- <div id="sharediv" style="position:absolute;top:150px;left:400px;"></div>
- <div id="recommenddiv" style="position:absolute;top:175px;left:400px;"></div>
- <div id="memberprofilediv" style="position:absolute;top:150px;left:500px;"></div>
- <div id="bottomdiv"></div>
+ <div id="sharediv" style="position:absolute;top:400px;left:400px;"></div>
+ <div id="recommenddiv" style="position:absolute;top:400px;left:400px;"></div>
+ <div id="memberprofilediv" style="position:absolute;top:400px;left:500px;"></div>
+ <div id="companyinsiderdiv"></div>
+ <div id="companyprofilediv"></div>
</body>
</html>
(function (Popcorn){
-/**
+ /**
* LinkedIn Popcorn plug-in
* Places a LinkedIn plugin inside a div ( http://developers.facebook.com/docs/plugins/ )
* Options parameter will need a start, end, target, type, and an api key
* Url is the desired url to share via LinkedIn. Defaults to the current page if no url is specified
* Counter is the position where the counter will be positioned. This is used if the type is "share" or "recommendproduct"
* The options are right and top (don't include this option if you do not want a counter)
- * Format is is the data format of the member and company profile plugins. The options are inlined, hover, and click. Defaults to inline
+ * Format is the data format of the member and company profile plugins. The options are inlined, hover, and click. Defaults to inline
* Companyid must be specified if the type is "companyprofile," "companyinsider," or "recommendproduct"
* Productid must be specified if the type is "recommendproduct"
*
* apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
* start: 1,
* end: 3
- * } )
+ * })
*
* This plugin will be displayed between 1 and 3 seconds, inclusive, in the video. This will show how many people have "shared" Google via LinkedIn,
* with the number of people (counter) displayed to the right of the share plugin.
_setup: function( options ) {
var apikey = options.apikey,
- target = document.getElementById( options.target );
+ target = document.getElementById( options.target ),
+ script = document.createElement( "script" );
Popcorn.getScript("http://platform.linkedin.com/in.js");
- options._container = document.createElement( "script" );
+ options._container = document.createElement( "div" );
+ options._container.appendChild( script );
if ( apikey ) {
- options._container.innerHTML = "api_key: " + apikey;
+ script.innerHTML = "api_key: " + apikey;
}
options.type = options.type.toLowerCase();
return {
share: function () {
- options._container.setAttribute( "type", "IN/Share" );
+ script.setAttribute( "type", "IN/Share" );
if ( options.counter ) {
- options._container.setAttribute( "data-counter", options.counter );
+ script.setAttribute( "data-counter", options.counter );
}
if ( options.url ) {
- options._container.setAttribute( "data-url", options.url );
+ script.setAttribute( "data-url", options.url );
}
},
memberprofile: function () {
- options._container.setAttribute( "type", "IN/MemberProfile" );
- options._container.setAttribute( "data-id", ( options.memberid ) );
- options._container.setAttribute( "data-format", ( options.format || "inline" ) );
+ script.setAttribute( "type", "IN/MemberProfile" );
+ script.setAttribute( "data-id", ( options.memberid ) );
+ script.setAttribute( "data-format", ( options.format || "inline" ) );
if ( options.text && options.format.toLowerCase() !== "inline" ) {
- options._container.setAttribute( "data-text", options.text );
+ script.setAttribute( "data-text", options.text );
}
},
companyinsider: function () {
- options._container.setAttribute( "type", "IN/CompanyInsider" );
- options._container.setAttribute( "data-id", options.companyid );
+ script.setAttribute( "type", "IN/CompanyInsider" );
+ script.setAttribute( "data-id", options.companyid );
if( options.modules ) {
options._container.setAttribute( "data-modules", options.modules );
},
companyprofile: function () {
- options._container.setAttribute( "type", "IN/CompanyProfile" );
- options._container.setAttribute( "data-id", ( options.companyid ) );
- options._container.setAttribute( "data-format", ( options.format || "inline" ) );
+ script.setAttribute( "type", "IN/CompanyProfile" );
+ script.setAttribute( "data-id", ( options.companyid ) );
+ script.setAttribute( "data-format", ( options.format || "inline" ) );
if ( options.text && options.format.toLowerCase() !== "inline" ) {
- options._container.setAttribute( "data-text", options.text );
+ script.setAttribute( "data-text", options.text );
}
if ( options.related !== undefined ) {
- options._container.setAttribute( "data-related", options.related );
+ script.setAttribute( "data-related", options.related );
}
},
recommendproduct: function () {
- options._container.setAttribute( "type", "IN/RecommendProduct" );
- options._container.setAttribute( "data-company", ( options.companyid || "LinkedIn" ) );
- options._container.setAttribute( "data-product", ( options.productid || "201714" ) );
+ script.setAttribute( "type", "IN/RecommendProduct" );
+ script.setAttribute( "data-company", ( options.companyid || "LinkedIn" ) );
+ script.setAttribute( "data-product", ( options.productid || "201714" ) );
if ( options.counter ) {
- options._container.setAttribute( "data-counter", options.counter );
+ script.setAttribute( "data-counter", options.counter );
}
}
};
*/
end: function( event, options ) {
options._container.parentNode.style.display = "none";
+ },
+ _teardown: function( options ) {
+ var tar = document.getElementById( options.target );
+ tar && tar.removeChild( options._container );
}
});
})( Popcorn );