Parameters
Name |
Type |
Description |
props |
object
|
Properties
Name |
Type |
Argument |
Default |
Description |
seasonId |
number
|
|
|
Season id.
|
seasonType |
string
|
<optional>
|
'regular'
|
Selected season type. Can be regular , playoffs .
|
conference |
string
|
<optional>
|
'all'
|
Selected conference. Can be al , nl , all .
|
statType |
string
|
<optional>
|
'hitting_runs_batted_in'
|
Selected stat. Can be hitting_runs_batted_in , hitting_batting_average , hitting_slugging_percentage , hitting_on_base_percentage , hitting_on_base_percentage_plus_slugging , hitting_extra_base_hits , hitting_hits , hitting_doubles , hitting_triples , hitting_home_runs , hitting_at_bats , hitting_batting_average_on_balls_in_play , hitting_isolated_power , hitting_walks_per_strikeout , hitting_at_bats_per_homerun , hitting_stolen_bases , hitting_caught_stealing , hitting_plate_appearances , hitting_ground_out_to_fly_out_ratio , pitching_overall_earned_run_average , pitching_overall_wins , pitching_overall_losses , pitching_overall_outs_pitched , pitching_overall_saves , pitching_overall_walks_plus_hits_per_innings_pitched , pitching_overall_total_strikeouts , pitching_overall_walks , pitching_overall_strikeouts_per_walk , pitching_overall_complete_games , pitching_overall_shutouts , pitching_overall_quality_starts , pitching_overall_holds , pitching_overall_opponents_batting_average , pitching_overall_ground_out_to_fly_out_ratio , pitching_overall_games_started .
|
disableDropdown |
boolean
|
<optional>
|
|
If true hides dropdown.
|
disableHeader |
boolean
|
<optional>
|
|
If true hides widget header.
|
showTitle |
boolean
|
<optional>
|
|
If true turns dropdown to title.
|
hidePlayers |
boolean
|
<optional>
|
|
If true hides player images.
|
playersLimit |
number
|
<optional>
|
5
|
Limits list length.
|
qualifiesAsLeagueLeader |
boolean
|
<optional>
|
true
|
If true enables statistical minimums to qualify a player for inclusion in a statistical category,
|
border |
boolean
|
<optional>
|
|
If true enables a border around the widget.
|
onItemClick |
function
|
<optional>
|
|
Function/event handler. Emits playerId on click or touch.
|
|
Examples
HTML/Declarative
<div class="sr-widget" data-sr-widget="us.season.mlb.topPlayers" data-sr-season-id="88607"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/uscommon/widgetloader" data-sr-language="en_us" async></script>
JS/Programmatic
<script>
(function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
)})(window,document,"script","https://widgets.media.sportradar.com/uscommon/widgetloader","USW", {
language: 'en_us'
});
USW('addWidget', '#sr-widget', 'us.season.mlb.topPlayers', {seasonId: 88607, statType: 'hitting_batting_average'});
</script>
<div id="sr-widget"></div>
JS/Example of using Event Handler
<script>
(function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
)})(window,document,"script","https://widgets.media.sportradar.com/uscommon/widgetloader","USW", {
language: 'en_us'
});
USW('addWidget', '#sr-widget', 'us.season.mlb.topPlayers', {seasonId: 88607, conference: 'al', statType: 'pitching_overall_earned_run_average', onItemClick: function(type, obj){alert('playerId: ' + obj.playerId);}});
</script>
<div id="sr-widget"></div>