[PATCH 3 of 4 V2] hgweb: add selector argument to process_dates
Alexander Plavin
alexander at plav.in
Tue Aug 20 06:24:25 CDT 2013
20.08.2013, 13:59, "Laurens Holst" <laurens.nospam at grauw.nl>:
> Op 18-08-13 00:35, Alexander Plavin schreef:
>
>> # HG changeset patch
>> # User Alexander Plavin <alexander at plav.in>
>> # Date 1374681754 -14400
>> # Wed Jul 24 20:02:34 2013 +0400
>> # Node ID 988392ad5f1e39a099a1b00c4595628420d19991
>> # Parent 122061a7a549d6e3faa84a0657699b5ed705f413
>> hgweb: add selector argument to process_dates
>>
>> Allow specifying elements to process with selector, useful for incremental page
>> updates.
>>
>> diff -r 122061a7a549 -r 988392ad5f1e mercurial/templates/static/mercurial.js
>> --- a/mercurial/templates/static/mercurial.js Wed Jul 24 20:13:52 2013 +0400
>> +++ b/mercurial/templates/static/mercurial.js Wed Jul 24 20:02:34 2013 +0400
>> @@ -168,7 +168,7 @@
>> }
>>
>> -function process_dates(){
>> +function process_dates(selector){
>>
>> // derived from code from mercurial/templatefilter.py
>>
>> @@ -245,7 +245,11 @@
>> }
>> }
>>
>> - var nodes = document.querySelectorAll('.age');
>> + if (typeof selector === 'undefined') {
>> + selector = '';
>> + }
>> +
>> + var nodes = document.querySelectorAll(selector + ' .age');
>
> Nit: I would simply do (selector || '').
Sure, will change :) At first there was slightly different code where this wouldn't suit, and after a change I didn't notice it can be rewritten better.
>
> ~Laurens
More information about the Mercurial-devel
mailing list