Added cookie deletion function etc
rodzic
8b828ec3c3
commit
e512d9c54d
|
@ -141,6 +141,8 @@ var hlTimeout = 5000; // high latency
|
||||||
<div id="location_save_local" class="box ui-corner-all">
|
<div id="location_save_local" class="box ui-corner-all">
|
||||||
<b>Saved Locations</b><br />
|
<b>Saved Locations</b><br />
|
||||||
<span id="locations_table">?</span>
|
<span id="locations_table">?</span>
|
||||||
|
<br />
|
||||||
|
<a id="locations_close">Close this window</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- the about window -->
|
<!-- the about window -->
|
||||||
|
|
|
@ -650,7 +650,13 @@ function setupEventHandlers() {
|
||||||
plotClick();
|
plotClick();
|
||||||
});
|
});
|
||||||
$("#site").change(function() {
|
$("#site").change(function() {
|
||||||
|
if ( $("#site").val() == "Other" ) {
|
||||||
|
appendDebug("User requested locally saved launch sites");
|
||||||
|
constructCookieLocationsTable("cusf_predictor");
|
||||||
|
$("#location_save_local").fadeIn();
|
||||||
|
} else {
|
||||||
plotClick();
|
plotClick();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$("#showHideDebug").click(function() {
|
$("#showHideDebug").click(function() {
|
||||||
toggleWindow("scenario_template", "showHideDebug", "Show Debug", "Hide Debug");
|
toggleWindow("scenario_template", "showHideDebug", "Show Debug", "Hide Debug");
|
||||||
|
@ -688,6 +694,9 @@ function setupEventHandlers() {
|
||||||
$("#req_close").click(function() {
|
$("#req_close").click(function() {
|
||||||
$("#location_save").fadeOut();
|
$("#location_save").fadeOut();
|
||||||
});
|
});
|
||||||
|
$("#locations_close").click(function() {
|
||||||
|
$("#location_save_local").fadeOut();
|
||||||
|
});
|
||||||
$("#req_open").click(function() {
|
$("#req_open").click(function() {
|
||||||
$("#req_lat").val($("#lat").val());
|
$("#req_lat").val($("#lat").val());
|
||||||
$("#req_lon").val($("#lon").val());
|
$("#req_lon").val($("#lon").val());
|
||||||
|
@ -714,8 +723,10 @@ function constructCookieLocationsTable(cookie_name) {
|
||||||
for (i=1; i<=idx; i++) {
|
for (i=1; i<=idx; i++) {
|
||||||
t += "<tr>";
|
t += "<tr>";
|
||||||
t += "<td>"+i+"</td><td>"+$.Jookie.Get(cookie_name, i+"_name")+"</td><td>";
|
t += "<td>"+i+"</td><td>"+$.Jookie.Get(cookie_name, i+"_name")+"</td><td>";
|
||||||
t += "<a id='"+i+"_usethis' onClick='setCookieLatLng("+i+")'>Use</a>";
|
t += "<a id='"+i+"_usethis' onClick='setCookieLatLng(\""+cookie_name+"\", \""+i+"\")'>Use</a>";
|
||||||
t += "</td><td>Delete</td>";
|
t += "</td><td>";
|
||||||
|
t += "<a id='"+i+"_usethis' onClick='deleteCookieLocation(\""+cookie_name+"\", \""+i+"\")'>Delete</a>";
|
||||||
|
t += "</td>";
|
||||||
t += "</tr>";
|
t += "</tr>";
|
||||||
}
|
}
|
||||||
t += "</table>";
|
t += "</table>";
|
||||||
|
@ -723,6 +734,31 @@ function constructCookieLocationsTable(cookie_name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCookieLatLng(cookie_name, idx) {
|
||||||
|
var req_lat = $.Jookie.Get(cookie_name, idx+"_lat");
|
||||||
|
var req_lon= $.Jookie.Get(cookie_name, idx+"_lon");
|
||||||
|
var req_alt = $.Jookie.Get(cookie_name, idx+"_alt");
|
||||||
|
$("#lat").val(req_lat);
|
||||||
|
$("#lon").val(req_lon);
|
||||||
|
$("#initial_alt").val(req_alt);
|
||||||
|
// now hide the window
|
||||||
|
$("#location_save_local").fadeOut();
|
||||||
|
SetSiteOther();
|
||||||
|
plotClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCookieLocation(cookie_name, idx) {
|
||||||
|
// Delete the location in the cookie
|
||||||
|
$.Jookie.Unset(cookie_name, idx+"_lat");
|
||||||
|
$.Jookie.Unset(cookie_name, idx+"_lon");
|
||||||
|
$.Jookie.Unset(cookie_name, idx+"_alt");
|
||||||
|
$.Jookie.Unset(cookie_name, idx+"_name");
|
||||||
|
// Decrease quantity in cookie by one
|
||||||
|
var qty = $.Jookie.Get(cookie_name, "idx");
|
||||||
|
qty--;
|
||||||
|
$.Jookie.Set(cookie_name, "idx", qty);
|
||||||
|
}
|
||||||
|
|
||||||
function POSIXtoHM(timestamp, format) {
|
function POSIXtoHM(timestamp, format) {
|
||||||
// using JS port of PHP's date()
|
// using JS port of PHP's date()
|
||||||
var ts = new Date();
|
var ts = new Date();
|
||||||
|
|
Ładowanie…
Reference in New Issue