(function($) { var LadderRoom = this.LadderRoom = this.Room.extend({ type: 'ladder', title: 'Ladder', initialize: function() { this.$el.addClass('ps-room-light').addClass('scrollable'); app.on('init:formats', this.update, this); this.update(); }, curFormat: '', update: function() { if (!this.curFormat) { var ladderButtons = ''; if (!window.BattleFormats) { this.$el.html('
Loading...
'); return; } var curSection = ''; for (var i in BattleFormats) { var format = BattleFormats[i]; if (format.section && format.section !== curSection) { curSection = format.section; ladderButtons += '

'+Tools.escapeHTML(curSection)+'