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

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 9, 2013, 6:57 p.m.
Message ID <d207510e86ed78f44521.1376074656@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2117/
State Changes Requested
Headers show

Comments

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

Patch

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