QUICK START
1) Download
S-S.js, and include it in the head of your web page.
2) Insert the following snippet where you want your social buttons:
3) That's it! You'll get privacy-respecting share buttons like these:
They have the same functionality as the official social sharing widgets,
but they don't use cookies, don't load external iframes, and in fact
never directly call the Facebook/Twitter servers.
Not only are they more customizeable and more lightweight, these buttons give a damn about Your Damn Privacy™.
HOW TO CUSTOMIZE
1) Customizing links, labels, and share description.
You can change the text and links of a share button simply by adding data- attributes to the HTML.
For example, this code...
... will give you this button.
2) Customizing styles.
Because the share button is not inside an external iframe,
you can directly modify its look simply by including a stylesheet!
(protip: give the buttons id's to change their styles individually)
which gives you... uh... this.
You can also pass in an HTML template as a data- attribute.
Here's a template for a very minimalist Twitter Share button.
The result:
3) Customizing APIs.
Whether it's requesting different stats, or building a social share button for a completely different site,
or making a button that calls an API that only returns the number "8"...
you can easily extend S-S to fit your needs.
To show this in action, a button that calls an API that only returns the number "8".
The "API" in question is just
a JSON file I posted on Pastebin.
To change the requests, I create a new config object in the global object,
SS_SOCIAL_API, like so:
The result:
HOW IT PROTECTS PRIVACY
1) Proxy server calls
To see how many times a link has been shared, you can call the Facebook/Twitter APIs.
Twitter -
http://urls.api.twitter.com/1/urls/count.json?url={{URL}}
Facebook -
http://graph.facebook.com/?id={{URL}}
S-S protects your privacy by calling these APIs through a proxy server.
(In fact, it
has to, because of
CORS issues when it comes to AJAX)
By default, S-S uses the open source
JSONProxy,
and if you want, you can easily customize S-S to use a different proxy:
2) Static share links
The standard sharing widgets load up external iframes and set cookies in your browser, even if you're not logged in.
Yeesh.
In contrast, the
one and only time S-S loads up Facebook/Twitter is when you click to share on Facebook/Twitter.
Otherwise, it remains static and can't track you.
When you want to share, S-S opens a popup to these links:
Twitter -
https://twitter.com/share?url={{link}}&text={{text}}
Facebook -
https://www.facebook.com/sharer/sharer.php?u={{link}}&t={{text}}
If you don't care about Share Counts or having a popup, you can avoid using S-S altogether and just use these links by themselves:
Result:
Tweet about GWD
3) Being open & customizeable
All of this would be pointless if you couldn't freely use, examine, and modify my code.
S-S is dedicated to the public domain using the
Unlicense.
With the code being open to the public, you can glance through my fairly short code (under 200 lines with whitespace and comments),
and make sure it really
does protect your privacy.