hgweb: call process_dates() via DOM event listener
All the hgweb templates include mercurial.js in their header. All
the hgweb templates have the same <script> boilerplate to run
process_dates(). This patch factors that function call into
mercurial.js as part of a DOMContentLoaded event listener.
--- a/mercurial/templates/gitweb/footer.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/gitweb/footer.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -1,4 +1,3 @@
-<script type="text/javascript">process_dates()</script>
<div class="page_footer">
<div class="page_footer_text">{repo|escape}</div>
<div class="rss_logo">
--- a/mercurial/templates/gitweb/index.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/gitweb/index.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -22,6 +22,5 @@
<div class="page_footer">
{motd}
</div>
-<script type="text/javascript">process_dates()</script>
</body>
</html>
--- a/mercurial/templates/monoblue/footer.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/monoblue/footer.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -1,4 +1,3 @@
- <script type="text/javascript">process_dates()</script>
<div class="page-footer">
<p>Mercurial Repository: {repo|escape}</p>
<ul class="rss-logo">
--- a/mercurial/templates/monoblue/index.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/monoblue/index.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -30,6 +30,5 @@
</div>
</div>
-<script type="text/javascript">process_dates()</script>
</body>
</html>
--- a/mercurial/templates/paper/footer.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/paper/footer.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -1,4 +1,3 @@
-<script type="text/javascript">process_dates()</script>
{motd}
</body>
--- a/mercurial/templates/spartan/footer.tmpl Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/spartan/footer.tmpl Tue Jan 10 20:47:48 2017 -0800
@@ -1,4 +1,3 @@
-<script type="text/javascript">process_dates()</script>
{motd}
<div class="logo">
<a href="{logourl}">
--- a/mercurial/templates/static/mercurial.js Sat Dec 24 15:29:32 2016 -0700
+++ b/mercurial/templates/static/mercurial.js Tue Jan 10 20:47:48 2017 -0800
@@ -433,3 +433,7 @@
window.addEventListener('resize', scrollHandler);
scrollHandler();
}
+
+document.addEventListener('DOMContentLoaded', function() {
+ process_dates();
+}, false);
--- a/tests/test-help.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-help.t Tue Jan 10 20:47:48 2017 -0800
@@ -2352,7 +2352,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -2527,7 +2526,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -2723,7 +2721,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -2818,7 +2815,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -2915,7 +2911,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -3154,7 +3149,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-hgweb-commands.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-commands.t Tue Jan 10 20:47:48 2017 -0800
@@ -829,7 +829,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -961,7 +960,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1068,7 +1066,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1352,7 +1349,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1478,7 +1474,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1690,7 +1685,6 @@
<td colspan="3"><a class="list" href="/branches?style=gitweb">...</a></td>
</tr>
</table>
- <script type="text/javascript">process_dates()</script>
<div class="page_footer">
<div class="page_footer_text">test</div>
<div class="rss_logo">
@@ -1835,7 +1829,6 @@
);
</script>
- <script type="text/javascript">process_dates()</script>
<div class="page_footer">
<div class="page_footer_text">test</div>
<div class="rss_logo">
--- a/tests/test-hgweb-descend-empties.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-descend-empties.t Tue Jan 10 20:47:48 2017 -0800
@@ -139,7 +139,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -259,7 +258,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -360,7 +358,6 @@
</table>
- <script type="text/javascript">process_dates()</script>
<div class="page-footer">
<p>Mercurial Repository: test</p>
<ul class="rss-logo">
@@ -470,7 +467,6 @@
</table>
- <script type="text/javascript">process_dates()</script>
<div class="page_footer">
<div class="page_footer_text">test</div>
<div class="rss_logo">
@@ -551,7 +547,6 @@
</a>
</table>
- <script type="text/javascript">process_dates()</script>
<div class="logo">
<a href="https://mercurial-scm.org/">
--- a/tests/test-hgweb-diffs.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-diffs.t Tue Jan 10 20:47:48 2017 -0800
@@ -162,7 +162,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -299,7 +298,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -442,7 +440,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -579,7 +576,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -703,7 +699,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -837,7 +832,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -969,7 +963,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1096,7 +1089,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-hgweb-empty.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-empty.t Tue Jan 10 20:47:48 2017 -0800
@@ -109,7 +109,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -220,7 +219,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -374,7 +372,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -454,7 +451,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-hgweb-filelog.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-filelog.t Tue Jan 10 20:47:48 2017 -0800
@@ -242,7 +242,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -362,7 +361,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -474,7 +472,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -586,7 +583,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -651,7 +647,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -757,7 +752,6 @@
- <script type="text/javascript">process_dates()</script>
<div class="logo">
<a href="https://mercurial-scm.org/">
--- a/tests/test-hgweb-removed.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb-removed.t Tue Jan 10 20:47:48 2017 -0800
@@ -131,7 +131,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -235,7 +234,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-hgweb.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgweb.t Tue Jan 10 20:47:48 2017 -0800
@@ -99,7 +99,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -207,7 +206,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -318,7 +316,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-hgwebdir.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-hgwebdir.t Tue Jan 10 20:47:48 2017 -0800
@@ -898,7 +898,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -969,7 +968,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -1407,7 +1405,6 @@
</table>
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
--- a/tests/test-highlight.t Sat Dec 24 15:29:32 2016 -0700
+++ b/tests/test-highlight.t Tue Jan 10 20:47:48 2017 -0800
@@ -186,7 +186,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>
@@ -857,7 +856,6 @@
</div>
</div>
- <script type="text/javascript">process_dates()</script>
</body>