Hello Friends! Hoje apresento o widget dos principais comentaristas do seu blog. É muito importante saber quem são os usuários que deixam mais comentários no blog, os que são mais ativos.
![]() |
Então vamos lá:
1. Primeiramente acesse o painel do Blogger;
2. Clique na guia "Layout" do blog desejado, em seguida "Adicionar um Gadget" e escolha o gadget "HTML/JavaScript".
3. Copie todo o código abaixo, e cole no gadget que você selecionou acima.
<style type = "text / css">
.top-comentaristas {
margin: 3px 0;
border-bottom: 1px #ccc pontilhada;
}
.avatar-top-comentaristas {
vertical-align: middle;
border-radius: 30px;
}
.Top-comentaristas .commenter-link-name {
padding-left: 0;
}
</ style>
<script type = "text / javascript"> var maxTopCommenters = 5; var minComments = 1; var numdays = 0; var excludeMe = true; var ExcludeUsers = [ "Anonymous", " seunomeaqui "]; var maxUserNameLength = 42; // var txtTopLine = '<b> [#] </ b> [imagem] [usuário] ([count]).'; var txtNoTopCommenters = 'Nenhum comentadores de topo no momento.'; var txtAnonymous = ''; // var sizeAvatar = 33; var cropAvatar = true; // var urlNoAvatar = + SizeAvatar; var urlAnoAvatar = 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH8Tx7yC1mfb7U9v1iyyMHzu6E1a8ND-483qfyGK4bahBkO0cAJjZgB0tfjBiY-2BcgMLR_6Qt8Rho55i_hE6X0_H5iMTDWNyhCAQagUoao-YuKQQjfQqrJsa223cPYKukzdu6lwP1Jfvr/s1600/avatar1.png' + sizeAvatar; var urlMyProfile = ''; var urlMyAvatar = '' ; (! Array.indexOf) se { Array.prototype.indexOf = function (obj) { for (var i = 0; i <this.length; i ++) se (este [i] == obj) return i; retorno - 1; }} replaceTopCmtVars função (texto, item, posição) { se o texto de retorno (item de || item.author!); var autor = item.author; var authorUri = ""; if (author.uri && author.uri .! ") $ t =" . authorUri = author.uri $ t; var avaimg = urlAnoAvatar; var bloggerprofile = "http://www.blogger.com/profile/"; if (autor $ imagem author.gd &&. gd $ image.src && authorUri.substr (0, bloggerprofile.length) == bloggerprofile) avaimg = author.gd $ image.src; else { var parseURL = document.createElement ( 'a'); if (! authorUri = " ") { parseurl.href = authorUri; avaimg = 'http://www.google.com/s2/favicons?domain=' + parseurl.hostname; } } if (! urlMyProfile =" "&& authorUri == urlMyProfile && urlMyAvatar ! = "") avaimg = urlMyAvatar; 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; if (Anonymous authorName == ' '&& txtAnonymous =!' '&& avaimg == urlAnoAvatar) authorName = txtAnonymous; var imgcode =' <img class = "avatar-top-comentaristas" 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 = "comentarista-link-name" href = "" + authorUri + ""> '+ authorcode +' </a> '; text = text.replace (' [usuário] ', authorcode); text = text.replace (' [ imagem] ', imgcode); text = text.replace (' [#] ', posição); text = text.replace (' [contador] ', item.count); retornar texto; } var topcommenters = {}; var ndxbase = 1; showTopCommenters função (JSON) { var one_day = 1000 * 60 * 60 * 24; var hoje = new Date (); if (urlMyProfile == "") { var elementos = document.getElementsByTagName ( "*"); var = / expr (^ | ) perfil-link (| $) /; for (var i = 0; i <elements.length; i ++) if (expr.test (elementos [i] .className)) { urlMyProfile = elementos [i] .href; pausa ; } } if (json && json.feed && json.feed.entry && json.feed.entry.length) for (var i = 0; i <json.feed.entry.length; i ++) { entrada var = json. feed.entry [i]; if (numdays> 0) { var datepart = entry.published $ t.match (/ \ d + / g);. var cmtDate = new Date (datepart [0], datepart [1] -1 , datepart [2], datepart [3], datepart [4], datepart [5]); var dias Math.ceil = ((today.getTime () - cmtDate.getTime ()) / (one_day)); if ( dias> numdays) break; } var authorUri = ""; . if (! entry.author [0] .uri && entry.author [0] .uri $ t = "") authorUri = entry.author [0] .uri . $ t; if (excludeMe && authorUri = "" && authorUri == urlMyProfile!) continue; var authorName = entry.author [0] .name $ t;. if (! excludeUsers.indexOf (authorName) = -1) continuam ; . var de hash = entry.author [0] .name $ t + "-" + authorUri; if (topcommenters [de hash]) topcommenters [haxixe] .count ++; else { var comentarista = new Object (); commenter.author = entry.author [0]; commenter.count = 1; topcommenters [haxixe] = comentarista; } } if (json && json.feed && json.feed.entry && json.feed.entry.length && json.feed.entry. comprimento == 200) { ndxbase + = 200; document.write ( '<script type = "text / javascript" converter objeto a matriz de tuplas var tuplear = []; para (chave var na topcommenters) tuplear.push ([chave, topcommenters [chave]]); tuplear.sort (function (a, b) { if (b [1] .count-a [1] .count) de retorno b [1] .count-a [1] .count; retorno (. a [1] .author.name $ t.toLowerCase () <b [1] .author. . name $ t.toLowerCase ()) -1: 1; }); var realcount = 0; for (var i = 0; i <maxTopCommenters && i <tuplear.length; i ++) { var item = tuplear [i] [1]; if (item.count <minComments) break; document.write ( '<di' + 'classe v = "top-comentaristas">'); document.write (replaceTopCmtVars (txtTopLine, item, type = "text / javascript"
.top-comentaristas {
margin: 3px 0;
border-bottom: 1px #ccc pontilhada;
}
.avatar-top-comentaristas {
vertical-align: middle;
border-radius: 30px;
}
.Top-comentaristas .commenter-link-name {
padding-left: 0;
}
</ style>
<script type = "text / javascript"> var maxTopCommenters = 5; var minComments = 1; var numdays = 0; var excludeMe = true; var ExcludeUsers = [ "Anonymous", " seunomeaqui "]; var maxUserNameLength = 42; // var txtTopLine = '<b> [#] </ b> [imagem] [usuário] ([count]).'; var txtNoTopCommenters = 'Nenhum comentadores de topo no momento.'; var txtAnonymous = ''; // var sizeAvatar = 33; var cropAvatar = true; // var urlNoAvatar = + SizeAvatar; var urlAnoAvatar = 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH8Tx7yC1mfb7U9v1iyyMHzu6E1a8ND-483qfyGK4bahBkO0cAJjZgB0tfjBiY-2BcgMLR_6Qt8Rho55i_hE6X0_H5iMTDWNyhCAQagUoao-YuKQQjfQqrJsa223cPYKukzdu6lwP1Jfvr/s1600/avatar1.png' + sizeAvatar; var urlMyProfile = ''; var urlMyAvatar = '' ; (! Array.indexOf) se { Array.prototype.indexOf = function (obj) { for (var i = 0; i <this.length; i ++) se (este [i] == obj) return i; retorno - 1; }} replaceTopCmtVars função (texto, item, posição) { se o texto de retorno (item de || item.author!); var autor = item.author; var authorUri = ""; if (author.uri && author.uri .! ") $ t =" . authorUri = author.uri $ t; var avaimg = urlAnoAvatar; var bloggerprofile = "http://www.blogger.com/profile/"; if (autor $ imagem author.gd &&. gd $ image.src && authorUri.substr (0, bloggerprofile.length) == bloggerprofile) avaimg = author.gd $ image.src; else { var parseURL = document.createElement ( 'a'); if (! authorUri = " ") { parseurl.href = authorUri; avaimg = 'http://www.google.com/s2/favicons?domain=' + parseurl.hostname; } } if (! urlMyProfile =" "&& authorUri == urlMyProfile && urlMyAvatar ! = "") avaimg = urlMyAvatar; 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; if (Anonymous authorName == ' '&& txtAnonymous =!' '&& avaimg == urlAnoAvatar) authorName = txtAnonymous; var imgcode =' <img class = "avatar-top-comentaristas" 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 = "comentarista-link-name" href = "" + authorUri + ""> '+ authorcode +' </a> '; text = text.replace (' [usuário] ', authorcode); text = text.replace (' [ imagem] ', imgcode); text = text.replace (' [#] ', posição); text = text.replace (' [contador] ', item.count); retornar texto; } var topcommenters = {}; var ndxbase = 1; showTopCommenters função (JSON) { var one_day = 1000 * 60 * 60 * 24; var hoje = new Date (); if (urlMyProfile == "") { var elementos = document.getElementsByTagName ( "*"); var = / expr (^ | ) perfil-link (| $) /; for (var i = 0; i <elements.length; i ++) if (expr.test (elementos [i] .className)) { urlMyProfile = elementos [i] .href; pausa ; } } if (json && json.feed && json.feed.entry && json.feed.entry.length) for (var i = 0; i <json.feed.entry.length; i ++) { entrada var = json. feed.entry [i]; if (numdays> 0) { var datepart = entry.published $ t.match (/ \ d + / g);. var cmtDate = new Date (datepart [0], datepart [1] -1 , datepart [2], datepart [3], datepart [4], datepart [5]); var dias Math.ceil = ((today.getTime () - cmtDate.getTime ()) / (one_day)); if ( dias> numdays) break; } var authorUri = ""; . if (! entry.author [0] .uri && entry.author [0] .uri $ t = "") authorUri = entry.author [0] .uri . $ t; if (excludeMe && authorUri = "" && authorUri == urlMyProfile!) continue; var authorName = entry.author [0] .name $ t;. if (! excludeUsers.indexOf (authorName) = -1) continuam ; . var de hash = entry.author [0] .name $ t + "-" + authorUri; if (topcommenters [de hash]) topcommenters [haxixe] .count ++; else { var comentarista = new Object (); commenter.author = entry.author [0]; commenter.count = 1; topcommenters [haxixe] = comentarista; } } if (json && json.feed && json.feed.entry && json.feed.entry.length && json.feed.entry. comprimento == 200) { ndxbase + = 200; document.write ( '<script type = "text / javascript" converter objeto a matriz de tuplas var tuplear = []; para (chave var na topcommenters) tuplear.push ([chave, topcommenters [chave]]); tuplear.sort (function (a, b) { if (b [1] .count-a [1] .count) de retorno b [1] .count-a [1] .count; retorno (. a [1] .author.name $ t.toLowerCase () <b [1] .author. . name $ t.toLowerCase ()) -1: 1; }); var realcount = 0; for (var i = 0; i <maxTopCommenters && i <tuplear.length; i ++) { var item = tuplear [i] [1]; if (item.count <minComments) break; document.write ( '<di' + 'classe v = "top-comentaristas">'); document.write (replaceTopCmtVars (txtTopLine, item, type = "text / javascript"
4. Clique no botão "Salvar" e pronto.
No código a marcação em vermelho (seunomeaqui), coloque o nome que você usa para responder os comentários do seu blog. Caso negativo, seu nome será contabilizado com os principais comentaristas.
Se você desejar que mais nomes de usuários não apareça no widget, é só acrescentar a , " nomedesejado ".
É isso pessoal, espero ter ajudado! Caso ficou alguma dúvida, deixe aqui nos comentários.
Olha amigo, essa é uma boa estratégia, eu gostei, no meu blog sei pela foto quem me visita mais, e quem visita nunca deixei de visitar, mas esse aà em cima é bom demais obrigada pela dica.
ResponderExcluirtambém tenho post novo, se puder ver
magrafelizpensa.blogspot.com
Olá Marcelia, seja bem-vinda!
ExcluirQue bom que você gostou da postagem. Muito obrigado pela visita e espero te ver mais vezes aqui! Abraços.
Este comentário foi removido pelo autor.
ResponderExcluirEste comentário foi removido pelo autor.
Excluir