Patchwork [4,of,4,V2] hgweb: call process_dates with a specified selector in ajax scroll

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 17, 2013, 10:35 p.m.
Message ID <f341f9062808e39aad54.1376778920@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2222/
State Superseded
Commit 5ba3cf17da9e5ccb89bb4f73582dbf26e0f75155
Headers show

Comments

Alexander Plavin - Aug. 17, 2013, 10:35 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1376740397 -14400
#      Sat Aug 17 15:53:17 2013 +0400
# Node ID f341f9062808e39aad54d66063ec9d1f532fffde
# Parent  988392ad5f1e39a099a1b00c4595628420d19991
hgweb: call process_dates with a specified selector in ajax scroll

Now this function processes only newly added entries, and not old ones,
the amount of which can be much bigger.

Patch

diff -r 988392ad5f1e -r f341f9062808 mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Wed Jul 24 20:02:34 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Sat Aug 17 15:53:17 2013 +0400
@@ -393,10 +393,13 @@ 
 
                     var doc = docFromHTML(htmlText);
                     var nodes = doc.querySelector(containerSelector).children;
+                    var curClass = 'c' + Date.now();
                     while (nodes.length) {
-                        container.appendChild(nodes[0]);
+                        var node = nodes[0];
+                        node.classList.add(curClass);
+                        container.appendChild(node);
                     }
-                    process_dates();
+                    process_dates('.' + curClass);
                 },
                 function onerror(errorText) {
                     var message = {