From b6b58b19c396d0e3d06f294cb53f1bf15369ea4e Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 28 Mar 2012 14:14:01 +0100 Subject: Start to consolidate disparate JavaScript files. --- .gitignore | 1 + templates/web/default/common_header_tags.html | 1 + templates/web/default/faq/faq-en-gb.html | 3 +- web/cobrands/bromley/fixmystreet.js | 168 +---------------------- web/cobrands/fixmystreet/fixmystreet.js | 170 +---------------------- web/css/core.scss | 6 +- web/js/common.js | 190 ++++++++++++++++++++++++++ web/js/fixmystreet.js | 156 --------------------- 8 files changed, 201 insertions(+), 494 deletions(-) create mode 100644 web/js/common.js diff --git a/.gitignore b/.gitignore index 055e181dd..974d01d6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.ttc /cities_bin /private_locale +*~ ._* .DS_Store .carton diff --git a/templates/web/default/common_header_tags.html b/templates/web/default/common_header_tags.html index e74ae7b70..251094c61 100644 --- a/templates/web/default/common_header_tags.html +++ b/templates/web/default/common_header_tags.html @@ -7,6 +7,7 @@ + [% map_js %] diff --git a/templates/web/default/faq/faq-en-gb.html b/templates/web/default/faq/faq-en-gb.html index ed9d53c24..cc9ba979a 100755 --- a/templates/web/default/faq/faq-en-gb.html +++ b/templates/web/default/faq/faq-en-gb.html @@ -93,7 +93,8 @@ href="https://secure.mysociety.org/donate/">please do. to find out where reports go at the moment. Also contact us to update the address or addresses we use.
I’m from a council, can we have FixMyStreet on our website?
-
Yes you can! We offer branded, hosted versions of FixMyStreet for local council websites. Full details.
+
Yes you can! We offer branded, hosted versions of FixMyStreet for local council websites. + Full details.
Do you remove silly or illegal content?
FixMyStreet is not responsible for the content and accuracy of material submitted by its users. We reserve the right to edit or remove any diff --git a/web/cobrands/bromley/fixmystreet.js b/web/cobrands/bromley/fixmystreet.js index b00a653c1..bfe985d5f 100644 --- a/web/cobrands/bromley/fixmystreet.js +++ b/web/cobrands/bromley/fixmystreet.js @@ -3,33 +3,6 @@ * FixMyStreet JavaScript */ -function form_category_onchange() { - var cat = $('#form_category'); - var args = { - category: cat.val() - }; - - if ( typeof fixmystreet !== 'undefined' ) { - args.latitude = fixmystreet.latitude; - args.longitude = fixmystreet.longitude; - } else { - args.latitude = $('input[name="latitude"]').val(); - args.longitude = $('input[name="longitude"]').val(); - } - - $.getJSON('/report/new/category_extras', args, function(data) { - if ( data.category_extra ) { - if ( $('#category_meta').size() ) { - $('#category_meta').html( data.category_extra); - } else { - $('#form_category_row').after( data.category_extra ); - } - } else { - $('#category_meta').empty(); - } - }); -} - /* * general height fixing function * @@ -80,11 +53,6 @@ function tabs(elem, indirect) { $(function(){ var $html = $('html'); - $html.removeClass('no-js').addClass('js'); - - // Preload the new report pin - document.createElement('img').src = '/i/pin-green.png'; - var last_type; $(window).resize(function(){ var type = $('#site-header').css('borderTopWidth'); @@ -154,141 +122,7 @@ $(function(){ $('span.report-a-problem-btn').css({ cursor:'' }).off('.reportBtn'); } last_type = type; - }); - - //add mobile class if small screen - $(window).resize(); - - $('#pc').focus(); - - $('input[type=submit]').removeAttr('disabled'); - /* - $('#mapForm').submit(function() { - if (this.submit_problem) { - $('input[type=submit]', this).prop("disabled", true); - } - return true; - }); - */ - - if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) { - $('#another_qn').hide(); - } - $('#been_fixed_no').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_unknown').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_yes').click(function() { - $('#another_qn').hide('fast'); - }); - - // FIXME - needs to use translated string - jQuery.validator.addMethod('validCategory', function(value, element) { - 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 ); - - var form_submitted = 0; - var submitted = false; - - $("form.validate").validate({ - rules: { - title: { required: true }, - detail: { required: true }, - email: { required: true }, - update: { required: true }, - rznvy: { required: true } - }, - messages: validation_strings, - onkeyup: false, - onfocusout: false, - errorElement: 'div', - errorClass: 'form-error', - // we do this to stop things jumping around on blur - success: function (err) { if ( form_submitted ) { err.addClass('label-valid').removeClass('label-valid-hidden').html( ' ' ); } else { err.addClass('label-valid-hidden'); } }, - errorPlacement: function( error, element ) { - element.before( error ); - }, - submitHandler: function(form) { - if (form.submit_problem) { - $('input[type=submit]', form).prop("disabled", true); - } - - form.submit(); - }, - // make sure we can see the error message when we focus on invalid elements - showErrors: function( errorMap, errorList ) { - if ( submitted && errorList.length ) { - $(window).scrollTop( $(errorList[0].element).offset().top - 120 ); - } - this.defaultShowErrors(); - submitted = false; - }, - invalidHandler: function(form, validator) { submitted = true; } - }); - - $('input[type=submit]').click( function(e) { form_submitted = 1; } ); - - /* set correct required status depending on what we submit - * NB: need to add things to form_category as the JS updating - * of this we do after a map click removes them */ - $('#submit_sign_in').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').removeClass(); - } ); - - $('#submit_register').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#problem_submit > input[type="submit"]').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#update_post').click( function(e) { - $('#form_name').addClass('required').removeClass('valid'); - } ); - - $('#form_category').change( form_category_onchange ); - - // Geolocation - if (geo_position_js.init()) { - $('#postcodeForm').after('… or locate me automatically'); - $('#geolocate_link').click(function(e) { - e.preventDefault(); - // Spinny thing! - if($('.mobile').length){ - $(this).append(' '); - }else{ - $(this).append(' '); - } - geo_position_js.getCurrentPosition(function(pos) { - $('img', this).remove(); - var latitude = pos.coords.latitude; - var longitude = pos.coords.longitude; - location.href = '/around?latitude=' + latitude + ';longitude=' + longitude; - }, function(err) { - $('img', this).remove(); - if (err.code == 1) { // User said no - } else if (err.code == 2) { // No position - $(this).html("Could not look up location"); - } else if (err.code == 3) { // Too long - $('this').html("No result returned"); - } else { // Unknown - $('this').html("Unknown error"); - } - }, { - enableHighAccuracy: true, - timeout: 10000 - }); - }); - } + }).resize(); /* * Report a problem page diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 0db8334fb..27b2b345b 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -3,33 +3,6 @@ * FixMyStreet JavaScript */ -function form_category_onchange() { - var cat = $('#form_category'); - var args = { - category: cat.val() - }; - - if ( typeof fixmystreet !== 'undefined' ) { - args.latitude = fixmystreet.latitude; - args.longitude = fixmystreet.longitude; - } else { - args.latitude = $('input[name="latitude"]').val(); - args.longitude = $('input[name="longitude"]').val(); - } - - $.getJSON('/report/new/category_extras', args, function(data) { - if ( data.category_extra ) { - if ( $('#category_meta').size() ) { - $('#category_meta').html( data.category_extra); - } else { - $('#form_category_row').after( data.category_extra ); - } - } else { - $('#category_meta').empty(); - } - }); -} - /* * general height fixing function * @@ -80,12 +53,7 @@ function tabs(elem, indirect) { $(function(){ var $html = $('html'); - $html.removeClass('no-js').addClass('js'); - - - // Preload the new report pin - document.createElement('img').src = '/i/pin-green.png'; - + // Deal with switching between mobile and desktop versions on resize var last_type; $(window).resize(function(){ var type = $('#site-header').css('borderTopWidth'); @@ -154,141 +122,7 @@ $(function(){ $('span.report-a-problem-btn').css({ cursor:'' }).off('.reportBtn'); } last_type = type; - }); - - //add mobile class if small screen - $(window).resize(); - - $('#pc').focus(); - - $('input[type=submit]').removeAttr('disabled'); - /* - $('#mapForm').submit(function() { - if (this.submit_problem) { - $('input[type=submit]', this).prop("disabled", true); - } - return true; - }); - */ - - if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) { - $('#another_qn').hide(); - } - $('#been_fixed_no').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_unknown').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_yes').click(function() { - $('#another_qn').hide('fast'); - }); - - // FIXME - needs to use translated string - jQuery.validator.addMethod('validCategory', function(value, element) { - 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 ); - - var form_submitted = 0; - var submitted = false; - - $("form.validate").validate({ - rules: { - title: { required: true }, - detail: { required: true }, - email: { required: true }, - update: { required: true }, - rznvy: { required: true } - }, - messages: validation_strings, - onkeyup: false, - onfocusout: false, - errorElement: 'div', - errorClass: 'form-error', - // we do this to stop things jumping around on blur - success: function (err) { if ( form_submitted ) { err.addClass('label-valid').removeClass('label-valid-hidden').html( ' ' ); } else { err.addClass('label-valid-hidden'); } }, - errorPlacement: function( error, element ) { - element.before( error ); - }, - submitHandler: function(form) { - if (form.submit_problem) { - $('input[type=submit]', form).prop("disabled", true); - } - - form.submit(); - }, - // make sure we can see the error message when we focus on invalid elements - showErrors: function( errorMap, errorList ) { - if ( submitted && errorList.length ) { - $(window).scrollTop( $(errorList[0].element).offset().top - 120 ); - } - this.defaultShowErrors(); - submitted = false; - }, - invalidHandler: function(form, validator) { submitted = true; } - }); - - $('input[type=submit]').click( function(e) { form_submitted = 1; } ); - - /* set correct required status depending on what we submit - * NB: need to add things to form_category as the JS updating - * of this we do after a map click removes them */ - $('#submit_sign_in').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').removeClass(); - } ); - - $('#submit_register').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#problem_submit > input[type="submit"]').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#update_post').click( function(e) { - $('#form_name').addClass('required').removeClass('valid'); - } ); - - $('#form_category').change( form_category_onchange ); - - // Geolocation - if (geo_position_js.init()) { - $('#postcodeForm').after('… or locate me automatically'); - $('#geolocate_link').click(function(e) { - e.preventDefault(); - // Spinny thing! - if($('.mobile').length){ - $(this).append(' '); - }else{ - $(this).append(' '); - } - geo_position_js.getCurrentPosition(function(pos) { - $('img', this).remove(); - var latitude = pos.coords.latitude; - var longitude = pos.coords.longitude; - location.href = '/around?latitude=' + latitude + ';longitude=' + longitude; - }, function(err) { - $('img', this).remove(); - if (err.code == 1) { // User said no - } else if (err.code == 2) { // No position - $(this).html("Could not look up location"); - } else if (err.code == 3) { // Too long - $('this').html("No result returned"); - } else { // Unknown - $('this').html("Unknown error"); - } - }, { - enableHighAccuracy: true, - timeout: 10000 - }); - }); - } + }).resize(); /* * Report a problem page diff --git a/web/css/core.scss b/web/css/core.scss index a38a188ce..72e483dfa 100644 --- a/web/css/core.scss +++ b/web/css/core.scss @@ -114,7 +114,9 @@ $map_width: 500px; } } - #geolocate_para { + #geolocate_link { + display: block; + border: none; font-size: 70%; margin: 2px 0 0 0; text-align: right; @@ -609,7 +611,7 @@ $map_width: 500px; } } - #geolocate_para { + #geolocate_link { font-size: 100%; } diff --git a/web/js/common.js b/web/js/common.js new file mode 100644 index 000000000..670791fc8 --- /dev/null +++ b/web/js/common.js @@ -0,0 +1,190 @@ +/* + * common.js + * FixMyStreet JavaScript used by all cobrands. + * With the JavaScript written more proper like. + */ + +(function($){ + +/* + Deal with changes to category by asking for details from the server. + */ +$(function(){ + + var $html = $('html'); + + // Add a class to the whole page saying JavaScript is enabled (for CSS and so on) + $html.removeClass('no-js').addClass('js'); + + // Preload the new report pin + document.createElement('img').src = '/i/pin-green.png'; + + // Focus on postcode box on front page + $('#pc').focus(); + + // In case we've come here by clicking back to a form that disabled a submit button + $('input[type=submit]').removeAttr('disabled'); + + // Questionnaire hide/showings + if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) { + $('#another_qn').hide(); + } + $('#been_fixed_no').click(function() { + $('#another_qn').show('fast'); + }); + $('#been_fixed_unknown').click(function() { + $('#another_qn').show('fast'); + }); + $('#been_fixed_yes').click(function() { + $('#another_qn').hide('fast'); + }); + + // Form validation + + // FIXME - needs to use translated string + jQuery.validator.addMethod('validCategory', function(value, element) { + 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 ); + + var form_submitted = 0; + var submitted = false; + + $("form.validate").validate({ + rules: { + title: { required: true }, + detail: { required: true }, + email: { required: true }, + update: { required: true }, + rznvy: { required: true } + }, + messages: validation_strings, + onkeyup: false, + onfocusout: false, + errorElement: 'div', + errorClass: 'form-error', + // we do this to stop things jumping around on blur + success: function (err) { if ( form_submitted ) { err.addClass('label-valid').removeClass('label-valid-hidden').html( ' ' ); } else { err.addClass('label-valid-hidden'); } }, + errorPlacement: function( error, element ) { + // Different for old/new style design + if ($('.form-field').length) { + element.parent('div.form-field').before( error ); + } else { + element.before( error ); + } + }, + submitHandler: function(form) { + if (form.submit_problem) { + $('input[type=submit]', form).prop("disabled", true); + } + + form.submit(); + }, + // make sure we can see the error message when we focus on invalid elements + showErrors: function( errorMap, errorList ) { + if ( submitted && errorList.length ) { + $(window).scrollTop( $(errorList[0].element).offset().top - 120 ); + } + this.defaultShowErrors(); + submitted = false; + }, + invalidHandler: function(form, validator) { submitted = true; } + }); + + $('input[type=submit]').click( function(e) { form_submitted = 1; } ); + + /* set correct required status depending on what we submit + * NB: need to add things to form_category as the JS updating + * of this we do after a map click removes them */ + $('#submit_sign_in').click( function(e) { + $('#form_category').addClass('required validCategory').removeClass('valid'); + $('#form_name').removeClass(); + } ); + + $('#submit_register').click( function(e) { + $('#form_category').addClass('required validCategory').removeClass('valid'); + $('#form_name').addClass('required validName'); + } ); + + $('#problem_submit > input[type="submit"]').click( function(e) { + $('#form_category').addClass('required validCategory').removeClass('valid'); + $('#form_name').addClass('required validName'); + } ); + + $('#update_post').click( function(e) { + $('#form_name').addClass('required').removeClass('valid'); + } ); + + // Geolocation + if (geo_position_js.init()) { + if ($('body.frontpage').length) { + $('#postcodeForm').after('… or locate me automatically'); + } else{ + $('#postcodeForm').append('… or locate me automatically'); + } + $('#geolocate_link').click(function(e) { + var $link = $(this); + e.preventDefault(); + // Spinny thing! + if($('.mobile').length){ + $link.append(' '); + }else{ + $link.append(' '); + } + geo_position_js.getCurrentPosition(function(pos) { + $link.find('img').remove(); + var latitude = pos.coords.latitude; + var longitude = pos.coords.longitude; + location.href = '/around?latitude=' + latitude + ';longitude=' + longitude; + }, function(err) { + $link.find('img').remove(); + if (err.code == 1) { // User said no + $link.html("You declined; please fill in the box above"); + } else if (err.code == 2) { // No position + $link.html("Could not look up location"); + } else if (err.code == 3) { // Too long + $link.html("No result returned"); + } else { // Unknown + $link.html("Unknown error"); + } + }, { + enableHighAccuracy: true, + timeout: 10000 + }); + }); + } + + // Delegation is necessary because #form_category may be replaced during the lifetime of the page + $("#problem_form").on("change.category", "select#form_category", function(){ + var args = { + category: $(this).val() + }; + + if ( typeof fixmystreet !== 'undefined' ) { + args.latitude = fixmystreet.latitude; + args.longitude = fixmystreet.longitude; + } else { + args.latitude = $('input[name="latitude"]').val(); + args.longitude = $('input[name="longitude"]').val(); + } + + $.getJSON('/report/new/category_extras', args, function(data) { + var $category_meta = $('#category_meta'); + if ( data.category_extra ) { + if ( $category_meta.length ) { + $category_meta.html( data.category_extra ); + } else { + $('#form_category_row').after( data.category_extra ); + } + } else { + $category_meta.empty(); + } + }); + }); + +}); + +})(jQuery); + diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 834aa4ed3..cf2bb0822 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -3,137 +3,13 @@ * FixMyStreet JavaScript */ -function form_category_onchange() { - var cat = $('#form_category'); - var args = { - category: cat.val() - }; - - if ( typeof fixmystreet !== 'undefined' ) { - args.latitude = fixmystreet.latitude; - args.longitude = fixmystreet.longitude; - } else { - args.latitude = $('input[name="latitude"]').val(); - args.longitude = $('input[name="longitude"]').val(); - } - - $.getJSON('/report/new/category_extras', args, function(data) { - if ( data.category_extra ) { - if ( $('#category_meta').size() ) { - $('#category_meta').html( data.category_extra); - } else { - $('#form_category_row').after( data.category_extra ); - } - } else { - $('#category_meta').empty(); - } - }); -} - $(function(){ - $('html').removeClass('no-js').addClass('js'); - - $('#pc').focus(); - - $('input[type=submit]').removeAttr('disabled'); - /* - $('#mapForm').submit(function() { - if (this.submit_problem) { - $('input[type=submit]', this).prop("disabled", true); - } - return true; - }); - */ - - if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) { - $('#another_qn').hide(); - } - $('#been_fixed_no').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_unknown').click(function() { - $('#another_qn').show('fast'); - }); - $('#been_fixed_yes').click(function() { - $('#another_qn').hide('fast'); - }); - var timer; function email_alert_close() { $('#email_alert_box').hide('fast'); } - // FIXME - needs to use translated string - jQuery.validator.addMethod('validCategory', function(value, element) { - 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 ); - - var form_submitted = 0; - var submitted = false; - - $("form.validate").validate({ - rules: { - title: { required: true }, - detail: { required: true }, - email: { required: true }, - update: { required: true }, - rznvy: { required: true } - }, - messages: validation_strings, - onkeyup: false, - errorElement: 'div', - errorClass: 'form-error', - // we do this to stop things jumping around on blur - success: function (err) { if ( form_submitted ) { err.addClass('label-valid').removeClass('label-valid-hidden').html( ' ' ); } else { err.addClass('label-valid-hidden'); } }, - errorPlacement: function( error, element ) { - element.parent('div').before( error ); - }, - submitHandler: function(form) { - if (form.submit_problem) { - $('input[type=submit]', form).prop("disabled", true); - } - - form.submit(); - }, - // make sure we can see the error message when we focus on invalid elements - showErrors: function( errorMap, errorList ) { - if ( submitted && errorList.length ) { - $(window).scrollTop( $(errorList[0].element).offset().top - 40 ); - } - this.defaultShowErrors(); - submitted = false; - }, - invalidHandler: function(form, validator) { submitted = true; } - }); - - $('input[type=submit]').click( function(e) { form_submitted = 1; } ); - - /* set correct required status depending on what we submit - * NB: need to add things to form_category as the JS updating - * of this we do after a map click removes them */ - $('#submit_sign_in').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').removeClass(); - } ); - - $('#submit_register').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#problem_submit > input[type="submit"]').click( function(e) { - $('#form_category').addClass('required validCategory').removeClass('valid'); - $('#form_name').addClass('required validName'); - } ); - - $('#update_post').click( function(e) { - $('#form_name').addClass('required').removeClass('valid'); - } ); - $('#email_alert').click(function(e) { if (!$('#email_alert_box').length) { return true; @@ -159,36 +35,4 @@ $(function(){ timer = window.setTimeout(email_alert_close, 2000); }); - // Using delegate here because we *might* be running under a cobrand which isn't jQuery 1.7+ - // Delegation is necessary because #form_category may be replaced during the lifetime of the page - $("#problem_form").delegate("select#form_category", "change", form_category_onchange ); - - // Geolocation - if (geo_position_js.init()) { - $('#postcodeForm').append('

Or locate me automatically').css({ "padding-bottom": "0.5em" }); - $('#geolocate_link').click(function(e) { - e.preventDefault(); - // Spinny thing! - $('#geolocate_para').append(' '); - geo_position_js.getCurrentPosition(function(pos) { - $('#geolocate_para img').remove(); - var latitude = pos.coords.latitude; - var longitude = pos.coords.longitude; - location.href = '/around?latitude=' + latitude + ';longitude=' + longitude; - }, function(err) { - $('#geolocate_para img').remove(); - if (err.code == 1) { // User said no - } else if (err.code == 2) { // No position - $('#geolocate_para').html("Could not look up location"); - } else if (err.code == 3) { // Too long - $('#geolocate_para').html("No result returned"); - } else { // Unknown - $('#geolocate_para').html("Unknown error"); - } - }, { - timeout: 10000 - }); - }); - } - }); -- cgit v1.2.3