[PATCH 3 of 4 V2] hgweb: add parentSelector argument to process_dates

Alexander Plavin alexander at plav.in
Sun Sep 29 12:15:35 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1378459858 -14400
#      Fri Sep 06 13:30:58 2013 +0400
# Node ID f65798655fca8f322cba0ed6a7c6656404980e2b
# Parent  306b4b9f13c96dbe7f69f3cfb67a0315ae71ff36
hgweb: add parentSelector argument to process_dates

Allow specifying parent selector of elements to process, useful for
incremental page updates.

diff -r 306b4b9f13c9 -r f65798655fca mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
@@ -176,7 +176,7 @@
 }
 
 
-function process_dates(){
+function process_dates(parentSelector){
 
 	// derived from code from mercurial/templatefilter.py
 
@@ -253,7 +253,7 @@
 		}
 	}
 
-	var nodes = document.querySelectorAll('.age');
+	var nodes = document.querySelectorAll((parentSelector || '') + ' .age');
 	var dateclass = new RegExp('\\bdate\\b');
 	for (var i=0; i<nodes.length; ++i){
 		var node = nodes[i];


More information about the Mercurial-devel mailing list