Commit c65b8135 authored by Kevin Bullock's avatar Kevin Bullock
Browse files

downloads: replace inline scripts with an onload function

parent aec3b193e5af
......@@ -132,3 +132,21 @@
return out;
}
};
(function (document, window) {
var load = function () {
Downloader.init(sources);
var dl = Downloader.select();
var versElement = document.getElementById('download-version')
, descElement = document.getElementById('download-description');
versElement.appendChild(document.createTextNode(dl.attr('version')));
descElement.appendChild(document.createTextNode(dl.attr('desc')));
}
if (document.readyState !== 'complete') {
document.addEventListener('DOMContentLoaded', load);
return;
}
load();
})(document, window);
......@@ -7,10 +7,6 @@
<script type="text/javascript" src="{{ url_for('static', filename='js/common.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='sources.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/download.js') }}"></script>
<script language="javascript">
Downloader.init(sources);
var dl = Downloader.select();
</script>
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico">
<title>Mercurial SCM</title>
......@@ -49,5 +45,5 @@
</div>
<div class="col">
{% block sidebar %}
<a class="download" href="/downloads" onClick="return dl.download();">
<a class="download" href="/downloads" onClick="return window.dl.download();">
<strong>Download now</strong>
......@@ -53,6 +49,6 @@
<strong>Download now</strong>
Mercurial <em><script language="Javascript">dl.write('version');</script></em>
<span><script language="javascript">dl.write('desc');</script></span>
Mercurial <em id="download-version"></em>
<span id="download-description"></span>
</a>
<dl>
<dt>Another OS?<br><em>Get Mercurial for:</em></dt>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment