vue-social-sharing
Advanced tools
Comparing version 2.4.4 to 2.4.5
@@ -0,1 +1,5 @@ | ||
<a name="2.4.5"></a> | ||
# [2.4.5](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.4.4...2.4.5) (2019-05-31) | ||
- Fix IOS Twitter sharing with empty hashtags | ||
<a name="2.4.4"></a> | ||
@@ -2,0 +6,0 @@ # [2.4.4](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.4.3...2.4.4) (2019-05-29) |
/*! | ||
* vue-social-sharing v2.4.4 | ||
* vue-social-sharing v2.4.5 | ||
* (c) 2019 nicolasbeauvais | ||
@@ -237,2 +237,6 @@ * Released under the MIT License. | ||
/** | ||
* On IOS, SMS sharing link need a special formating | ||
* Source: https://weblog.west-wind.com/posts/2013/Oct/09/Prefilling-an-SMS-on-Mobile-Devices-with-the-sms-Uri-Scheme#Body-only | ||
*/ | ||
if (network === 'sms' && (ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1)) { | ||
@@ -242,3 +246,13 @@ network += '_ios'; | ||
return this.baseNetworks[network].sharer | ||
var url = this.baseNetworks[network].sharer; | ||
/** | ||
* On IOS, Twitter sharing shouldn't include a hashtag parameter if the hashtag value is empty | ||
* Source: https://github.com/nicolasbeauvais/vue-social-sharing/issues/143 | ||
*/ | ||
if (network === 'twitter' && this.hashtags.length === 0) { | ||
url.replace('&hashtags=@hashtags', ''); | ||
} | ||
return url | ||
.replace(/@url/g, encodeURIComponent(this.url)) | ||
@@ -380,3 +394,3 @@ .replace(/@title/g, encodeURIComponent(this.title)) | ||
SocialSharing.version = '2.4.4'; | ||
SocialSharing.version = '2.4.5'; | ||
@@ -383,0 +397,0 @@ SocialSharing.install = function (Vue) { |
/*! | ||
* vue-social-sharing v2.4.4 | ||
* vue-social-sharing v2.4.5 | ||
* (c) 2019 nicolasbeauvais | ||
@@ -239,2 +239,6 @@ * Released under the MIT License. | ||
/** | ||
* On IOS, SMS sharing link need a special formating | ||
* Source: https://weblog.west-wind.com/posts/2013/Oct/09/Prefilling-an-SMS-on-Mobile-Devices-with-the-sms-Uri-Scheme#Body-only | ||
*/ | ||
if (network === 'sms' && (ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1)) { | ||
@@ -244,3 +248,13 @@ network += '_ios'; | ||
return this.baseNetworks[network].sharer | ||
var url = this.baseNetworks[network].sharer; | ||
/** | ||
* On IOS, Twitter sharing shouldn't include a hashtag parameter if the hashtag value is empty | ||
* Source: https://github.com/nicolasbeauvais/vue-social-sharing/issues/143 | ||
*/ | ||
if (network === 'twitter' && this.hashtags.length === 0) { | ||
url.replace('&hashtags=@hashtags', ''); | ||
} | ||
return url | ||
.replace(/@url/g, encodeURIComponent(this.url)) | ||
@@ -382,3 +396,3 @@ .replace(/@title/g, encodeURIComponent(this.title)) | ||
SocialSharing.version = '2.4.4'; | ||
SocialSharing.version = '2.4.5'; | ||
@@ -385,0 +399,0 @@ SocialSharing.install = function (Vue) { |
/*! | ||
* vue-social-sharing v2.4.4 | ||
* vue-social-sharing v2.4.5 | ||
* (c) 2019 nicolasbeauvais | ||
* Released under the MIT License. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):t.VueSocialSharing=e(t.Vue)}(this,function(t){"use strict";t="default"in t?t.default:t;var e={functional:!0,props:{network:{type:String,default:""}},render:function(t,e){var r=e.parent._data.baseNetworks[e.props.network];return r?t(e.parent.networkTag,{staticClass:e.data.staticClass||null,staticStyle:e.data.staticStyle||null,class:e.data.class||null,style:e.data.style||null,attrs:{id:e.data.attrs.id||null,tabindex:e.data.attrs.tabindex||0,"data-link":"popup"===r.type?"#share-"+e.props.network:e.parent.createSharingUrl(e.props.network),"data-action":"popup"===r.type?null:r.action},on:{click:"popup"===r.type?function(){e.parent.share(e.props.network)}:function(){e.parent.touch(e.props.network)}}},e.children):console.warn("Network "+e.props.network+" does not exist")}},r={sharer:"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description",type:"direct"},i={sharer:"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description"e=@quote&hashtag=@hashtags",type:"popup"},s={sharer:"https://plus.google.com/share?url=@url",type:"popup"},o={sharer:"http://line.me/R/msg/text/?@description%0D%0A@url",type:"popup"},p={sharer:"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description",type:"popup"},n={sharer:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description",type:"popup"},a={sharer:"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title",type:"popup"},l={sharer:"https://www.reddit.com/submit?url=@url&title=@title",type:"popup"},u={sharer:"https://web.skype.com/share?url=@description%0D%0A@url",type:"popup"},h={sharer:"https://t.me/share/url?url=@url&text=@description",type:"popup"},c={sharer:"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser",type:"popup"},d={sharer:"viber://forward?text=@url @description",type:"direct"},m={sharer:"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true",type:"popup"},w={sharer:"http://service.weibo.com/share/share.php?url=@url&title=@title",type:"popup"},f={sharer:"https://api.whatsapp.com/send?text=@description%0D%0A@url",type:"popup",action:"share/whatsapp/share"},g={sharer:"sms:?body=@url%20@description",type:"direct"},y={sharer:"sms:;body=@url%20@description",type:"direct"},b={email:r,facebook:i,googleplus:s,line:o,linkedin:p,odnoklassniki:n,pinterest:a,reddit:l,skype:u,telegram:h,twitter:c,viber:d,vk:m,weibo:w,whatsapp:f,sms:g,sms_ios:y},k="undefined"!=typeof window,v=k?window:null,S={props:{url:{type:String,default:k?window.location.href:""},title:{type:String,default:""},description:{type:String,default:""},quote:{type:String,default:""},hashtags:{type:String,default:""},twitterUser:{type:String,default:""},withCounts:{type:[String,Boolean],default:!1},googleKey:{type:String,default:void 0},media:{type:String,default:""},networkTag:{type:String,default:"span"},networks:{type:Object,default:function(){return{}}}},data:function(){return{baseNetworks:b,popup:{status:!1,resizable:!0,toolbar:!1,menubar:!1,scrollbars:!1,location:!1,directories:!1,width:626,height:436,top:0,left:0,window:void 0,interval:null}}},methods:{createSharingUrl:function(t){var e=navigator.userAgent.toLowerCase();return"sms"===t&&(e.indexOf("iphone")>-1||e.indexOf("ipad")>-1)&&(t+="_ios"),this.baseNetworks[t].sharer.replace(/@url/g,encodeURIComponent(this.url)).replace(/@title/g,encodeURIComponent(this.title)).replace(/@description/g,encodeURIComponent(this.description)).replace(/@quote/g,encodeURIComponent(this.quote)).replace(/@hashtags/g,this.generateHashtags(t,this.hashtags)).replace(/@media/g,this.media).replace(/@twitteruser/g,this.twitterUser?"&via="+this.twitterUser:"")},generateHashtags:function(t,e){return"facebook"===t&&e.length>0?"%23"+e.split(",")[0]:e},share:function(t){this.openSharer(t,this.createSharingUrl(t)),this.$root.$emit("social_shares_open",t,this.url),this.$emit("open",t,this.url)},touch:function(t){window.open(this.createSharingUrl(t),"_self"),this.$root.$emit("social_shares_open",t,this.url),this.$emit("open",t,this.url)},openSharer:function(t,e){var r=this,i=null;i&&this.popup.interval&&(clearInterval(this.popup.interval),i.close(),this.$root.$emit("social_shares_change",t,this.url),this.$emit("change",t,this.url)),i=window.open(e,"sharer","status="+(this.popup.status?"yes":"no")+",height="+this.popup.height+",width="+this.popup.width+",resizable="+(this.popup.resizable?"yes":"no")+",left="+this.popup.left+",top="+this.popup.top+",screenX="+this.popup.left+",screenY="+this.popup.top+",toolbar="+(this.popup.toolbar?"yes":"no")+",menubar="+(this.popup.menubar?"yes":"no")+",scrollbars="+(this.popup.scrollbars?"yes":"no")+",location="+(this.popup.location?"yes":"no")+",directories="+(this.popup.directories?"yes":"no")),i.focus(),this.popup.interval=setInterval(function(){i.closed&&(clearInterval(r.popup.interval),i=void 0,r.$root.$emit("social_shares_close",t,r.url),r.$emit("close",t,r.url))},500)}},beforeMount:function(){this.baseNetworks=t.util.extend(this.baseNetworks,this.networks)},mounted:function(){if(k){var t=void 0!==v.screenLeft?v.screenLeft:screen.left,e=void 0!==v.screenTop?v.screenTop:screen.top,r=v.innerWidth?v.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=v.innerHeight?v.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;this.popup.left=r/2-this.popup.width/2+t,this.popup.top=i/2-this.popup.height/2+e}},components:{network:e}};return S.version="2.4.4",S.install=function(t){t.component("social-sharing",S)},"undefined"!=typeof window&&(window.SocialSharing=S),S}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):t.VueSocialSharing=e(t.Vue)}(this,function(t){"use strict";t="default"in t?t.default:t;var e={functional:!0,props:{network:{type:String,default:""}},render:function(t,e){var r=e.parent._data.baseNetworks[e.props.network];return r?t(e.parent.networkTag,{staticClass:e.data.staticClass||null,staticStyle:e.data.staticStyle||null,class:e.data.class||null,style:e.data.style||null,attrs:{id:e.data.attrs.id||null,tabindex:e.data.attrs.tabindex||0,"data-link":"popup"===r.type?"#share-"+e.props.network:e.parent.createSharingUrl(e.props.network),"data-action":"popup"===r.type?null:r.action},on:{click:"popup"===r.type?function(){e.parent.share(e.props.network)}:function(){e.parent.touch(e.props.network)}}},e.children):console.warn("Network "+e.props.network+" does not exist")}},r={sharer:"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description",type:"direct"},i={sharer:"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description"e=@quote&hashtag=@hashtags",type:"popup"},s={sharer:"https://plus.google.com/share?url=@url",type:"popup"},o={sharer:"http://line.me/R/msg/text/?@description%0D%0A@url",type:"popup"},p={sharer:"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description",type:"popup"},n={sharer:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description",type:"popup"},a={sharer:"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title",type:"popup"},l={sharer:"https://www.reddit.com/submit?url=@url&title=@title",type:"popup"},h={sharer:"https://web.skype.com/share?url=@description%0D%0A@url",type:"popup"},u={sharer:"https://t.me/share/url?url=@url&text=@description",type:"popup"},c={sharer:"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser",type:"popup"},d={sharer:"viber://forward?text=@url @description",type:"direct"},m={sharer:"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true",type:"popup"},w={sharer:"http://service.weibo.com/share/share.php?url=@url&title=@title",type:"popup"},g={sharer:"https://api.whatsapp.com/send?text=@description%0D%0A@url",type:"popup",action:"share/whatsapp/share"},f={sharer:"sms:?body=@url%20@description",type:"direct"},y={sharer:"sms:;body=@url%20@description",type:"direct"},b={email:r,facebook:i,googleplus:s,line:o,linkedin:p,odnoklassniki:n,pinterest:a,reddit:l,skype:h,telegram:u,twitter:c,viber:d,vk:m,weibo:w,whatsapp:g,sms:f,sms_ios:y},k="undefined"!=typeof window,v=k?window:null,S={props:{url:{type:String,default:k?window.location.href:""},title:{type:String,default:""},description:{type:String,default:""},quote:{type:String,default:""},hashtags:{type:String,default:""},twitterUser:{type:String,default:""},withCounts:{type:[String,Boolean],default:!1},googleKey:{type:String,default:void 0},media:{type:String,default:""},networkTag:{type:String,default:"span"},networks:{type:Object,default:function(){return{}}}},data:function(){return{baseNetworks:b,popup:{status:!1,resizable:!0,toolbar:!1,menubar:!1,scrollbars:!1,location:!1,directories:!1,width:626,height:436,top:0,left:0,window:void 0,interval:null}}},methods:{createSharingUrl:function(t){var e=navigator.userAgent.toLowerCase();"sms"===t&&(e.indexOf("iphone")>-1||e.indexOf("ipad")>-1)&&(t+="_ios");var r=this.baseNetworks[t].sharer;return"twitter"===t&&0===this.hashtags.length&&r.replace("&hashtags=@hashtags",""),r.replace(/@url/g,encodeURIComponent(this.url)).replace(/@title/g,encodeURIComponent(this.title)).replace(/@description/g,encodeURIComponent(this.description)).replace(/@quote/g,encodeURIComponent(this.quote)).replace(/@hashtags/g,this.generateHashtags(t,this.hashtags)).replace(/@media/g,this.media).replace(/@twitteruser/g,this.twitterUser?"&via="+this.twitterUser:"")},generateHashtags:function(t,e){return"facebook"===t&&e.length>0?"%23"+e.split(",")[0]:e},share:function(t){this.openSharer(t,this.createSharingUrl(t)),this.$root.$emit("social_shares_open",t,this.url),this.$emit("open",t,this.url)},touch:function(t){window.open(this.createSharingUrl(t),"_self"),this.$root.$emit("social_shares_open",t,this.url),this.$emit("open",t,this.url)},openSharer:function(t,e){var r=this,i=null;i&&this.popup.interval&&(clearInterval(this.popup.interval),i.close(),this.$root.$emit("social_shares_change",t,this.url),this.$emit("change",t,this.url)),i=window.open(e,"sharer","status="+(this.popup.status?"yes":"no")+",height="+this.popup.height+",width="+this.popup.width+",resizable="+(this.popup.resizable?"yes":"no")+",left="+this.popup.left+",top="+this.popup.top+",screenX="+this.popup.left+",screenY="+this.popup.top+",toolbar="+(this.popup.toolbar?"yes":"no")+",menubar="+(this.popup.menubar?"yes":"no")+",scrollbars="+(this.popup.scrollbars?"yes":"no")+",location="+(this.popup.location?"yes":"no")+",directories="+(this.popup.directories?"yes":"no")),i.focus(),this.popup.interval=setInterval(function(){i.closed&&(clearInterval(r.popup.interval),i=void 0,r.$root.$emit("social_shares_close",t,r.url),r.$emit("close",t,r.url))},500)}},beforeMount:function(){this.baseNetworks=t.util.extend(this.baseNetworks,this.networks)},mounted:function(){if(k){var t=void 0!==v.screenLeft?v.screenLeft:screen.left,e=void 0!==v.screenTop?v.screenTop:screen.top,r=v.innerWidth?v.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=v.innerHeight?v.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;this.popup.left=r/2-this.popup.width/2+t,this.popup.top=i/2-this.popup.height/2+e}},components:{network:e}};return S.version="2.4.5",S.install=function(t){t.component("social-sharing",S)},"undefined"!=typeof window&&(window.SocialSharing=S),S}); |
{ | ||
"name": "vue-social-sharing", | ||
"description": "A Vue.js component for sharing links to social networks", | ||
"version": "2.4.4", | ||
"version": "2.4.5", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "nicolasbeauvais", |
import SocialSharing from './social-sharing'; | ||
SocialSharing.version = '2.4.4'; | ||
SocialSharing.version = '2.4.5'; | ||
@@ -5,0 +5,0 @@ SocialSharing.install = (Vue) => { |
@@ -156,2 +156,6 @@ import SocialSharingNetwork from './social-sharing-network'; | ||
/** | ||
* On IOS, SMS sharing link need a special formating | ||
* Source: https://weblog.west-wind.com/posts/2013/Oct/09/Prefilling-an-SMS-on-Mobile-Devices-with-the-sms-Uri-Scheme#Body-only | ||
*/ | ||
if (network === 'sms' && (ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1)) { | ||
@@ -161,3 +165,13 @@ network += '_ios'; | ||
return this.baseNetworks[network].sharer | ||
const url = this.baseNetworks[network].sharer; | ||
/** | ||
* On IOS, Twitter sharing shouldn't include a hashtag parameter if the hashtag value is empty | ||
* Source: https://github.com/nicolasbeauvais/vue-social-sharing/issues/143 | ||
*/ | ||
if (network === 'twitter' && this.hashtags.length === 0) { | ||
url.replace('&hashtags=@hashtags', ''); | ||
} | ||
return url | ||
.replace(/@url/g, encodeURIComponent(this.url)) | ||
@@ -164,0 +178,0 @@ .replace(/@title/g, encodeURIComponent(this.title)) |
60381
1096