Skip to content

Commit

Permalink
Tag 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Beauvais committed Feb 19, 2019
1 parent d6b7450 commit fd0a6f2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<a name="2.4.0"></a>
# [2.4.0](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.3.4...2.4.0) (2019-02-19)
- Fix facebook hashtags
- Move rollup-plugin-json to devDependencies
- Improve readme

<a name="2.3.4"></a>
# [2.3.4](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.3.3...2.3.4) (2019-02-11)
- Add support for facebook hashtags (PR #120)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-social-sharing",
"version": "2.3.4",
"version": "2.4.0",
"homepage": "https://github.com/nicolasbeauvais/vue-social-sharing",
"authors": [
"nicolasbeauvais <nicolasbeauvais1@gmail.com>"
Expand Down
29 changes: 17 additions & 12 deletions dist/vue-social-sharing.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-social-sharing v2.3.4
* vue-social-sharing v2.4.0
* (c) 2019 nicolasbeauvais
* Released under the MIT License.
*/
Expand Down Expand Up @@ -234,23 +234,27 @@ var SocialSharing = {
.replace(/@title/g, encodeURIComponent(this.title))
.replace(/@description/g, encodeURIComponent(this.description))
.replace(/@quote/g, encodeURIComponent(this.quote))
.replace(/@hashtags/g, this.encodeFacebookHashtags(network, this.hashtags))
.replace(/@hashtags/g, this.generateHashtags(network, this.hashtags))
.replace(/@media/g, this.media)
.replace(/@twitteruser/g, this.twitterUser ? '&via=' + this.twitterUser : '');
},
/**
* encode hash tag for facebook url
* @param network to check if the current network is facebbok
* @param hashtags all hashtags specified
* @return encoded hashtag [only the first one because of facebook policy]
* Encode hashtags for the specified social network.
*
* @param network Social network key
* @param hashtags All hashtags specified
*/
encodeFacebookHashtags: function encodeFacebookHashtags (network, hashtags) {
return network === 'facebook' ? '%23' + hashtags : hashtags;
generateHashtags: function generateHashtags (network, hashtags) {
if (network === 'facebook') {
return '%23' + hashtags.split(',')[0];
}

return hashtags;
},
/**
* Shares URL in specified network.
*
* @param string network Social network key.
* @param network Social network key.
*/
share: function share (network) {
this.openSharer(network, this.createSharingUrl(network));
Expand All @@ -262,7 +266,7 @@ var SocialSharing = {
/**
* Touches network and emits click event.
*
* @param string network Social network key.
* @param network Social network key.
*/
touch: function touch (network) {
window.open(this.createSharingUrl(network), '_self');
Expand All @@ -274,7 +278,8 @@ var SocialSharing = {
/**
* Opens sharer popup.
*
* @param string url Url to share.
* @param network Social network key
* @param url Url to share.
*/
openSharer: function openSharer (network, url) {
var this$1 = this;
Expand Down Expand Up @@ -360,7 +365,7 @@ var SocialSharing = {
}
};

SocialSharing.version = '2.3.4';
SocialSharing.version = '2.4.0';

SocialSharing.install = function (Vue) {
Vue.component('social-sharing', SocialSharing);
Expand Down
29 changes: 17 additions & 12 deletions dist/vue-social-sharing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-social-sharing v2.3.4
* vue-social-sharing v2.4.0
* (c) 2019 nicolasbeauvais
* Released under the MIT License.
*/
Expand Down Expand Up @@ -236,23 +236,27 @@ var SocialSharing = {
.replace(/@title/g, encodeURIComponent(this.title))
.replace(/@description/g, encodeURIComponent(this.description))
.replace(/@quote/g, encodeURIComponent(this.quote))
.replace(/@hashtags/g, this.encodeFacebookHashtags(network, this.hashtags))
.replace(/@hashtags/g, this.generateHashtags(network, this.hashtags))
.replace(/@media/g, this.media)
.replace(/@twitteruser/g, this.twitterUser ? '&via=' + this.twitterUser : '');
},
/**
* encode hash tag for facebook url
* @param network to check if the current network is facebbok
* @param hashtags all hashtags specified
* @return encoded hashtag [only the first one because of facebook policy]
* Encode hashtags for the specified social network.
*
* @param network Social network key
* @param hashtags All hashtags specified
*/
encodeFacebookHashtags: function encodeFacebookHashtags (network, hashtags) {
return network === 'facebook' ? '%23' + hashtags : hashtags;
generateHashtags: function generateHashtags (network, hashtags) {
if (network === 'facebook') {
return '%23' + hashtags.split(',')[0];
}

return hashtags;
},
/**
* Shares URL in specified network.
*
* @param string network Social network key.
* @param network Social network key.
*/
share: function share (network) {
this.openSharer(network, this.createSharingUrl(network));
Expand All @@ -264,7 +268,7 @@ var SocialSharing = {
/**
* Touches network and emits click event.
*
* @param string network Social network key.
* @param network Social network key.
*/
touch: function touch (network) {
window.open(this.createSharingUrl(network), '_self');
Expand All @@ -276,7 +280,8 @@ var SocialSharing = {
/**
* Opens sharer popup.
*
* @param string url Url to share.
* @param network Social network key
* @param url Url to share.
*/
openSharer: function openSharer (network, url) {
var this$1 = this;
Expand Down Expand Up @@ -362,7 +367,7 @@ var SocialSharing = {
}
};

SocialSharing.version = '2.3.4';
SocialSharing.version = '2.4.0';

SocialSharing.install = function (Vue) {
Vue.component('social-sharing', SocialSharing);
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-social-sharing.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SocialSharing from './social-sharing';

SocialSharing.version = '2.3.4';
SocialSharing.version = '2.4.0';

SocialSharing.install = (Vue) => {
Vue.component('social-sharing', SocialSharing);
Expand Down

0 comments on commit fd0a6f2

Please sign in to comment.