def home(): if request.method == "GET": locations = [] elevations = [] return render_template('./index.html', locations=locations, elevations=elevations) start=request.form['start_loc'] end=request.form['end_loc'] locations = pythontrace.enter_route(start, end, 'driving') elevations = generate_route.json_to_elevation(generate_route.generate_url_for_elevation(start,end,'driving')) return render_template('./index.html', locations=locations,elevations=elevations)
def java_script_file(start,end,mode): java_str = """ var x = -1; function displayNextImage() { x = (x === images.length - 1) ? 0 : x + 1; document.getElementById("img").src = images[x]; } function imgError(image){ image.onerror = ""; image.src = ""; return true; } function displayPreviousImage() { x = (x <= 0) ? images.length - 1 : x - 1; document.getElementById("img").src = images[x]; } function startTimer() { setInterval(displayNextImage, %d); } var images = %s; function imgError(image){ image.onerror = ""; image.src = ""; return true; } """%(IMAGE_INTERVAL,pythontrace.enter_route(start,end,mode)) return java_str