hgtemplates: port 4.1 template changes to gitweb_mozilla (
bug 1333616); r?glob
gitweb_mozilla is our fork of the gitweb style. Every release, we have
to port changes to the gitweb style to gitweb_mozilla.
The changes in this release weren't too bad.
process_dates() was factored into mercurial.js, so we can delete it.
In order to support CSP, all <script> instances now have some template
boilerplate to automatically emit a CSP nonce.
The only non-obvious change was pushlog.tmpl had a <script> that needed
to be taught about a nonce.
MozReview-Commit-ID: Cwl4dWEY0Ji
--- a/hgtemplates/gitweb_mozilla/footer.tmpl
+++ b/hgtemplates/gitweb_mozilla/footer.tmpl
@@ -1,9 +1,8 @@
-<script type="text/javascript">process_dates()</script>
<div class="page_footer">
<div class="page_footer_text">{repo|escape}</div>
<div class="page_footer_text" style="padding-left: 10px">Deployed from <a href="https://hg.mozilla.org/hgcustom/version-control-tools/rev/VCTNODE">VCTNODE</a> at DEPLOYDATE.</div>
<div class="rss_logo">
<a href="{url|urlescape}rss-log">RSS</a>
<a href="{url|urlescape}atom-log">Atom</a>
</div>
<br />
--- a/hgtemplates/gitweb_mozilla/graph.tmpl
+++ b/hgtemplates/gitweb_mozilla/graph.tmpl
@@ -41,17 +41,17 @@ graph |
<noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
<div id="wrapper">
<ul id="nodebgs"></ul>
<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
</div>
-<script>
+<script{if(nonce, ' nonce="{nonce}"')}>
<!-- hide script content
var data = {jsdata|json};
var graph = new Graph();
graph.scale({bg_height});
graph.vertex = function(x, y, color, parity, cur) \{
@@ -104,17 +104,17 @@ graph.render(data);
</script>
<div class="page_nav">
<a href="{url|urlescape}graph/{symrev}{lessvars%urlparameter}">less</a>
<a href="{url|urlescape}graph/{symrev}{morevars%urlparameter}">more</a>
| {changenav%navgraph}
</div>
-<script type="text/javascript">
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
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'
);
--- a/hgtemplates/gitweb_mozilla/index.tmpl
+++ b/hgtemplates/gitweb_mozilla/index.tmpl
@@ -148,11 +148,10 @@
<tr>
<td><a href="/www">www</a></td>
<td>Code related to various mozilla websites</td>
</tr>
</table>
<div class="page_footer">
{motd}
</div>
-<script type="text/javascript">process_dates()</script>
</body>
</html>
--- a/hgtemplates/gitweb_mozilla/pushlog.tmpl
+++ b/hgtemplates/gitweb_mozilla/pushlog.tmpl
@@ -3,17 +3,17 @@
<link rel="alternate" type="application/atom+xml"
href="{url|urlescape}pushlog" title="Atom feed for {repo|escape} pushlog"/>
<style type="text/css">
#localize, .expand \{
font-size: x-small;
}
</style>
<script type="text/javascript" src="{staticurl}jquery-1.2.6.min.js"></script>
-<script type="text/javascript">// <![CDATA[
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>// <![CDATA[
$(document).ready(function () \{
// add click handler to the localize dates link
$('#localize').show().click(function () \{
$(this).hide();
$('.date').each(function (i) \{
$(this).text(new Date($(this).text()).toLocaleString());
});
return false;
--- a/hgtemplates/gitweb_mozilla/shortlog.tmpl
+++ b/hgtemplates/gitweb_mozilla/shortlog.tmpl
@@ -36,17 +36,17 @@ shortlog |
<table class="shortlogtable" cellspacing="0">
{entries%shortlogentry}
</table>
<div class="page_nav">
{changenav%navshort}
</div>
-<script type="text/javascript">
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
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)',