##// END OF EJS Templates
hgweb: add graph mode of ajax response processing...
Alexander Plavin -
r19782:8123f505 default
parent child Browse files
Show More
@@ -358,7 +358,8 b' function ajaxScrollInit(urlFormat,'
358 358 nextPageVar,
359 359 nextPageVarGet,
360 360 containerSelector,
361 messageFormat) {
361 messageFormat,
362 mode) {
362 363 updateInitiated = false;
363 364 container = document.querySelector(containerSelector);
364 365
@@ -399,14 +400,25 b' function ajaxScrollInit(urlFormat,'
399 400 function onsuccess(htmlText) {
400 401 nextPageVar = nextPageVarGet(htmlText, nextPageVar);
401 402
402 var doc = docFromHTML(htmlText);
403 var nodes = doc.querySelector(containerSelector).children;
404 while (nodes.length) {
405 var node = nodes[0];
406 node = document.adoptNode(node);
407 container.appendChild(node);
403 if (mode == 'graph') {
404 var addHeight = htmlText.match(/^<canvas id="graph".*height="(\d+)"><\/canvas>$/m)[1];
405 addHeight = parseInt(addHeight);
406 graph.canvas.height = addHeight;
407
408 var dataStr = htmlText.match(/^\s*var data = (.*);$/m)[1];
409 var data = JSON.parse(dataStr)
410 graph.reset();
411 graph.render(data);
412 } else {
413 var doc = docFromHTML(htmlText);
414 var nodes = doc.querySelector(containerSelector).children;
415 while (nodes.length) {
416 var node = nodes[0];
417 node = document.adoptNode(node);
418 container.appendChild(node);
419 }
420 process_dates();
408 421 }
409 process_dates();
410 422 },
411 423 function onerror(errorText) {
412 424 var message = {
General Comments 0
You need to be logged in to leave comments. Login now