tabalinas / jssocials

Social Network Sharing jQuery Plugin
http://js-socials.com
MIT License
464 stars 104 forks source link

Twitter share count works!! #194

Open php5drvn opened 6 years ago

php5drvn commented 6 years ago

On site http://opensharecount.com/ I found that twits can be counted by this service. You just need to set up your domain on this site. And change share twitter like this twitter: { label: "Tweet", logo: "fa fa-twitter", shareUrl: "https://twitter.com/share?url={url}&text={text}&via={via}&hashtags={hashtags}", countUrl: "http://opensharecount.com/count.json?url={url}", getCount: function (data) { return data.count||0; } },

ghost commented 6 years ago

Thanks! Here's my code with reddit/instagram/flickr added...

$.extend(jsSocials.shares, {
    // Optional Twitter Count - https://opensharecount.com
    twitter: {
        label: "Tweet",
        logo: "fa fa-twitter",
        shareUrl: "https://twitter.com/share?url={url}&text={text}&via={via}&hashtags={hashtags}",
        countUrl: "https://opensharecount.com/count.json?url={url}",
        getCount: function (data) {
            return data.count||0;
        }
    },
    reddit: {
        label: "Reddit",
        logo: "fa fa-reddit",
        shareUrl: "https://www.reddit.com/submit?url={url}",
        countUrl: ""
    },
    instagram: {
        label: "Instagram",
        logo: "fa fa-instagram",
        shareUrl: "https://www.instagram.com/someuser/",
        countUrl: ""
    },
    flickr: {
        label: "Flickr",
        logo: "fa fa-flickr",
        shareUrl: "https://www.flickr.com/someuser/",
        countUrl: ""
    },
});
.jssocials-share-reddit .jssocials-share-link {
  background: #64a4ff; color: #fff !important; }
  .jssocials-share-reddit .jssocials-share-link:hover {
    background: #4585ee; color: #fff !important; }

.jssocials-share-instagram .jssocials-share-link {
  background: #405de6; color: #fff !important; }
  .jssocials-share-instagram .jssocials-share-link:hover {
    background: #5851db; color: #fff !important; }

.jssocials-share-flickr .jssocials-share-link {
  background: #0063dc; color: #fff !important; }
  .jssocials-share-flickr .jssocials-share-link:hover {
    background: #ff0084; color: #fff !important; }