Skip to content

Commit 228e870

Browse files
committed
Update docs
1 parent c22d1de commit 228e870

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed
Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +0,0 @@
1-
require(['gitbook', 'jquery'], function(gitbook, $) {
2-
var SITES = {
3-
'facebook': {
4-
'label': 'Facebook',
5-
'icon': 'fa fa-facebook',
6-
'onClick': function(e) {
7-
e.preventDefault();
8-
window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href));
9-
}
10-
},
11-
'twitter': {
12-
'label': 'Twitter',
13-
'icon': 'fa fa-twitter',
14-
'onClick': function(e) {
15-
e.preventDefault();
16-
window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href));
17-
}
18-
},
19-
'google': {
20-
'label': 'Google+',
21-
'icon': 'fa fa-google-plus',
22-
'onClick': function(e) {
23-
e.preventDefault();
24-
window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href));
25-
}
26-
},
27-
'weibo': {
28-
'label': 'Weibo',
29-
'icon': 'fa fa-weibo',
30-
'onClick': function(e) {
31-
e.preventDefault();
32-
window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title));
33-
}
34-
},
35-
'instapaper': {
36-
'label': 'Instapaper',
37-
'icon': 'fa fa-instapaper',
38-
'onClick': function(e) {
39-
e.preventDefault();
40-
window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href));
41-
}
42-
},
43-
'vk': {
44-
'label': 'VK',
45-
'icon': 'fa fa-vk',
46-
'onClick': function(e) {
47-
e.preventDefault();
48-
window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href));
49-
}
50-
}
51-
};
52-
53-
54-
55-
gitbook.events.bind('start', function(e, config) {
56-
var opts = config.sharing;
57-
58-
// Create dropdown menu
59-
var menu = $.map(opts.all, function(id) {
60-
var site = SITES[id];
61-
62-
return {
63-
text: site.label,
64-
onClick: site.onClick
65-
};
66-
});
67-
68-
// Create main button with dropdown
69-
if (menu.length > 0) {
70-
gitbook.toolbar.createButton({
71-
icon: 'fa fa-share-alt',
72-
label: 'Share',
73-
position: 'right',
74-
dropdown: [menu]
75-
});
76-
}
77-
78-
// Direct actions to share
79-
$.each(SITES, function(sideId, site) {
80-
if (!opts[sideId]) return;
81-
82-
gitbook.toolbar.createButton({
83-
icon: site.icon,
84-
label: site.text,
85-
position: 'right',
86-
onClick: site.onClick
87-
});
88-
});
89-
});
90-
});

0 commit comments

Comments
 (0)