Skip to content
This repository was archived by the owner on Mar 7, 2022. It is now read-only.

Commit cf9ce4e

Browse files
committed
weibo new provider thanks to @shahzad-0
1 parent 7795e52 commit cf9ce4e

5 files changed

+37
-9
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-socialshare",
3-
"version": "2.3.5",
3+
"version": "2.3.6",
44
"description": "A social media url and content share module for angularjs.",
55
"authors": [
66
"Filippo Oretti <[email protected]",

dist/angular-socialshare.js

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* angular-socialshare
3-
* 2.3.5
3+
* 2.3.6
44
*
55
* A social media url and content share module for angularjs.
66
* http://720kb.github.io/angular-socialshare
77
*
88
* MIT license
9-
* Fri Jan 27 2017
9+
* Tue Feb 07 2017
1010
*/
1111
/*global angular*/
1212
/*eslint no-loop-func:0, func-names:0*/
@@ -16,7 +16,7 @@
1616

1717
var directiveName = 'socialshare'
1818
, serviceName = 'Socialshare'
19-
, socialshareProviderNames = ['facebook', 'facebook-messenger','sms', 'twitter', 'linkedin', 'google', 'pinterest', 'tumblr', 'reddit', 'stumbleupon', 'buffer', 'digg', 'delicious', 'vk', 'pocket', 'wordpress', 'flipboard', 'xing', 'hackernews', 'evernote', 'whatsapp', 'telegram', 'viber', 'skype', 'email', 'ok']
19+
, socialshareProviderNames = ['facebook', 'facebook-messenger','sms', 'twitter', 'linkedin', 'google', 'pinterest', 'tumblr', 'reddit', 'stumbleupon', 'buffer', 'digg', 'delicious', 'vk', 'pocket', 'wordpress', 'flipboard', 'xing', 'hackernews', 'evernote', 'whatsapp', 'telegram', 'viber', 'skype', 'email', 'ok', 'weibo']
2020
, socialshareConfigurationProvider = /*@ngInject*/ function socialshareConfigurationProvider() {
2121

2222
var socialshareConfigurationDefault = [{
@@ -299,6 +299,16 @@
299299
'popupHeight': 600,
300300
'popupWidth': 500
301301
}
302+
},
303+
{
304+
'provider': 'weibo',
305+
'conf': {
306+
'url': '',
307+
'text': '',
308+
'trigger': 'click',
309+
'popupHeight': 600,
310+
'popupWidth': 500
311+
}
302312
}];
303313

304314
return {
@@ -874,6 +884,18 @@
874884
, 'Skype', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
875885
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
876886
}
887+
, weiboShare = function weiboShare($window, attrs) {
888+
var urlString = 'http://service.weibo.com/share/share.php?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href);
889+
890+
if (attrs.socialshareText) {
891+
urlString += '&title=' + encodeURIComponent(attrs.socialshareText);
892+
}
893+
894+
$window.open(
895+
urlString
896+
, 'Weibo', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
897+
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
898+
}
877899
, socialshareService = /*@ngInject*/ ['$window', '$log', function socialshareService($window, $log) {
878900

879901
this.emailShare = manageEmailShare;
@@ -905,6 +927,7 @@
905927
//this.whatsappShare = manageWhatsappShare;
906928
this.skypeShare = skypeShare;
907929
this.smsShare = manageSmsShare;
930+
this.weiboShare = weiboShare;
908931

909932
this.share = function shareTrigger(serviceShareConf) {
910933

@@ -1001,6 +1024,10 @@
10011024
this.flipboardShare($window, serviceShareConf.attrs);
10021025
break;
10031026
}
1027+
case 'weibo': {
1028+
this.weiboShare($window, serviceShareConf.attrs);
1029+
break;
1030+
}
10041031
default: {
10051032
return;
10061033
}
@@ -1104,6 +1131,7 @@
11041131
, 'telegram': manageTelegramShare
11051132
, 'viber': manageViberShare
11061133
, 'skype': skypeShare
1134+
, 'weibo': weiboShare
11071135
};
11081136

11091137

0 commit comments

Comments
 (0)