/*** @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) ); }, renderJubility: function(player) { return( // version == prop ( No Jubility ) this.state.version == 10 ? null : // version == qubell ( No Jubility ) this.state.version == 11 ? null : // version == festo this.state.version == 13 ? {(player.common_jubility+player.pick_up_jubility).toFixed(1)} : // Default which version >= Saucer except qubell and festo this.state.version >= 8 ? {player.jubility / 100} : null ) }, render: function() { if (this.state.player[this.state.version]) { var player = this.state.player[this.state.version]; var item = Object.keys(window.versions).map(function(k){ return window.versions[k] }) return (

{player.name}'s profile

{this.state.profiles.map(function(version) { return (
{player.extid} {player.plays}回
{player.ex_count}回 {player.fc_count}回 {this.renderJubility(player)}
{this.state.version >= 12 ?
{ window.own_profile ? Your Jubility Breakdown → : {player.name}'s Jubility Breakdown → }
: null}
{ 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 { var item = Object.keys(window.versions).map(function(k){ return window.versions[k] }) return (
This player has no profile for {window.versions[this.state.version]}!
); } }, }); ReactDOM.render( React.createElement(profile_view, null), document.getElementById('content') );