changeset 19742:ac68009c31a4

hgweb: add removeByClassName javascript function It removes all elements with specified class name from the document.
author Alexander Plavin <alexander@plav.in>
date Fri, 06 Sep 2013 13:30:58 +0400
parents 2a9a21e1e1db
children fdd41257def8
files mercurial/templates/static/mercurial.js
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:57 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
@@ -329,6 +329,13 @@
     return xfr;
 }
 
+function removeByClassName(className) {
+    var nodes = document.getElementsByClassName(className);
+    while (nodes.length) {
+        nodes[0].parentNode.removeChild(nodes[0]);
+    }
+}
+
 function docFromHTML(html) {
     var doc = document.implementation.createHTMLDocument('');
     doc.documentElement.innerHTML = html;