Share buttons test
This commit is contained in:
parent
bb12d7c516
commit
29e351c7ab
5
build.rb
5
build.rb
|
@ -91,7 +91,10 @@ def replace_content content, title = 'Main'
|
|||
content.gsub!($mariana, "<a target=\"_blank\" href=\"https://marianaeguaras.com/blog/\">#{$mariana}</a>")
|
||||
end
|
||||
|
||||
if title == 'Main' then content.gsub!('href="../', 'href="') end
|
||||
if title == 'Main'
|
||||
content.gsub!('href="../', 'href="')
|
||||
content.gsub!('src="../', 'src="')
|
||||
end
|
||||
|
||||
return content
|
||||
end
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -10,6 +10,7 @@
|
|||
<link rel="alternate" type="application/rss+xml" href="https://blog.cliteratu.re/feed/" title="Publishing is Coding: Change My Mind">
|
||||
<link type="text/css" rel="stylesheet" href="../css/core.css">
|
||||
<link type="text/css" rel="stylesheet" href="../css/extra.css">
|
||||
<script type="text/javascript" src="../js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<link rel="alternate" type="application/rss+xml" href="https://blog.cliteratu.re/feed/" title="Publishing is Coding: Change My Mind">
|
||||
<link type="text/css" rel="stylesheet" href="css/core.css">
|
||||
<link type="text/css" rel="stylesheet" href="css/extra.css">
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Mastodon Share
|
||||
// Create of DEADBLACKCLOVER
|
||||
// License GNU GPL-3
|
||||
|
||||
var host = null,
|
||||
message = null;
|
||||
|
||||
var mastodon = document.getElementById("mastodon-share");
|
||||
|
||||
mastodon.innerHTML = "<div><button id='mastodon-share-btn' onclick='viewHostMastodon()'></button></div>" +
|
||||
"<div id='mastodon-share-host' hidden>"+
|
||||
"<input id='mastodon-share-ipt' type='text' placeholder='Mastodon URL'>"+
|
||||
"<button id='mastodon-share-share' onclick='getHostMastodon()'>OK</button>"+
|
||||
"</div>";
|
||||
|
||||
var btn = document.getElementById("mastodon-share-btn");
|
||||
|
||||
btn.style.width = "120px";
|
||||
btn.style.height = "30px";
|
||||
btn.style.backgroundColor = "#282c37";
|
||||
btn.style.backgroundImage = "url(https://joinmastodon.org/static/media/logo_full.97822390.svg)";
|
||||
btn.style.backgroundSize = "75% 80%";
|
||||
btn.style.backgroundRepeat = "no-repeat";
|
||||
btn.style.backgroundPosition = "50% 50%";
|
||||
btn.style.color = "#d9e1e8";
|
||||
btn.style.border = "0";
|
||||
btn.style.borderRadius = "5px";
|
||||
|
||||
var block = document.getElementById("mastodon-share-host");
|
||||
|
||||
block.style.marginTop = "5px";
|
||||
block.style.backgroundColor = "#282c37";
|
||||
block.style.width = "180px";
|
||||
block.style.padding = "5px";
|
||||
block.style.borderRadius = "5px";
|
||||
|
||||
var ipt = document.getElementById("mastodon-share-ipt");
|
||||
|
||||
ipt.style.width = "110px";
|
||||
ipt.style.marginRight = "5px";
|
||||
|
||||
function getMessageMastodon(mes) {
|
||||
message = mes;
|
||||
}
|
||||
|
||||
function viewHostMastodon() {
|
||||
block.hidden = false;
|
||||
}
|
||||
|
||||
function getHostMastodon(){
|
||||
host = ipt.value;
|
||||
shareMastodon();
|
||||
}
|
||||
|
||||
function shareMastodon() {
|
||||
if(host && message){
|
||||
host = 'https://' + host + '/share?text=' + message;
|
||||
var newWin = window.open(host, "Mastodon", "width=430,height=320");
|
||||
}
|
||||
}
|
|
@ -10,5 +10,6 @@
|
|||
<link rel="alternate" type="application/rss+xml" href="$site_link$/feed/" title="$site_name$">
|
||||
<link type="text/css" rel="stylesheet" href="../css/core.css">
|
||||
<link type="text/css" rel="stylesheet" href="../css/extra.css">
|
||||
<script type="text/javascript" src="../js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue