/*** @jsx React.DOM */ var valid_versions = Object.keys(window.versions); var pagenav = new History(valid_versions); var jubility_view = React.createClass({ getInitialState: function(props) { var profiles = Object.keys(window.player); return { player: window.player, songs: window.songs, 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) ); }, renderJubilityBreakdown: function(player) { return (
{this.renderJubilityTable(player, true)} {this.renderJubilityTable(player, false)}
); }, renderJubilityTable: function(player, pickup) { if (this.state.version != 13) // festo return null; if (pickup == true) jubilityChart = player.pick_up_chart; else jubilityChart = player.common_chart; if (typeof jubilityChart === 'undefined' || jubilityChart.length == 0) { return null; } return(

{pickup == true ? Pick up chart breakdown : Common chart breakdown}

{ this.state.songs[entry.music_id].name }
); }.bind(this), }, { name: 'Hard Mode', render: function(entry) { return entry.seq >= 3 ? 'Yes' : 'No'; } }, { name: 'Music Rate', render: function(entry) { return entry.music_rate.toFixed(1) + '%'; }, sort: function(a, b) { return a.music_rate - b.music_rate; }, reverse: true, }, { name: 'Jubility', render: function(entry) { return entry.value.toFixed(1); }, sort: function(a, b) { return a.value - b.value; }, reverse: true, }, ]} defaultsort='Jubility' rows={jubilityChart} /> ); }, renderJubility: function(player) { return( // version == prop ( No Jubility ) this.state.version == 10 ?

This version of jubeat doesn't support Jubility

: // version == qubell ( No Jubility ) this.state.version == 11 ?

This version of jubeat doesn't support Jubility

: // version == festo this.state.version == 13 ?
{(player.common_jubility+player.pick_up_jubility).toFixed(1)} {player.common_jubility.toFixed(1)} {player.pick_up_jubility.toFixed(1)}
: // Default which version >= Saucer except qubell and festo this.state.version >= 8 ?
{player.jubility / 100}
:

This version of jubeat doesn't support Jubility

) }, render: function() { if (this.state.player[this.state.version]) { var player = this.state.player[this.state.version]; var filteredVersion = Object.values(this.state.profiles).map(function(version) { return Object.values(window.versions)[version-1] }); var item = Object.keys(window.versions).map(function(k){ return window.versions[k] }) return (

← Back To Profile

{player.name}'s jubility

{this.state.profiles.map(function(version) { return (

{this.renderJubility(player)}
{this.renderJubilityBreakdown(player)}
); } 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(jubility_view, null), document.getElementById('content') );