Mercurial > hg
diff mercurial/templates/static/mercurial.js @ 19781:74564c90026b
hgweb: make infinite scroll handling more generic and extensible
Namely, this allows the next page pointer to be not only revision hash given
in page code, but also any value computed from the value for previous page.
author | Alexander Plavin <alexander@plav.in> |
---|---|
date | Sun, 22 Sep 2013 14:18:23 +0400 |
parents | 659bc603bd0d |
children | 8123f50555ff |
line wrap: on
line diff
--- a/mercurial/templates/static/mercurial.js Fri Sep 06 13:30:59 2013 +0400 +++ b/mercurial/templates/static/mercurial.js Sun Sep 22 14:18:23 2013 +0400 @@ -355,8 +355,8 @@ } function ajaxScrollInit(urlFormat, - nextHash, - nextHashRegex, + nextPageVar, + nextPageVarGet, containerSelector, messageFormat) { updateInitiated = false; @@ -377,7 +377,7 @@ removeByClassName('scroll-loading-error'); container.lastElementChild.classList.add('scroll-separator'); - if (!nextHash) { + if (!nextPageVar) { var message = { class: 'scroll-loading-info', text: 'No more entries' @@ -387,7 +387,7 @@ } makeRequest( - format(urlFormat, {hash: nextHash}), + format(urlFormat, {next: nextPageVar}), 'GET', function onstart() { var message = { @@ -397,8 +397,7 @@ appendFormatHTML(container, messageFormat, message); }, function onsuccess(htmlText) { - var m = htmlText.match(nextHashRegex); - nextHash = m ? m[1] : null; + nextPageVar = nextPageVarGet(htmlText, nextPageVar); var doc = docFromHTML(htmlText); var nodes = doc.querySelector(containerSelector).children;