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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// All the sharing platforms
const SITES = {
// One sharing platform
'facebook': {
// Displayed name
label: 'Facebook',
// Font-awesome icon id
icon: 'facebook',
/**
* Share a page on this platform
* @param {String} url The url to share
* @param {String} title The title of the url page
*/
onShare(url, title) {
url = encodeURIComponent(url);
window.open(`http://www.facebook.com/sharer/sharer.php?s=100&p[url]=${url}`);
}
},
'twitter': {
label: 'Twitter',
icon: 'twitter',
onShare(url, title) {
const status = encodeURIComponent(title + ' ' + url);
window.open(`http://twitter.com/home?status=${status}`);
}
},
'google': {
label: 'Google+',
icon: 'google-plus',
onShare(url, title) {
url = encodeURIComponent(url);
window.open(`https://plus.google.com/share?url=${url}`);
}
},
'weibo': {
label: 'Weibo',
icon: 'weibo',
onShare(url, title) {
url = encodeURIComponent(url);
title = encodeURIComponent(title);
window.open(`http://service.weibo.com/share/share.php?content=utf-8&url=${url}&title=${title}`);
}
},
'instapaper': {
label: 'Instapaper',
icon: 'instapaper',
onShare(url, title) {
url = encodeURIComponent(url);
window.open(`http://www.instapaper.com/text?u=${url}`);
}
},
'vk': {
label: 'VK',
icon: 'vk',
onShare(url, title) {
url = encodeURIComponent(url);
window.open(`http://vkontakte.ru/share.php?url=${url}`);
}
}
};
SITES.ALL = Object.keys(SITES);
module.exports = SITES;
|