##// END OF EJS Templates
hgweb: adopt child nodes in ajaxScrollInit on /graph pages too...
av6 -
r35217:fcc96cf0 default
parent child Browse files
Show More
@@ -339,6 +339,18 function appendFormatHTML(element, forma
339 element.insertAdjacentHTML('beforeend', format(formatStr, replacements));
339 element.insertAdjacentHTML('beforeend', format(formatStr, replacements));
340 }
340 }
341
341
342 function adoptChildren(from, to) {
343 var nodes = from.children;
344 var curClass = 'c' + Date.now();
345 while (nodes.length) {
346 var node = nodes[0];
347 node = document.adoptNode(node);
348 node.classList.add(curClass);
349 to.appendChild(node);
350 }
351 process_dates('.' + curClass);
352 }
353
342 function ajaxScrollInit(urlFormat,
354 function ajaxScrollInit(urlFormat,
343 nextPageVar,
355 nextPageVar,
344 nextPageVarGet,
356 nextPageVarGet,
@@ -382,6 +394,8 function ajaxScrollInit(urlFormat,
382 appendFormatHTML(container, messageFormat, message);
394 appendFormatHTML(container, messageFormat, message);
383 },
395 },
384 function onsuccess(htmlText) {
396 function onsuccess(htmlText) {
397 var doc = docFromHTML(htmlText);
398
385 if (mode === 'graph') {
399 if (mode === 'graph') {
386 var graph = window.graph;
400 var graph = window.graph;
387 var sizes = htmlText.match(/^\s*<canvas id="graph" width="(\d+)" height="(\d+)"><\/canvas>$/m);
401 var sizes = htmlText.match(/^\s*<canvas id="graph" width="(\d+)" height="(\d+)"><\/canvas>$/m);
@@ -398,18 +412,10 function ajaxScrollInit(urlFormat,
398 nextPageVar = undefined;
412 nextPageVar = undefined;
399 }
413 }
400 graph.reset();
414 graph.reset();
415 adoptChildren(doc.querySelector('#graphnodes'), container.querySelector('#graphnodes'));
401 graph.render(data);
416 graph.render(data);
402 } else {
417 } else {
403 var doc = docFromHTML(htmlText);
418 adoptChildren(doc.querySelector(containerSelector), container);
404 var nodes = doc.querySelector(containerSelector).children;
405 var curClass = 'c' + Date.now();
406 while (nodes.length) {
407 var node = nodes[0];
408 node = document.adoptNode(node);
409 node.classList.add(curClass);
410 container.appendChild(node);
411 }
412 process_dates('.' + curClass);
413 }
419 }
414
420
415 nextPageVar = nextPageVarGet(htmlText, nextPageVar);
421 nextPageVar = nextPageVarGet(htmlText, nextPageVar);
General Comments 0
You need to be logged in to leave comments. Login now