@@ -16,21 +19,27 @@ function realSaveProgress(location, percentage) {
data:data
}
);
$("#lastsaved").html("Progress saved.");
}
functionsaveProgress(location,percentage){
// Track the last time we saved
letcurrent_time=newDate();
if (current_time-last_save_time>5000){
if (saveTimeout!==null){
// Clear the timeout if it's set
clearTimeout(saveTimeout);
}
saveTimeout=null;
// Save the progress
realSaveProgress(location,percentage);
last_save_time=current_time;
}else{
// Don't save 'cause we don't want to lag out the server if the user is scrolling
$("#lastsaved").html("Unsaved progress - <a href=\"#\" onclick=\"realSaveProgress('"+location+"', "+percentage+"); return false;\">Click here to save now</a>");
// Set a timeout to autosave in 5 seconds in case we've stopped scrolling