
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
share-dialog
Advanced tools
Creates share dialogs for Facebook, Twitter, Pinterest, Google Plus, Tumblr and LinkedIn.
npm i share-dialog --save
To use in a browser, browserify it.
See service methods below for specific service args.
var Dialog = require('share-dialog')
// Example to share a link on Twitter
var twitter = Dialog.twitter("http://example.com", "This is my tweet")
// Get the dialog URL
var url = twitter.get()
// Or open it in a new window
twitter.open()
Each of the service methods (e.g. Dialog.twitter) returns a Dialog instance. These instances are reusable:
var dialog = Dialog.tumblr.link('http://example.com/', 'Some link')
dialog.open()
dialog.params({url: 'http://example.com/foo', name: 'Some link with foo'})
dialog.open()
dialog.params({ object })
Overwrite GET parameters of share URL.
dialog.params() Get current parameters.
dialog.config({ object })
Overwrite window configuration. The default configuration is:
{ toolbar: 0
, status: 0
, width: 650 // differs per service
, height: 306
, top: function(config)
{ return screen.availHeight/2 - config.height/2 }
, left: function(config)
{ return screen.availWidth/2 - config.width/2 }
}
dialog.config() Get current configuration.
dialog.get() Return the dialog URL.
dialog.open() Open the share dialog in a new window.
The argument names listed for each service method below, are equal to the GET parameter names. This means..
Dialog.facebook('my_app_id')
.. is the same as writing:
Dialog.facebook().params({app_id: 'my_app_id'})
Share dialog (facebook.com/dialog/share?app_id=..)
Dialog.facebook(app_id, href, redirect_uri)
Legacy sharer.php (facebook.com/sharer/sharer.php?u=..)
Dialog.facebook(u) where u is the URL to share. Does not require an app id.
Dialog.pinterest(url, media [, description])
Share a link:
Dialog.tumblr.link(url [, name, description])
Share a photo:
Dialog.tumblr.photo(source [, caption, clickthru])
Dialog.gplus(url)
Dialog.twitter(url [, text, via, in_reply_to, hashtags, related])
url (string): the URL you want to share (required)text (string): tweet text (optional)via (string): username (optional)in_reply_to (number or string): status ID of a tweet (optional)hashtags (array): hashtags to append to tweet, e.g. ['food', 'monsters'] (optional)related (array): related Twitter usernames (optional)Dialog.linkedIn(url[, title, source, summary])
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.