This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.social-share-custom.js
54 lines (53 loc) · 2.16 KB
/
jquery.social-share-custom.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
49
50
51
52
53
54
(function ($) {
window.fbAsyncInit = function() {
FB.init({
appId : '<insert your id>',
xfbml : true,
version : 'v2.5'
});
};
$.fn.ShareTwitter = function (link, text, hashtags) {
return this.click(function () {
window.open(
'https://twitter.com/share' +
'?url=' + encodeURIComponent(typeof link === 'function' ? link() : link) +
'&text=' + encodeURIComponent(typeof text === 'function' ? text() : text) +
'&hashtags=' + encodeURIComponent(hashtags),
'',
'width=626,height=436');
return false;
});
};
$.fn.ShareFacebook = function (link, text, picture) {
return this.click(function () {
FB.ui({
method: 'feed',
link: encodeURIComponent(typeof link === 'function' ? link() : link),
caption: encodeURIComponent(typeof text === 'function' ? text() : text),
picture: picture,
display: 'popup'
});
return false;
});
};
$.fn.ShareMail = function (text, link, subject) {
return this.click(function () {
document.location.href =
'mailto:[email protected]' +
'?body=' + encodeURIComponent(typeof text === 'function' ? text() : text) + (typeof link === 'function' ? link() : link) +
'&subject=' + encodeURIComponent(subject);
return false;
});
};
$.fn.ShareLinkedIn = function (link, title, summary) {
return this.click(function () {
window.open(
'http://www.linkedin.com/shareArticle?mini=true' +
'&url=' + encodeURIComponent(typeof link === 'function' ? link() : link) +
'&title=' + encodeURIComponent(typeof title === 'function' ? title() : title) +
'&summary=' + encodeURIComponent(typeof summary === 'function' ? summary() : summary)
);
return false;
});
};
})(jQuery);