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

login
register
mail settings
Submitter Alexander Plavin
Date Sept. 29, 2013, 5:15 p.m.
Message ID <f65798655fca8f322cba.1380474935@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2665/
State Accepted
Commit 4a8c5a51f7a10a0ad49145eeec57e75c17dc0bc1
Headers show

Comments

Alexander Plavin - Sept. 29, 2013, 5:15 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@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.

Patch

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];