Patchwork [09,of,20] hgweb: add removeByClassName javascript function

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 9, 2013, 6:57 p.m.
Message ID <14a87d839b2d7d922315.1376074654@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2127/
State Superseded
Commit ac68009c31a4234419333cc299a558337a130780
Headers show

Comments

Alexander Plavin - Aug. 9, 2013, 6:57 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1376052713 -14400
#      Fri Aug 09 16:51:53 2013 +0400
# Node ID 14a87d839b2d7d9223150d2c8073d9df0062533b
# Parent  d4cdebd1a84f65faa6a21ad275cc9394b03cdef7
hgweb: add removeByClassName javascript function

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

Patch

diff -r d4cdebd1a84f -r 14a87d839b2d mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Aug 09 19:13:58 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Aug 09 16:51:53 2013 +0400
@@ -344,3 +344,10 @@ 
     onstart();
     return xfr;
 }
+
+function removeByClassName(className) {
+    var nodes = document.getElementsByClassName(className);
+    while (nodes.length) {
+        nodes[0].parentNode.removeChild(nodes[0]);
+    }
+}