25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
window.onload = function () {
|
|
var url = window.location.pathname,
|
|
file = url.split('/')[url.split('/').length - 1];
|
|
|
|
if (file != 'index.html') {
|
|
add_shares(url);
|
|
}
|
|
};
|
|
|
|
function add_shares (url) {
|
|
var section = document.getElementsByTagName('section')[0],
|
|
div = document.createElement('div'),
|
|
script = document.createElement('script');
|
|
|
|
div.id = 'social';
|
|
div.style.cssText = 'margin-top:1em;padding-top:1em;border-top:1px dashed gray;'
|
|
div.innerHTML += '<div id="mastodon-share"></div>';
|
|
div.innerHTML += '<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="See: " data-url="' + url + '" data-via="_perroTuerto" data-hashtags="Publishing" data-lang="en" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>';
|
|
div.innerHTML += '<h3 style="margin:0;color:gray;font-style:normal;">Comments</h3>';
|
|
section.appendChild(div);
|
|
|
|
script.src = '../js/mastodon.js';
|
|
section.appendChild(script);
|
|
}
|