Skip to content

Commit

Permalink
Add manifest to Linkedin plugin [#671]
Browse files Browse the repository at this point in the history
  • Loading branch information
jbuck committed Aug 25, 2011
2 parents 97d6588 + 439f739 commit f9b3b0e
Showing 1 changed file with 70 additions and 14 deletions.
84 changes: 70 additions & 14 deletions plugins/linkedin/popcorn.linkedin.js
Expand Up @@ -10,17 +10,17 @@
* 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, options are share, memberprofile, companyinsider, companyprofile, or recommendproduct
* Type is the name of the plugin, options are share, memberprofile, companyinsider, companyprofile, or recommendproduct
* Apikey is your own api key from obtained from https://www.linkedin.com/secure/developer
* 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 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"
*
*
* @param {Object} options
*
*
* Example:
* <script src="popcorn.linkedin.js"></script>
* ...
Expand All @@ -47,11 +47,67 @@
website: "dsventura.blogspot.com"
},
options: {
type: {
type: {
elem: "input",
type: "text",
label: "Type"
},
},
url: {
elem: "input",
type: "text",
label: "URL"
},
apikey: {
elem: "input",
type: "text",
label: "API Key"
},
counter: {
elem: "input",
type: "text",
label: "Counter"
},
memberid: {
elem:"input",
type:"text",
label:"Member ID"
},
format: {
elem:"input",
type:"text",
label:"Format"
},
companyid: {
elem:"input",
type:"text",
label:"Company ID"
},
modules: {
elem:"input",
type:"text",
label:"Modules"
},
productid: {
elem:"input",
type:"text",
label:"productid"
},
related: {
elem:"input",
type:"text",
label:"related"
},
start: {
elem:"input",
type:"text",
label:"In"
},
end: {
elem:"input",
type:"text",
label:"Out"
},

target: "linkedin-container"
}
},
Expand All @@ -62,24 +118,24 @@
script = document.createElement( "script" );

Popcorn.getScript("http://platform.linkedin.com/in.js");

options._container = document.createElement( "div" );
options._container.appendChild( script );

if ( apikey ) {
script.innerHTML = "api_key: " + apikey;
}

options.type = options.type.toLowerCase();

// Replace the LinkedIn plugin's error message to something more helpful
var errorMsg = function() {

options._container = document.createElement( "p" );
options._container.innerHTML = "Plugin requires a valid <a href='https://www.linkedin.com/secure/developer'>apikey</a>";
document.getElementById( options.target ).appendChild( options._container );
};

var setOptions = (function ( options ) {

return {
Expand Down Expand Up @@ -138,13 +194,13 @@
}
};
})( options );

if ( !apikey ) {
errorMsg();
} else {
setOptions[ options.type ] && setOptions[ options.type ]();
}

if ( document.getElementById( options.target ) ) {
document.getElementById( options.target ).appendChild( options._container );
}
Expand All @@ -165,7 +221,7 @@
* 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";
},
Expand Down

0 comments on commit f9b3b0e

Please sign in to comment.