New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-social-sharing

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-social-sharing - npm Package Compare versions

Comparing version 2.2.11 to 2.3.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

<a name="2.3.1"></a>
# [2.3.1](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.2.11...2.3.1) (2017-12-03)
- Possibility to add custom networks or override existing ones
<a name="2.2.11"></a>

@@ -2,0 +6,0 @@ # [2.2.11](https://github.com/nicolasbeauvais/vue-social-sharing/compare/2.2.10...2.2.11) (2017-12-03)

104

dist/vue-social-sharing.common.js
/*!
* vue-social-sharing v2.2.11
* vue-social-sharing v2.3.1
* (c) 2017 nicolasbeauvais

@@ -8,35 +8,6 @@ * Released under the MIT License.

var email = {"sharer":"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description","type":"direct"};
var facebook = {"sharer":"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote","type":"popup"};
var googleplus = {"sharer":"https://plus.google.com/share?url=@url","type":"popup"};
var line = {"sharer":"http://line.me/R/msg/text/?@description%0D%0A@url","type":"popup"};
var linkedin = {"sharer":"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description","type":"popup"};
var odnoklassniki = {"sharer":"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description","type":"popup"};
var pinterest = {"sharer":"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title","type":"popup"};
var reddit = {"sharer":"https://www.reddit.com/submit?url=@url&title=@title","type":"popup"};
var skype = {"sharer":"https://web.skype.com/share?url=@description%0D%0A@url","type":"popup"};
var telegram = {"sharer":"https://t.me/share/url?url=@url&text=@description","type":"popup"};
var twitter = {"sharer":"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser","type":"popup"};
var vk = {"sharer":"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true","type":"popup"};
var weibo = {"sharer":"http://service.weibo.com/share/share.php?url=@url&title=@title","type":"popup"};
var whatsapp = {"sharer":"whatsapp://send?text=@description%0D%0A@url","type":"direct","action":"share/whatsapp/share"};
var sms = {"sharer":"sms:?body=@url%20@description","type":"direct"};
var Networks = {
email: email,
facebook: facebook,
googleplus: googleplus,
line: line,
linkedin: linkedin,
odnoklassniki: odnoklassniki,
pinterest: pinterest,
reddit: reddit,
skype: skype,
telegram: telegram,
twitter: twitter,
vk: vk,
weibo: weibo,
whatsapp: whatsapp,
sms: sms
};
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var Vue = _interopDefault(require('vue'));
var SocialSharingNetwork = {

@@ -52,4 +23,4 @@ functional: true,

render: function render (createElement, context) {
var network = Networks[context.props.network];
render: function (createElement, context) {
var network = context.parent._data.baseNetworks[context.props.network];

@@ -83,2 +54,35 @@ if (!network) {

var email = {"sharer":"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description","type":"direct"};
var facebook = {"sharer":"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote","type":"popup"};
var googleplus = {"sharer":"https://plus.google.com/share?url=@url","type":"popup"};
var line = {"sharer":"http://line.me/R/msg/text/?@description%0D%0A@url","type":"popup"};
var linkedin = {"sharer":"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description","type":"popup"};
var odnoklassniki = {"sharer":"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description","type":"popup"};
var pinterest = {"sharer":"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title","type":"popup"};
var reddit = {"sharer":"https://www.reddit.com/submit?url=@url&title=@title","type":"popup"};
var skype = {"sharer":"https://web.skype.com/share?url=@description%0D%0A@url","type":"popup"};
var telegram = {"sharer":"https://t.me/share/url?url=@url&text=@description","type":"popup"};
var twitter = {"sharer":"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser","type":"popup"};
var vk = {"sharer":"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true","type":"popup"};
var weibo = {"sharer":"http://service.weibo.com/share/share.php?url=@url&title=@title","type":"popup"};
var whatsapp = {"sharer":"whatsapp://send?text=@description%0D%0A@url","type":"direct","action":"share/whatsapp/share"};
var sms = {"sharer":"sms:?body=@url%20@description","type":"direct"};
var BaseNetworks = {
email: email,
facebook: facebook,
googleplus: googleplus,
line: line,
linkedin: linkedin,
odnoklassniki: odnoklassniki,
pinterest: pinterest,
reddit: reddit,
skype: skype,
telegram: telegram,
twitter: twitter,
vk: vk,
weibo: weibo,
whatsapp: whatsapp,
sms: sms
};
var inBrowser = typeof window !== 'undefined';

@@ -178,2 +182,13 @@ var $window = inBrowser ? window : null;

default: 'span'
},
/**
* Additional or overridden networks.
* Default to BaseNetworks
*/
networks: {
type: Object,
default: function () {
return {};
}
}

@@ -188,3 +203,3 @@ },

*/
networks: Networks,
baseNetworks: BaseNetworks,

@@ -220,3 +235,3 @@ /**

createSharingUrl: function createSharingUrl (network) {
return this.networks[network].sharer
return this.baseNetworks[network].sharer
.replace(/@url/g, encodeURIComponent(this.url))

@@ -238,2 +253,3 @@ .replace(/@title/g, encodeURIComponent(this.title))

this.openSharer(network, this.createSharingUrl(network));
this.$root.$emit('social_shares_open', network, this.url);

@@ -250,2 +266,3 @@ this.$emit('open', network, this.url);

window.open(this.createSharingUrl(network), '_self');
this.$root.$emit('social_shares_open', network, this.url);

@@ -266,3 +283,5 @@ this.$emit('open', network, this.url);

clearInterval(this.popup.interval);
this.popup.window.close();// Force close (for Facebook)
this.$root.$emit('social_shares_change', network, this.url);

@@ -296,3 +315,5 @@ this.$emit('change', network, this.url);

clearInterval(this$1.popup.interval);
this$1.popup.window = undefined;
this$1.$root.$emit('social_shares_close', network, this$1.url);

@@ -306,2 +327,9 @@ this$1.$emit('close', network, this$1.url);

/**
* Merge base networks list with user's list
*/
beforeMount: function beforeMount () {
this.baseNetworks = Vue.util.extend(this.baseNetworks, this.networks);
},
/**
* Sets popup default dimensions.

@@ -336,3 +364,3 @@ */

SocialSharing.version = '2.2.11';
SocialSharing.version = '2.3.1';

@@ -339,0 +367,0 @@ SocialSharing.install = function (Vue) {

/*!
* vue-social-sharing v2.2.11
* vue-social-sharing v2.3.1
* (c) 2017 nicolasbeauvais

@@ -7,39 +7,8 @@ * Released under the MIT License.

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.VueSocialSharing = factory());
}(this, (function () { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue')) :
typeof define === 'function' && define.amd ? define(['vue'], factory) :
(global.VueSocialSharing = factory(global.Vue));
}(this, (function (Vue) { 'use strict';
var email = {"sharer":"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description","type":"direct"};
var facebook = {"sharer":"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote","type":"popup"};
var googleplus = {"sharer":"https://plus.google.com/share?url=@url","type":"popup"};
var line = {"sharer":"http://line.me/R/msg/text/?@description%0D%0A@url","type":"popup"};
var linkedin = {"sharer":"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description","type":"popup"};
var odnoklassniki = {"sharer":"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description","type":"popup"};
var pinterest = {"sharer":"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title","type":"popup"};
var reddit = {"sharer":"https://www.reddit.com/submit?url=@url&title=@title","type":"popup"};
var skype = {"sharer":"https://web.skype.com/share?url=@description%0D%0A@url","type":"popup"};
var telegram = {"sharer":"https://t.me/share/url?url=@url&text=@description","type":"popup"};
var twitter = {"sharer":"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser","type":"popup"};
var vk = {"sharer":"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true","type":"popup"};
var weibo = {"sharer":"http://service.weibo.com/share/share.php?url=@url&title=@title","type":"popup"};
var whatsapp = {"sharer":"whatsapp://send?text=@description%0D%0A@url","type":"direct","action":"share/whatsapp/share"};
var sms = {"sharer":"sms:?body=@url%20@description","type":"direct"};
var Networks = {
email: email,
facebook: facebook,
googleplus: googleplus,
line: line,
linkedin: linkedin,
odnoklassniki: odnoklassniki,
pinterest: pinterest,
reddit: reddit,
skype: skype,
telegram: telegram,
twitter: twitter,
vk: vk,
weibo: weibo,
whatsapp: whatsapp,
sms: sms
};
Vue = 'default' in Vue ? Vue['default'] : Vue;

@@ -56,4 +25,4 @@ var SocialSharingNetwork = {

render: function render (createElement, context) {
var network = Networks[context.props.network];
render: function (createElement, context) {
var network = context.parent._data.baseNetworks[context.props.network];

@@ -87,2 +56,35 @@ if (!network) {

var email = {"sharer":"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description","type":"direct"};
var facebook = {"sharer":"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote","type":"popup"};
var googleplus = {"sharer":"https://plus.google.com/share?url=@url","type":"popup"};
var line = {"sharer":"http://line.me/R/msg/text/?@description%0D%0A@url","type":"popup"};
var linkedin = {"sharer":"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description","type":"popup"};
var odnoklassniki = {"sharer":"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description","type":"popup"};
var pinterest = {"sharer":"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title","type":"popup"};
var reddit = {"sharer":"https://www.reddit.com/submit?url=@url&title=@title","type":"popup"};
var skype = {"sharer":"https://web.skype.com/share?url=@description%0D%0A@url","type":"popup"};
var telegram = {"sharer":"https://t.me/share/url?url=@url&text=@description","type":"popup"};
var twitter = {"sharer":"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser","type":"popup"};
var vk = {"sharer":"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true","type":"popup"};
var weibo = {"sharer":"http://service.weibo.com/share/share.php?url=@url&title=@title","type":"popup"};
var whatsapp = {"sharer":"whatsapp://send?text=@description%0D%0A@url","type":"direct","action":"share/whatsapp/share"};
var sms = {"sharer":"sms:?body=@url%20@description","type":"direct"};
var BaseNetworks = {
email: email,
facebook: facebook,
googleplus: googleplus,
line: line,
linkedin: linkedin,
odnoklassniki: odnoklassniki,
pinterest: pinterest,
reddit: reddit,
skype: skype,
telegram: telegram,
twitter: twitter,
vk: vk,
weibo: weibo,
whatsapp: whatsapp,
sms: sms
};
var inBrowser = typeof window !== 'undefined';

@@ -182,2 +184,13 @@ var $window = inBrowser ? window : null;

default: 'span'
},
/**
* Additional or overridden networks.
* Default to BaseNetworks
*/
networks: {
type: Object,
default: function () {
return {};
}
}

@@ -192,3 +205,3 @@ },

*/
networks: Networks,
baseNetworks: BaseNetworks,

@@ -224,3 +237,3 @@ /**

createSharingUrl: function createSharingUrl (network) {
return this.networks[network].sharer
return this.baseNetworks[network].sharer
.replace(/@url/g, encodeURIComponent(this.url))

@@ -242,2 +255,3 @@ .replace(/@title/g, encodeURIComponent(this.title))

this.openSharer(network, this.createSharingUrl(network));
this.$root.$emit('social_shares_open', network, this.url);

@@ -254,2 +268,3 @@ this.$emit('open', network, this.url);

window.open(this.createSharingUrl(network), '_self');
this.$root.$emit('social_shares_open', network, this.url);

@@ -270,3 +285,5 @@ this.$emit('open', network, this.url);

clearInterval(this.popup.interval);
this.popup.window.close();// Force close (for Facebook)
this.$root.$emit('social_shares_change', network, this.url);

@@ -300,3 +317,5 @@ this.$emit('change', network, this.url);

clearInterval(this$1.popup.interval);
this$1.popup.window = undefined;
this$1.$root.$emit('social_shares_close', network, this$1.url);

@@ -310,2 +329,9 @@ this$1.$emit('close', network, this$1.url);

/**
* Merge base networks list with user's list
*/
beforeMount: function beforeMount () {
this.baseNetworks = Vue.util.extend(this.baseNetworks, this.networks);
},
/**
* Sets popup default dimensions.

@@ -340,3 +366,3 @@ */

SocialSharing.version = '2.2.11';
SocialSharing.version = '2.3.1';

@@ -343,0 +369,0 @@ SocialSharing.install = function (Vue) {

/*!
* vue-social-sharing v2.2.11
* vue-social-sharing v2.3.1
* (c) 2017 nicolasbeauvais
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueSocialSharing=e()}(this,function(){"use strict";var t={sharer:"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description",type:"direct"},e={sharer:"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote",type:"popup"},i={sharer:"https://plus.google.com/share?url=@url",type:"popup"},r={sharer:"http://line.me/R/msg/text/?@description%0D%0A@url",type:"popup"},o={sharer:"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description",type:"popup"},p={sharer:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description",type:"popup"},s={sharer:"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title",type:"popup"},n={sharer:"https://www.reddit.com/submit?url=@url&title=@title",type:"popup"},a={sharer:"https://web.skype.com/share?url=@description%0D%0A@url",type:"popup"},l={sharer:"https://t.me/share/url?url=@url&text=@description",type:"popup"},u={sharer:"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser",type:"popup"},h={sharer:"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true",type:"popup"},c={sharer:"http://service.weibo.com/share/share.php?url=@url&title=@title",type:"popup"},d={sharer:"whatsapp://send?text=@description%0D%0A@url",type:"direct",action:"share/whatsapp/share"},w={sharer:"sms:?body=@url%20@description",type:"direct"},m={email:t,facebook:e,googleplus:i,line:r,linkedin:o,odnoklassniki:p,pinterest:s,reddit:n,skype:a,telegram:l,twitter:u,vk:h,weibo:c,whatsapp:d,sms:w},g={functional:!0,props:{network:{type:String,default:""}},render:function(t,e){var i=m[e.props.network];return i?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,"data-link":"popup"===i.type?"#share-"+e.props.network:e.parent.createSharingUrl(e.props.network),"data-action":"popup"===i.type?null:i.action},on:{click:"popup"===i.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")}},f="undefined"!=typeof window,y=f?window:null,k={props:{url:{type:String,default:f?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"}},data:function(){return{networks:m,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){return this.networks[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.hashtags).replace(/@media/g,this.media).replace(/@twitteruser/g,this.twitterUser?"&via="+this.twitterUser:"")},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 i=this;this.popup.window&&this.popup.interval&&(clearInterval(this.popup.interval),this.popup.window.close(),this.$root.$emit("social_shares_change",t,this.url),this.$emit("change",t,this.url)),this.popup.window=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")),this.popup.window.focus(),this.popup.interval=setInterval(function(){i.popup.window.closed&&(clearInterval(i.popup.interval),i.popup.window=void 0,i.$root.$emit("social_shares_close",t,i.url),i.$emit("close",t,i.url))},500)}},mounted:function(){if(f){var t=void 0!==y.screenLeft?y.screenLeft:screen.left,e=void 0!==y.screenTop?y.screenTop:screen.top,i=y.innerWidth?y.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,r=y.innerHeight?y.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;this.popup.left=i/2-this.popup.width/2+t,this.popup.top=r/2-this.popup.height/2+e}},components:{network:g}};return k.version="2.2.11",k.install=function(t){t.component("social-sharing",k)},"undefined"!=typeof window&&(window.SocialSharing=k),k});
!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 i=e.parent._data.baseNetworks[e.props.network];return i?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,"data-link":"popup"===i.type?"#share-"+e.props.network:e.parent.createSharingUrl(e.props.network),"data-action":"popup"===i.type?null:i.action},on:{click:"popup"===i.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")}},i={sharer:"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description",type:"direct"},r={sharer:"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description&quote=@quote",type:"popup"},o={sharer:"https://plus.google.com/share?url=@url",type:"popup"},p={sharer:"http://line.me/R/msg/text/?@description%0D%0A@url",type:"popup"},s={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:"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"},m={sharer:"whatsapp://send?text=@description%0D%0A@url",type:"direct",action:"share/whatsapp/share"},f={sharer:"sms:?body=@url%20@description",type:"direct"},g={email:i,facebook:r,googleplus:o,line:p,linkedin:s,odnoklassniki:n,pinterest:a,reddit:l,skype:u,telegram:h,twitter:c,vk:d,weibo:w,whatsapp:m,sms:f},y="undefined"!=typeof window,k=y?window:null,b={props:{url:{type:String,default:y?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:g,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){return 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.hashtags).replace(/@media/g,this.media).replace(/@twitteruser/g,this.twitterUser?"&via="+this.twitterUser:"")},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 i=this;this.popup.window&&this.popup.interval&&(clearInterval(this.popup.interval),this.popup.window.close(),this.$root.$emit("social_shares_change",t,this.url),this.$emit("change",t,this.url)),this.popup.window=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")),this.popup.window.focus(),this.popup.interval=setInterval(function(){i.popup.window.closed&&(clearInterval(i.popup.interval),i.popup.window=void 0,i.$root.$emit("social_shares_close",t,i.url),i.$emit("close",t,i.url))},500)}},beforeMount:function(){this.baseNetworks=t.util.extend(this.baseNetworks,this.networks)},mounted:function(){if(y){var t=void 0!==k.screenLeft?k.screenLeft:screen.left,e=void 0!==k.screenTop?k.screenTop:screen.top,i=k.innerWidth?k.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,r=k.innerHeight?k.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;this.popup.left=i/2-this.popup.width/2+t,this.popup.top=r/2-this.popup.height/2+e}},components:{network:e}};return b.version="2.3.1",b.install=function(t){t.component("social-sharing",b)},"undefined"!=typeof window&&(window.SocialSharing=b),b});
{
"name": "vue-social-sharing",
"description": "A Vue.js component for sharing links to social networks",
"version": "2.2.11",
"version": "2.3.1",
"author": {

@@ -6,0 +6,0 @@ "name": "nicolasbeauvais",

@@ -129,5 +129,4 @@ # vue-social-sharing

Events are emitted on the vue $root instance and on the local instance:
Events are emitted on the vue $root instance:
$root instance events:
Name | Data | Description

@@ -146,3 +145,4 @@ ---------------------- | -------------------------- | --------------------------------------------------------------------------

Local instance events:
And on the Local Vue-social-sharing instance:
Name | Data | Description

@@ -157,3 +157,3 @@ ---------------------- | -------------------------- | --------------------------------------------------------------------------

<some-component>
<social-sharing @open="open()" @close="close()">
<social-sharing @open="open()" @change="change()" @close="close()">
</social-sharing>

@@ -165,2 +165,37 @@ </some-component>

## Extending the network list
Since version `2.3.1` you can extend and override the list of available networks. You can see a working example of the feature in the `examples/vue2-example.html` file:
```html
<social-sharing ...:networks="overriddenNetworks" inline-template>
<div>
<network network="custom">
Custom network
</network>
</div>
</social-sharing>
<script>
...
new Vue({
data: {
overriddenNetworks: {
"custom": {
"sharer": "https://mycustomdomain.com",
"type": "popup"
},
}
}
});
</script>
```
There are two available network types:
Type | Effect
---------------------- | --------------------------
`popup` | Open the sharing link in a new popup
`direct` | Open directly the sharing link (suitable for mobile apps sharing, emails, sms, ...)
## Feature request

@@ -167,0 +202,0 @@ Feel free to open an issue to ask for a new social network support.

import SocialSharing from './social-sharing';
SocialSharing.version = '2.2.11';
SocialSharing.version = '2.3.1';

@@ -5,0 +5,0 @@ SocialSharing.install = (Vue) => {

@@ -1,3 +0,1 @@

import Networks from './networks.json';
export default {

@@ -13,4 +11,4 @@ functional: true,

render (createElement, context) {
const network = Networks[context.props.network];
render: (createElement, context) => {
const network = context.parent._data.baseNetworks[context.props.network];

@@ -17,0 +15,0 @@ if (!network) {

import SocialSharingNetwork from './social-sharing-network';
import Networks from './networks.json';
import BaseNetworks from './networks.json';
import Vue from 'vue';

@@ -102,2 +103,13 @@ const inBrowser = typeof window !== 'undefined';

default: 'span'
},
/**
* Additional or overridden networks.
* Default to BaseNetworks
*/
networks: {
type: Object,
default: function () {
return {};
}
}

@@ -112,3 +124,3 @@ },

*/
networks: Networks,
baseNetworks: BaseNetworks,

@@ -144,3 +156,3 @@ /**

createSharingUrl (network) {
return this.networks[network].sharer
return this.baseNetworks[network].sharer
.replace(/@url/g, encodeURIComponent(this.url))

@@ -162,2 +174,3 @@ .replace(/@title/g, encodeURIComponent(this.title))

this.openSharer(network, this.createSharingUrl(network));
this.$root.$emit('social_shares_open', network, this.url);

@@ -174,2 +187,3 @@ this.$emit('open', network, this.url);

window.open(this.createSharingUrl(network), '_self');
this.$root.$emit('social_shares_open', network, this.url);

@@ -188,3 +202,5 @@ this.$emit('open', network, this.url);

clearInterval(this.popup.interval);
this.popup.window.close();// Force close (for Facebook)
this.$root.$emit('social_shares_change', network, this.url);

@@ -218,3 +234,5 @@ this.$emit('change', network, this.url);

clearInterval(this.popup.interval);
this.popup.window = undefined;
this.$root.$emit('social_shares_close', network, this.url);

@@ -228,2 +246,9 @@ this.$emit('close', network, this.url);

/**
* Merge base networks list with user's list
*/
beforeMount () {
this.baseNetworks = Vue.util.extend(this.baseNetworks, this.networks);
},
/**
* Sets popup default dimensions.

@@ -230,0 +255,0 @@ */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc