Mercurial > hg
annotate mercurial/templates/static/mercurial.js @ 16983:13cdc10929d1
tests: move tests in test-walk.t using ':' in filenames to conditional section
eol-in-paths will also protect against testing ':' in filenames on FAT.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 18 Jun 2012 23:44:11 +0200 |
parents | 6e4de55a41a4 |
children | fa714f3ed298 |
rev | line source |
---|---|
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
1 // mercurial.js - JavaScript utility functions |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
2 // |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
3 // Rendering of branch DAGs on the client side |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
4 // Display of elapsed time |
14571
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
5 // Show or hide diffstat |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
6 // |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
7 // Copyright 2008 Dirkjan Ochtman <dirkjan AT ochtman DOT nl> |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
8 // Copyright 2006 Alexander Schremmer <alex AT alexanderweb DOT de> |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
9 // |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
10 // derived from code written by Scott James Remnant <scott@ubuntu.com> |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
11 // Copyright 2005 Canonical Ltd. |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
12 // |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
13 // This software may be used and distributed according to the terms |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
14 // of the GNU General Public License, incorporated herein by reference. |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
15 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
16 var colors = [ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
17 [ 1.0, 0.0, 0.0 ], |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
18 [ 1.0, 1.0, 0.0 ], |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
19 [ 0.0, 1.0, 0.0 ], |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
20 [ 0.0, 1.0, 1.0 ], |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
21 [ 0.0, 0.0, 1.0 ], |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
22 [ 1.0, 0.0, 1.0 ] |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
23 ]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
24 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
25 function Graph() { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
26 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
27 this.canvas = document.getElementById('graph'); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
28 if (navigator.userAgent.indexOf('MSIE') >= 0) this.canvas = window.G_vmlCanvasManager.initElement(this.canvas); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
29 this.ctx = this.canvas.getContext('2d'); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
30 this.ctx.strokeStyle = 'rgb(0, 0, 0)'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
31 this.ctx.fillStyle = 'rgb(0, 0, 0)'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
32 this.cur = [0, 0]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
33 this.line_width = 3; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
34 this.bg = [0, 4]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
35 this.cell = [2, 0]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
36 this.columns = 0; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
37 this.revlink = ''; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
38 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
39 this.scale = function(height) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
40 this.bg_height = height; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
41 this.box_size = Math.floor(this.bg_height / 1.2); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
42 this.cell_height = this.box_size; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
43 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
44 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
45 function colorPart(num) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
46 num *= 255 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
47 num = num < 0 ? 0 : num; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
48 num = num > 255 ? 255 : num; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
49 var digits = Math.round(num).toString(16); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
50 if (num < 16) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
51 return '0' + digits; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
52 } else { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
53 return digits; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
54 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
55 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
56 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
57 this.setColor = function(color, bg, fg) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
58 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
59 // Set the colour. |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
60 // |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
61 // If color is a string, expect an hexadecimal RGB |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
62 // value and apply it unchanged. If color is a number, |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
63 // pick a distinct colour based on an internal wheel; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
64 // the bg parameter provides the value that should be |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
65 // assigned to the 'zero' colours and the fg parameter |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
66 // provides the multiplier that should be applied to |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
67 // the foreground colours. |
16130
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
68 var s; |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
69 if(typeof color == "string") { |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
70 s = "#" + color; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
71 } else { //typeof color == "number" |
16130
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
72 color %= colors.length; |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
73 var red = (colors[color][0] * fg) || bg; |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
74 var green = (colors[color][1] * fg) || bg; |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
75 var blue = (colors[color][2] * fg) || bg; |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
76 red = Math.round(red * 255); |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
77 green = Math.round(green * 255); |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
78 blue = Math.round(blue * 255); |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
79 s = 'rgb(' + red + ', ' + green + ', ' + blue + ')'; |
33f702e52906
graph: in hgrc specify line color for main branch
Constantine Linnick <theaspect@gmail.com>
parents:
16129
diff
changeset
|
80 } |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
81 this.ctx.strokeStyle = s; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
82 this.ctx.fillStyle = s; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
83 return s; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
84 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
85 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
86 |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
87 this.edge = function(x0, y0, x1, y1, color, width) { |
16137
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
88 |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
89 this.setColor(color, 0.0, 0.65); |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
90 if(width >= 0) |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
91 this.ctx.lineWidth = width; |
16137
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
92 this.ctx.beginPath(); |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
93 this.ctx.moveTo(x0, y0); |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
94 this.ctx.lineTo(x1, y1); |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
95 this.ctx.stroke(); |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
96 |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
97 } |
8fd18eb8aab7
templates: move Graph.edge() implementation in mercurial.js
Patrick Mezard <patrick@mezard.eu>
parents:
16130
diff
changeset
|
98 |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
99 this.render = function(data) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
100 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
101 var backgrounds = ''; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
102 var nodedata = ''; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
103 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
104 for (var i in data) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
105 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
106 var parity = i % 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
107 this.cell[1] += this.bg_height; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
108 this.bg[1] += this.bg_height; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
109 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
110 var cur = data[i]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
111 var node = cur[1]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
112 var edges = cur[2]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
113 var fold = false; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
114 |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
115 var prevWidth = this.ctx.lineWidth; |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
116 for (var j in edges) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
117 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
118 line = edges[j]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
119 start = line[0]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
120 end = line[1]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
121 color = line[2]; |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
122 var width = line[3]; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
123 if(width < 0) |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
124 width = prevWidth; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
125 var branchcolor = line[4]; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
126 if(branchcolor) |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
127 color = branchcolor; |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
128 |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
129 if (end > this.columns || start > this.columns) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
130 this.columns += 1; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
131 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
132 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
133 if (start == this.columns && start > end) { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
134 var fold = true; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
135 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
136 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
137 x0 = this.cell[0] + this.box_size * start + this.box_size / 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
138 y0 = this.bg[1] - this.bg_height / 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
139 x1 = this.cell[0] + this.box_size * end + this.box_size / 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
140 y1 = this.bg[1] + this.bg_height / 2; |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
141 |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
142 this.edge(x0, y0, x1, y1, color, width); |
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
143 |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
144 } |
16138
6e4de55a41a4
hgweb: refactor graph customization javascript
Patrick Mezard <patrick@mezard.eu>
parents:
16137
diff
changeset
|
145 this.ctx.lineWidth = prevWidth; |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
146 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
147 // Draw the revision node in the right column |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
148 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
149 column = node[0] |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
150 color = node[1] |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
151 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
152 radius = this.box_size / 8; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
153 x = this.cell[0] + this.box_size * column + this.box_size / 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
154 y = this.bg[1] - this.bg_height / 2; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
155 var add = this.vertex(x, y, color, parity, cur); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
156 backgrounds += add[0]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
157 nodedata += add[1]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
158 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
159 if (fold) this.columns -= 1; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
160 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
161 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
162 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
163 document.getElementById('nodebgs').innerHTML += backgrounds; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
164 document.getElementById('graphnodes').innerHTML += nodedata; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
165 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
166 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
167 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
168 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
169 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
170 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
171 process_dates = (function(document, RegExp, Math, isNaN, Date, _false, _true){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
172 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
173 // derived from code from mercurial/templatefilter.py |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
174 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
175 var scales = { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
176 'year': 365 * 24 * 60 * 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
177 'month': 30 * 24 * 60 * 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
178 'week': 7 * 24 * 60 * 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
179 'day': 24 * 60 * 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
180 'hour': 60 * 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
181 'minute': 60, |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
182 'second': 1 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
183 }; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
184 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
185 function format(count, string){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
186 var ret = count + ' ' + string; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
187 if (count > 1){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
188 ret = ret + 's'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
189 } |
14881
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
190 return ret; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
191 } |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
192 |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
193 function shortdate(date){ |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
194 var ret = date.getFullYear() + '-'; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
195 // getMonth() gives a 0-11 result |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
196 var month = date.getMonth() + 1; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
197 if (month <= 9){ |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
198 ret += '0' + month; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
199 } else { |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
200 ret += month; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
201 } |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
202 ret += '-'; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
203 var day = date.getDate(); |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
204 if (day <= 9){ |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
205 ret += '0' + day; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
206 } else { |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
207 ret += day; |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
208 } |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
209 return ret; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
210 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
211 |
14881
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
212 function age(datestr){ |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
213 var now = new Date(); |
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
214 var once = new Date(datestr); |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
215 if (isNaN(once.getTime())){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
216 // parsing error |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
217 return datestr; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
218 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
219 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
220 var delta = Math.floor((now.getTime() - once.getTime()) / 1000); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
221 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
222 var future = _false; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
223 if (delta < 0){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
224 future = _true; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
225 delta = -delta; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
226 if (delta > (30 * scales.year)){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
227 return "in the distant future"; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
228 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
229 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
230 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
231 if (delta > (2 * scales.year)){ |
14881
2e54387976d4
web: Output a correct date in short format (issue2902)
Benoit Allard <benoit@aeteurope.nl>
parents:
14571
diff
changeset
|
232 return shortdate(once); |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
233 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
234 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
235 for (unit in scales){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
236 var s = scales[unit]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
237 var n = Math.floor(delta / s); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
238 if ((n >= 2) || (s == 1)){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
239 if (future){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
240 return format(n, unit) + ' from now'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
241 } else { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
242 return format(n, unit) + ' ago'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
243 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
244 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
245 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
246 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
247 |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
248 return function(){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
249 var nodes = document.getElementsByTagName('*'); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
250 var ageclass = new RegExp('\\bage\\b'); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
251 var dateclass = new RegExp('\\bdate\\b'); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
252 for (var i=0; i<nodes.length; ++i){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
253 var node = nodes[i]; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
254 var classes = node.className; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
255 if (ageclass.test(classes)){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
256 var agevalue = age(node.textContent); |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
257 if (dateclass.test(classes)){ |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
258 // We want both: date + (age) |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
259 node.textContent += ' ('+agevalue+')'; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
260 } else { |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
261 node.textContent = agevalue; |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
262 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
263 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
264 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
265 } |
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
266 })(document, RegExp, Math, isNaN, Date, false, true) |
14571
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
267 |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
268 function showDiffstat() { |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
269 document.getElementById('diffstatdetails').style.display = 'inline'; |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
270 document.getElementById('diffstatexpand').style.display = 'none'; |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
271 } |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
272 |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
273 function hideDiffstat() { |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
274 document.getElementById('diffstatdetails').style.display = 'none'; |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
275 document.getElementById('diffstatexpand').style.display = 'inline'; |
17c0cb1045e5
paper, coal: display diffstat on the changeset page
Steven Brown <StevenGBrown@gmail.com>
parents:
14046
diff
changeset
|
276 } |