All Projects → borodean → sharon

borodean / sharon

Licence: MIT license
A lightweight and modular social sharing library

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to sharon

vue-socials
💬 Social media share buttons and counts for Vue.js
Stars: ✭ 32 (+100%)
Mutual labels:  reddit, tumblr, linkedin, vkontakte, odnoklassniki
CwsShareCount
PHP class to get social share count for Delicious, Facebook, Google+, Linkedin, Pinterest, Reddit, StumbleUpon and Twitter.
Stars: ✭ 13 (-18.75%)
Mutual labels:  facebook, reddit, linkedin, pinterest, google-plus
Socialreaper
Social media scraping / data collection library for Facebook, Twitter, Reddit, YouTube, Pinterest, and Tumblr APIs
Stars: ✭ 338 (+2012.5%)
Mutual labels:  facebook, reddit, tumblr, pinterest
Reaper
Social media scraping / data collection tool for the Facebook, Twitter, Reddit, YouTube, Pinterest, and Tumblr APIs
Stars: ✭ 240 (+1400%)
Mutual labels:  facebook, reddit, tumblr, pinterest
Skraper
Kotlin/Java library and cli tool for scraping posts and media from various sources with neither authorization nor full page rendering (Facebook, Instagram, Twitter, Youtube, Tiktok, Telegram, Twitch, Reddit, 9GAG, Pinterest, Flickr, Tumblr, IFunny, VK, Pikabu)
Stars: ✭ 72 (+350%)
Mutual labels:  facebook, reddit, tumblr, pinterest
Oauth
🔗 OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (+2000%)
Mutual labels:  facebook, reddit, linkedin
Login With
Stateless login-with microservice for OAuth
Stars: ✭ 2,301 (+14281.25%)
Mutual labels:  facebook, reddit, linkedin
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.
Stars: ✭ 1,026 (+6312.5%)
Mutual labels:  facebook, linkedin, weibo
Postwill
Posting to the most popular social media from Ruby
Stars: ✭ 181 (+1031.25%)
Mutual labels:  facebook, tumblr, pinterest
Network Avatar Picker
A npm module that returns user's social network avatar. Supported providers: facebook, instagram, twitter, tumblr, vimeo, github, youtube and gmail
Stars: ✭ 74 (+362.5%)
Mutual labels:  facebook, buffer, tumblr
Laravel Socialite
Social OAuth Authentication for Laravel 5. drivers: facebook, github, google, linkedin, weibo, qq, wechat and douban
Stars: ✭ 296 (+1750%)
Mutual labels:  facebook, linkedin, weibo
Sharer.js
🔛 🔖 Create your own social share buttons. No jquery.
Stars: ✭ 1,624 (+10050%)
Mutual labels:  facebook, reddit, pinterest
Play Authenticate
An authentication plugin for Play Framework 2.x (Java)
Stars: ✭ 813 (+4981.25%)
Mutual labels:  facebook, linkedin, vkontakte
Keyring
Keyring is an authentication framework for WordPress. It comes with definitions for a variety of HTTP Basic, OAuth1 and OAuth2 web services. Use it as a common foundation for working with other web services from within WordPress code.
Stars: ✭ 52 (+225%)
Mutual labels:  facebook, linkedin, pinterest
Socialcounters
jQuery/PHP - Collection of Social Media APIs that display number of your social media fans. Facebook Likes, Twitter Followers, Instagram Followers, YouTube Subscribers, etc..
Stars: ✭ 104 (+550%)
Mutual labels:  facebook, tumblr, pinterest
react-custom-share
Social media share buttons for ReactJS. Use one of the built-in button themes or create a custom one from scratch.
Stars: ✭ 47 (+193.75%)
Mutual labels:  facebook, linkedin, pinterest
Hackers Tool Kit
Its a framework filled with alot of options and hacking tools you use directly in the script from brute forcing to payload making im still adding more stuff i now have another tool out called htkl-lite its hackers-tool-kit just not as big and messy to see updates check on my instagram @tuf_unkn0wn or if there are any problems message me on instagram
Stars: ✭ 211 (+1218.75%)
Mutual labels:  facebook, gmail
Ngx Avatar
Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources
Stars: ✭ 210 (+1212.5%)
Mutual labels:  facebook, vkontakte
Swiftui Animation
SwiftUI Animation
Stars: ✭ 233 (+1356.25%)
Mutual labels:  facebook, linkedin
Hackathon Starter Kit
A Node-Typescript/Express Boilerplate with Authentication(Local, Github, Facebook, Twitter, Google, Dropbox, LinkedIn, Discord, Slack), Authorization, and CRUD functionality + PWA Support!
Stars: ✭ 242 (+1412.5%)
Mutual labels:  facebook, linkedin

Sauce Test Status

Sharon

A lightweight and modular social sharing library:

  • a toolkit to build your own share buttons;
  • supports 13 sharing platforms;
  • gzipped size is 1.72 KB;
  • you can cherry-pick which sharing platforms to use to make it even smaller.

Here how it looks when you want Sharon to open a tweet popup:

sharon.twitter({
  title: "One last quarter as defending champs!",
  hashtags: ["SuperBowl", "DenverBroncos"],
});

Or to get a Facebook share count for your page:

sharon.facebook.count((err, count) => {
  if (err) throw err;
  console.log("Whoa, we have " + count + " shares!");
});

Table of contents

Setup

CommonJS

Install Sharon using npm:

npm install sharon --save

Load the whole library:

import sharon from "sharon";

Or cherry-pick platforms for smaller Webpack, Rollup, or Browserify bundles:

import facebook from "sharon/facebook";
import twitter from "sharon/twitter";

Browser

<script src="dist/sharon.js"></script>

For the sharon.js file, check the dist directory of the installed module or directly download it:

API

Supported sharing platforms

Each sharing platform has its endpoint under the Sharon API:

Sharing platform Endpoint Share count support Share parameters
Buffer sharon.buffer Yes Reference
Facebook sharon.facebook Yes
Gmail sharon.gmail
LinkedIn sharon.linkedin Reference
Odnoklassniki sharon.ok Yes
Pinterest sharon.pinterest Yes Reference
Reddit sharon.reddit Yes Reference
Telegram sharon.telegram
Tumblr sharon.tumblr Yes Reference
Twitter sharon.twitter Reference
Vkontakte sharon.vk Yes Reference
Weibo sharon.weibo
XING sharon.xing Reference

This table also shows which platforms support retrieving share counts and links to the share parameters references.

sharon.platform(url = location.href, parameters = { title: document.title })

  • url <String> The URL to share. Defaults to the current location.
  • parameters <Object> Share parameters. Default to an object with the title property equal to the current page title.

Opens a share popup.

Examples Share the current page:
sharon.twitter();

With a custom title:

sharon.twitter({ title: "Check it out" });

Share example.com:

sharon.twitter("http://example.com");

Share example.com with a custom title:

sharon.twitter("http://example.com", { title: "Check it out" });

sharon.platform.href(url = location.href, parameters = { title: document.title })

  • url <String> The URL to share. Defaults to the current location.
  • parameters <Object> Share parameters. Default to an object with the title property equal to the current page title.
  • Returns: <String>

Returns a share popup URL.

Examples Get the share popup URL for the current page:
const link = sharon.twitter.href();

With a custom title:

const link = sharon.twitter.href({ title: "Check it out" });

For example.com:

const link = sharon.twitter.href("http://example.com");

For example.com with a custom title:

const link = sharon.twitter.href("http://example.com", {
  title: "Check it out",
});

sharon.platform.count(url = location.href, callback)

  • url <String> The URL of which to retrive the share count. Defaults to the current location.
  • callback <Function(err, count)> A callback function that receives the count.

Retrieves the share count of a URL.

Examples Share count for the current page:
sharon.facebook.count((err, count) => {
  if (err) throw err;
  console.log(count);
});

For example.com:

sharon.facebook.count("http://example.com", (err, count) => {
  if (err) throw err;
  console.log(count);
});

Share parameters

When using sharon.platform or sharon.platform.href functions you can specify the share parameters by passing an object as the last argument. They are added to the query parameters of the share popup URL and are specifying additional features:

sharon.twitter({
  title: "One last quarter as defending champs!",
  hashtags: ["SuperBowl", "DenverBroncos"],
});

This produces a popup with a predefined title and hashtags:

Example

The set of features is different for most of the sharing platforms. To find them out, check their documentation, links provided in the Supported sharing platforms table.

There is an inconsistency between different platforms: for instance, Twitter expects the text parameter to contain a link title, while Pinterest expects the description one. Sharon normalizes this behavior: when you pass a title parameter, it is automatically translated into one corresponding to a chosen platform.

More examples

Poor man's tweet button

<button type="button" onclick="sharon.twitter()">Tweet</button>

React component

function LinkedInShareButton {
  const [count, setCount] = useState();

  useEffect(() => {
    sharon.linkedin.count((err, count) => {
      if (err) throw err;
      setCount(count);
    });
  }, []);

  const share = useCallback((event) => {
    event.preventDefault();
    sharon.linkedin();
  }, []);

  return (
    <a onClick={share} href={sharon.linkedin.href()}>
      Share on LinkedIn {count}
    </a>
  );
}

AngularJS

<a ng-click="share($event)" ng-href="{{href}}">Share on Facebook {{count}}</a>
$scope.href = sharon.facebook.href();

$scope.share = (event) => {
  event.preventDefault();
  sharon.facebook();
};

sharon.facebook.count((err, count) => {
  if (err) throw err;

  $scope.$apply(() => {
    $scope.count = count;
  });
});

:heart:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].