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

login
register
mail settings
Submitter Alexander Plavin
Date Sept. 24, 2013, 7:39 p.m.
Message ID <6d269731f167e906f9aa.1380051557@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2626/
State Superseded
Commit 5ba3cf17da9e5ccb89bb4f73582dbf26e0f75155
Headers show

Comments

Alexander Plavin - Sept. 24, 2013, 7:39 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1378459858 -14400
#      Fri Sep 06 13:30:58 2013 +0400
# Node ID 6d269731f167e906f9aa58240ddc4abbccb291c7
# Parent  cf5221a1d0e097358788350b9b0b75f0b63575c7
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 cf5221a1d0e0 -r 6d269731f167 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
@@ -407,12 +407,14 @@ 
                     } else {
                         var doc = docFromHTML(htmlText);
                         var nodes = doc.querySelector(containerSelector).children;
+                        var curClass = 'c' + Date.now();
                         while (nodes.length) {
                             var node = nodes[0];
                             node = document.adoptNode(node);
+                            node.classList.add(curClass);
                             container.appendChild(node);
                         }
-                        process_dates();
+                        process_dates('.' + curClass);
                     }
                 },
                 function onerror(errorText) {