Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <b:if cond='data:blog.pageType == "item"'>
- <script type='text/javascript'>
- //<![CDATA[
- // Threaded comments for Blogger
- // by MS-potilas 2011
- // http://yabtb.blogspot.com
- var clss = [];
- var elements = document.getElementsByTagName("*");
- for(var i=0 ; i<elements.length ; i++)
- if(elements[i].className=="normal-comment" || elements[i].className=="admin-comment")
- clss.push(elements[i]);
- var prevAuthor = "";
- var prevNode = null;
- var authornodes = {};
- for (var x=0 ; x < clss.length; x++ )
- {
- var moved = false;
- var width = clss[x].scrollWidth;
- clss[x].style.position = "relative";
- clss[x].style.left = "0px";
- var author = clss[x].innerHTML.toLowerCase().indexOf("%22%3e");
- author = clss[x].innerHTML.substr(author+6);
- if(author.toLowerCase().indexOf("%3c%2fa%3e") > -1)
- author = author.substr(0, author.toLowerCase().indexOf("%3c%2fa%3e"));
- else
- author = "";
- var cmtChild = clss[x].firstChild;
- while(cmtChild && !/(^| )comment-body( |$)/.test(cmtChild.className) && !/(^| )comment-body-author( |$)/.test(cmtChild.className))
- cmtChild = cmtChild.nextSibling;
- var txt = cmtChild.innerHTML;
- var elm = null;
- var cmtID = txt.toLowerCase().indexOf("href=\"#");
- if(cmtID == -1) cmtID = txt.toLowerCase().indexOf("href=\"" + (window.location.href.toLowerCase()).split("#",1)[0] + "#");
- if(cmtID > -1) {
- var commentid = "x" + txt.substr(cmtID).split("#")[1].split("\"")[0];
- elm = document.getElementById(commentid);
- }
- if(!elm && prevAuthor != "" && x && prevNode)
- {
- if(txt.indexOf("@" + prevAuthor) > -1)
- elm = prevNode;
- else if(prevAuthor.length > 3 && txt.toLowerCase().indexOf("@" + prevAuthor.toLowerCase()) > -1)
- elm = prevNode;
- }
- if(!elm) {
- for(var tmp in authornodes) {
- if(txt.indexOf("@" + tmp) > -1)
- elm = authornodes[tmp];
- }
- }
- if(elm) {
- var ind = 0;
- if(elm.style.left != "")
- ind = parseInt(elm.style.left);
- if(ind < 300) { // max indent
- ind = ind + 20; // amount of indent
- }
- var parNode = elm.parentNode;
- var place = elm;
- var xpos;
- do {
- do place = place.nextSibling;
- while(place && place.nodeType != 1);
- if(place && place.style && place.style.left != "")
- xpos = parseInt(place.style.left);
- else
- xpos = 0;
- } while(place && xpos >= ind);
- if(place != clss[x]) {
- parNode.insertBefore(clss[x], place);
- moved = true;
- }
- clss[x].style.position = "relative";
- clss[x].style.left = ind + "px";
- width = width - ind;
- }
- clss[x].style.width = width + "px";
- if(!moved) {
- prevAuthor = author;
- prevNode = clss[x];
- }
- if(author != "")
- authornodes[author] = clss[x];
- }
- //]]>
- </script>
- </b:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement