Mercurial > hg-stable
diff mercurial/templates/static/mercurial.js @ 19530:a63d3ff0d765
hgweb: remove trailing whitespace in mercurial.js
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sun, 04 Aug 2013 16:19:12 -0500 |
parents | 5ec5097b4c0f |
children | 26943a6394d4 |
line wrap: on
line diff
--- a/mercurial/templates/static/mercurial.js Mon Jul 22 17:07:19 2013 +0400 +++ b/mercurial/templates/static/mercurial.js Sun Aug 04 16:19:12 2013 -0500 @@ -23,7 +23,7 @@ ]; function Graph() { - + this.canvas = document.getElementById('graph'); if (window.G_vmlCanvasManager) this.canvas = window.G_vmlCanvasManager.initElement(this.canvas); this.ctx = this.canvas.getContext('2d'); @@ -35,13 +35,13 @@ this.cell = [2, 0]; this.columns = 0; this.revlink = ''; - + this.scale = function(height) { this.bg_height = height; this.box_size = Math.floor(this.bg_height / 1.2); this.cell_height = this.box_size; } - + function colorPart(num) { num *= 255 num = num < 0 ? 0 : num; @@ -55,7 +55,7 @@ } this.setColor = function(color, bg, fg) { - + // Set the colour. // // If color is a string, expect an hexadecimal RGB @@ -81,11 +81,11 @@ this.ctx.strokeStyle = s; this.ctx.fillStyle = s; return s; - + } this.edge = function(x0, y0, x1, y1, color, width) { - + this.setColor(color, 0.0, 0.65); if(width >= 0) this.ctx.lineWidth = width; @@ -93,28 +93,28 @@ this.ctx.moveTo(x0, y0); this.ctx.lineTo(x1, y1); this.ctx.stroke(); - + } this.render = function(data) { - + var backgrounds = ''; var nodedata = ''; - + for (var i in data) { - + var parity = i % 2; this.cell[1] += this.bg_height; this.bg[1] += this.bg_height; - + var cur = data[i]; var node = cur[1]; var edges = cur[2]; var fold = false; - + var prevWidth = this.ctx.lineWidth; for (var j in edges) { - + line = edges[j]; start = line[0]; end = line[1]; @@ -125,44 +125,44 @@ var branchcolor = line[4]; if(branchcolor) color = branchcolor; - + if (end > this.columns || start > this.columns) { this.columns += 1; } - + if (start == this.columns && start > end) { var fold = true; } - + x0 = this.cell[0] + this.box_size * start + this.box_size / 2; y0 = this.bg[1] - this.bg_height / 2; x1 = this.cell[0] + this.box_size * end + this.box_size / 2; y1 = this.bg[1] + this.bg_height / 2; - + this.edge(x0, y0, x1, y1, color, width); - + } this.ctx.lineWidth = prevWidth; - + // Draw the revision node in the right column - + column = node[0] color = node[1] - + 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, color, parity, cur); backgrounds += add[0]; nodedata += add[1]; - + if (fold) this.columns -= 1; - + } - + document.getElementById('nodebgs').innerHTML += backgrounds; document.getElementById('graphnodes').innerHTML += nodedata; - + } }