Advertisement
Guest User

Recent Comments

a guest
Mar 28th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function showrecentcomments(json) {
  2. for (var i = 0; i < numcomments; i++) {
  3. var entry = json.feed.entry[i];
  4. var alturl;
  5.  
  6. if (i == json.feed.entry.length) break;
  7. for (var k = 0; k < entry.link.length; k++) {
  8. if (entry.link[k].rel == 'alternate') {
  9. alturl = entry.link[k].href;
  10. break;
  11. }
  12. }
  13. alturl = alturl.replace("#", "#comment-");
  14. var postlink = alturl.split("#");
  15. postlink = postlink[0];
  16. var linktext = postlink.split("/");
  17. linktext = linktext[5];
  18. linktext = linktext.split(".html");
  19. linktext = linktext[0];
  20. var posttitle = linktext.replace(/-/g," ");
  21. posttitle = posttitle.link(postlink);
  22. var commentdate = entry.published.$t;
  23. var cdyear = commentdate.substring(0,4);
  24. var cdmonth = commentdate.substring(5,7);
  25. var cdday = commentdate.substring(8,10);
  26. var monthnames = new Array();
  27. monthnames[1] = "Jan";
  28. monthnames[2] = "Feb";
  29. monthnames[3] = "Mar";
  30. monthnames[4] = "Apr";
  31. monthnames[5] = "May";
  32. monthnames[6] = "Jun";
  33. monthnames[7] = "Jul";
  34. monthnames[8] = "Aug";
  35. monthnames[9] = "Sep";
  36. monthnames[10] = "Oct";
  37. monthnames[11] = "Nov";
  38. monthnames[12] = "Dec";
  39. if ("content" in entry) {
  40. var comment = entry.content.$t;}
  41. else
  42. if ("summary" in entry) {
  43. var comment = entry.summary.$t;}
  44. else var comment = "";
  45. var re = /<\S[^>]*>/g;
  46. comment = comment.replace(re, "");
  47. if (!standardstyling) document.write('<div class="bbrecpost">');
  48. if (standardstyling) document.write('<br/>');
  49. if (showcommentdate == true) document.write('On ' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday + ' ');
  50. document.write('<a href="' + alturl + '">' + entry.author[0].name.$t + '</a> commented');
  51. if (showposttitle == true) document.write(' on ' + posttitle);
  52. if (!standardstyling) document.write('</div><div class="bbrecpostsum">');
  53. if (standardstyling) document.write('<br/>');
  54. if (comment.length < numchars) {
  55. if (standardstyling) document.write('<i>');
  56. document.write(comment);
  57. if (standardstyling) document.write('</i>');}
  58. else
  59. {
  60. if (standardstyling) document.write('<i>');
  61. comment = comment.substring(0, numchars);
  62. var quoteEnd = comment.lastIndexOf(" ");
  63. comment = comment.substring(0, quoteEnd);
  64. document.write(comment + '...<a href="' + alturl + '">(more)</a>');
  65. if (standardstyling) document.write('</i>');}
  66. if (!standardstyling) document.write('</div>');
  67. if (standardstyling) document.write('<br/>');
  68. }
  69. if (!standardstyling) document.write('<div class="bbwidgetfooter">');
  70. if (standardstyling) document.write('<br/>')('</div>');
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement