[PATCH 2 of 9 V2] hgweb: add removeByClassName javascript function

Alexander Plavin alexander at plav.in
Sat Aug 17 17:33:07 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1376052713 -14400
#      Fri Aug 09 16:51:53 2013 +0400
# Node ID 1617b8aa1c4aaf41305a2f73251085b1d469f03a
# Parent  071ef2e72dfbf110ec46ddd74300b6fd390b2a48
hgweb: add removeByClassName javascript function

It removes all elements with specified class name from the document.

diff -r 071ef2e72dfb -r 1617b8aa1c4a mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Sat Aug 17 22:50:27 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Aug 09 16:51:53 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;


More information about the Mercurial-devel mailing list