Follow Button
Dashboard Button
Back to top

Friday, May 29, 2015

Add Recent Comments Widget Without Author Comments for Blogger


In this tutorial, i will teach you guys how to have cool recent comments widget without author comments. As you can see at the sidebars, im using this widget. Not only because it makes my eportfolio looks good but also helps me to keep notice when someone commenting my post here. In eportfolio development interaction between lecturers and friends are crucial to encourage learning. 

Recent Comments Widget With Effects and Avatar which Exlude/Hide Author Comments

recent comments widget with hide author function, blogger tutorial, blogspot widget

Why should i add this widget to my eportfolio/blog?

As i said before, with this widget you can simply notice when someone commenting your post without the need to login to your blogger account and open the comment section. You can get a glimpse of what's happening by just simply opening your blog :)

This widget also have cool features listed below :
     
✔ beautiful rolling effect when you hover at the avatar
✔ when you click the avatar, you will be directed to the commentator profile 
    (either blogger or google plus profile)
✔ you can customize the size, color, number of characters/comments to display, and etc.
✔ when you hover at the commentator's name, u will see the title of the post they had
    commented + date & time they posted those comments
✔ and if you click the name, you will be directed to their comments
✔ the best part is that, all your comments (the author) will not be shown, so you can reply to
    your readers comments as many as you want :)

Without further ado, let's follow the tutorial:

Step 1. Go to Blogger Dashboard > select your blog > go to Layout and click on Add a Gadget link.

new blogger layout

Step 2. When the popup window appears, scroll down and choose the HTML/JavaScript widget.
blogger html javascript widget

Step 3. Copy the following code and Paste inside the empty box:
<style type="text/css">
.rc{padding-left:24px; padding-top: 6px;}
.rc a:hover {color: ##F3903E;text-decoration: none;}
.rc-ico{margin-left:-20px;margin-top:4px;float:left; margin-right:3px}
.rc-ico img {margin-top: -2px;margin-right:5px; border: 3px solid #BEBEBE;-webkit-border-radius: 100px;-moz-border-radius: 1px;border-radius: 100px;-webkit-box-shadow: 0 0px 0px rgba(0, 0, 0, .4);-moz-box-shadow: 0 0px 0px rgba(0, 0, 0, .4);box-shadow: 0 0px 0px rgba(0, 0, 0, .4);
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out; }
.rc-ico img:hover {-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);}
.rc-header{font-size: 12px;}
.rc-header a{}
.rc-body{font-style: normal;font-size:11px;padding: 1px 4px 1px 10px;border: 1px solid transparent;}
.rc-footer{font-size:10px; float: right;}
</style>
<script type="text/javascript">
var numRecentComments = 5;
var maxCommentChars = 55;
var trueAvatars = true;
var urlMyAvatar = '';
var urlMyProfile = '';
var cropAvatar = true;
var sizeAvatar = 55;
var urlNoAvatar = "http://www.vincegolangco.com/wp-content/uploads/s"+sizeAvatar+"/2010/12/batman-for-facebook.jpg";
var urlAnoAvatar = 'http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=' + sizeAvatar;
var txtMore = '';
var txtWrote = '';
var txtAnonymous = '';
var maxResultsComments = "";
var numPerPost = 2;
var maxPostTitleChars = 40;
var getTitles = true;
var maxResultsPosts = "";
var txtTooltip = '[user] on &quot;[title]&quot; - [date MM-dd-yyyy hh:mm]';
var urlToTitle = {};
function replaceVars(text, user, title, date) {
text = text.replace('[user]', user);
text = text.replace('[date]', date.toLocaleDateString());
text = text.replace('[datetime]', date.toLocaleString());
text = text.replace('[time]', date.toLocaleTimeString());
text = text.replace('[title]', title.replace(/\"/g,'&quot;'));
var i = text.indexOf("[date ");
if(i > -1) {
var format = /\[date\s+(.+?)\]/.exec(text)[1];
if(format != '') {
var txtDate = format.replace(/yyyy/i, date.getFullYear());
txtDate = txtDate.replace(/yy/i, date.getFullYear().toString().slice(-2));
txtDate = txtDate.replace("MM", String("0"+(date.getMonth()+1)).slice(-2));
txtDate = txtDate.replace("mm", String("0"+date.getMinutes()).slice(-2));
txtDate = txtDate.replace("ss", String("0"+date.getSeconds()).slice(-2));
txtDate = txtDate.replace("dd", String("0"+date.getDate()).slice(-2));
//or: txtDate = txtDate.replace("dd", date.getDate());
txtDate = txtDate.replace("hh", String("0"+date.getHours()).slice(-2));
//or: txtDate = txtDate.replace("hh", date.getHours());
text = text.replace(/\[date\s+(.+?)\]/, txtDate)
}
}
return text;
}
if(urlMyProfile == "") {
var elements = document.getElementsByTagName("*");
var expr = /(^| )profile-link( |$)/;
for(var i=0 ; i<elements.length ; i++)
if(expr.test(elements[i].className)) {
urlMyProfile = elements[i].href;
break;
}
}
function getPostUrlsForComments(json) {
for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
var entry = json.feed.entry[i];
for (var k = 0; k < entry.link.length; k++ ) {
if (entry.link[k].rel == 'alternate') {
href = entry.link[k].href;
break;
}
}
urlToTitle[href] = entry.title.$t;
}
}
function showRecentComments(json) {
var postHandled = {};
var j = 0;
if(numPerPost) {
while(numPerPost < numRecentComments) {
for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
var entry = json.feed.entry[i]; if(entry.author[0].name.$t=="YOUR NAME") continue;
if(entry["thr$in-reply-to"]) {
if(!postHandled[entry["thr$in-reply-to"].href])
postHandled[entry["thr$in-reply-to"].href] = 1;
else
postHandled[entry["thr$in-reply-to"].href]++;
if(postHandled[entry["thr$in-reply-to"].href] <= numPerPost)
j++;
}
}
if(j >= numRecentComments)
break;
numPerPost++;
j = 0;
postHandled = {};
}
if(numRecentComments == numPerPost)
numPerPost = 0;
}
postHandled = {};
j = 0;
for(var i = 0 ; j < numRecentComments && i < json.feed.entry.length ; i++ ) {
var entry = json.feed.entry[i]; if(entry.author[0].name.$t=="YOUR NAME") continue;
if(numPerPost && postHandled[entry["thr$in-reply-to"].href] && postHandled[entry["thr$in-reply-to"].href] >= numPerPost)
continue;
if(entry["thr$in-reply-to"]) {
if(!postHandled[entry["thr$in-reply-to"].href])
postHandled[entry["thr$in-reply-to"].href] = 1;
else
postHandled[entry["thr$in-reply-to"].href]++;
j++;
var href='';
for (var k = 0; k < entry.link.length; k++ ) {
if (entry.link[k].rel == 'alternate') {
href = entry.link[k].href;
break;
}
}
if(href=='') {j--; continue; }
var hrefPost = href.split("?")[0];
var comment = "";
if("content" in entry) comment = entry.content.$t;
else comment = entry.summary.$t;
comment = comment.replace(/<br[^>]*>/ig, " ");
comment = comment.replace(/<\S[^>]*>/g, "");
var postTitle="-";
if(urlToTitle[hrefPost]) postTitle=urlToTitle[hrefPost];
else {
if(hrefPost.match(/\/([^/]*)\.html/)) postTitle = hrefPost.match(/\/([^/]*)\.html/)[1].replace(/_\d{2}$/, "");
postTitle = postTitle.replace(/-/g," ");
postTitle = postTitle[0].toUpperCase() + postTitle.slice(1);
}
if(maxPostTitleChars && postTitle.length > maxPostTitleChars) {
postTitle = postTitle.substring(0, maxPostTitleChars);
var indexBreak = postTitle.lastIndexOf(" ");
postTitle = postTitle.substring(0, indexBreak) + "...";
}
var authorName = entry.author[0].name.$t;
var authorUri = "";
if(entry.author[0].uri && entry.author[0].uri.$t != "")
authorUri = entry.author[0].uri.$t;
var avaimg = urlAnoAvatar;
var bloggerprofile = "http://www.blogger.com/profile/";
if(trueAvatars && entry.author[0].gd$image && entry.author[0].gd$image.src && authorUri.substr(0,bloggerprofile.length) == bloggerprofile)
avaimg = entry.author[0].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+"/");
if(authorName == 'Anonymous' && txtAnonymous != '' && avaimg == urlAnoAvatar)
authorName = txtAnonymous;
var imgcode = '<img height="'+sizeAvatar+'" width="'+sizeAvatar+'" title="'+authorName+'" src="'+avaimg+'" />';
if (authorUri!="") imgcode = '<a href="'+authorUri+'">'+imgcode+'</a>';
var clsAdmin = "";
if(urlMyProfile != "" && authorUri == urlMyProfile)
clsAdmin = " rc-admin";
var datePart = entry.published.$t.match(/\d+/g); // assume ISO 8601
var cmtDate = new Date(datePart[0],datePart[1]-1,datePart[2],datePart[3],datePart[4],datePart[5]);
var txtHeader = txtWrote;
if(txtWrote.indexOf('[')==-1)
txtHeader = authorName + ' ' + txtWrote;
else
txtHeader = replaceVars(txtHeader, authorName, postTitle, cmtDate);
var tooltip = replaceVars(txtTooltip, authorName, postTitle, cmtDate);
if(!/#/.test(href)) href += "#comments";
document.write('<div title="'+tooltip+'" class="rc'+clsAdmin+'">');
document.write('<div title="'+tooltip+'" class="rc-header'+clsAdmin+'"><div title="'+tooltip+'" class="rc-ico'+clsAdmin+'">'+imgcode+'</div><a title="'+tooltip+'" href="' + href + '">' + txtHeader + ' </a></div>');
if(comment.length < maxCommentChars)
document.write('<div title="'+tooltip+'" class="rc-body'+clsAdmin+'">' + comment + '</div>');
else {
comment = comment.substring(0, maxCommentChars);
var indexBreak = comment.lastIndexOf(" ");
comment = comment.substring(0, indexBreak);
document.write('<div title="'+tooltip+'" class="rc-body'+clsAdmin+'">' + comment + '...</div>');
if(txtMore != "") {
var moretext = replaceVars(txtMore, authorName, postTitle, cmtDate);
document.write('<div title="'+tooltip+'" class="rc-footer'+clsAdmin+'"><a title="'+tooltip+'" href="' + href + '">' + moretext + '</a></div>');
}
}
document.write('<div style="clear:both;"></div></div>');
}
}
}
if(getTitles)
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/summary?redirect=false'+maxResultsPosts+'&alt=json-in-script&callback=getPostUrlsForComments"></'+'script>');
document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/comments/default?redirect=false'+maxResultsComments+'&alt=json-in-script&callback=showRecentComments"></'+'script>');
</script>
Step 4. Replace this line  $t=="YOUR NAME"  with your blogger/google+ profile name. You will find this line twice in the code, change both. Remember, this is code is case-sensitive,
if your name ex. Linda Khoo you have to write it as (entry.author[0].name.$t=="Linda Khoo")

How to customize?

If you just copy-paste the above code without changing any value, your widget will look exactly like this blog recent comments widget. You can change the code a little bit to make it looks different:

● border: 3px solid #BEBEBE 
   3 here refer to the thickness of the border around the avatar and #BEBEBE refer to the
   border color. Visit Here and Here to get the color code if you want to change the color.

● .rc-header{font-size: 12px;} - 12 refer to the size of the commentator's name.

●  rc-body{font-style: normal;font-size:11px
    font-style can either be normal or italic 11 refer to the comments font-size in the widget.

● numRecentComments = 5 - the number of recent comments you want to display. 
● maxCommentChars = 55 - the number of characters in the comments you want to display.
● sizeAvatar = 55 - the size of the avatar. 


Step 5. After you've made the changes, click Save.. and you are Done!


P/s: If you guys have any questions, don't hesitate to ask in the comment section below ok :)

Credit to: helpblogger 

20 comments:

  1. Awesome :) thanks for this tutorial :)

    ReplyDelete
  2. okay nice tutorial.. thanks for sharing...

    My Latest Entry : Sakit Lutut Punca Dan Rawatan

    ReplyDelete
  3. Thanks you for sharing this tutorial.

    ReplyDelete
  4. My friend asked a question. Add Recent Comments Widget to Blogger without author comments. You cannot answer this question. because to much work load from my Custom Assignment Writing Service so that why I could not that answer

    ReplyDelete
  5. If you just copy-paste the above code without changing any value, your widget will look exactly like this blog recent comments widget. lawn dresses with prices , latest lawn collection 2016 with price

    ReplyDelete
  6. Best Merchant Cash Advance Leads Best Merchant Cash Advance Leads are exclusive Leads addressed to you Merchant Cash Advance Leads is the Qualified MCA Leads provider as a firm in the entire globe.

    ReplyDelete
  7. Very good written article. It will be supportive to anyone who utilizes it, including me. Keep doing what you are doing ? can’r wait to read more posts.
    very nice article. 바카라
    (mm)

    ReplyDelete
  8. I recently came across your blog and have been reading along. I found your website via Google while searching for a related topic, your website came up, it looks great. I have bookmarked it. Great info! I recently came across your blog and have been reading along. I especially appreciate content that has to do with beauty and fitness, so it’s of particular interest to me to see what you have here. Thanks for sharing this informative post with us, Keep sharing it in future also. There. I found your blog using msn. This is a really well written article. l make sure to bookmark it and return to read more of your useful info. Thanks for the post.
    슬롯사이트


    >cc

    ReplyDelete
  9. Add Recent Comments Widget Without Author Comments For Blogger >>>>> Download Now

    >>>>> Download Full

    Add Recent Comments Widget Without Author Comments For Blogger >>>>> Download LINK

    >>>>> Download Now

    Add Recent Comments Widget Without Author Comments For Blogger >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete
  10. I like your post about add recent comments widget without author comments for blogger it is very good written article. It will be supportive to anyone who utilizes it, please keep up your great job on your site. Anyways, Try accounting homework help service if ever you need help in your homework because they are providing assignment help in uk at very cheap prices so come visit this.

    ReplyDelete
  11. hello, my name is ezra daniel and i am a content writer. I really like your blog, this blog is very informative. thanks for sharing this because it will enhance our knowledge.
    Read More

    ReplyDelete
  12. Very detailed information was provided by you on the topic of how to have cool recent comments widget without author comments. This article would be very helpful for the readers. Thanks for sharing with us. Now it's time to avail Window Installation Services In Citrus County FL for more information.

    ReplyDelete
  13. You have shared very good points on the Comments Widget. Thanks for sharing your thoughts. Your article is really helpful for us. Now it's time to avail Affordable car service orange county for more informatio

    ReplyDelete
  14. I hope this post finds you all in good spirits. Today, I wanted to share my excitement about Break Even Analysis and how it has helped me gain a deeper understanding of my business's financial health. Moreover, I wanted to extend a helping hand to anyone seeking assistance with this crucial concept.

    Undoubtedly, Break Even Analysis Assignment Help is a vital tool for entrepreneurs and business owners alike. It allows us to determine the point at which our revenues cover all costs, enabling us to make informed decisions and set realistic goals. Through my own experience, I have realized the immense impact this analysis can have on the growth and profitability of any venture.

    If you're currently facing challenges with Break Even Analysis or simply looking to strengthen your understanding, fret not! I'm here to offer my assistance. Having delved deep into the subject, I can provide guidance, clarify any doubts, and even share helpful resources to simplify the process for you.

    So, whether you're a student tackling an assignment or a business professional seeking practical application, feel free to reach out. Together, we can unlock the secrets of Break Even Analysis and propel our ventures to greater heights.

    Let's conquer Break Even Analysis and watch our businesses thrive!

    ReplyDelete

Need to add an image/video?
[img]http://i681.photobucket.com/albums/vv180/kylekaulitzalyamani/tips.jpg[/img]
Thank you so much for taking the time to comment this post! ♥