Advertisement
Guest User

Code:

a guest
Sep 2nd, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <!-- Auto read more script Start -->
  2. <script type='text/javascript'>
  3. var thumbnail_mode = "yes"; //yes -with thumbnail, no -no thumbnail
  4. summary_noimg = 430; //summary length when no image
  5. summary_img = 340; //summary length when with image
  6. img_thumb_height = 200;
  7. img_thumb_width = 200;
  8. </script>
  9. <script type='text/javascript'>
  10. //<![CDATA[
  11. function removeHtmlTag(strx,chop){
  12. if(strx.indexOf("<")!=-1)
  13. {
  14. var s = strx.split("<");
  15. for(var i=0;i<s.length;i++){
  16. if(s[i].indexOf(">")!=-1){
  17. s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
  18. }
  19. }
  20. strx = s.join("");
  21. }
  22. chop = (chop < strx.length-1) ? chop : strx.length-2;
  23. while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
  24. strx = strx.substring(0,chop-1);
  25. return strx+'...';
  26. }
  27.  
  28. function createSummaryAndThumb(pID){
  29. var div = document.getElementById(pID);
  30. var imgtag = "";
  31. var img = div.getElementsByTagName("img");
  32. var summ = summary_noimg;
  33. if(thumbnail_mode == "yes") {
  34. if(img.length>=1) {
  35. imgtag = '<span style="float:left; padding:0px 10px 5px 0px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';
  36. summ = summary_img;
  37. }
  38. }
  39. var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
  40. div.innerHTML = summary;
  41. }
  42. //]]>
  43. </script>
  44. <!-- Auto read more script End -->
  45.  
  46.  
  47.  
  48. 5. Now find this line <data:post.body/> and replace this line with the code.
  49.  
  50.  
  51.  
  52. <!-- Auto read more Start -->
  53. <!-- http://www.BloggerSentral.com -->
  54. <b:if cond='data:blog.pageType == &quot;item&quot;'>
  55. <data:post.body/>
  56. <b:else/>
  57. <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
  58. <data:post.body/>
  59. <b:else/>
  60. <div expr:id='&quot;summary&quot; + data:post.id'><data:post.body/></div>
  61. <script type='text/javascript'> createSummaryAndThumb(&quot;summary<data:post.id/>&quot;);
  62. </script>
  63. <a class='more' expr:href='data:post.url'>Read more ...</a>
  64. </b:if>
  65. </b:if>
  66. <!-- Auto read more End -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement