[PATCH] hgweb: add reset javascript function to Graph

Alexander Plavin alexander at plav.in
Fri Sep 20 14:34:11 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1378459859 -14400
#      Fri Sep 06 13:30:59 2013 +0400
# Node ID 88d653bd293dc30fcb4fad582c5a4240997d3d62
# Parent  1cf75502e51cba2fb1d70ad513926f40e5a4766a
hgweb: add reset javascript function to Graph

It makes the Graph object to be in the same state as just after
the initialization.

diff -r 1cf75502e51c -r 88d653bd293d mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:59 2013 +0400
@@ -36,6 +36,14 @@
 	this.columns = 0;
 	this.revlink = '';
 
+    this.reset = function() {
+        this.bg = [0, 4];
+        this.cell = [2, 0];
+        this.columns = 0;
+        document.getElementById('nodebgs').innerHTML = '';
+        document.getElementById('graphnodes').innerHTML = '';
+    }
+
 	this.scale = function(height) {
 		this.bg_height = height;
 		this.box_size = Math.floor(this.bg_height / 1.2);


More information about the Mercurial-devel mailing list