-
Notifications
You must be signed in to change notification settings - Fork 11
/
pinterest-share-button.html
60 lines (53 loc) · 5.33 KB
/
pinterest-share-button.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<!--
GitHub: HenriqueIni
https://www.blogcyberini.com/
-->
<html>
<head>
<meta charset="utf-8">
<title>Botão do Pinterest</title>
<!--
A imagem do botão está em Base64 e foi obtida no IconFinder (https://www.iconfinder.com/icons/764968/media_pinterest_social_square_icon)
Se preferir, coloque este CSS num arquivo externo.
-->
<style>
.pinterest-share-button{
display: inline-block;
width: 40px;
height: 40px;
margin: 5px;
background-size: 100% 100%; /* ou 'contain' */
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSI2MHB4IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA2MCA2MCIgd2lkdGg9IjYwcHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2gvbnMiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGUvPjxkZXNjLz48ZGVmcy8+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBpZD0ic29pY2FsIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSI+PGcgaWQ9InNvY2lhbCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTY3My4wMDAwMDAsIC0xMzguMDAwMDAwKSI+PGcgaWQ9InNsaWNlcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTczLjAwMDAwMCwgMTM4LjAwMDAwM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NTA5MyA1MTMuNTUzNTk5LDI3LjMwNTM3NzUgNTEzLjE1ODY3NiwyOS4wMDgyNDg0IEM1MTIuODAwNTY1LDMwLjU1ODk5MTMgNTEyLjc0Njk2NywzMi4yNjMzNjU0IDUxMi43OTczMjYsMzMuNzAzNzcwNSBDNTEyLjk0NzgxNSwzNC45OTU5NTYxIDUxNC4xOTk0MzUsMzYuMDQ4MjI0NCA1MTUuMjg1MjUyLDM0LjYzMDY2ODYgQzUxNi4wNDg1OTIsMzMuMzg1MDgzNSA1MTYuODY5MzYsMzEuODEyMDkyNiA1MTcuMjk0MDI4LDMwLjIzNTQ5MzkgQzUxNy41NDcyOTcsMjkuMzAyNTgyOCA1MTguNzQwMDE2LDI0LjQ2OTk2NTIgNTE4Ljc0MDAxNiwyNC40Njk5NjUyIEM1MTkuNDU0NzY1LDI1Ljg2MDE2MiA1MjEuNTQxMjg5LDI3LjA4NDQwMTEgNTIzLjc1OTQ1MywyNy4wODQ0MDExIFoiIGlkPSJwaW50ZXJlc3QiLz48L2c+PC9nPjwvZz48L3N2Zz4="); /*Base 64 Icon by Xinh Studio*/
background-repeat: no-repeat;
background-position: center;
}
</style>
</head>
<body>
<a href="" id="pinterest-share-btt" rel="nofollow" target="_blank" class="pinterest-share-button"></a>
<!-- Você pode colocar este script num arquivo externo -->
<script type="text/javascript">
//Constrói a URL depois que o DOM estiver pronto
document.addEventListener("DOMContentLoaded", function() {
var url = encodeURIComponent(window.location.href);
//tenta obter o conteúdo da meta tag description
var desc = document.querySelector("meta[name='description']");
desc = (!!desc)? desc.getAttribute("content") : null;
//se a meta tag description estiver ausente...
if(!desc){
//...tenta obter o conteúdo da meta tag og:description
desc = document.querySelector("meta[property='og:description']");
desc = (!!desc)? desc.getAttribute("content") : null;
}
//metas tags description e og:description ausentes
if(!desc){
//obtém title
desc = document.title;
}
//altera a URL do botão
document.getElementById("pinterest-share-btt").href = "https://www.pinterest.com/pin/create/button/?url="+url+"&description="+encodeURIComponent(desc);
}, false);
</script>
</body>
</html>