An open API service indexing awesome lists of open source software.

https://github.com/bufferapp/sharejs

Trigger the Buffer Share popup from any DOM element
https://github.com/bufferapp/sharejs

Last synced: 9 months ago
JSON representation

Trigger the Buffer Share popup from any DOM element

Awesome Lists containing this project

README

          

Share.js (0.0.3)
=======

Trigger the Buffer Share Popup from any specified DOM element

Share.js is a super minimal and easy plug in to make any DOM element trigger a Buffer share. It loads asynchronously to your page and doesn't add any overhead. Share.JS is still early in development, so please be sure to send any issues over to Sunil .

##How to use Share.js
1. Include this script in your header
```

```
2. Add an anchor tag with attribute `data-buffer-share` and parameters

###Example:

```
Share to Buffer
```

##Optional Parameters:

- **data-url**: URL to share. If not specified, the url will be the current page
- **data-text**: Text to share.
- **data-preferred-login**: Preferred service to share to or login from
- **data-via**: Via (twitter screen_name)
- **data-partner-source**: Partner name.
- **data-partner-placement**: Partner specified identifier (ie. mini)

####Native Retweets
Share.js supports creating Native Retweets. You'll need to supply four params if you'd like to use this.
- **data-retweeted-tweet-id**: Numeric Twitter ID of the status. You can find this on the twitter url of a status
- **data-retweeted-user-id**: The twitter user id who created the status
- **data-retweeted-user-name**: The user screen name of the twitter user who created the status
- **data-retweeted-user-display-name**: The display name of the twitter user who created this status

##Creating Buffer Share DOM Elements with Javascript
No worries ;-), Buffer will be automatically attached to elements created with javascript after window.onload is called.

#Development
Buffer Share.js is open source. While maintained by Buffer, we welcome any improvements you have! Here's how you can get started contributing.

##Building
1. Install grunt.js

```
$ sudo npm install -g grunt-cli
$ npm install
```

2. Run grunt after you're satisfied with your changes.
```
$ grunt
```

##Contributing
When you've made your changes, feel free to submit pull requests. When/if merged, we'll be sure to update the Share.JS version and upload it onto the Buffer CDN.