[PATCH 4 of 5] hgweb: add removeByClassName javascript function
Alexander Plavin
alexander at plav.in
Wed Sep 18 18:33:18 UTC 2013
# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1378459858 -14400
# Fri Sep 06 13:30:58 2013 +0400
# Node ID 631f431af5acdd4c405e15b68b6360c3667ca40b
# Parent 5877a02a4fe62cf43e5e7972ea29bfcb7b7497f9
hgweb: add removeByClassName javascript function
It removes all elements with specified class name from the document.
diff -r 5877a02a4fe6 -r 631f431af5ac mercurial/templates/static/mercurial.js
--- 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;
More information about the Mercurial-devel
mailing list