Vá até Layout
Clique em Adicionar um Gadget
Ao abrir, clique em HTML/Javascript
Cole então o próximo código fazendo as modificações necessárias.
<style type="text/css">
.author-line {margin: 3px 0;}
.author-avatar {vertical-align:middle;}
</style>
<script type="text/javascript">
//
// Blog authors gadget, works like multi author profile gadget,
// but with post counts and avatars, ordered most written first,
// by MS-potilas 2012. See http://yabtb.blogspot.fi/2012/06/profile-gadget-with-avatars-and-post.html
//
// CONFIG:
var maxUserNameLength = 42; // 0: don't cut, >4: cut usernames
//
var txtAuthorLine = '[image] [user] tem publicado [count] [posts neste blog]'; // can also use [#] (=position)
//
var sizeAvatar = 20;
var cropAvatar = true;
//
var urlNoAvatar = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjimvnDWN_ZSbOAfn1yN1IeQtSh_4TM9t92YuwK0m7YdPSW6IF6xonKnP4ZzOmIlBdu1uVtnBGGVJ6gqReS5RVJX04Nc7ZOJsApem3G3ajiLsPu0EbLfDCqG9kXqqqVfSvXtIXjmIfqxg/"+sizeAvatar+"/avatar_blue_m_96.png"; // http://www.blogger.com/img/avatar_blue_m_96.png resizeable
// config end
function replaceAuthorVars(text, item, position)
{
if(!item || !item.author) return text;
var author = item.author;
var authorUri = "";
if(author.uri && author.uri.$t != "")
authorUri = author.uri.$t;
var avaimg = urlNoAvatar;
if(author.gd$image && author.gd$image.src)
avaimg = author.gd$image.src;
if(avaimg == "http://img2.blogblog.com/img/b16-rounded.gif" && urlNoAvatar != "")
avaimg = urlNoAvatar;
var newsize="s"+sizeAvatar;
avaimg = avaimg.replace(/\/s\d\d+-c\//, "/"+newsize+"-c/");
if(cropAvatar) newsize+="-c";
avaimg = avaimg.replace(/\/s\d\d+(-c){0,1}\//, "/"+newsize+"/");
var authorName = author.name.$t;
var imgcode = '<img class="author-avatar" height="'+sizeAvatar+'" width="'+sizeAvatar+'" title="'+authorName+'" src="'+avaimg+'" />';
if(authorUri!="") imgcode = '<a href="'+authorUri+'">'+imgcode+'</a>';
if(maxUserNameLength > 3 && authorName.length > maxUserNameLength)
authorName = authorName.substr(0, maxUserNameLength-3) + "...";
var authorcode = authorName;
if(authorUri!="") authorcode = '<a class="profile-name-link" href="'+authorUri+'">'+authorcode+'</a>';
text = text.replace('[user]', authorcode);
text = text.replace('[image]', imgcode);
text = text.replace('[#]', position);
text = text.replace('[count]', item.count);
if(item.count != 1)
text = text.replace('[post]', "posts");
else
text = text.replace('[post]', "post");
return text;
}
var blauthors = {};
var blndxbase = 1;
function showAuthors(json) {
for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
var entry = json.feed.entry[i];
var authorUri = "";
if(entry.author[0].uri && entry.author[0].uri.$t != "")
authorUri = entry.author[0].uri.$t;
var authorName = entry.author[0].name.$t;
if(blauthors[authorName])
blauthors[authorName].count++;
else {
var aut = new Object();
aut.author = entry.author[0];
aut.count = 1;
blauthors[authorName] = aut;
}
}
if(json.feed.entry.length == 500) {
blndxbase += 500;
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&start-index='+blndxbase+'&alt=json-in-script&callback=showAuthors"></'+'script>');
return;
}
var tuplear = [];
for(var key in blauthors) tuplear.push([key, blauthors[key]]);
tuplear.sort(function(a, b) {
if(b[1].count-a[1].count)
return b[1].count-a[1].count;
return (a[1].author.name.$t.toLowerCase() < b[1].author.name.$t.toLowerCase()) ? -1 : 1;
});
// output authors:
document.write('<di'+'v class="blog-author">');
for(var i = 0; i < tuplear.length ; i++) {
var item = tuplear[i][1];
document.write('<di'+'v class="author-line">');
document.write(replaceAuthorVars(txtAuthorLine, item, i+1));
document.write('</d'+'iv>');
}
document.write('</d'+'iv>');
}
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&alt=json-in-script&callback=showAuthors"></'+'script>');
</script>
.author-line {margin: 3px 0;}
.author-avatar {vertical-align:middle;}
</style>
<script type="text/javascript">
//
// Blog authors gadget, works like multi author profile gadget,
// but with post counts and avatars, ordered most written first,
// by MS-potilas 2012. See http://yabtb.blogspot.fi/2012/06/profile-gadget-with-avatars-and-post.html
//
// CONFIG:
var maxUserNameLength = 42; // 0: don't cut, >4: cut usernames
//
var txtAuthorLine = '[image] [user] tem publicado [count] [posts neste blog]'; // can also use [#] (=position)
//
var sizeAvatar = 20;
var cropAvatar = true;
//
var urlNoAvatar = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjimvnDWN_ZSbOAfn1yN1IeQtSh_4TM9t92YuwK0m7YdPSW6IF6xonKnP4ZzOmIlBdu1uVtnBGGVJ6gqReS5RVJX04Nc7ZOJsApem3G3ajiLsPu0EbLfDCqG9kXqqqVfSvXtIXjmIfqxg/"+sizeAvatar+"/avatar_blue_m_96.png"; // http://www.blogger.com/img/avatar_blue_m_96.png resizeable
// config end
function replaceAuthorVars(text, item, position)
{
if(!item || !item.author) return text;
var author = item.author;
var authorUri = "";
if(author.uri && author.uri.$t != "")
authorUri = author.uri.$t;
var avaimg = urlNoAvatar;
if(author.gd$image && author.gd$image.src)
avaimg = author.gd$image.src;
if(avaimg == "http://img2.blogblog.com/img/b16-rounded.gif" && urlNoAvatar != "")
avaimg = urlNoAvatar;
var newsize="s"+sizeAvatar;
avaimg = avaimg.replace(/\/s\d\d+-c\//, "/"+newsize+"-c/");
if(cropAvatar) newsize+="-c";
avaimg = avaimg.replace(/\/s\d\d+(-c){0,1}\//, "/"+newsize+"/");
var authorName = author.name.$t;
var imgcode = '<img class="author-avatar" height="'+sizeAvatar+'" width="'+sizeAvatar+'" title="'+authorName+'" src="'+avaimg+'" />';
if(authorUri!="") imgcode = '<a href="'+authorUri+'">'+imgcode+'</a>';
if(maxUserNameLength > 3 && authorName.length > maxUserNameLength)
authorName = authorName.substr(0, maxUserNameLength-3) + "...";
var authorcode = authorName;
if(authorUri!="") authorcode = '<a class="profile-name-link" href="'+authorUri+'">'+authorcode+'</a>';
text = text.replace('[user]', authorcode);
text = text.replace('[image]', imgcode);
text = text.replace('[#]', position);
text = text.replace('[count]', item.count);
if(item.count != 1)
text = text.replace('[post]', "posts");
else
text = text.replace('[post]', "post");
return text;
}
var blauthors = {};
var blndxbase = 1;
function showAuthors(json) {
for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
var entry = json.feed.entry[i];
var authorUri = "";
if(entry.author[0].uri && entry.author[0].uri.$t != "")
authorUri = entry.author[0].uri.$t;
var authorName = entry.author[0].name.$t;
if(blauthors[authorName])
blauthors[authorName].count++;
else {
var aut = new Object();
aut.author = entry.author[0];
aut.count = 1;
blauthors[authorName] = aut;
}
}
if(json.feed.entry.length == 500) {
blndxbase += 500;
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&start-index='+blndxbase+'&alt=json-in-script&callback=showAuthors"></'+'script>');
return;
}
var tuplear = [];
for(var key in blauthors) tuplear.push([key, blauthors[key]]);
tuplear.sort(function(a, b) {
if(b[1].count-a[1].count)
return b[1].count-a[1].count;
return (a[1].author.name.$t.toLowerCase() < b[1].author.name.$t.toLowerCase()) ? -1 : 1;
});
// output authors:
document.write('<di'+'v class="blog-author">');
for(var i = 0; i < tuplear.length ; i++) {
var item = tuplear[i][1];
document.write('<di'+'v class="author-line">');
document.write(replaceAuthorVars(txtAuthorLine, item, i+1));
document.write('</d'+'iv>');
}
document.write('</d'+'iv>');
}
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&alt=json-in-script&callback=showAuthors"></'+'script>');
</script>
Salve e pronto
.
Nenhum comentário:
Postar um comentário
A legislação brasileira prevê a possibilidade de se responsabilizar o blogueiro pelo conteúdo do blog, inclusive quanto a comentários; portanto, o autor deste blog reserva a si o direito de não publicar comentários que firam a lei, a ética ou quaisquer outros princípios da boa convivência. Não serão aceitos comentários anônimos ou que envolvam crimes de calúnia, ofensa, falsidade ideológica, multiplicidade de nomes para um mesmo IP ou invasão de privacidade pessoal / familiar a qualquer pessoa. Comentários sobre assuntos que não são tratados aqui também poderão ser suprimidos, bem como comentários com links. Este é um espaço público e coletivo e merece ser mantido limpo para o bem-estar de todos nós.