diff --git a/data/graphics.js b/data/graphics.js index 88bf692f3..e29debf36 100644 --- a/data/graphics.js +++ b/data/graphics.js @@ -6107,7 +6107,7 @@ var BattleMoveAnims = { }, 'decel', 'explode'); } } -} +}; // placeholder animations BattleMoveAnims['vcreate'] = {anim:BattleMoveAnims['flareblitz'].anim}; diff --git a/js/battle.js b/js/battle.js index 2fa6cd99b..9d270778e 100644 --- a/js/battle.js +++ b/js/battle.js @@ -478,7 +478,7 @@ function Pokemon(species) { return !!selfP.turnstatuses[volatile]; }; this.clearTurnstatuses = function () { - for (i in selfP.turnstatuses) { + for (var i in selfP.turnstatuses) { selfP.removeTurnstatus(i); } selfP.turnstatuses = {}; @@ -500,13 +500,13 @@ function Pokemon(species) { return !!selfP.movestatuses[volatile]; }; this.clearMovestatuses = function () { - for (i in selfP.movestatuses) { + for (var i in selfP.movestatuses) { selfP.removeMovestatus(i); } selfP.movestatuses = {}; }; this.clearVolatiles = function () { - for (i in selfP.volatiles) { + for (var i in selfP.volatiles) { selfP.removeVolatile(i); } selfP.volatiles = {}; @@ -528,7 +528,7 @@ function Pokemon(species) { } }; this.getTitle = function () { - titlestring = '(' + selfP.ability + ') '; + var titlestring = '(' + selfP.ability + ') '; for (var i = 0; i < selfP.moves.length; i++) { if (i != 0) titlestring += ' / '; @@ -563,7 +563,7 @@ function Pokemon(species) { } } return name; - } + }; this.getBoost = function (boostStat) { var boostStatTable = { atk: 'Atk', @@ -597,7 +597,7 @@ function Pokemon(species) { var badBoostTable = ['1×', '0.67×', '0.5×', '0.4×', '0.33×', '0.29×', '0.25×']; //var badBoostTable = ['Normal', '−1', '−2', '−3', '−4', '−5', '−6']; return '' + badBoostTable[-selfP.boosts[boostStat]] + ' ' + boostStatTable[boostStat]; - } + }; this.getBoostType = function (boostStat) { if (!selfP.boosts[boostStat]) { return 'neutral'; @@ -605,7 +605,7 @@ function Pokemon(species) { return 'good'; } return 'bad'; - } + }; this.clearVolatile = function () { selfP.atk = selfP.atkStat; @@ -687,7 +687,7 @@ function Pokemon(species) { var range = selfP.getPixelRange(selfP.hp, selfP.hpcolor); return selfP.getFormattedRange(range, precision, '–'); }; -}; +} function Battle(frame, logFrame, noPreload) { var self = this; @@ -1018,10 +1018,10 @@ function Battle(frame, logFrame, noPreload) { this.duringMove = false; this.behindx = function (offset) { return selfS.x + (selfS.isBackSprite ? -1 : 1) * offset; - } + }; this.behindy = function (offset) { return selfS.y + (selfS.isBackSprite ? 1 : -1) * offset; - } + }; this.leftof = function (offset) { return (selfS.isBackSprite ? -1 : 1) * offset; }; @@ -1366,7 +1366,7 @@ function Battle(frame, logFrame, noPreload) { selfS.elem.delay(time); if (selfS.subElem) { selfS.subElem.delay(time); - }; + } return selfS; }; this.selfAnim = function (end, transition) { @@ -1424,7 +1424,7 @@ function Battle(frame, logFrame, noPreload) { elem.animate({ opacity: 0 }, 250); - } + }; this.showEffect = function (img, start, end, transition, after) { var effect = img; if (img && img.length) effect = BattleEffects[img]; @@ -1493,10 +1493,10 @@ function Battle(frame, logFrame, noPreload) { this.behindx = function (offset) { return selfS.x + (!selfS.n ? -1 : 1) * offset; - } + }; this.behindy = function (offset) { return selfS.y + (!selfS.n ? 1 : -1) * offset; - } + }; this.leftof = function (offset) { return (!selfS.n ? -1 : 1) * offset; }; @@ -1537,7 +1537,7 @@ function Battle(frame, logFrame, noPreload) { sprite: new self.Sprite(null, selfS.leftof(-100), selfS.y, selfS.z, selfS.n) }; for (var i = 0; i < selfS.pokemon.length; i++) { - poke = selfS.pokemon[i]; + var poke = selfS.pokemon[i]; poke.sprite.destroy(); poke.sprite = new self.Sprite(Tools.getSpriteData(poke, selfS.n, {afd: self.tier === "[Seasonal] Fools Festival"}), selfS.x, selfS.y, selfS.z, selfS.n); } @@ -1573,7 +1573,7 @@ function Battle(frame, logFrame, noPreload) { this.updateSidebar = function () { var pokemonhtml = ''; for (var i = 0; i < 6; i++) { - poke = selfS.pokemon[i]; + var poke = selfS.pokemon[i]; if (i >= selfS.totalPokemon) { pokemonhtml += ''; } else if (!poke) { @@ -1597,6 +1597,7 @@ function Battle(frame, logFrame, noPreload) { } }; this.addSideCondition = function (condition) { + var elem, curelem; condition = toId(condition); if (selfS.sideConditions[condition]) { if (condition === 'spikes' || condition === 'toxicspikes') { @@ -1638,7 +1639,6 @@ function Battle(frame, logFrame, noPreload) { } return; } - var elem, curelem; switch (condition) { case 'reflect': self.spriteElemsFront[selfS.n].append(''; @@ -500,7 +500,7 @@ teamPreview: [1,2,3,4,5,6].slice(0,switchables.length), done: 0, count: 0 - } + }; if (this.battle.gameType === 'doubles') { this.choice.count = 2; } @@ -606,7 +606,6 @@ if (!sideData.id) return; this.side = sideData.id; if (this.battle.sidesSwitched !== !!(this.side === 'p2')) { - sidesSwitched = true; this.battle.reset(true); this.battle.switchSides(); if (midBattle) { @@ -916,7 +915,7 @@ case 'pokemon': var pokemon = this.battle.getPokemon(thing); if (!pokemon) return; - //fallthrough + /* falls through */ case 'sidepokemon': if (!pokemon) pokemon = this.battle.mySide.pokemon[parseInt(thing)]; var gender = ''; diff --git a/js/client-chat-tournament.js b/js/client-chat-tournament.js index d607c0cce..012ed3f6f 100644 --- a/js/client-chat-tournament.js +++ b/js/client-chat-tournament.js @@ -442,9 +442,9 @@ break; case 'error': - var appendError = (function(message) { + var appendError = function(message) { this.room.$chat.append("
" + message + "
"); - }).bind(this); + }.bind(this); switch (data[0]) { case 'BracketFrozen': diff --git a/js/client-chat.js b/js/client-chat.js index cd9e037d3..823c5ea82 100644 --- a/js/client-chat.js +++ b/js/client-chat.js @@ -512,10 +512,8 @@ case 'timestamps': var targets = target.split(','); - if ((['all', 'lobby', 'pms'].indexOf(targets[0]) === -1) - || (targets.length < 2) - || (['off', 'minutes', 'seconds'].indexOf( - targets[1] = targets[1].trim()) === -1)) { + if ((['all', 'lobby', 'pms'].indexOf(targets[0]) === -1) || targets.length < 2 || + (['off', 'minutes', 'seconds'].indexOf(targets[1] = targets[1].trim()) === -1)) { this.add('Error: Invalid /timestamps command'); return '/help timestamps'; // show help } @@ -1112,11 +1110,7 @@ var pref = Tools.prefs('timestamps') || {}; var sectionPref = ((section === 'pms') ? pref.pms : pref.lobby) || 'off'; if ((sectionPref === 'off') || (sectionPref === undefined)) return ''; - if (!deltatime || isNaN(deltatime)) { - var date = new Date(); - } else { - var date = new Date(Date.now() - deltatime * 1000); - } + var date = new Date(deltatime && !isNaN(deltatime) ? Date.now() - deltatime * 1000 : undefined); var components = [ date.getHours(), date.getMinutes() ]; if (sectionPref === 'seconds') { components.push(date.getSeconds()); @@ -1189,10 +1183,6 @@ var users = Math.max(this.room.userCount.users || 0, this.room.userCount.globalUsers || 0); $('#' + this.room.id + '-usercount-users').html('' + users); }, - updateCurrentUser: function() { - $('.userlist > .cur').attr('class', ''); // this doesn't need to be namespaced - $('#' + this.room.id + '-userlist-user-' + me.userForm).attr('class', 'cur'); - }, add: function(userid) { $('#' + this.room.id + '-userlist-user-' + userid).remove(); var users = this.$el.children(); @@ -1216,12 +1206,6 @@ remove: function(userid) { $('#' + this.room.id + '-userlist-user-' + userid).remove(); }, - buttonOnClick: function(userid) { - if (app.user.get('named')) { - return selfR.formChallenge(userid); - } - return selfR.formRename(); - }, constructItem: function(userid) { var name = this.room.users[userid]; var text = ''; diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index ec5abf6b4..5d6757f9f 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -129,6 +129,7 @@ var $chatFrame = $pmWindow.find('.pm-log'); var $chat = $pmWindow.find('.inner'); + var autoscroll = false; if ($chatFrame.scrollTop() + 60 >= $chat.height() - $chatFrame.height()) { autoscroll = true; } @@ -174,7 +175,7 @@ var userid = toId(name); var $pmWindow = this.$pmBox.find('.pm-window-'+userid); if (!$pmWindow.length) { - group = name.charAt(0); + var group = name.charAt(0); if (group === ' ') { group = ''; } else { @@ -222,7 +223,7 @@ $pmWindow.remove(); return; } - $pmWindow = this.$pmBox.find('.pm-window-'+userid) + $pmWindow = this.$pmBox.find('.pm-window-'+userid); $pmWindow.hide(); var $rejectButton = $pmWindow.find('button[name=rejectChallenge]'); @@ -503,9 +504,9 @@ } if (format) format = toId(format); - var teamIndex = undefined; + var teamIndex; if (Storage.teams && team) { - var team = toId(team); + team = toId(team); for (var i = 0; i < Storage.teams.length; i++) { if (team === toId(Storage.teams[i].name || '')) { teamIndex = i; @@ -591,7 +592,7 @@ return ''; } if (_.isEmpty(BattleFormats)) { - return '' + return ''; } if (!noChoice) { this.curFormat = formatid; @@ -623,7 +624,7 @@ } var teams = Storage.teams; if (!teams.length) { - return '' + return ''; } if (teamIndex === undefined) { teamIndex = 0; @@ -683,9 +684,6 @@ this.searching = false; this.updateSearch(); }, - joinRoom: function(room) { - app.joinRoom(room); - }, credits: function() { app.addPopup(CreditsPopup); }, @@ -763,10 +761,10 @@ bufBoundary = Math.ceil(teams.length/2); } + var format = BattleFormats[data.format]; if (!teams.length) { bufs[curBuf] = '
  • You have no teams
  • '; } else { - var format = BattleFormats[data.format]; var curTeam = +data.team; var teamFormat = (format.teambuilderFormat || (format.isTeambuilderFormat ? data.format : false)); var count = 0; diff --git a/js/client-rooms.js b/js/client-rooms.js index 4a0ccc2b7..f6ea725c3 100644 --- a/js/client-rooms.js +++ b/js/client-rooms.js @@ -82,7 +82,7 @@ buf += '
    (' + Number(roomData.userCount) + ' users) ' + Tools.escapeHTML(roomData.title) + '
    ' + escapedDesc + '
    '; } - buf += '

    ' + buf += '

    '; buf += ''; this.$el.html(buf); diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index cf2dd5c1c..90438c0b5 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -121,7 +121,7 @@ } if (!teams) { - buf = '

    lol zarel this is a horrible teambuilder

    ' + buf = '

    lol zarel this is a horrible teambuilder

    '; buf += '

    that\'s because we\'re not done loading it...

    '; this.$el.html(buf); return; diff --git a/js/client.js b/js/client.js index 1f7d7b65e..5b8d282cd 100644 --- a/js/client.js +++ b/js/client.js @@ -887,8 +887,8 @@ break; } } - /* falls through */ + /* fall through */ default: // the messagetype wasn't in our list of recognized global // messagetypes; so the message is presumed to be for the @@ -939,7 +939,7 @@ } var id = toId(name); var isTeambuilderFormat = searchShow && !team; - var teambuilderFormat = undefined; + var teambuilderFormat; if (isTeambuilderFormat) { var parenPos = name.indexOf('('); if (parenPos > 0 && name.charAt(name.length-1) === ')') { @@ -1337,7 +1337,7 @@ if (popup.type === 'normal') { $('body').append(popup.el); } else { - $overlay = $('
    ').appendTo('body').append(popup.el) + $overlay = $('
    ').appendTo('body').append(popup.el); if (popup.type === 'semimodal') { $overlay.on('click', function(e) { if (e.currentTarget === e.target) { @@ -2018,7 +2018,7 @@ buf += '

    Couldn\'t connect to server!

    '; buf += '

    '; } else { - buf += '

    You have been disconnected – possibly because the server was restarted.

    ' + buf += '

    You have been disconnected – possibly because the server was restarted.

    '; buf += '

    '; } @@ -2215,7 +2215,7 @@ var buf = ''; var muted = !!Tools.prefs('mute'); buf += '

    '+(muted?'(muted)':'')+'

    '; - buf += '

    '+(muted?'(muted)':'')+'

    ' + buf += '

    '+(muted?'(muted)':'')+'

    '; buf += '

    '; this.$el.html(buf).css('min-width', 160); }, @@ -2460,7 +2460,7 @@ buf += '
    '; for (var i=1; i<=293; i++) { - var offset = '-'+(((i-1)%16)*80)+'px -'+(Math.floor((i-1)/16)*80)+'px' + var offset = '-'+(((i-1)%16)*80)+'px -'+(Math.floor((i-1)/16)*80)+'px'; buf += ''; } buf += '
    '; diff --git a/js/storage.js b/js/storage.js index 65d68199c..5e86141fd 100644 --- a/js/storage.js +++ b/js/storage.js @@ -118,7 +118,7 @@ _Storage.prototype.packTeam = function(team) { if (set.gender && set.gender !== template.gender) { buf += '|'+set.gender; } else { - buf += '|' + buf += '|'; } // ivs @@ -136,14 +136,14 @@ _Storage.prototype.packTeam = function(team) { if (set.shiny) { buf += '|S'; } else { - buf += '|' + buf += '|'; } // level if (set.level && set.level != 100) { buf += '|'+set.level; } else { - buf += '|' + buf += '|'; } // happiness diff --git a/js/utilichart.js b/js/utilichart.js index 942353ee0..56f078328 100644 --- a/js/utilichart.js +++ b/js/utilichart.js @@ -55,16 +55,12 @@ function BattleChart() { case 'pokemon': return self.pokemonRow(thing, attrs, match, isFirst); - break; case 'item': return self.itemRow(thing, attrs, match, isFirst); - break; case 'ability': return self.abilityRow(thing, attrs, match, isFirst); - break; case 'move': return self.moveRow(thing, attrs, match, isFirst); - break; } }; this.pokemonRow = function(pokemon, attrs, match, isFirst) {