|
@ -24,6 +24,7 @@ |
|
|
|
|
|
|
|
|
<input type="text" id="note_location_msg" value="" class="form-control" placeholder="" readonly="readonly"> |
|
|
<input type="text" id="note_location_msg" value="" class="form-control" placeholder="" readonly="readonly"> |
|
|
<input type="hidden" id="note_location"> |
|
|
<input type="hidden" id="note_location"> |
|
|
|
|
|
<input type="hidden" id="location_enabled" value="<?= $this->location_enabled ?>"> |
|
|
|
|
|
|
|
|
<div id="note_location_img" style="display: none;"> |
|
|
<div id="note_location_img" style="display: none;"> |
|
|
<img src="" height="180" id="note_location_img_wide" class="img-responsive"> |
|
|
<img src="" height="180" id="note_location_img_wide" class="img-responsive"> |
|
@ -112,15 +113,12 @@ $(function(){ |
|
|
var map_template_wide = "<?= static_map('{lat}', '{lng}', 180, 700, 15) ?>"; |
|
|
var map_template_wide = "<?= static_map('{lat}', '{lng}', 180, 700, 15) ?>"; |
|
|
var map_template_small = "<?= static_map('{lat}', '{lng}', 320, 480, 15) ?>"; |
|
|
var map_template_small = "<?= static_map('{lat}', '{lng}', 320, 480, 15) ?>"; |
|
|
|
|
|
|
|
|
$("#note_location_chk").click(function(){ |
|
|
|
|
|
if($(this).attr("checked") == "checked") { |
|
|
|
|
|
if(navigator.geolocation) { |
|
|
|
|
|
|
|
|
function fetch_location() { |
|
|
$("#note_location_loading").show(); |
|
|
$("#note_location_loading").show(); |
|
|
|
|
|
|
|
|
navigator.geolocation.getCurrentPosition(function(position){ |
|
|
navigator.geolocation.getCurrentPosition(function(position){ |
|
|
|
|
|
|
|
|
$("#note_location_loading").hide(); |
|
|
$("#note_location_loading").hide(); |
|
|
console.log(position); |
|
|
|
|
|
var geo = "geo:" + (Math.round(position.coords.latitude * 100000) / 100000) + "," + (Math.round(position.coords.longitude * 100000) / 100000) + ";u=" + position.coords.accuracy; |
|
|
var geo = "geo:" + (Math.round(position.coords.latitude * 100000) / 100000) + "," + (Math.round(position.coords.longitude * 100000) / 100000) + ";u=" + position.coords.accuracy; |
|
|
$("#note_location_msg").val(geo); |
|
|
$("#note_location_msg").val(geo); |
|
|
$("#note_location").val(geo); |
|
|
$("#note_location").val(geo); |
|
@ -138,7 +136,15 @@ $(function(){ |
|
|
location_error("Timed out getting location"); |
|
|
location_error("Timed out getting location"); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$("#note_location_chk").click(function(){ |
|
|
|
|
|
if($(this).attr("checked") == "checked") { |
|
|
|
|
|
if(navigator.geolocation) { |
|
|
|
|
|
$.post("/prefs", { |
|
|
|
|
|
enabled: 1 |
|
|
|
|
|
}); |
|
|
|
|
|
fetch_location(); |
|
|
} else { |
|
|
} else { |
|
|
location_error("Browser location is not supported"); |
|
|
location_error("Browser location is not supported"); |
|
|
} |
|
|
} |
|
@ -147,9 +153,18 @@ $(function(){ |
|
|
$("#note_location_msg").removeClass("img-visible"); |
|
|
$("#note_location_msg").removeClass("img-visible"); |
|
|
$("#note_location_msg").val(''); |
|
|
$("#note_location_msg").val(''); |
|
|
$("#note_location").val(''); |
|
|
$("#note_location").val(''); |
|
|
|
|
|
|
|
|
|
|
|
$.post("/prefs", { |
|
|
|
|
|
enabled: 0 |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if($("#location_enabled").val() == 1) { |
|
|
|
|
|
$("#note_location_chk").attr("checked","checked"); |
|
|
|
|
|
fetch_location(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|
<style type="text/css"> |
|
|
<style type="text/css"> |
|
|