[PATCH] web: Made elapsed time calculation dynamic (javascript).

Adrian Buehlmann adrian at cadifra.com
Tue Apr 26 10:07:22 CDT 2011


On 2011-04-26 14:52, Benoît Allard wrote:
> Martin Geisler wrote:
>> Benoît Allard <benoit at aeteurope.nl> writes:
>>> Another solution that comes to mind would be to calculate the elapsed
>>> time in javascript. That way, the content of the page is always the
>>> same and can be safely cached.
>>
>> Heh, that is much more elegant than the server-side solution I just
>> outlined!
>>
> 
> Here it is !
> 
> As there are (really) long lines in the templates, you might get into 
> trouble with line wrapping. For this reason, the patch is also enclosed 
> as bundle.
> 
> # HG changeset patch
> # User Benoit Allard <benoit at aeteurope.nl>
> # Date 1303821734 -7200
> # Node ID 64ca69686a618fd23f2aa4d9eff473f571c10b6f
> # Parent  bcff4759d17dc7d6eec967b4ec2d7d12cde22cf7
> web: Made elapsed time calculation dynamic (javascript).
> 
> This allow safe caching of the pages by the browser and still display 
> the right
> amount of elapsed time upon page refresh.
> 
> If javascript is disabled, absolute time is displayed, leaving it readable.
> 
> All the templates have been updated.

If I refresh the log page (seen with Google Chrome 10.0.648.205 and
Firefox 4.0.1 on Windows 7 x64, page served by 'hg serve'), there's a
flicker: the age column entries are briefly shown as full dates and then
they switch to the (expected) age values. The other columns are moved to
the right and then jump back to the left.

Interestingly, IE9 (9.0.8112) doesn't show that flicker.



More information about the Mercurial-devel mailing list