-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvjs-social-share.js
48 lines (46 loc) · 1.86 KB
/
vjs-social-share.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* addShareButton()
*
* Creates share button/icons for the video.js player
*
* REFERENCE: https://simplesharebuttons.com/html-share-buttons/
*
* @param player
* @param link
* @param title
* @param image
*/
function addShareButton(player, link, title) {
var Button = videojs.getComponent('Button');
var MyButton = videojs.extend(Button, {
constructor: function() {
Button.apply(this, arguments);
/* initialize your button */
},
handleClick: function() {
$('.vjs-share-button #video-share-icons').slideToggle("slow");
// alert("Coming Soon!");
}
});
videojs.registerComponent('MyButton', MyButton);
var newButton = player.getChild('controlBar').addChild('myButton', {});
newButton.addClass('vjs-share-button');
newButton.el().innerHTML = '<span class="vjs-control-text">Share</span>' +
'<div id="video-share-icons">' +
'<a href="mailto:?Subject=Check Out This Video!&Body=I%20thought%20you%20might%20like%20to%20see%20this!%20 %0D%0A %0D%0A' + title + '%0D%0A' +link+'">' +
'<span class="fa fa-2x fa-envelope"></span>' +
'</a>' +
'<a href="http://www.facebook.com/sharer.php?u=' + link + '" target="_blank">' +
'<span class="fa fa-2x fa-facebook"></span>' +
'</a>' +
'<a href="https://twitter.com/share?url=' + link + '&text=' + title + '&hashtags=SomeTag" target="_blank">' +
'<span class="fa fa-2x fa-twitter"></span>' +
'</a>' +
'<a href="https://plus.google.com/share?url=' + link + '" target="_blank">' +
'<span class="fa fa-2x fa-google-plus"></span>' +
'</a>' +
'<a href="http://www.linkedin.com/shareArticle?mini=true&url=' + link + '" target="_blank">' +
'<span class="fa fa-2x fa-linkedin"></span>' +
'</a>' +
'</div>';
}