From 92c28d670fcbc1db679b50c5ae3a214dc438d59e Mon Sep 17 00:00:00 2001 From: Eric Fredricksen Date: Mon, 5 Jul 2010 21:37:06 -0700 Subject: [PATCH] Pass lint --- config.js | 9 ++++----- jsl.conf | 2 +- main.js | 3 ++- newguy.js | 2 +- roster.js | 5 +++-- 5 files changed, 11 insertions(+), 10 deletions(-) mode change 100644 => 100755 jsl.conf diff --git a/config.js b/config.js index 0baffa8..7ace681 100644 --- a/config.js +++ b/config.js @@ -35,7 +35,7 @@ function Alea() { var s2 = 0; var c = 1; - if (args.length == 0) { + if (!args.length) { args = [+new Date]; } var mash = Mash(); @@ -80,14 +80,13 @@ function Alea() { s1 = newstate[1]; s2 = newstate[2]; c = newstate[3]; - } else { - return [s0,s1,s2,c]; } + return [s0,s1,s2,c]; }; return random; } (Array.prototype.slice.call(arguments))); -}; +} var seed = new Alea(); @@ -127,7 +126,7 @@ function loadRoster() { try { return JSON.parse(r); } catch (err) { - return {} + return {}; } } } diff --git a/jsl.conf b/jsl.conf old mode 100644 new mode 100755 index 84a91ef..e74bf1c --- a/jsl.conf +++ b/jsl.conf @@ -1,4 +1,4 @@ -# +#!/usr/bin/env jsl -conf # Configuration File for JavaScript Lint 0.3.0 # Developed by Matthias Miller (http://www.JavaScriptLint.com) # diff --git a/main.js b/main.js index f712073..368896e 100644 --- a/main.js +++ b/main.js @@ -1173,10 +1173,11 @@ function HotOrNot() { // Figure out which spell is best var flat = 1; // Flattening constant var best = 0, i; - for (i = 1; i < Spells.length(); ++i) + for (i = 1; i < Spells.length(); ++i) { if ((i+flat) * toArabic(Get(Spells,i)) > (best+flat) * toArabic(Get(Spells,best))) best = i; + } game.Spells.best = Spells.label(best) + ' ' + Get(Spells, best); /// And which stat is best? diff --git a/newguy.js b/newguy.js index 7fb2c3f..395c621 100644 --- a/newguy.js +++ b/newguy.js @@ -142,7 +142,7 @@ function sold() { name: $("#Name").val(), race: $("input:radio[name=Race]:checked").val(), 'class': $("input:radio[name=Class]:checked").val(), - seed: stats.seed, + seed: stats.seed }; $.each('STR,CON,DEX,INT,WIS,CHA'.split(','), function (index,value) { newguy[value] = stats[value]; diff --git a/roster.js b/roster.js index 493f3b7..e8f0c15 100644 --- a/roster.js +++ b/roster.js @@ -6,7 +6,7 @@ $(document).ready(function () { var roster = $("#roster"); roster.empty(); - games = loadRoster() + games = loadRoster(); if (!games) { roster.text("Err...no local storage"); return; @@ -16,7 +16,7 @@ $(document).ready(function () { var br = brag(c); roster.append(br); - br.find("a").attr("href", "main.html#" + name) + br.find("a").attr("href", "main.html#" + name); br.find("button").click(function () { if (confirm("Terminate " + Pick(["faithful","noble","loyal","brave"])+ @@ -60,6 +60,7 @@ $(document).ready(function () { $.each(p1.split("."), function (i,v) { if (!dict) return true; dict = dict[v]; + return null; }); return dict || ''; });