forked from null-none/social-image-sharing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocial-image-sharing.js
26 lines (26 loc) · 1.3 KB
/
social-image-sharing.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
angular.module('socialImageSharing', [])
.directive('imageShare', ['$log', '$window', function($log, $window) {
return {
link: function(scope, element, attrs) {
element.on('click', function() {
switch (element.data('type')) {
case 'facebook':
$window.open('https://www.facebook.com/sharer/sharer.php?u=' + element.data('url'), element.data('text'), config = 'height=300, width=500');
break;
case 'google':
$window.open('https://plus.google.com/share?url=' + element.data('url'), element.data('text'), config = 'height=300, width=500');
break;
case 'twitter':
$window.open('http://twitter.com/home?status=' + element.data('url'), element.data('text'), config = 'height=300, width=500');
break;
case 'pinterest':
$window.open('http://www.pinterest.com/pin/create/button/?url=' + element.data('url') + '&media=' + element.data('url') + '&description=' + element.data('text'), element.data('url'), config = 'height=300, width=500');
break;
case 'vk':
$window.open('http://vk.com/share.php?url=' + element.data('url'), config = 'height = 300, width = 500 ');
break;
}
});
}
}
}]);