Private
Public Access
1
0

Merge branch 'release/v10.65'

This commit is contained in:
Sander Roosendaal
2019-12-07 07:52:01 +01:00
3 changed files with 462 additions and 63 deletions

View File

@@ -99,6 +99,8 @@
<input type="range" min="0" max="{{ maxtime }}" value="{{ analysis.delay }}"
id="myRange">
</div>
<div id="dataplay"></div>
<!-- <div id="datastop"></div> -->
</li>
<li class="grid_2">
<div id="player"></div>
@@ -117,7 +119,8 @@
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
var playing;
var playing = false;
var dataplaying = false;
var videotime = 0;
var data = JSON.parse('{{ data|safe }}');
{% for id, metric in metrics.items %}
@@ -183,56 +186,65 @@
datatime = slider.value;
if (lock.checked) {
sliderpos = Math.round(videotime) + Math.round(delay);
slider.value = sliderpos;
// Setting Data
// velo = boatspeed[Math.round(datatime)];
lat = latitude[Math.round(datatime)];
lon = longitude[Math.round(datatime)];
// strokerate = spm[Math.round(datatime)];
// catchangle = ctch[Math.round(datatime)];
{% for id, metric in metrics.items %}
{{ id }}_now = {{ id }}_values[Math.round(datatime)];
// console.log(datatime,{{ id }}_now, "{{ metric.name }}")
{% endfor %}
if (!dataplaying) { // set data values
sliderpos = Math.round(videotime) + Math.round(delay);
slider.value = sliderpos;
document.getElementById("time").innerHTML = Math.round(videotime);
document.getElementById("datatime").innerHTML = Math.round(datatime);
// document.getElementById("speed").innerHTML = velo;
// document.getElementById("spm").innerHTML = strokerate;
// document.getElementById("catch").innerHTML = catchangle;
{% for id, metric in metrics.items %}
document.getElementById("{{ id }}").innerHTML = {{ id }}_now;
document.getElementById("{{ id }}").className = 'bold';
{% endfor %}
{% for group in metricsgroups %}
try {
set_{{ group }}();
} catch (e) {}
{% endfor %}
try {
var newLatLng = new L.LatLng(lat, lon);
// console.log(newLatLng);
marker.setLatLng(newLatLng);
} catch (e) {
// Setting Data
// velo = boatspeed[Math.round(datatime)];
lat = latitude[Math.round(datatime)];
lon = longitude[Math.round(datatime)];
// strokerate = spm[Math.round(datatime)];
// catchangle = ctch[Math.round(datatime)];
{% for id, metric in metrics.items %}
{{ id }}_now = {{ id }}_values[Math.round(datatime)];
// console.log(datatime,{{ id }}_now, "{{ metric.name }}")
{% endfor %}
document.getElementById("time").innerHTML = Math.round(videotime);
document.getElementById("datatime").innerHTML = Math.round(datatime);
// document.getElementById("speed").innerHTML = velo;
// document.getElementById("spm").innerHTML = strokerate;
// document.getElementById("catch").innerHTML = catchangle;
{% for id, metric in metrics.items %}
document.getElementById("{{ id }}").innerHTML = {{ id }}_now;
document.getElementById("{{ id }}").className = 'bold';
{% endfor %}
{% for group in metricsgroups %}
try {
set_{{ group }}();
} catch (e) {}
{% endfor %}
try {
var newLatLng = new L.LatLng(lat, lon);
// console.log(newLatLng);
marker.setLatLng(newLatLng);
} catch (e) {
}
}
} else {
output.value = Math.round(datatime)-Math.round(videotime);
if (!dataplaying) {
output.value = Math.round(datatime)-Math.round(videotime);
}
}
}
function stopVideo() {
player.stopVideo();
player.pauseVideo();
playing = false;
}
// call this function when player state changes
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
playing = false;
} else {
playing = true;
}
}
</script>
@@ -304,6 +316,7 @@
$(document).ready( function() {
// lock
var lock = document.getElementById("lock");
// lock.onchange nog doen
var output = document.getElementById("id_delay");
{% if locked %}
lock.checked = true;
@@ -322,15 +335,18 @@
// Update the current slider value (each time you drag the slider handle)
slider.oninput = function() {
try {
output.value = Math.round(slider.value)-Math.round(player.getCurrentTime()); // Display the default slider value
delay = Math.round(slider.value)-Math.round(player.getCurrentTime());
if (!lock.checked) {
try {
delay = Math.round(slider.value)-Math.round(player.getCurrentTime());
output.value = Math.round(slider.value)-Math.round(player.getCurrentTime()); // Display the default slider value
}
catch(err) {
output.value = Math.round(slider.value);
delay = Math.round(slider.value);
}
}
catch(err) {
output.value = Math.round(slider.value);
delay = Math.round(slider.value);
}
clearInterval(timeupdater)
clearInterval(timeupdater);
var datatime = this.value
var videotime = Math.round(player.getCurrentTime());
if (lock.checked) {
@@ -338,13 +354,14 @@
player.seekTo(this.value-output.value);
videotime = this.value-output.value;
} else {
if (playing) {
if (playing && !dataplaying) {
player.seekTo(0);
player.playVideo();
}
else {
else if (!playing && !dataplaying) {
player.seekTo(0);
player.pauseVideo();
playing = false;
}
}
} else {
@@ -412,10 +429,10 @@
else {
player.seekTo(0);
player.pauseVideo();
playing = false;
}
}
} else {
console.log('changing, not checked');
output.value = this.value-Math.round(player.getCurrentTime());
}
var datatime = this.value
@@ -468,7 +485,101 @@
} else {
output.disabled = false;
}
}
// Slider start stop
// moet de buttons pas hieronder definieren en dan in de html
// pluggen
var timer;
function clock() {
timer = setInterval(myClock, 1000);
var c = parseInt(slider.value,10);
console.log('starting clock');
function myClock() {
document.getElementById("datatime").innerHTML = c;
c = c+1;
slider.value = c;
// update data fields
lat = latitude[Math.round(c)];
lon = longitude[Math.round(c)];
{% for id, metric in metrics.items %}
{{ id }}_now = {{ id }}_values[Math.round(c)];
// console.log(datatime,{{ id }}_now, "{{ metric.name }}")
{% endfor %}
{% for id, metric in metrics.items %}
document.getElementById("{{ id }}").innerHTML = {{ id }}_now;
document.getElementById("{{ id }}").className = 'bold';
{% endfor %}
{% for group in metricsgroups %}
try {
set_{{ group }}();
} catch (e) {}
{% endfor %}
try {
var newLatLng = new L.LatLng(lat, lon);
// console.log(newLatLng);
marker.setLatLng(newLatLng);
} catch (e) {
}
if (lock.checked) {
player.seekTo(c+parseInt(output.value));
}
if (c == latitude.length) {
clearInterval(timer);
c = 0;
}
}
}
// onderstaande alleen als lock.checked
var dataplay = document.createElement("input");
dataplay.type = "button";
dataplay.value = "Play";
document.getElementById("dataplay").appendChild(dataplay);
// var datastop = document.createElement("input");
// datastop.type = "button";
// datastop.value = "Stop";
// document.getElementById("datastop").appendChild(datastop)
dataplay.onclick = function() {
if (lock.checked) {
dataplaying = false;
if (playing == false) {
player.playVideo();
dataplay.value = "Pause";
playing = true;
} else {
player.pauseVideo();
dataplay.value = "Play";
playing = false;
}
} else {
if (!dataplaying) {
clock();
dataplay.value = "Pause";
dataplaying = true;
if (lock.checked) {
playing = true;
}
} else {
clearInterval(timer);
dataplay.value = "Play";
dataplaying = false;
}
}
}
// datastop.onclick = function() {
// console.log('stopping');
// clearInterval(timer);
// }
});
</script>
<script type="text/javascript" src="https://bernii.github.io/gauge.js/dist/gauge.js"></script>

288
rowers/tests/testdata/courses.kml vendored Normal file
View File

@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Courses.kml</name>
<Style id="s_ylw-pushpin_hl">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="default">
</Style>
<Style id="s_ylw-pushpin_hl1">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="s_ylw-pushpin0">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="m_ylw-pushpin00">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl1</styleUrl>
</Pair>
</StyleMap>
<StyleMap id="default0">
<Pair>
<key>normal</key>
<styleUrl>#default</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#hl</styleUrl>
</Pair>
</StyleMap>
<Style id="hl">
<IconStyle>
<scale>1.2</scale>
</IconStyle>
</Style>
<StyleMap id="m_ylw-pushpin0">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin0</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
</Pair>
</StyleMap>
<Style id="s_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Folder>
<name>Courses</name>
<open>1</open>
<Folder>
<name>Prygl 6k</name>
<open>1</open>
<Placemark>
<name>Start</name>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
16.493756183,49.24844155419999,0 16.4950276036,49.24946598889999,0 16.4935514581,49.25030382040001,0 16.4924501194,49.24874879119999,0 16.493756183,49.24844155419999,0 16.493756183,49.24844155419999,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Point 1</name>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
16.506708949,49.2439847728,0 16.502701462,49.2422079428,0 16.5053367985,49.2401527868,0 16.5094023592,49.2415898407,0 16.506708949,49.2439847728,0 16.506708949,49.2439847728,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Turn</name>
<styleUrl>#default0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
16.5163547561,49.2300084054,0 16.5130017315,49.2295990778,0 16.5136670476,49.2286154281,0 16.5163274873,49.2289844757,0 16.5163547561,49.2300084054,0 16.5163547561,49.2300084054,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Finish</name>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
16.493756183,49.24844155419999,0 16.4950276036,49.24946598889999,0 16.4935514581,49.25030382040001,0 16.4924501194,49.24874879119999,0 16.493756183,49.24844155419999,0 16.493756183,49.24844155419999,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
<Folder>
<name>Head of Prague</name>
<open>1</open>
<Placemark>
<name>Start</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
14.40795442915535,50.03834045518993,0 14.40882772308304,50.03984594689523,0 14.40678066310206,50.0401625745879,0 14.40566906248426,50.03869597446091,0 14.40795442915535,50.03834045518993,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Veslarsky Ostrov</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
14.41831806167885,50.05959293886939,0 14.41614241009258,50.05961498094956,0 14.41609483686422,50.05813133073231,0 14.41797644481905,50.05800508407179,0 14.41831806167885,50.05959293886939,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Bojka</name>
<styleUrl>#m_ylw-pushpin00</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
14.41054841341896,50.07305590743798,0 14.41375740150687,50.07320621749878,0 14.41377510507448,50.07566133081293,0 14.40951128720742,50.07537273111618,0 14.41054841341896,50.07305590743798,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Finish</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
14.41318302502365,50.05400249489735,0 14.41471506059726,50.05385405063235,0 14.41509370112687,50.05487283052923,0 14.41358101629957,50.05505593846001,0 14.41318302502365,50.05400249489735,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
<Folder>
<name>Kalfje - Hoop</name>
<open>1</open>
<Placemark>
<name>Start</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.894634980284101,52.3241873636367,0 4.895882222031302,52.32412984086649,0 4.895948941317798,52.32437687533162,0 4.894738874909264,52.32446348873298,0 4.894634980284101,52.3241873636367,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Rozenoord</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.897729984257948,52.33262092523194,0 4.89915049100132,52.3319113286945,0 4.899970177239785,52.33280796122619,0 4.8987424624178,52.33344193891938,0 4.897729984257948,52.33262092523194,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Willem</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.905851388469005,52.33544760540416,0 4.907086749586547,52.33518724070484,0 4.907534397847626,52.33579218770413,0 4.906276375816578,52.33609021548775,0 4.905851388469005,52.33544760540416,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>RIC</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.913241097543322,52.34075176199372,0 4.915165311671077,52.34014081049786,0 4.915552301531854,52.34055865906679,0 4.913870849216051,52.34141037275882,0 4.913241097543322,52.34075176199372,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Berlage</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.912187508821495,52.34692417428406,0 4.913632470994549,52.34710492136726,0 4.913415380326047,52.34752349771391,0 4.912003822744286,52.34732938928842,0 4.912187508821495,52.34692417428406,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Finish</name>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
4.908558247025685,52.35433618476513,0 4.90724093544173,52.35393344489751,0 4.907595629957788,52.35358471533717,0 4.908788523651813,52.35393270379102,0 4.908558247025685,52.35433618476513,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
</Folder>
</Document>
</kml>

View File

@@ -64,7 +64,7 @@
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.async=true;
js.async=true;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
@@ -72,7 +72,7 @@
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));</script>
@@ -94,9 +94,9 @@
window.addEventListener('DOMContentLoaded', function() {
$(document).ready(function(){
var accordionsMenu = $('.cd-accordion-menu');
if( accordionsMenu.length > 0 ) {
accordionsMenu.each(function(){
var accordion = $(this);
//detect change in the input[type="checkbox"] value
@@ -121,7 +121,7 @@
</script>
{% analytical_head_bottom %}
</head>
<body data-root="https://webapiv2.navionics.com/dist/webapi/images">
<div class="wrapper">
@@ -184,10 +184,10 @@
<side-nav class="side-nav">
&nbsp;
</side-nav>
<nav class="main-nav">
<ul>
<li id="nav-workouts">
<li id="nav-workouts">
<a href="/rowers/list-workouts/">
<i class="fas fa-clipboard-list"></i>&nbsp;Workouts
</a>
@@ -233,8 +233,8 @@
<li class="grid_4">
<p class="successmessage">
You have {{ user.rower.planexpires|date_dif|ddays }} days left of your one year subscription. Please renew on or before {{ user.rower.planexpires }} or your plan will be reset to Basic. Click <a href="/rowers/paidplans/">here</a> to renew your membership.</p>
</li>
{% endif %}
</li>
{% endif %}
{% endif %}
{% endif %}
{% if user.rower.protrialexpires and user.rower.protrialexpires|is_future_date %}
@@ -292,17 +292,17 @@
</ul>
{% block main %}
{% endblock %}
{% endblock %}
</main>
<aside class="side">
{% block sidebar %}
{% endblock %}
</aside>
<ad class="ad">
{% if request|announcements %}
<h1>News</h1>
<h2>News</h2>
{% for a in request|announcements %}
<div class="site-announcement-box">
<div class="site-announcement-white">
@@ -346,7 +346,7 @@
<p>
<ul>
<li>
<h1>Help</h1>
<h2>Help</h2>
<ul>
<li>
<a href="/rowers/help/">Help</a>
@@ -366,7 +366,7 @@
</ul>
</li>
<li>
<h1>About</h1>
<h2>About</h2>
<ul>
<li>
<a href="/rowers/email/">Contact</a>
@@ -386,7 +386,7 @@
</ul>
</li>
<li>
<h1>Paid Plans</h1>
<h2>Paid Plans</h2>
<ul>
<li>
<a href="/rowers/paidplans/">Paid Plans</a>
@@ -394,7 +394,7 @@
</ul>
</li>
<li>
<h1>Legal</h1>
<h2>Legal</h2>
<ul>
<li>
<a href="/rowers/legal/">Terms and Conditions</a>