function defloat_predicate(elt, topelt) { var cl = elt.getAttribute('class'); var pcl = elt.parentNode.getAttribute('class'); var st = window.getComputedStyle(elt, null); return (st.cssFloat != "none" || elt.sunk == topelt) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } function author_predicate(elt, topelt) { var cl = elt.getAttribute('class'); if (elt.parentNode.parentNode != topelt) return NodeFilter.FILTER_SKIP; return (cl == "author") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } function flip_predicate(elt, topelt) { var cl = elt.getAttribute('class'); var pcl = elt.parentNode.getAttribute('class'); var st = window.getComputedStyle(elt, null); if (elt.parentNode.parentNode != topelt) return NodeFilter.FILTER_SKIP; if (cl == "placeholder") return NodeFilter.FILTER_ACCEPT; if (cl == "subject" || cl == "date" || cl == "to") return NodeFilter.FILTER_SKIP; if (cl == "author" && (pcl == "email" || pcl == "emailtop")) return NodeFilter.FILTER_SKIP; return (st.display == "block" || elt.flipped) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } // From http://my.opera.com/GreyWyvern/blog/show.dml/1725165 Object.prototype.clone = function() { var c = (this instanceof Array) ? [] : {}; for (i in this) { if (i == 'clone') continue; if (this[i] && typeof this[i] == "object") { c[i] = this[i].clone(); } else c[i] = this[i]; } return c; }; function author_click() { var topelt = this.parentNode.parentNode; var author_walker = document.createTreeWalker(topelt, NodeFilter.SHOW_ELEMENT, function (elt) { return author_predicate(elt, topelt); }, false); var float_walker = document.createTreeWalker(topelt, NodeFilter.SHOW_ELEMENT, function (elt) { return defloat_predicate(elt, topelt); }, false); var walker = document.createTreeWalker(topelt, NodeFilter.SHOW_ELEMENT, function (elt) { return flip_predicate(elt, topelt); }, false); var elt; var cl; var y; y = 0; if ((elt = author_walker.nextNode()) != null) { while (elt.offsetParent) { y += elt.offsetTop; elt = elt.offsetParent; } } elt = this; while (elt.offsetParent) { y -= elt.offsetTop; elt = elt.offsetParent; } window.scrollBy(0, y); while ((elt = float_walker.nextNode()) != null) { var t = {"cssFloat" : "none"}; if (elt.sunk == null || elt.sunk == undefined) { elt.flippedfloat = {}; for (var i in t) { elt.flippedfloat[i] = elt.style[i]; elt.style[i] = t[i]; } elt.sunk = topelt; } else if (elt.sunk == topelt) { for (var i in elt.flippedfloat) elt.style[i] = elt.flippedfloat[i]; elt.sunk = null; } } while ((elt = walker.nextNode()) != null) { cl = elt.getAttribute('class'); if (cl == "placeholder") { if (elt.style.display == "") { elt.style.display = "block"; } else if (elt.style.display == "block") { elt.style.display = ""; } } else if (cl == "container" || elt.tagName == "P") { if (elt.style.height === "") { var t = {"display" : "hidden", "height" : "0px", "overflow-y" : "hidden", "padding-top" : "0px", "padding-bottom" : "0px", "margin-top" : "0px", "margin-bottom" : "0px"}; elt.flippedstyle = {}; for (var i in t) { elt.flippedstyle[i] = elt.style[i]; elt.style[i] = t[i]; } } else { for (var i in elt.flippedstyle) elt.style[i] = elt.flippedstyle[i]; } } else if (elt.style.display == "") { elt.style.display = "none"; } else if (elt.style.display == "none") { elt.style.display = ""; } else continue; elt.flipped = !elt.flipped; } } function author_divs_init() { var elts = document.getElementsByTagName('DIV'); var inited = 0, visited = 0; for (var i = 0; i < elts.length; i++) { var elt = elts[i]; var eltclass = elt.getAttribute('class'); visited++; if (eltclass == null) continue; if (eltclass != "author") continue; elt.addEventListener('click', author_click, false); inited++; } } document.addEventListener('DOMContentLoaded', author_divs_init, false);