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

Commit c89c4a9

Browse files
committed
refactored Facebook based on the new documentation (they are now using og:meta to retrieve images and previews)
1 parent ecd2f77 commit c89c4a9

6 files changed

+24
-46
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.9",
3+
"version": "2.3.10",
44
"description": "A social media url and content share module for angularjs.",
55
"authors": [
66
"Filippo Oretti <[email protected]",

dist/angular-socialshare.js

+10-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* angular-socialshare
3-
* 2.3.9
3+
* 2.3.10
44
*
55
* A social media url and content share module for angularjs.
66
* http://720kb.github.io/angular-socialshare
@@ -372,7 +372,8 @@
372372
var urlString;
373373

374374
if (attrs.socialshareType && attrs.socialshareType === 'feed') {
375-
// if user specifies that they want to use the Facebook feed dialog (https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4)
375+
// if user specifies that they want to use the Facebook feed dialog
376+
//(https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4)
376377
urlString = 'https://www.facebook.com/dialog/feed?';
377378

378379
if (attrs.socialshareVia) {
@@ -412,14 +413,16 @@
412413
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
413414

414415
} else if (attrs.socialshareType && attrs.socialshareType === 'share') {
415-
// if user specifies that they want to use the Facebook feed dialog (https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4)
416+
// if user specifies that they want to use the Facebook share dialog
417+
//(https://developers.facebook.com/docs/sharing/reference/share-dialog)
416418
urlString = 'https://www.facebook.com/dialog/share?';
417419

418420
if (attrs.socialshareVia) {
419421
urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia);
420422
}
421-
if (attrs.socialshareTitle) {
422-
urlString += '&title=' + encodeURIComponent(attrs.socialshareTitle);
423+
424+
if (attrs.socialshareRedirectUri) {
425+
urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri);
423426
}
424427

425428
if (attrs.socialshareUrl) {
@@ -438,29 +441,19 @@
438441
urlString += '&mobile_iframe=' + encodeURIComponent(attrs.socialshareMobileiframe);
439442
}
440443

441-
if (attrs.socialshareDescription) {
442-
urlString += '&description=' + encodeURIComponent(attrs.socialshareDescription);
443-
}
444-
445444
if (attrs.socialshareHashtags) {
446445
urlString += '&hashtag=' + encodeURIComponent(attrs.socialshareHashtags);
447446
}
448447

449-
if (attrs.socialshareCaption) {
450-
urlString += '&caption=' + encodeURIComponent(attrs.socialshareCaption);
451-
}
452-
453-
if (attrs.socialshareMedia) {
454-
urlString += '&picture=' + encodeURIComponent(attrs.socialshareMedia);
455-
}
456448

457449
$window.open(
458450
urlString,
459451
'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
460452
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
461453

462454
} else if (attrs.socialshareType && attrs.socialshareType === 'send') {
463-
// if user specifies that they want to use the Facebook send dialog (https://developers.facebook.com/docs/sharing/reference/send-dialog)
455+
// if user specifies that they want to use the Facebook send dialog
456+
//(https://developers.facebook.com/docs/sharing/reference/send-dialog)
464457
urlString = 'https://www.facebook.com/dialog/send?';
465458

466459
if (attrs.socialshareVia) {
@@ -483,10 +476,6 @@
483476
urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay);
484477
}
485478

486-
if (attrs.socialshareRef) {
487-
urlString += '&ref=' + encodeURIComponent(attrs.socialshareRef);
488-
}
489-
490479
$window.open(
491480
urlString,
492481
'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight

0 commit comments

Comments
 (0)