Don't add on click events on dialog open

Instead add them once durring setup
This fixes an issue where click events would fire x amount of times
depending on how many times the dialog was opened and closed, on even
times sort would run twice and not toggle.
This commit is contained in:
Fragger
2013-11-14 16:37:25 -08:00
parent f421302776
commit c5251d22c5
2 changed files with 17 additions and 19 deletions

View File

@ -287,11 +287,6 @@ window.plugin.scoreboard.display = function() {
id: 'scoreboard'
});
// Setup sorting
$(document).on('click', '#players table th', function() {
$('#players').html(window.plugin.scoreboard.playerTable($(this).data('sort')));
});
//run the name resolving process
resolvePlayerNames();
}
@ -334,6 +329,10 @@ var setup = function() {
'.mu_score span.res { background-color: #005684; text-align: right; padding-right:4px; }' +
'.mu_score span.enl { background-color: #017f01; padding-left: 4px; }' +
'</style>');
// Setup sorting
$(document).on('click', '#players table th', function() {
$('#players').html(window.plugin.scoreboard.playerTable($(this).data('sort')));
});
}
// PLUGIN END //////////////////////////////////////////////////////////