{"comment":{"created_at":"2011-10-12T22:10:07Z","body":"Thanks potch. Our needs are pretty simple, I don't think we even compare versions for download button (just show either nightly, aurora, beta, or final). I'll peruse through AMO's code though.\r\n\r\nI've started work on the javascript library to prettify buttons. Will hopefully have something soon.","updated_at":"2011-10-12T22:10:07Z","url":"https://api.github.com/repos/mozilla/bedrock/issues/comments/2387671","id":2387671,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7ed988fcb335ac36e3c9f7fc8fdb7c10?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jlongster","id":17031,"login":"jlongster"}},"action":"created","issue":{"number":4,"created_at":"2011-10-11T22:13:32Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"A little documentation after reviewing the mozilla.com source:\r\n\r\nThe download button is an absolute messy mix of PHP and javascript.\r\n\r\nEvery button calls `getNoScriptBlockForLocale` on the firefoxDetails object which dumps out markup for people with Javascript disabled.\r\n\r\nFor javascript users, there are two versions of the download button:\r\n\r\n1. One that uses download.old.js, and simply dumps a block of javascript on the page to render the button (using a large template string and a bunch of document.write's). download.old.js depends on a big javascript object being dumped by the productDetails object containing details about the versions.\r\n\r\n2. The other one uses download.js (which seems to be a newer version) and calls `getDownloadBlockForLocale` which dumps out javascript that calls into download.js functions. The difference seems to be that it dumps all the needed info into the js inline.\r\n\r\nThe productDetails class is 1000 lines long with a bunch of functions that mostly just dump HTML to render different ways of downloading Firefox.\r\n\r\nThis will be one of hardest things to migrate, I think. I don't think it will be possible to do this without cleaning up a lot of it. My hunch is to build a javascript library on top of the json files in product-details (that other projects use). The json can be dumped onto the page and the client-side javascript can take care of the rest. For the javascript disabled, we can build a light jinja helper which dumps out the markup that we do now.","comments":5,"title":"Get basic download button working","updated_at":"2011-10-12T22:10:07Z","url":"https://api.github.com/repos/mozilla/bedrock/issues/4","id":1881616,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7ed988fcb335ac36e3c9f7fc8fdb7c10?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jlongster","id":17031,"login":"jlongster"},"html_url":"https://github.com/mozilla/bedrock/issues/4","labels":[],"state":"open"},"legacy":{"issue_id":1881616,"comment_id":2387671}}