Lên đầu trang
Xuống cuối trang

Để cài đặt tiện ích này, trước tiên bạn cần chuẩn bị một số điều kiện sau đây. Thứ nhất là BlogID của bạn, nó chính là chuỗi số trên công cụ trình duyệt khi bạn đăng nhập Blogger ở chế độ chỉnh sửa Template. Thứ hai là Blogger Profile ID của bạn, nó là chuỗi số trên công cụ trình duyệt khi bạn xem hồ sơ Blogger của bạn (ví dụ: http://www.blogger.com/profile/08632189195057782511).

Nào, chúng ta cùng cài đặt nhé. Đăng nhập Blogger, vào Design >> Page Elements. Thêm một tiện ích HTML/JavaScript và đặt đoạn code dưới đây vào phần nội dung tiện ích.

<style type="text/css">
.rcmstyle {padding:3px 0 5px;border-bottom:1px #bbbbbb dotted}
.rcmstyle:hover {background: #A0CFEC}
.rcmstyle a {text-decoration:none}
.rcmstyle a:hover {text-decoration:underline;color: #667C26}
</style>
<script type="text/javascript">
var cm_mode = "icon"; // Bạn hãy xóa từ icon nếu k muốn hiển thị icon
var cm_num = 7; // Số nhận xét
var cm_desc = 100; // Số ký tự thể hiện độ dài nhận xét
var blogID = "5730565790137789925"; // Bạn thay ID cho blog của bạn
var homepage = "http://huynh-nhat-ha.blogspot.com"; // Bạn cần thay tên blogspot

var cm_icon = new Array();
cm_icon['admin'] = "URL_icon_Admin"; // Bạn cần thay URL_icon_của bạn
cm_icon['blogger'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/blogger.gif";
cm_icon['openid'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/openid.gif";
cm_icon['livej'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/lj.gif";
cm_icon['wp'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/wp.gif";
cm_icon['typekey'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/typkey.gif";
cm_icon['aim'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/aim.gif";
cm_icon['anon'] = "http://sites.google.com/site/ngonngulaptrinhvn/files/anon.gif";
</script>
<script type="text/javascript">
function removeHtmlTag(strx,chop){
if(strx.indexOf("<")!=-1)
{
var s = strx.split("<");
for(var i=0;i<s.length;i++){
if(s[i].indexOf(">")!=-1){
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
}
}
strx = s.join("");
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+'...';
}

function showRComments(json){
var entry = json.feed.entry;
var str = "<ul id=\"rcommentwg\">";
var month = [1,2,3,4,5,6,7,8,9,10,11,12];
var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
for(var i=0; i < cm_num; i++){

str += "<li class=\"rcmstyle\">" + "<a href='" + entry[i].link[2].href + "'>" + entry[i].author[0].name.$t+"</a>";
var pdate = entry[i].published.$t;
var m = parseInt(pdate.substring(5,7));
for(var j=0; j<month.length;j++){
if(m==month[j]){
m = month2[j]; break;
}
}
str += ", <i><a href='" + entry[i].link[2].href + "'>" + pdate.substring(8,10) + "-" + pdate.substring(5,7) + "-" + pdate.substring(0,4)+"</a></i>";
str += "<br/> " + removeHtmlTag(entry[i].summary.$t,cm_desc) + "</li>";
}
str = str + "</ul>";
document.write(str);
}
function showRCommentsThumb(json){
var entry = json.feed.entry;
var str = "<div id=\"rcommentwg\">";

var month = [1,2,3,4,5,6,7,8,9,10,11,12];
var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
for(var i=0; i < cm_num; i++){
var iconUrl = entry[i].author[0].uri;
var iconT = "";
if(iconUrl != undefined) {
if(iconUrl.$t.match("00819429141342166010")) { iconT = cm_icon['admin'] ;}
else if(iconUrl.$t.match("blogger.com")) { iconT = cm_icon['blogger'] ;}
else if(iconUrl.$t.match("openid.net")) { iconT = cm_icon['openid'] ;}
else if(iconUrl.$t.match("livejournal.com")) { iconT = cm_icon['livej'] ;}
else if(iconUrl.$t.match("wordpress.com")) { iconT = cm_icon['wp'] ;}
else if(iconUrl.$t.match("typekey.com")) { iconT = cm_icon['typekey'] ;}
else if(iconUrl.$t.match("aol.com")) { iconT = cm_icon['aim'] ;}
else { iconT = cm_icon['anon'] ;}
} else { iconT = cm_icon['anon'] ;}

str += "<div class=\"rcmstyle\"><img align=\"top\" src=\"" + iconT + "\" />&nbsp;<a href='" + entry[i].link[2].href + "'>" + entry[i].author[0].name.$t+"</a>";
var pdate = entry[i].published.$t;
var m = parseInt(pdate.substring(5,7));
for(var j=0; j<month.length;j++){
if(m==month[j]){
m = month2[j]; break;
}
}
str += ", <i><a href='" + entry[i].link[2].href + "'>"+ pdate.substring(11,16) + "-" + pdate.substring(8,10) + "/" + pdate.substring(5,7) + "/" + pdate.substring(2,4)+"</a></i>";
str += "<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + removeHtmlTag(entry[i].summary.$t,cm_desc) + "</div>";
}
str = str + "</div>";
document.write(str);

}
if(cm_mode == "icon") {
document.write("<script type=\"text/javascript\" src=\""+homepage+"/feeds/comments/summary?max-results="+cm_num+"&alt=json-in-script&callback=showRCommentsThumb\"><\/script>");
}

else {
document.write("<script type=\"text/javascript\" src=\""+homepage+"/feeds/comments/summary?max-results="+cm_num+"&alt=json-in-script&callback=showRComments\"><\/script>");
}
</script>
<div class='clear'></div>

Trong đoạn code trên, bạn cần thay BlogID và thay chuỗi số 00819429141342166010 bằng ID cho Blogger Profile của bạn. Ngoài ra cần thay tên blogspot của bạn và URL icon đại diện cho bạn là tác giả blog (Ngoài ra bạn nên download các icon về rồi upload lên host của bạn để xài riêng, tránh hạn chế băng thông do dùng chung code thủ thuật). Sau đó Lưu tiện ích là OK.

ST:
http://huynh-nhat-ha.blogspot.com/2011/01/recent-comments-with-icon-widget.html

Posted by ChoiBlogs.blogspot.com Thứ Ba, 18 tháng 1, 2011

0 comments

Đăng nhận xét

_ Khi nhận xét không phải xác minh từ.
_ Bạn nhận xét xong sẽ được quản lý duyệt.
_ Spam link vào nhận xét xem như bạn đã chưa nhận xét !
_ Ghé thăm tôi vào những lúc bạn vui hoặc buồn và khi cần hổ trợ gì đó !
_ Khi bài viết nào có lỗi: xin vui lòng góp ý chân thành! cảm ơn!!!

Nhãn Đám Mây

Software (754) Video (582) Video-Fun (227) Thủ Thuật Blog (211) System tools (184) Hài Kịch (182) Video-Pro (179) Pictures-Fun (161) Tin gì (156) Tin gì ? (154) THỦ THUẬT INTETNET (136) Wallpaper (123) Pictures-Girl Xinh (117) Gift of life (110) Internet Tools (105) Games (75) Template PTS (67) Skin-Gaw2 (66) Giải Trí (65) Others (60) Video-Shock (58) Thủ Thuật Máy Tính (48) Design Tools (46) Music (43) Download Tools (42) CSS ChoiBlogs (41) Anti-Virus (39) Sức Khoẻ (32) Kỹ Năng Sống (30) MultiMedia (28) Video-Tools (28) Cosplay (25) USB Tools (24) Browsers (22) Desktop (22) PDF Tools (22) Phim (22) Rar-Zip-Tool (22) Video-Animals (21) Burning- Convert (19) Thơ và Nhạc (19) Drivers (18) Hoài Linh (18) Media Player (18) Pictures-Pro (18) Rao Bán (18) Registry Tool (18) Thủ Thuật Yahoo (18) Khóa Thư Mục-WebĐen-EXE (15) Virus (15) Add or Remove Programs (14) Thơ (14) Video-SHOW (14) Phong Lee (13) Game-Web (12) Video-Tài Liệu (12) Hide-IP Tools (11) List Xem Nhanh ChoiBlogs (11) Photos -pictures tools (11) Video-Thể Thao (11) Free Licence (10) Office Tools (10) Task Manager Tool (10) Thủ Thuật Facebook (10) Thủ Thuật Photoshop (10) Thủ Thuật Youtube (10) Vietnam's Got Talent (10) WiFi Tools (10) -Cổ tích Việt Nam- (9) DVD-Tools (9) HDD Tool (9) Thủ Thuật Android (Thiết Bị Di Động) (9) Video- Sao Nối Ngôi (9) Video-Bình Tinh (9) Video-Music (9) Video-VÕ HẠ TRÂM (9) Video-Thời Sự (8) Video-Thủ Thuật Đời Sống (8) Defrag tools (7) Flash Tools (7) HTML Tool (7) Hacker Tool (7) MP3 Tools (7) Thuý Nga (7) Từ Khóa Google (7) Icon Tools (6) Kiếm Tiền Online (6) Music-Girl Xinh (6) Tình Yêu (6) Video-Gương Mặt Thân Quen 2016 (6) Chí Tài (5) Game Flash (5) Game Tools (5) Góc nhìn (5) Mobile Tools (5) Nguyen Thi Anh Vien (5) Translate Tools (5) Webcam Tool (5) skin-blog (5) Firewalls (4) Game-mini (4) Screensaver Tools (4) Video-Cờ Cá Ngựa (4) Video-Kim Tử Long (4) Video-Thể Hình (4) Font View (3) Templates (3) Windows 7 (3) Windows Tools (3) Actions PTS (2) Audio tools (2) Editing tools (2) Event-Online (2) Font (2) Game-DOWNLOAD (2) Game-MU Đại Thiên Sứ (2) Ghost WINDOWN (2) Host Free (2) Infographic (2) Keylogger Tools (2) Nghệ Sĩ Minh Béo (2) Nhật Cường (2) PTS Brush (2) PTS Style (2) Sống Đẹp (2) Video-Game (2) Video-Quân Sự (2) Đạo Đời (2) CPU-Tools (1) Camera (1) Camera giao thông (1) Chính Sách Mới - Pháp Luật (1) Coppy Tools (1) Công Nghệ (1) Cảnh Giác (1) Dương Thúy Vi-Wuhsu (1) File Hệ Thống (1) Files Manager (1) Game-Gaw2 (1) Ghost XP (1) Hack Blog (1) Hệ Điều Hành (1) Icon Cảm Xúc (1) Iphone-Tools (1) Khám Phá (1) Music- Pic-Pro (1) PDS PhoToShop (1) Phần Cứng (1) Portable (1) Soft-Test (1) Soft-Việt Hóa (1) Sách Nói (1) TIVI Online (1) Thủ Thuật - Proshow Producer (1) Thủ Thuật Mobile (1) Thủ Thuật-Cốc Cốc (1) Thủ Thuật Di Động (1) Thủ Thuật FireFox (1) Thủ Thuật Phần Cứng (1) Thủ Thuật office (1) Thủ Thuật Điện (1) Thủ Thuật Đời Sống (1) Tin-Bảo Mật (1) Tình Yêu và Cuộc Sống (1) Tiện Ích FireFox (1) Tiện Ích Mouse (1) Tuyển THành Viên (1) Tài Liệu - Biểu Mẫu (1) Tình Yêu Giới Tính (1) Tự Kỷ (1) Video Tools (1) Video-Công Nghệ (1) Video-Cảnh Giác (1) Video-Giao Thông (1) Video-Hướng Dẫn Làm (1) Video-Movie (1) Video-NSƯT Bạch Long (1) Video-Sáng Tạo (1) Video-Thủ Thuật - Proshow Producer (1) Video-Vietnam's Got Talent 2014 (1) Video-Đời Sống (1) Video-Ơn Trời Cậu Đây Rồi (1) Yahoo Chat (1) [Danh Sách] Karaoke MrChoiBlog (Karaoke-Beat-Chuẩn) (1)

Đăng ký nhận bài viết mới

Bài đăng phổ biến

New Commets