Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latitude bug #19

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ function initVideo(info) {

let video_location = metadata.location ?? {};
let latitude = video_location.latitude ?? undefined;
let latitude_input_value = convertCoordinatesForInput(latitude);
let longitude = video_location.longitude ?? undefined;
let longitude_input_value = convertCoordinatesForInput(longitude);

window.shark.info['video'] = {
id: info.video_id,
name: name,
start_time: start_time,
latitude: latitude,
longitude: longitude,
latitude: latitude_input_value,
longitude: longitude_input_value,
};

window.shark.info['key_metadata'] = info.key_metadata;
Expand Down Expand Up @@ -175,14 +177,14 @@ function initVideo(info) {
<input type='number' name='latitude' step='0.01'
data-video-id='${info.video_id}'
onchange='editVideo(this, "latitude")'
value='${latitude}' />
value='${latitude_input_value}' />
</div>
<div>
<label for='longitude'>Longitude:</label>
<input type='number' name='longitude' step='0.01'
data-video-id='${info.video_id}'
onchange='editVideo(this, "longitude")'
value='${longitude}' />
value='${longitude_input_value}' />
</div>
</div>
`;
Expand Down Expand Up @@ -419,6 +421,15 @@ function convertUnixSecsForInput(unixSeconds) {
return offsetDate.toISOString().slice(0, 19);
}

function convertCoordinatesForInput(coordinates) {
if (!coordinates) {
return undefined;
}

// Remove leading "+" from coordinates.
return coordinates.replace('+', '');
}

// Fetch the server's version and add it to the page's title.
function fetchVersion() {
let promise = fetch('/version', {
Expand Down