[PATCH 11 of 20] hgweb: add selector argument to process_dates

Alexander Plavin alexander at plav.in
Fri Aug 9 13:57:36 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1374681754 -14400
#      Wed Jul 24 20:02:34 2013 +0400
# Node ID d207510e86ed78f44521ce847283ac5abafa9eeb
# Parent  a6f9aff2141f3654ab8d04347d24f3ed236a542f
hgweb: add selector argument to process_dates

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

diff -r a6f9aff2141f -r d207510e86ed mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Aug 09 16:57:20 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Wed Jul 24 20:02:34 2013 +0400
@@ -168,7 +168,7 @@
 }
 
 
-function process_dates(){
+function process_dates(selector){
 
 	// derived from code from mercurial/templatefilter.py
 
@@ -245,7 +245,11 @@
 		}
 	}
 
-    var nodes = document.querySelectorAll('.age');
+    if (typeof selector === 'undefined') {
+        selector = '';
+    }
+
+    var nodes = document.querySelectorAll(selector + ' .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