Patchwork [5,of,5] hgweb: stop adding strings to innerHTML of #graphnodes and #nodebgs (BC)

login
register
mail settings
Submitter Anton Shestakov
Date Jan. 5, 2018, 12:32 p.m.
Message ID <34ef3e7168543ee519e2.1515155551@neuro>
Download mbox | patch
Permalink /patch/26563/
State Accepted
Headers show

Comments

Anton Shestakov - Jan. 5, 2018, 12:32 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1515151830 -28800
#      Fri Jan 05 19:30:30 2018 +0800
# Node ID 34ef3e7168543ee519e2b20c6b0a6edf8a379503
# Parent  ec07c21e5900ae499b45288dce7a4e9c9697e231
hgweb: stop adding strings to innerHTML of #graphnodes and #nodebgs (BC)

There's nothing that uses this functionality anymore, since all HTML is
generated server-side now. Changeset entries are still accessible in JS via
DOM (that's how we set left padding), so it's still possible to do something
unusual by overriding Graph.prototype.vertex().

Patch

diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js
+++ b/mercurial/templates/static/mercurial.js
@@ -40,7 +40,6 @@  Graph.prototype = {
 		this.bg = [0, 4];
 		this.cell = [2, 0];
 		this.columns = 0;
-		document.getElementById('nodebgs').innerHTML = '';
 	},
 
 	scale: function(height) {
@@ -102,14 +101,10 @@  Graph.prototype = {
 		if (item) {
 			item.style.paddingLeft = left + 'px';
 		}
-
-		return ['', ''];
 	},
 
 	render: function(data) {
 
-		var backgrounds = '';
-		var nodedata = '';
 		var i, j, cur, line, start, end, color, x, y, x0, y0, x1, y1, column, radius;
 
 		var cols = 0;
@@ -172,17 +167,12 @@  Graph.prototype = {
 			radius = this.box_size / 8;
 			x = this.cell[0] + this.box_size * column + this.box_size / 2;
 			y = this.bg[1] - this.bg_height / 2;
-			var add = this.vertex(x, y, radius, color, parity, cur);
-			backgrounds += add[0];
-			nodedata += add[1];
+			this.vertex(x, y, radius, color, parity, cur);
 
 			if (fold) this.columns -= 1;
 
 		}
 
-		document.getElementById('nodebgs').innerHTML += backgrounds;
-		document.getElementById('graphnodes').innerHTML += nodedata;
-
 	}
 
 };