SHARE
TWEET

alin andrei

a guest Jul 30th, 2009 436 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type='text/javascript'>
  2. var thumbnail_mode = 'no-float' ;
  3. var classicMode = false ;
  4. var summary_noimg = 60;
  5. var summary_img = 50;
  6. var img_thumb_height = 150;
  7. var img_thumb_width = 220;
  8. var indent = 3;
  9.  
  10. <script type="text/javascript">
  11. //<![CDATA[
  12. /******************************************
  13. Auto-readmore link script, version 4.0 (for blogspot)
  14.  
  15. (C)2009 by Anhvo
  16.  
  17. Homepage:  http://vietwebguide.com
  18.  
  19. Please dont remove this copyright or change it into your own
  20. ******************************************************/
  21.  
  22. /*******************************************
  23.         CONFIG (extenal code)
  24.        -------------------------------
  25.  
  26. var thumbnail_mode = "float" ; //(or "no-float")
  27. var classicMode = false ;
  28. var summary_noimg = 60;
  29. var summary_img = 50;
  30. var img_thumb_height = 100;
  31. var img_thumb_width = 120;
  32. var indent = 3;
  33.  
  34. *********************************************/
  35.  
  36. function stripHtmlTags(s,max){return s.replace(/<.*?>/ig, '').split(/\s+/).slice(0,max-1).join(' ')}
  37.  
  38. function getSummaryLikeWP(id) {
  39.         return document.getElementById(id).innerHTML.split(/<!--\s*more\s*-->/)[0];
  40. }
  41.  
  42. function getSummaryImproved(post,max){
  43.    var re = /<.*?>/gi
  44.    var re2 = /<br.*?>/gi
  45.    var re3 = /(<\/{1}p>)|(<\/{1}div>)/gi
  46.    var re4 = /(<style.*?\/{1}style>)|(<script.*?\/{1}script>)|(<table.*?\/{1}table>)|(<form.*?\/{1}form>)|(<code.*?\/{1}code>)|(<pre.*?\/{1}pre>)/gi
  47.  
  48.    post = post.replace(re4,'')
  49.    post = post.replace(re3,'<br /> ').split(re2)
  50.  
  51.    for(var i=0; i<post.length; i++){
  52.    post[i] = post[i].replace(re,'');
  53.   }
  54. var post2 = new Array();
  55. for(var i in post) {
  56.  //if(post[i]!='' && post[i]!=' ' && post[i] != '\n') post2.push(post[i]);
  57.  if(/[a-zA-Z0-9]/.test(post[i])) post2.push(post[i]) ;
  58.  
  59. }
  60.  
  61.  
  62. var s = "";
  63. var indentBlank = "";
  64. for(var i=0;i<indent;i++){
  65.  indentBlank += " ";
  66. }
  67. if(post2.join('<br/>').split(' ').length < max-1 ){
  68.   s = post2.join(indentBlank +' <br/>');
  69.  } else {
  70.   var i = 0;
  71.   while(s.split(' ').length < max){
  72.   s += indentBlank + ' ' + post2[i]+'<br/>';
  73.    i++;
  74.   }
  75.  }  
  76.  return s;
  77. }
  78.  
  79.  
  80. function createSummaryAndThumb(pID){
  81.  var div = document.getElementById(pID);
  82.  var content = div.innerHTML;
  83.  if (/<!--\s*more\s*-->/.test(content)) {
  84.   div.innerHTML = getSummaryLikeWP(pID);
  85.   div.style.display = "block";
  86.  }
  87.  else {
  88.  
  89.  var imgtag = "";
  90.  var img = div.getElementsByTagName("img");
  91.  var summ = summary_noimg;
  92.  if(img.length>=1) {
  93.   if(thumbnail_mode == "float") {
  94.    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>';
  95.    summ = summary_img;
  96.   } else {
  97.    imgtag = '<div style="padding:5px" align="center"><img style="max-width:'+img_thumb_width+'px; max-height:'+img_thumb_height+'px;" src="'+img[0].src+'" /></div>';
  98.    summ = summary_img;
  99.   }
  100.  }
  101.  
  102.  var summary = (classicMode) ? imgtag + '<div>' + stripHtmlTags(content,summ) + '</div>' : imgtag + '<div>' + getSummaryImproved(content,summ) + '</div>';
  103.  
  104.  div.innerHTML = summary;
  105.  div.style.display = "block";
  106.  }
  107. }
  108. //]]>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top