var React = require('react'); var render = require('../../lib/render.jsx'); var FormattedHTMLMessage = require('react-intl').FormattedHTMLMessage; var FormattedMessage = require('react-intl').FormattedMessage; var api = require('../../lib/api'); var Page = require('../../components/page/www/page.jsx'); var TitleBanner = require('../../components/title-banner/title-banner.jsx'); var FlexRow = require('../../components/flex-row/flex-row.jsx'); var SubNavigation = require('../../components/subnavigation/subnavigation.jsx'); require('./download.scss'); require('../../components/forms/button.scss'); var Download = React.createClass({ type: 'Download', getInitialState: function () { return { swfVersion: '456.0.3' }; }, componentDidMount: function () { api({ host: '', uri: '/scratchr2/static/sa/version.xml', responseType: 'string' }, function (err, body) { if (err) return; var doc = new DOMParser().parseFromString(body, 'text/xml'); return this.setState({ swfVersion: doc.getElementsByTagName('versionNumber')[0].childNodes[0].nodeValue }); }.bind(this)); }, render: function () { var downloadUrls = { mac: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.dmg', mac105: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air', windows: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.exe', linux: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air' }; return (
); } }); render(