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

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 17, 2013, 10:33 p.m.
Message ID <1617b8aa1c4aaf41305a.1376778787@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2212/
State Superseded
Commit ac68009c31a4234419333cc299a558337a130780
Headers show

Comments

Alexander Plavin - Aug. 17, 2013, 10:33 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@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.

Patch

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;