<script src="../../popcorn.js"></script>
<script src="popcorn.linkedin.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+
+ var p = Popcorn( "#video" )
+ .volume( 0 )
.play()
.linkedin({
- type : 'share',
- counter : 'right',
- url : "http://www.google.ca",
- target : "sharediv",
- apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
- start : 1,
- end : 3
+ type: "share",
+ counter: "right",
+ url: "http://www.google.ca",
+ target: "sharediv",
+ apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
+ start: 1,
+ end: 3
})
.linkedin({
- type : 'recommendproduct',
- counter : 'top',
+ type : "recommendproduct",
+ counter : "top",
target : "recommenddiv",
- companyid : 'LinkedIn',
- productid : '201714',
- apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ companyid : "LinkedIn",
+ productid : "201714",
+ apikey : "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start : 4,
end : 7
})
.linkedin({
- type : 'memberprofile',
- memberid : '/in/jeffweiner08',
- format : 'inline',
+ type : "memberprofile",
+ memberid : "/in/jeffweiner08",
+ format : "inline",
target : "memberprofilediv",
- apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start : 9,
end : 11
})
.linkedin({
- type : 'companyinsider',
- companyid : '1441',
+ type : "companyinsider",
+ companyid : "1441",
target : "bottomdiv",
- apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start : 9,
end : 11
})
.linkedin({
- type : 'companyprofile',
- companyid : '1441',
- format : 'inline',
+ type : "companyprofile",
+ companyid : "1441",
+ format : "inline",
target : "bottomdiv",
- apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
start : 13,
end : 17
});
</p>
<div>
- <video id='video'
- controls preload='none'
- width= '350px'
+ <video id="video"
+ controls preload="none"
+ width="350px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
<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">
- <br />
- </div>
+ <div id="bottomdiv"></div>
</body>
</html>
\ No newline at end of file
//PLUGIN: linkedin
+
(function (Popcorn){
+
/**
* LinkedIn Popcorn plug-in
* Places a LinkedIn plugin inside a div ( http://developers.facebook.com/docs/plugins/ )
* Example:
* <script src="popcorn.linkedin.js"></script>
* ...
- * var p = Popcorn('#video')
+ * var p = Popcorn("#video")
* .linkedin({
- * type : 'share',
- * url : "http://www.google.ca",
- * counter : "right",
- * target : 'sharediv'
- * apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
- * start : 1,
- * end : 3
+ * type: "share",
+ * url: "http://www.google.ca",
+ * counter: "right",
+ * target: "sharediv"
+ * 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.
*/
-
Popcorn.plugin( "linkedin", {
-
manifest: {
-
about: {
-
- name : "Popcorn LinkedIn Plugin",
+ name: "Popcorn LinkedIn Plugin",
version: "0.1",
- author : "Dan Ventura",
+ author: "Dan Ventura",
website: "dsventura.blogspot.com"
},
options: {
-
- type : {elem:"input", type:'text', label:"Type"},
- target : 'linkedin-container'
+ type: {
+ elem: "input",
+ type: "text",
+ label: "Type"
+ },
+ target: "linkedin-container"
}
},
-
_setup: function( options ) {
var apikey = options.apikey,
- target = document.getElementById( options.target );
+ target = document.getElementById( options.target );
+
+ if ( !document.getElementById( "linkedin-root" ) ) {
+
+ var root = document.createElement( "div" );
- if ( !document.getElementById("linkedin-root") ) {
- var root = document.createElement( 'div' );
- root.setAttribute( 'div', "linkedin-root" );
+ root.setAttribute( "div", "linkedin-root" );
document.body.appendChild( root );
(function() {
- var linkedinAPIScript = document.createElement( 'script' );
- linkedinAPIScript.setAttribute( 'src', "http://platform.linkedin.com/in.js" );
- linkedinAPIScript.setAttribute( 'type', "text/javascript" );
- linkedinAPIScript.setAttribute( 'async', 'true' );
+
+ var linkedinAPIScript = document.createElement( "script" );
+ linkedinAPIScript.setAttribute( "src", "http://platform.linkedin.com/in.js" );
+ linkedinAPIScript.setAttribute( "type", "text/javascript" );
+ linkedinAPIScript.setAttribute( "async", "true" );
root.appendChild( linkedinAPIScript );
}());
}
- options._container = document.createElement( 'script' );
+ options._container = document.createElement( "script" );
if ( apikey ) {
- options._container.innerHTML = 'api_key: ' + apikey;
+ options._container.innerHTML = "api_key: " + apikey;
}
options.type = options.type.toLowerCase();
var setOptions = (function ( options ) {
return {
-
share: function () {
- options._container.setAttribute( 'type', "IN/Share" );
+ options._container.setAttribute( "type", "IN/Share" );
+
if ( options.counter ) {
- options._container.setAttribute( 'data-counter', options.counter );
+ options._container.setAttribute( "data-counter", options.counter );
}
if ( options.url ) {
- options._container.setAttribute( 'data-url', options.url);
+ options._container.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" ) );
+ options._container.setAttribute( "type", "IN/MemberProfile" );
+ options._container.setAttribute( "data-id", ( options.memberid ) );
+ options._container.setAttribute( "data-format", ( options.format || "inline" ) );
+
if ( options.text && options.format.toLowerCase() !== "inline" ) {
- options._container.setAttribute( 'data-text', options.text );
+ options._container.setAttribute( "data-text", options.text );
}
},
companyinsider: function () {
- options._container.setAttribute( 'type', "IN/CompanyInsider" );
- options._container.setAttribute( 'data-id', options.companyid );
+ options._container.setAttribute( "type", "IN/CompanyInsider" );
+ options._container.setAttribute( "data-id", options.companyid );
+
if( options.modules ) {
- options._container.setAttribute( 'data-modules', 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" ) );
+ options._container.setAttribute( "type", "IN/CompanyProfile" );
+ options._container.setAttribute( "data-id", ( options.companyid ) );
+ options._container.setAttribute( "data-format", ( options.format || "inline" ) );
+
if ( options.text && options.format.toLowerCase() !== "inline" ) {
- options._container.setAttribute( 'data-text', options.text );
+ options._container.setAttribute( "data-text", options.text );
}
if ( options.related !== undefined ) {
- options._container.setAttribute( 'data-related', options.related );
+ options._container.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" ) );
+ options._container.setAttribute( "type", "IN/RecommendProduct" );
+ options._container.setAttribute( "data-company", ( options.companyid || "LinkedIn" ) );
+ options._container.setAttribute( "data-product", ( options.productid || "201714" ) );
+
if ( options.counter ) {
- options._container.setAttribute( 'data-counter', options.counter );
+ options._container.setAttribute( "data-counter", options.counter );
}
}
};
})( options );
if ( !apikey ) {
-
errorMsg();
} else {
-
setOptions[ options.type ] && setOptions[ options.type ]();
}
target.style.display = "none";
},
-
/**
* @member linkedin
* The start function will be executed when the currentTime
* options variable
*/
start: function( event, options ) {
-
options._container.parentNode.style.display = "block";
},
-
/**
* @member linkedin
* The end function will be executed when the currentTime
* options variable
*/
end: function( event, options ) {
-
options._container.parentNode.style.display = "none";
}
});
-
})( Popcorn );
\ No newline at end of file