/*** @jsx React.DOM */ var valid_versions = Object.keys(window.versions); var pagenav = new History(valid_versions); var profile_view = createReactClass({ getInitialState: function(props) { var profiles = Object.keys(window.player); return { player: window.player, profiles: profiles, version: pagenav.getInitialState(profiles[profiles.length - 1]), }; }, componentDidMount: function() { pagenav.onChange(function(version) { this.setState({version: version}); }.bind(this)); this.refreshProfile(); }, refreshProfile: function() { AJAX.get( Link.get('refresh'), function(response) { var profiles = Object.keys(response.player); this.setState({ player: response.player, profiles: profiles, }); setTimeout(this.refreshProfile, 5000); }.bind(this) ); }, render: function() { if (this.state.player[this.state.version]) { var player = this.state.player[this.state.version]; return (

{player.name}'s profile

{this.state.profiles.map(function(version) { return (
{player.extid} {player.plays}回
{ window.own_profile ? view your records : view {player.name}'s records } · { window.own_profile ? view all your scores : view all {player.name}'s scores }
); } else { return (
{this.state.profiles.map(function(version) { return (
This player has no profile for {window.versions[this.state.version]}!
); } }, }); ReactDOM.render( React.createElement(profile_view, null), document.getElementById('content') );