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

login
register
mail settings
Submitter Takumi IINO
Date Jan. 7, 2014, 3:52 p.m.
Message ID <fa073629c74ab6ba4d5f.1389109936@iinotakken-no-MacBook-Air.local>
Download mbox | patch
Permalink /patch/3268/
State Accepted
Headers show

Comments

Takumi IINO - Jan. 7, 2014, 3:52 p.m.
# HG changeset patch
# User Takumi IINO <trot.thunder@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

Patch

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">&nbsp;</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;
+}
+
+@-webkit-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+@-moz-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+@-o-keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+@keyframes change_color {
+  from { background-color: #A0CEFF; } to {  }
+}
+
+.scroll-loading-error {
+    background-color: #FFCCCC !important;
+}