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

Commit

Permalink
refactored Facebook based on the new documentation (they are now usin…
Browse files Browse the repository at this point in the history
…g og:meta to retrieve images and previews)
  • Loading branch information
45kb committed Jun 16, 2017
1 parent ecd2f77 commit c89c4a9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 46 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-socialshare",
"version": "2.3.9",
"version": "2.3.10",
"description": "A social media url and content share module for angularjs.",
"authors": [
"Filippo Oretti <[email protected]",
Expand Down
31 changes: 10 additions & 21 deletions dist/angular-socialshare.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* angular-socialshare
* 2.3.9
* 2.3.10
*
* A social media url and content share module for angularjs.
* http://720kb.github.io/angular-socialshare
Expand Down Expand Up @@ -372,7 +372,8 @@
var urlString;

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

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

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

if (attrs.socialshareVia) {
urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia);
}
if (attrs.socialshareTitle) {
urlString += '&title=' + encodeURIComponent(attrs.socialshareTitle);

if (attrs.socialshareRedirectUri) {
urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri);
}

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

if (attrs.socialshareDescription) {
urlString += '&description=' + encodeURIComponent(attrs.socialshareDescription);
}

if (attrs.socialshareHashtags) {
urlString += '&hashtag=' + encodeURIComponent(attrs.socialshareHashtags);
}

if (attrs.socialshareCaption) {
urlString += '&caption=' + encodeURIComponent(attrs.socialshareCaption);
}

if (attrs.socialshareMedia) {
urlString += '&picture=' + encodeURIComponent(attrs.socialshareMedia);
}

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

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

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

if (attrs.socialshareRef) {
urlString += '&ref=' + encodeURIComponent(attrs.socialshareRef);
}

$window.open(
urlString,
'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
Expand Down
Loading

0 comments on commit c89c4a9

Please sign in to comment.