diff options
author | Struan Donald <struan@exo.org.uk> | 2012-01-11 10:29:41 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-01-11 10:29:41 +0000 |
commit | d7e33494ffc038eba364c9ab64181b7895c07069 (patch) | |
tree | 358e31ec0a0436ac0604ff9b26517fa1ce61c997 /web/js/fixmystreet.js | |
parent | 6228cc7aa55defdb694d2de05d2a2be282955fe6 (diff) |
make changes as suggested by jslint
Diffstat (limited to 'web/js/fixmystreet.js')
-rw-r--r-- | web/js/fixmystreet.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 524bcdafa..23c43567e 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -10,11 +10,11 @@ function form_category_onchange() { }; if ( typeof fixmystreet !== 'undefined' ) { - args['latitude'] = fixmystreet.latitude; - args['longitude'] = fixmystreet.longitude; + args.latitude = fixmystreet.latitude; + args.longitude = fixmystreet.longitude; } else { - args['latitude'] = $('input[name="latitude"]').val(); - args['longitude'] = $('input[name="longitude"]').val(); + args.latitude = $('input[name="latitude"]').val(); + args.longitude = $('input[name="longitude"]').val(); } $.getJSON('/report/new/category_extras', args, function(data) { @@ -66,11 +66,11 @@ $(function(){ // FIXME - needs to use translated string jQuery.validator.addMethod('validCategory', function(value, element) { - return this.optional(element) || value != '-- Pick a category --'; }, validation_strings['category'] ); + return this.optional(element) || value != '-- Pick a category --'; }, validation_strings.category ); jQuery.validator.addMethod('validName', function(value, element) { var validNamePat = /\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i; - return this.optional(element) || value.length > 5 && value.match( /\S/ ) && !value.match( validNamePat ) }, validation_strings['category'] ); + return this.optional(element) || value.length > 5 && value.match( /\S/ ) && !value.match( validNamePat ); }, validation_strings.category ); var form_submitted = 0; @@ -108,7 +108,9 @@ $(function(){ }, // make sure we can see the error message when we focus on invalid elements showErrors: function( errorMap, errorList ) { - submitted && errorList.length && $(window).scrollTop( $(errorList[0].element).offset().top - 40 ); + if ( submitted && errorList.length ) { + $(window).scrollTop( $(errorList[0].element).offset().top - 40 ); + } this.defaultShowErrors(); submitted = false; }, @@ -140,8 +142,9 @@ $(function(){ } ); $('#email_alert').click(function(e) { - if (!$('#email_alert_box').length) + if (!$('#email_alert_box').length) { return true; + } e.preventDefault(); if ($('#email_alert_box').is(':visible')) { email_alert_close(); |