DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Anidar Comentarios En Meneame.net 1ª Referencia(BookMarklet)

09.02.2006
| 3100 views |
  • submit to reddit
        Anida los comentarios usando el número de comentario (#XX) que los usuarios de Meneame utilizan para referirse a otros comentarios, pero únicamente tiene en cuenta la 1ª referencia.
javascript:(function() {var cl = document.getElementById("comments-list");var l = null;for(var i in cl.childNodes){l = cl.childNodes.item(i);if(l && (l.tagName) && (l.tagName.toUpperCase() == "LI")){var d = l.firstChild;var nc = parseInt(d.id.slice(8));var r = d.firstChild.nextSibling.nextSibling.innerHTML.match(/#[0-9]+/g);var nr = 0;var anidado = false;for(var j in r){nr = parseInt(r[j].slice(1));if((anidado = (nr > 0) && (nc > nr))){var lr = document.getElementById("comment-" + nr).parentNode;if(lr.lastChild.name != "anidados"){var a = document.createElement("ul");a.name = "anidados";a.style.borderLeft = "1px dotted #aaaaaa";lr.appendChild(a);}lr.lastChild.appendChild(l.cloneNode(true));try{cl.removeChild(l);} catch(e){}break;}}}}})();