Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@

<!-- TRANSLATE "title" & "text". Make sure it's less than 112 characters, for Twitter's sake -->
<!-- Also, change "link" to whatever the link for the translated version will be! -->
<!-- Also, TRANSLATE "facebook", "twitter" & "email". -->
<sharing title="The Evolution of Trust"
text="People no longer trust each other. Why? And how can we fix it? An interactive guide to the game theory of trust:"
link="http://ncase.me/trust/"></sharing>
link="http://ncase.me/trust/"
facebook="Share on Facebook"
twitter="Tweet"
email="Send email"></sharing>

<!-- List of translations thus far! -->
<div id="translations">
Expand Down
12 changes: 8 additions & 4 deletions js/lib/sharing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ window.addEventListener("load",function(){
text = encodeURIComponent(text);
link = encodeURIComponent(link);

var facebook = sharingDOM.getAttribute("facebook");
var twitter = sharingDOM.getAttribute("twitter");
var email = sharingDOM.getAttribute("email");

// Create full html
var sharing = document.createElement("div");
sharing.className = "sharing";
sharing.innerHTML = '<a href="https://www.facebook.com/sharer/sharer.php?u='+link+'&t='+text+'" title="Share on Facebook" target="_blank"><img alt="Share on Facebook" src="social/facebook.png"></a>'+
'<a href="https://twitter.com/intent/tweet?source='+link+'&text='+text+'%20'+link+'" target="_blank" title="Tweet"><img alt="Tweet" src="social/twitter.png"></a>'+
'<a href="mailto:?subject='+title+'&body='+text+" "+link+'" target="_blank" title="Send email"><img alt="Send email" src="social/email.png"></a>';
sharing.innerHTML = '<a href="https://www.facebook.com/sharer/sharer.php?u='+link+'&t='+text+'" title="'+facebook+'" target="_blank"><img alt="'+facebook+'" src="social/facebook.png"></a>'+
'<a href="https://twitter.com/intent/tweet?source='+link+'&text='+text+'%20'+link+'" target="_blank" title="'+twitter+'"><img alt="'+twitter+'" src="social/twitter.png"></a>'+
'<a href="mailto:?subject='+title+'&body='+text+" "+link+'" target="_blank" title="'+email+'"><img alt="'+email+'" src="social/email.png"></a>';

// Replace it in the dom
sharingDOM.parentNode.replaceChild(sharing, sharingDOM);

});
});