{"id":968,"date":"2016-01-15T14:23:16","date_gmt":"2016-01-15T14:23:16","guid":{"rendered":"http:\/\/sandjam.co.uk\/sandjam\/?p=968"},"modified":"2018-08-03T13:51:27","modified_gmt":"2018-08-03T12:51:27","slug":"creating-a-custom-sharing-service","status":"publish","type":"post","link":"https:\/\/sandjam.co.uk\/sandjam\/2016\/01\/creating-a-custom-sharing-service\/","title":{"rendered":"Creating a custom sharing service"},"content":{"rendered":"<p>This is possibly an example of a pun which has gotten out of hand. It began when I was setting up some sharing buttons on a blog using the service <a href=\"http:\/\/www.sharethis.com\" target=\"_blank\" rel=\"noopener\">sharethis.com.<\/a><\/p>\n<p>I couldn&#8217;t help thinking how funny it would be to have a similar service called &#8220;Cher This&#8221; which somehow allowed you to share a link with your friends through the voice of Cher.<\/p>\n<p>I was also interested in seeing whether I could set up a proof-of-concept service which would emulate the experience of sharethis.com, so I hacked this demo together and I&#8217;m quite pleased about how it&#8217;s turned out.<\/p>\n<h2>Cross domain javascript<\/h2>\n<p>The javascript is written without any libraries so that it can be included on any page without dependencies. I&#8217;ve also set up the required headers to allow cross-domain javascript calls. I&#8217;m sure this isn&#8217;t going to get used widely, but in theory anyone could include this service on their site.<\/p>\n<h2>Facebook sharing<\/h2>\n<p>The widget makes a call to the Facebook API via the sharing dialog, the callback URL which follows a share allows me to count each successful share.<\/p>\n<h2>Customised images<\/h2>\n<p>The API call sends an image path which is actually a PHP script that dynamically creates a composite of a Cher graphic and the open graph image tag included on the target page.<\/p>\n<h2>Demo<\/h2>\n<p>The working demo page allows you to either share a specific URL, or include the widget on your page so your visitors can Cher that page.<\/p>\n<p><a href=\"http:\/\/sandjam.co.uk\/demos\/cherthis\/demo.php\" target=\"_parent\" class=\"button \">Check out the Cher This demo<\/a><\/p>\n<h2>Cher this page<\/h2>\n<p>Alternately, here&#8217;s the widget in use so you can Cher This Page:<\/p>\n<p><script src=\"http:\/\/sandjam.co.uk\/demos\/cherthis\/cher.js\" async=\"async\"><\/script><\/p>\n<div id=\"cherthis\"><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is possibly an example of a pun which has gotten out of hand. It began when I was setting up some sharing buttons on a blog using the service sharethis.com. I couldn&#8217;t help thinking how funny it would be to have a similar service called &#8220;Cher This&#8221; which somehow allowed you to share a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":971,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4,61],"tags":[29,14],"class_list":["post-968","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","category-javascript-2","tag-facebook","tag-javascript"],"acf":[],"_links":{"self":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/comments?post=968"}],"version-history":[{"count":3,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/968\/revisions"}],"predecessor-version":[{"id":1079,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/968\/revisions\/1079"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/media\/971"}],"wp:attachment":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/media?parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/categories?post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/tags?post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}