share-this
share-this copied to clipboard
Hi Max,
Probably it is no news to you, but I just want to tell that I appreciate your code. :)
I've got one question on how to bring in new sharers.. I've checked the twitter.js to understand what is going on there. But the code there is minimized/uglified for a good reason.
Could you recommend a place where I can go get/or study & build ,say WhatsApp sharing, capability for example?
Well, I figured it out! it was not all that bad. This should give others to lead...
<script>
// put this in whatsapp.js if you like, just like the twitter.js
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o(e.ShareThisViaWhatsApp=e.ShareThisViaWhatsApp||{})}(this,function(e){"use strict";function o(e,o,n){return'<a href="'+this.getShareUrl(e,n)+'" target="_blank" rel="noopener nofollow noreferrer"><img src=https://icons.iconarchive.com/icons/dtafalonso/android-l/32/WhatsApp-icon.png></a>'}function n(e,o){return"https://web.whatsapp.com/send?text=="+encodeURIComponent(e)+"&u="+encodeURIComponent(o)}function t(e,o){e.preventDefault(),o.ownerDocument.defaultView.open(o.firstChild.href,"share_via_whatsapp","height=440,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,width=640").opener=null}e.render=o,e.getShareUrl=n,e.action=t,e.name="whatsapp",Object.defineProperty(e,"__esModule",{value:!0})});
</script>
<script src="https://maxart2501.github.io/share-this/dist/sharers/twitter.js"></script>
<script>
ShareThis({
sharers: [ ShareThisViaTwitter, ShareThisViaWhatsApp, ShareThisViaReddit ],
selector: "article"
}).init();
</script>