Patchwork [1,of,4,graph-inf-scroll] hgweb: add reset javascript function to Graph

login
register
mail settings
Submitter Alexander Plavin
Date Sept. 22, 2013, 10:29 a.m.
Message ID <a0fe07019c9dfa0b3fd4.1379845799@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2593/
State Accepted
Commit 659bc603bd0d1fa393dd53f8b81d3c046de83826
Headers show

Comments

Alexander Plavin - Sept. 22, 2013, 10:29 a.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1378459859 -14400
#      Fri Sep 06 13:30:59 2013 +0400
# Node ID a0fe07019c9dfa0b3fd4fe3f62619de47ed75882
# Parent  313c61e33ade62a74dcd0169d3e3d8ceecdd803d
hgweb: add reset javascript function to Graph

It makes the Graph object to be in the same state as just after
the initialization. This will help to add infinite scrolling to graph view.

Patch

diff -r 313c61e33ade -r a0fe07019c9d 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);