document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <b:if cond=\'data:blog.pageType == &quot;item&quot;\'>
  2. <script type=\'text/javascript\'>
  3. //<![CDATA[
  4.  
  5. // Threaded comments for Blogger
  6. // by MS-potilas 2011
  7. // http://yabtb.blogspot.com
  8.  
  9.   var clss = [];
  10.   var elements = document.getElementsByTagName("*");
  11.   for(var i=0 ; i<elements.length ; i++)
  12.     if(elements[i].className=="normal-comment" || elements[i].className=="admin-comment")
  13.       clss.push(elements[i]);
  14.  
  15.   var prevAuthor = "";
  16.   var prevNode = null;
  17.   var authornodes = {};
  18.   for (var x=0 ; x < clss.length; x++ )
  19.   {
  20.     var moved = false;
  21.  
  22.     var width = clss[x].scrollWidth;
  23.     clss[x].style.position = "relative";
  24.     clss[x].style.left = "0px";
  25.  
  26.     var author = clss[x].innerHTML.toLowerCase().indexOf("%22%3e");
  27.     author = clss[x].innerHTML.substr(author+6);
  28.  
  29.     if(author.toLowerCase().indexOf("%3c%2fa%3e") > -1)
  30.       author = author.substr(0, author.toLowerCase().indexOf("%3c%2fa%3e"));
  31.     else
  32.       author = "";
  33.  
  34.     var cmtChild = clss[x].firstChild;
  35.     while(cmtChild && !/(^| )comment-body( |$)/.test(cmtChild.className) && !/(^| )comment-body-author( |$)/.test(cmtChild.className))
  36.         cmtChild = cmtChild.nextSibling;
  37.     var txt = cmtChild.innerHTML;
  38.  
  39.     var elm = null;
  40.     var cmtID = txt.toLowerCase().indexOf("href=\\"#");
  41.     if(cmtID == -1) cmtID = txt.toLowerCase().indexOf("href=\\"" + (window.location.href.toLowerCase()).split("#",1)[0] + "#");
  42.     if(cmtID > -1) {
  43.       var commentid = "x" + txt.substr(cmtID).split("#")[1].split("\\"")[0];
  44.       elm = document.getElementById(commentid);
  45.     }
  46.     if(!elm && prevAuthor != "" && x && prevNode)
  47.     {
  48.       if(txt.indexOf("@" + prevAuthor) > -1)
  49.         elm = prevNode;
  50.       else if(prevAuthor.length > 3 && txt.toLowerCase().indexOf("@" + prevAuthor.toLowerCase()) > -1)
  51.         elm = prevNode;
  52.     }
  53.     if(!elm) {
  54.         for(var tmp in authornodes) {
  55.             if(txt.indexOf("@" + tmp) > -1)
  56.                 elm = authornodes[tmp];
  57.         }
  58.     }
  59.     if(elm) {
  60.       var ind = 0;
  61.       if(elm.style.left != "")
  62.         ind = parseInt(elm.style.left);
  63.       if(ind < 300) {     // max indent
  64.         ind = ind + 20;   // amount of indent
  65.       }
  66.       var parNode = elm.parentNode;
  67.       var place = elm;
  68.       var xpos;
  69.  
  70.       do {
  71.         do place = place.nextSibling;
  72.         while(place && place.nodeType != 1);
  73.  
  74.         if(place && place.style && place.style.left != "")
  75.             xpos = parseInt(place.style.left);
  76.         else
  77.             xpos = 0;
  78.  
  79.       } while(place && xpos >= ind);
  80.  
  81.       if(place != clss[x]) {
  82.         parNode.insertBefore(clss[x], place);
  83.         moved = true;
  84.       }
  85.  
  86.       clss[x].style.position = "relative";
  87.       clss[x].style.left = ind + "px";
  88.       width = width - ind;
  89.     }
  90.     clss[x].style.width = width + "px";
  91.     if(!moved) {
  92.       prevAuthor = author;
  93.       prevNode = clss[x];
  94.     }
  95.     if(author != "")
  96.         authornodes[author] = clss[x];
  97.   }
  98. //]]>
  99. </script>
  100. </b:if>
');