[PATCH 3 of 5] hgweb: infinite scroll support for gitweb style

Takumi IINO trot.thunder at gmail.com
Tue Jan 7 09:52:16 CST 2014


# HG changeset patch
# User Takumi IINO <trot.thunder at gmail.com>
# Date 1389109663 -32400
#      Wed Jan 08 00:47:43 2014 +0900
# Node ID fa073629c74ab6ba4d5f7f19f5daa5f2a7120262
# Parent  7a6741c42018ae560f031be991a64fface19f8d2
hgweb: infinite scroll support for gitweb style

diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -106,6 +106,17 @@ graph.render(data);
 <a href="{url|urlescape}graph/{rev}{lessvars%urlparameter}">less</a>
 <a href="{url|urlescape}graph/{rev}{morevars%urlparameter}">more</a>
 | {changenav%navgraph}
 </div>
 
+<script type="text/javascript">
+    ajaxScrollInit(
+            '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
+            {revcount}+60,
+            function (htmlText, previousVal) \{ return previousVal + 60; },
+            '#wrapper',
+            '<div class="%class%" style="text-align: center;">%text%</div>',
+            'graph'
+    );
+</script>
+
 {footer}
diff --git a/mercurial/templates/gitweb/shortlog.tmpl b/mercurial/templates/gitweb/shortlog.tmpl
--- a/mercurial/templates/gitweb/shortlog.tmpl
+++ b/mercurial/templates/gitweb/shortlog.tmpl
@@ -30,14 +30,29 @@ shortlog |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>{changenav%navshort}<br/>
 </div>
 
 <div class="title"> </div>
-<table cellspacing="0">
+<table class="shortlogtable" cellspacing="0">
 {entries%shortlogentry}
 </table>
 
 <div class="page_nav">
 {changenav%navshort}
 </div>
 
+<script type="text/javascript">
+    ajaxScrollInit(
+            '{url|urlescape}shortlog/%next%{sessionvars%urlparameter}',
+            '{nextentry%"{node}"}', <!-- NEXTHASH
+            function (htmlText, previousVal) \{
+                var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                return m ? m[1] : null;
+            },
+            '.shortlogtable > tbody:nth-of-type(1)',
+            '<tr class="%class%">\
+            <td colspan="4" style="text-align: center;">%text%</td>\
+            </tr>'
+    );
+</script>
+
 {footer}
diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -165,5 +165,29 @@ ul#graphnodes li .info {
 }
 
 .block {
     border-top: 1px solid #d9d8d1;
 }
+
+.scroll-loading {
+  -webkit-animation: change_color 1s linear 0s infinite alternate;
+  -moz-animation: change_color 1s linear 0s infinite alternate;
+  -o-animation: change_color 1s linear 0s infinite alternate;
+  animation: change_color 1s linear 0s infinite alternate;
+}
+
+ at -webkit-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+ at -moz-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+ at -o-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+ at keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+
+.scroll-loading-error {
+    background-color: #FFCCCC !important;
+}


More information about the Mercurial-devel mailing list