Mercurial > hg-website
diff static/js/download.js @ 478:c65b81353b8f
downloads: replace inline scripts with an onload function
author | Kevin Bullock <kbullock+mercurial@ringworld.org> |
---|---|
date | Wed, 10 May 2017 12:19:45 -0500 |
parents | 8e3b10220bb9 |
children | 23ff698c5dbb |
line wrap: on
line diff
--- a/static/js/download.js Wed May 10 11:46:48 2017 -0500 +++ b/static/js/download.js Wed May 10 12:19:45 2017 -0500 @@ -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);