posts | comments | archives | links | create | song
(reminder: all quotes here are fiddled, probably.)

給小雲


just insert the codes into the place you want in the template. that's it.



Recent comments script
created by Ebenezer
modified by sf



<!-- **** FARRAGO RECENT COMMENTS HACK **** -->
<!-- Version 1.03 -->
<!-- Copyright c 2004 Ebenezer Orthodoxy -->
<!-- http://boggerhacks.blogspot.com -->
<!-- ************** OPTIONS *************** -->
<script type="text/javascript" language="JavaScript1.2">
var titleText = "Recent Comments";
var numberToShow = 12;
var displayTemplate = "[name]: [expt]";
var nameIsLink = true;
</script>
<!-- ********* CODE DO NOT CHANGE ******** -->
<script type="text/javascript" language="JavaScript1.2">
var comments=new Array(0);var title = "";
var itemurl = "";
function getSortDate(strDate){var d=new Date(strDate);
var day=''+d.getDate();if(day.length==1)day='0'+day;
var month=''+(d.getMonth()+1);if(month.length==1)month='0'+month;
var hour=''+d.getHours();
if(hour.length==1)hour='0'+hour;var min=''+d.getMinutes();
if(min.length==1)min='0'+min;
var sec=''+d.getSeconds();if(sec.length==1)sec= '0'+sec;
var sortDate=''+d.getFullYear()+month+day+hour+min+sec;
return sortDate;}
function recentComment(t,u,i,a,d){var rcmnt=
document.getElementById('frch'+i).innerHTML;
while(rcmnt.indexOf("\n") > -1)rcmnt=rcmnt.replace("\n","");
while(rcmnt.indexOf(" />") > -1)rcmnt=rcmnt.replace(" />","/>");
while(rcmnt.indexOf(" <a/>") > -1)rcmnt=rcmnt.replace(" <a/>","<a/>");
var author=a;
var pos=rcmnt.toLowerCase().lastIndexOf('<br><a></a>posted by');
var pos2=rcmnt.toLowerCase().lastIndexOf('<br><a></a><a></a>');
var pos3=rcmnt.toLowerCase().lastIndexOf('<br/><a/><a/>');
var pos4=rcmnt.toLowerCase().lastIndexOf('<br/><a></a><a></a>');
var aoffset=pos+6;if (pos3 > -1) pos2=pos3;
if (pos4 > -1) pos2=pos4;
if (pos2 > -1){pos=pos2;aoffset=rcmnt.toLowerCase().lastIndexOf('<a><b> </b></a>');
if (aoffset==-1)aoffset=rcmnt.toLowerCase().lastIndexOf('<a><b></b></a>')-1;}
if (pos > -1){author=rcmnt.substr(aoffset+15,rcmnt.length-1);var expt="";
expt=rcmnt.substr(0,pos-4).replace(/(<([^>]+)>)/ig,"");}
else expt=rcmnt.replace(/(<([^>]+)>)/ig,"");
author=author.replace("<A ","<a ");
if (expt.length > 50){expt=expt.substr(0,50);
if (expt.lastIndexOf(' ') > -1)
expt=expt.substr(0,expt.lastIndexOf(' '));expt+='...';}
expt=expt.replace('"',"\"");expt=expt.replace("'","\'");
if (!nameIsLink)author=author.replace(/(<([^>]+)>)/ig,"");
var exps=expt; if (exps.length > 12){exps=exps.substr(0,12);exps+='...';};
var st=getSortDate(d)+'<li>'+displayTemplate+'</li>';
st=st.replace('[name]',author);
st=st.replace('[date]','<a title="'+t+'::'+expt+'" href="'+
u+'#c'+i+'">'+d+'</a>');
st=st.replace('[expt]','<a title="'+t+'::'+d+'" href="'+
u+'#c'+i+'">'+exps+'</a>');
st=st.replace('[title]','<a title="'+expt+'" href="'+
u+'#c'+i+'">'+t+'</a>');comments.push(st);}</script>
<MainPage><h2 class="sidebar-title">
<script type="text/javascript" language="JavaScript1.2">
document.write(titleText+'</h2>');</script>
<Blogger>
<span id="frcht<$BlogItemNumber$>"
style="visibility:hidden;position:absolute;">
<BlogItemTitle><$BlogItemTitle$></BlogItemTitle></span>
<script type="text/javascript" language="JavaScript1.2">
title=document.getElementById('frcht<$BlogItemNumber$>').innerHTML;
itemurl='<$BlogItemPermalinkURL$>';</script>
<BlogItemCommentsEnabled><BlogItemComments>
<span id="frch<$BlogCommentNumber$>"
style="visibility:hidden;position:absolute;">
<$BlogCommentBody$></span>
<script type="text/javascript" language="JavaScript1.2">
recentComment(title,itemurl,'<$BlogCommentNumber$>',
'<$BlogCommentAuthor$>','<$BlogCommentDateTime$>');
</script></BlogItemComments>
</BlogItemCommentsEnabled></Blogger><ul><small>
<script type="text/javascript" language="JavaScript1.2">
comments.sort();comments.reverse();
for (i=0; i<10 && i < comments.length && i < numberToShow; i++){
var s=comments[i];s=s.substr(14,s.length-1); document.write(s);}
</script>
[<a title="Farrago Recent Comments Hack from BloggerHacks"
href="http://bloggerhacks.blogspot.com">BloggerHacks</a>]

</small>
</ul></MainPage>
<!-- END FARRAGO RECENT COMMENTS HACK -->

2 Comments:

:: Blogger ah-yun (12.05.07, 01:56   ) sagt...

thank you! but it didn't work! :(

嗚嗚嗚﹗

I think it's because you are using the old template. I tried both ways, to add as a widget and insert into the HTML. It won't accept in the HTML codes.

By the way, you might want to take out your "bloggerhack" link, click on it you will know... heh!



:: Blogger sf (12.05.07, 15:29   ) sagt...

小雲, 那沒法了.



coComment


:: Kommentar veröffentlichen
 (留言請留名, 謝!)

<< Home