Submitter | Alexander Plavin |
---|---|
Date | Sept. 18, 2013, 6:52 p.m. |
Message ID | <0032f7b54b7bb23b3557.1379530345@debian-alexander.dolgopa> |
Download | mbox | patch |
Permalink | /patch/2527/ |
State | Accepted |
Commit | da3808bcfbfa9467b2dee82ba51f398f1c371fac |
Headers | show |
Comments
On Wed, 2013-09-18 at 22:52 +0400, Alexander Plavin wrote: > # HG changeset patch > # User Alexander Plavin <alexander@plav.in> > # Date 1378459857 -14400 > # Fri Sep 06 13:30:57 2013 +0400 > # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199 > # Parent 0a792989e90204557812427f02ba2f176f08d8c1 > paper: call ajaxScrollInit in shortlog These are queued for default, thanks. This version is much tidier than the last one I looked at, well done.
Alexander Plavin <alexander@plav.in> writes: > # HG changeset patch > # User Alexander Plavin <alexander@plav.in> > # Date 1378459857 -14400 > # Fri Sep 06 13:30:57 2013 +0400 > # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199 > # Parent 0a792989e90204557812427f02ba2f176f08d8c1 > paper: call ajaxScrollInit in shortlog > > This just calls ajaxScrollInit at the shortlog page template with all needed > agruments. So, infinite scrolling is working now there. > > diff -r 0a792989e902 -r 0032f7b54b7b mercurial/templates/paper/shortlog.tmpl > --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12 2013 +0400 > +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57 2013 +0400 > @@ -71,6 +71,18 @@ > | rev {rev}: {changenav%navshort} > </div> > > +<script type="text/javascript"> > + ajaxScrollInit( > + '{url|urlescape}shortlog/%hash%', > + '{nextentry%"{node}"}', <!-- NEXTHASH I'm missing something here... This HTML comment looks unclosed to me? Would '//' not be more appropriate for a comment inside JavaScript?
19.09.2013, 10:59, "Martin Geisler" <martin@geisler.net>: > Alexander Plavin <alexander@plav.in> writes: > >> # HG changeset patch >> # User Alexander Plavin <alexander@plav.in> >> # Date 1378459857 -14400 >> # Fri Sep 06 13:30:57 2013 +0400 >> # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199 >> # Parent 0a792989e90204557812427f02ba2f176f08d8c1 >> paper: call ajaxScrollInit in shortlog >> >> This just calls ajaxScrollInit at the shortlog page template with all needed >> agruments. So, infinite scrolling is working now there. >> >> diff -r 0a792989e902 -r 0032f7b54b7b mercurial/templates/paper/shortlog.tmpl >> --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12 2013 +0400 >> +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57 2013 +0400 >> @@ -71,6 +71,18 @@ >> | rev {rev}: {changenav%navshort} >> </div> >> >> +<script type="text/javascript"> >> + ajaxScrollInit( >> + '{url|urlescape}shortlog/%hash%', >> + '{nextentry%"{node}"}', <!-- NEXTHASH > > I'm missing something here... This HTML comment looks unclosed to me? > Would '//' not be more appropriate for a comment inside JavaScript? It's valid JS code, such one-line comments are allowed (look http://www.javascripter.net/faq/comments.htm for example). I used '<!--' instead of '//' because with '//' it's possible (through very unlikely) that such sequence (like "'abc', // NEXTHASH") appears in a commit message, but the same is impossible for '<!--' as '<' is always replaced with corresponding html entity on the page. > > -- > Martin Geisler
Alexander Plavin <alexander@plav.in> writes: > 19.09.2013, 10:59, "Martin Geisler" <martin@geisler.net>: >> Alexander Plavin <alexander@plav.in> writes: >> >>> # HG changeset patch >>> # User Alexander Plavin <alexander@plav.in> >>> # Date 1378459857 -14400 >>> # Fri Sep 06 13:30:57 2013 +0400 >>> # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199 >>> # Parent 0a792989e90204557812427f02ba2f176f08d8c1 >>> paper: call ajaxScrollInit in shortlog >>> >>> This just calls ajaxScrollInit at the shortlog page template with >>> all needed >>> agruments. So, infinite scrolling is working now there. >>> >>> diff -r 0a792989e902 -r 0032f7b54b7b >>> mercurial/templates/paper/shortlog.tmpl >>> --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12 >>> 2013 +0400 >>> +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57 >>> 2013 +0400 >>> @@ -71,6 +71,18 @@ >>> | rev {rev}: {changenav%navshort} >>> </div> >>> >>> +<script type="text/javascript"> >>> + ajaxScrollInit( >>> + '{url|urlescape}shortlog/%hash%', >>> + '{nextentry%"{node}"}', <!-- NEXTHASH >> >> I'm missing something here... This HTML comment looks unclosed to me? >> Would '//' not be more appropriate for a comment inside JavaScript? > > It's valid JS code, such one-line comments are allowed (look > http://www.javascripter.net/faq/comments.htm for example). Wow, that's... strange. I found this answer on SO: http://www.javascripter.net/faq/comments.htm which says it's a non-standard feature always implemented by browsers and JavaScript engines. The answer pointed to this definition: http://javascript.spec.whatwg.org/#comment-syntax The section about comments in the ECMA script 5.1 spec doesn't mention this syntax: http://ecma-international.org/ecma-262/5.1/#sec-7.4 > I used <!--' instead of '//' because with '//' it's possible (through > very unlikely) that such sequence (like "'abc', // NEXTHASH") appears > in a commit message, but the same is impossible for '<!--' as '<' is > always replaced with corresponding html entity on the page. Surely such a commit message is JSON encoded before being put into the page? If so, then I don't understand why you cannot use the normal normal comment syntax.
20.09.2013, 10:34, "Martin Geisler" <martin@geisler.net>: > Alexander Plavin <alexander@plav.in> writes: > >> 19.09.2013, 10:59, "Martin Geisler" <martin@geisler.net>: >>> Alexander Plavin <alexander@plav.in> writes: >>>> # HG changeset patch >>>> # User Alexander Plavin <alexander@plav.in> >>>> # Date 1378459857 -14400 >>>> # Fri Sep 06 13:30:57 2013 +0400 >>>> # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199 >>>> # Parent 0a792989e90204557812427f02ba2f176f08d8c1 >>>> paper: call ajaxScrollInit in shortlog >>>> >>>> This just calls ajaxScrollInit at the shortlog page template with >>>> all needed >>>> agruments. So, infinite scrolling is working now there. >>>> >>>> diff -r 0a792989e902 -r 0032f7b54b7b >>>> mercurial/templates/paper/shortlog.tmpl >>>> --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12 >>>> 2013 +0400 >>>> +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57 >>>> 2013 +0400 >>>> @@ -71,6 +71,18 @@ >>>> | rev {rev}: {changenav%navshort} >>>> </div> >>>> >>>> +<script type="text/javascript"> >>>> + ajaxScrollInit( >>>> + '{url|urlescape}shortlog/%hash%', >>>> + '{nextentry%"{node}"}', <!-- NEXTHASH >>> I'm missing something here... This HTML comment looks unclosed to me? >>> Would '//' not be more appropriate for a comment inside JavaScript? >> It's valid JS code, such one-line comments are allowed (look >> http://www.javascripter.net/faq/comments.htm for example). > > Wow, that's... strange. I found this answer on SO: > > http://www.javascripter.net/faq/comments.htm > > which says it's a non-standard feature always implemented by browsers > and JavaScript engines. The answer pointed to this definition: > > http://javascript.spec.whatwg.org/#comment-syntax > > The section about comments in the ECMA script 5.1 spec doesn't mention > this syntax: > > http://ecma-international.org/ecma-262/5.1/#sec-7.4 Althrough it appears not to be in the ecmascript specification, there are many places where such comments are mentioned, so it's pretty safe to assume that browser will not change their processing. > >> I used <!--' instead of '//' because with '//' it's possible (through >> very unlikely) that such sequence (like "'abc', // NEXTHASH") appears >> in a commit message, but the same is impossible for '<!--' as '<' is >> always replaced with corresponding html entity on the page. > > Surely such a commit message is JSON encoded before being put into the > page? If so, then I don't understand why you cannot use the normal > normal comment syntax. "'abc', // NEXTHASH" (without outer quotes) isn't encoded. > > -- > Martin Geisler
Patch
diff -r 0a792989e902 -r 0032f7b54b7b mercurial/templates/paper/shortlog.tmpl --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12 2013 +0400 +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57 2013 +0400 @@ -71,6 +71,18 @@ | rev {rev}: {changenav%navshort} </div> +<script type="text/javascript"> + ajaxScrollInit( + '{url|urlescape}shortlog/%hash%', + '{nextentry%"{node}"}', <!-- NEXTHASH + /'(\w+)', <!-- NEXTHASH/, + '.bigtable > tbody:nth-of-type(2)', + '<tr class="%class%">\ + <td colspan="3" style="text-align: center;">%text%</td>\ + </tr>' + ); +</script> + </div> </div> diff -r 0a792989e902 -r 0032f7b54b7b tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Wed Sep 18 22:44:12 2013 +0400 +++ b/tests/test-hgweb-commands.t Fri Sep 06 13:30:57 2013 +0400 @@ -305,6 +305,18 @@ | rev 3: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div> + <script type="text/javascript"> + ajaxScrollInit( + '/shortlog/%hash%', + '', <!-- NEXTHASH + /'(\w+)', <!-- NEXTHASH/, + '.bigtable > tbody:nth-of-type(2)', + '<tr class="%class%">\ + <td colspan="3" style="text-align: center;">%text%</td>\ + </tr>' + ); + </script> + </div> </div> diff -r 0a792989e902 -r 0032f7b54b7b tests/test-hgweb-empty.t --- a/tests/test-hgweb-empty.t Wed Sep 18 22:44:12 2013 +0400 +++ b/tests/test-hgweb-empty.t Fri Sep 06 13:30:57 2013 +0400 @@ -90,6 +90,18 @@ | rev -1: </div> + <script type="text/javascript"> + ajaxScrollInit( + '/shortlog/%hash%', + '', <!-- NEXTHASH + /'(\w+)', <!-- NEXTHASH/, + '.bigtable > tbody:nth-of-type(2)', + '<tr class="%class%">\ + <td colspan="3" style="text-align: center;">%text%</td>\ + </tr>' + ); + </script> + </div> </div> @@ -185,6 +197,18 @@ | rev -1: </div> + <script type="text/javascript"> + ajaxScrollInit( + '/shortlog/%hash%', + '', <!-- NEXTHASH + /'(\w+)', <!-- NEXTHASH/, + '.bigtable > tbody:nth-of-type(2)', + '<tr class="%class%">\ + <td colspan="3" style="text-align: center;">%text%</td>\ + </tr>' + ); + </script> + </div> </div>