Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gwa/share-links
Lightweight, non-api share links for Facebook, Twitter, WhatsApp, Weibo, Linkedin, Xing, Mail & Print
https://github.com/gwa/share-links
facebook javascript share twitter whatsapp
Last synced: 28 days ago
JSON representation
Lightweight, non-api share links for Facebook, Twitter, WhatsApp, Weibo, Linkedin, Xing, Mail & Print
- Host: GitHub
- URL: https://github.com/gwa/share-links
- Owner: gwa
- License: mit
- Created: 2015-10-28T11:03:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-20T10:30:46.000Z (about 7 years ago)
- Last Synced: 2024-10-05T13:52:46.740Z (about 1 month ago)
- Topics: facebook, javascript, share, twitter, whatsapp
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Share Links
Simple non-API share links for:
* Mail page
* Print pageNo platform specific JavaScript required (e.g. Facebook SDK).
**Styling is not provided!**
Currently requires jQuery.
[![Build Status](https://travis-ci.org/gwa/share-links.svg?branch=master)](https://travis-ci.org/gwa/share-links)
## Installation
```bash
npm install --save gwa-share-links
bower install --save gwa-share-links
```## Usage
```markup
Share on Facebook
Share on Twitter
Share on Whatsapp
Share on WeiboShare on LinkedIn
Share on Xing
``````js
gwa.ShareLinks.initFacebook($('a.fb-share'));
gwa.ShareLinks.initTwitter($('a.tw-share'));
gwa.ShareLinks.initWhatsapp($('a.wa-share'));
gwa.ShareLinks.initWeibo($('a.wb-share'));// Init multiple that have the `data-type` attribute.
gwa.ShareLinks.initMultiple($('a.share'));// Init by passing type as 2nd argument.
gwa.ShareLinks.init($('a.mail', 'mail'));
```You can also use `data-type` to set the type, and then init all in one call:
```markup
Share on Facebook
Share on Twitter
``````js
gwa.ShareLinks.initMultiple($('.share'));
```### URLs
Set a custom URL by adding the `href`, or set to `#` to use the page location.
### Titles
Some sharers, e.g. Twitter or Mail, use text content.
The order of preference is as follows:
* `data-content` attribute
* `og:title` metatag
* the page `title`This means that you can use `data-content` to add hashtags to a Twitter share.