Changeset - 42d1e1ab41a8
[Not reviewed]
default
0 2 0
Mads Kiilerich - 9 years ago 2016-06-29 16:52:07
madski@unity3d.com
js: clean-up of trailing whitespace in graph.js
2 files changed with 9 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -19,25 +19,25 @@ var colors = [
 
	[ 0.0, 0.0, 1.0 ],
 
	[ 1.0, 0.0, 1.0 ],
 
	[ 1.0, 1.0, 0.0 ],
 
	[ 0.0, 0.0, 0.0 ]
 
];
 

	
 
function BranchRenderer(canvas_id, content_id, row_id_prefix) {
 
	// canvas_id is canvas to render into
 
	// content_id's height is applied to canvas
 
	// row_id_prefix is prefix that is applied to get row id's
 
	this.canvas = document.getElementById(canvas_id);
 
	var content = document.getElementById(content_id);
 
	
 

	
 
	if (!document.createElement("canvas").getContext)
 
		this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);
 
	if (!this.canvas) { // canvas creation did for some reason fail - fail silently
 
		this.render = function(data,canvasWidth) {};
 
		return;
 
	}
 
	this.ctx = this.canvas.getContext('2d');
 
	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 
	this.ctx.fillStyle = 'rgb(0, 0, 0)';
 
	this.cur = [0, 0];
 
	this.line_width = 2.0;
 
	this.dot_radius = 3.5;
 
@@ -91,41 +91,41 @@ function BranchRenderer(canvas_id, conte
 
		var edge_pad = this.dot_radius + 2;
 
		var box_size = Math.min(18, (canvasWidth - edge_pad * 2) / lineCount);
 
		var base_x = canvasWidth - edge_pad;
 

	
 
		for (var i=0; i < data.length; ++i) {
 
			var row = document.getElementById(row_id_prefix+idx);
 
			if (row == null) {
 
				console.log("error: row "+row_id_prefix+idx+" not found");
 
				continue;
 
			}
 
			var next = document.getElementById(row_id_prefix+(idx+1));
 
			var extra = 0;
 
			
 

	
 
			cur = data[i];
 
			node = cur[0];
 
			in_l = cur[1];
 
			closing = cur[2];
 
			obsolete_node = cur[3];
 

	
 
			var rowY = row.offsetTop + row.offsetHeight/2;
 
			var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2;
 

	
 
			for (var j in in_l) {
 
				line = in_l[j];
 
				start = line[0];
 
				end = line[1];
 
				color = line[2];
 
				obsolete_line = line[3];
 
				
 

	
 
				x = Math.floor(base_x - box_size * start);
 

	
 
				// figure out if this is a dead-end;
 
				// we want to fade away this line
 
				var dead_end = true;
 
				if (next != null) {
 
					nextdata = data[i+1];
 
					next_l = nextdata[1];
 
					for (var k=0; k < next_l.length; ++k) {
 
						if (next_l[k][0] == end) {
 
							dead_end = false;
 
							break;
 
@@ -148,25 +148,25 @@ function BranchRenderer(canvas_id, conte
 
				else if (color != node[1] && start == node[0])
 
				{
 
					var gradient = this.ctx.createLinearGradient(x,rowY,x,nextY);
 
					gradient.addColorStop(0,this.calcColor(node[1], 0.0, 0.65));
 
					gradient.addColorStop(1,this.calcColor(color, 0.0, 0.65));
 
					this.ctx.strokeStyle = gradient;
 
					this.ctx.fillStyle = gradient;
 
				}
 
				else
 
				{
 
					this.setColor(color, 0.0, 0.65);
 
				}
 
				
 

	
 
				this.ctx.lineWidth=this.line_width;
 
				this.ctx.beginPath();
 
				if (obsolete_line)
 
				{
 
					this.ctx.setLineDash([5]);
 
				}
 
				this.ctx.beginPath();
 
				this.ctx.moveTo(x, rowY);
 
				if (start == end)
 
				{
 
					this.ctx.lineTo(x,nextY+extra,3);
 
				}
 
@@ -174,30 +174,30 @@ function BranchRenderer(canvas_id, conte
 
				{
 
					var x2 = Math.floor(base_x - box_size * end);
 
					var ymid = (rowY+nextY) / 2;
 
					if (obsolete_node)
 
					{
 
						this.ctx.setLineDash([5]);
 
					}
 
					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 
				}
 
				this.ctx.stroke();
 
				this.ctx.setLineDash([]); // reset the dashed line, if any
 
			}
 
			
 

	
 
			column = node[0];
 
			color = node[1];
 
			
 

	
 
			x = Math.floor(base_x - box_size * column);
 
		
 

	
 
			this.setColor(color, 0.25, 0.75);
 

	
 

	
 
			r = this.dot_radius
 
			if (obsolete_node)
 
			{
 
				this.ctx.beginPath();
 
				this.ctx.moveTo(x - this.close_x, rowY - this.close_y - 3);
 
				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y + 4*this.close_y - 1);
 
				this.ctx.moveTo(x - this.close_x, rowY - this.close_y + 4*this.close_y - 1);
 
				this.ctx.lineTo(x - this.close_x + 2*this.close_x, rowY - this.close_y - 3);
 
				this.ctx.stroke();
 
@@ -207,16 +207,16 @@ function BranchRenderer(canvas_id, conte
 
			{
 
				this.ctx.fillRect(x - this.close_x, rowY - this.close_y, 2*this.close_x, 2*this.close_y);
 
			}
 
			else
 
			{
 
				this.ctx.beginPath();
 
				this.ctx.arc(x, rowY, r, 0, Math.PI * 2, true);
 
				this.ctx.fill();
 
			}
 

	
 
			idx++;
 
		}
 
				
 

	
 
	}
 

	
 
}
scripts/whitespacecleanup.sh
Show inline comments
 
@@ -9,17 +9,18 @@ sed -i -e "s,  *$,,g" $files
 
sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
 
# ensure one trailing newline - remove empty last line and make last line include trailing newline:
 
sed -i -e '$,${/^$/d}' -e '$a\' $files
 

	
 
sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'`
 
sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'`
 

	
 
sed -i -e 's/^\(    [^: ]*\) *: *\([^/]\)/\1: \2/g' kallithea/public/css/{style,contextbar}.css
 
sed -i -e '1s|, |,|g' kallithea/public/css/{style,contextbar}.css
 
sed -i -e 's/^\([^ ,/]\+ [^,]*[^ ,]\) *, *\(.\)/\1,\n\2/g' kallithea/public/css/{style,contextbar}.css
 
sed -i -e 's/^\([^ ,/].*\)   */\1 /g' kallithea/public/css/{style,contextbar}.css
 
sed -i -e 's,^--$,-- ,g' kallithea/templates/email_templates/main.txt
 
sed -i -e 's,[ 	][ 	]*$,,g' -e 's, 	,	,g' kallithea/public/js/graph.js
 

	
 
hg mani | xargs chmod -x
 
hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x
 

	
 
hg diff
0 comments (0 inline, 0 general)