G(f/y)&&a("overflow"),n*=y;t=b.length+1,N=c(g-o,t,0==o),G(g/t)>f-h&&a("overflow"),h+=G(g/t),g%=t,b.splice(g++,0,h)}return u(b)}function d(e){var t,r,i,s,o,u,p,l,d,y,b,S,g,h,N,I=[];for(e=n(e),S=e.length,t=D,r=0,o=v,u=0;u=t&&bG((f-r)/g)&&a("overflow"),r+=(p-t)*g,t=p,u=0;uf&&a("overflow"),b==t){for(l=r,d=T;y=d<=o?C:d>=o+k?k:d-o,!(l= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=T-C,G=Math.floor,w=String.fromCharCode;if(N={version:"1.3.2",ucs2:{decode:n,encode:u},decode:l,encode:d,toASCII:b,toUnicode:y},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return N});else if(S&&g)if(t.exports==S)g.exports=N;else for(I in N)N.hasOwnProperty(I)&&(S[I]=N[I]);else i.punycode=N}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],434:[function(e,t,r){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,s){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var n=/\+/g;e=e.split(t);var u=1e3;s&&"number"==typeof s.maxKeys&&(u=s.maxKeys);var p=e.length;u>0&&p>u&&(p=u);for(var m=0;m=0?(c=b.substr(0,S),l=b.substr(S+1)):(c=b,l=""),d=decodeURIComponent(c),y=decodeURIComponent(l),i(o,d)?a(o[d])?o[d].push(y):o[d]=[o[d],y]:o[d]=y}return o};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],435:[function(e,t,r){"use strict";function i(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i0&&u>n&&(u=n);for(var p=0;p=0?(m=y.substr(0,b),c=y.substr(b+1)):(m=y,c=""),l=decodeURIComponent(m),d=decodeURIComponent(c),i(s,l)?Array.isArray(s[l])?s[l].push(d):s[l]=[s[l],d]:s[l]=d}return s}},{}],438:[function(e,t,r){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(a){var s=encodeURIComponent(i(a))+r;return Array.isArray(e[a])?e[a].map(function(e){return s+encodeURIComponent(i(e))}).join(t):s+encodeURIComponent(i(e[a]))}).join(t):a?encodeURIComponent(i(a))+r+encodeURIComponent(i(e)):""}},{}],439:[function(e,t,r){arguments[4][436][0].apply(r,arguments)},{"./decode":437,"./encode":438,dup:436}],440:[function(e,t,r){(function(t,i){(function(){function a(e,t){this._id=e,this._clearFn=t}var s=e("process/browser.js").nextTick,o=Function.prototype.apply,n=Array.prototype.slice,u={},p=0;r.setTimeout=function(){return new a(o.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new a(o.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(e){e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},r.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},r._unrefActive=r.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r.setImmediate="function"==typeof t?t:function(e){var t=p++,i=!(arguments.length<2)&&n.call(arguments,1);return u[t]=!0,s(function(){u[t]&&(i?e.apply(null,i):e.call(null),r.clearImmediate(t))}),t},r.clearImmediate="function"==typeof i?i:function(e){delete u[e]}}).call(this)}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":432,timers:440}],441:[function(e,t,r){function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function a(e,t,r){if(e&&p(e)&&e instanceof i)return e;var a=new i;return a.parse(e,t,r),a}function s(e){return u(e)&&(e=a(e)),e instanceof i?e.format():i.prototype.format.call(e)}function o(e,t){return a(e,!1,!0).resolve(t)}function n(e,t){return e?a(e,!1,!0).resolveObject(t):t}function u(e){return"string"==typeof e}function p(e){return"object"==typeof e&&null!==e}function m(e){return null===e}function c(e){return null==e}var l=e("punycode");r.parse=a,r.resolve=o,r.resolveObject=n,r.format=s,r.Url=i;var d=/^([a-z0-9.+-]+:)/i,y=/:[0-9]*$/,b=["<",">",'"',"`"," ","\r","\n","\t"],S=["{","}","|","\\","^","`"].concat(b),g=["'"].concat(S),h=["%","/","?",";","#"].concat(g),N=["/","?","#"],I=/^[a-z0-9A-Z_-]{0,63}$/,f=/^([a-z0-9A-Z_-]{0,63})(.*)$/,T={javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},k={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},R=e("querystring");i.prototype.parse=function(e,t,r){if(!u(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e;i=i.trim();var a=d.exec(i);if(a){a=a[0];var s=a.toLowerCase();this.protocol=s,i=i.substr(a.length)}if(r||a||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var o="//"===i.substr(0,2);!o||a&&C[a]||(i=i.substr(2),this.slashes=!0)}if(!C[a]&&(o||a&&!k[a])){for(var n=-1,p=0;p127?D+="x":D+=v[P];if(!D.match(I)){var q=S.slice(0,p),E=S.slice(p+1),M=v.match(f);M&&(q.push(M[1]),E.unshift(M[2])),E.length&&(i="/"+E.join(".")+i),this.hostname=q.join(".");break}}}if(this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),!b){for(var L=this.hostname.split("."),G=[],p=0;p0)&&r.host.split("@");S&&(r.auth=S.shift(),r.host=r.hostname=S.shift())}return r.search=e.search,r.query=e.query,m(r.pathname)&&m(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!y.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var g=y.slice(-1)[0],h=(r.host||e.host)&&("."===g||".."===g)||""===g,N=0,I=y.length;I>=0;I--)g=y[I],"."==g?y.splice(I,1):".."===g?(y.splice(I,1),N++):N&&(y.splice(I,1),N--);if(!l&&!d)for(;N--;N)y.unshift("..");!l||""===y[0]||y[0]&&"/"===y[0].charAt(0)||y.unshift(""),h&&"/"!==y.join("/").substr(-1)&&y.push("");var f=""===y[0]||y[0]&&"/"===y[0].charAt(0);if(b){r.hostname=r.host=f?"":y.length?y.shift():"";var S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");S&&(r.auth=S.shift(),r.host=r.hostname=S.shift())}return l=l||r.host&&y.length,l&&!f&&y.unshift(""),y.length?r.pathname=y.join("/"):(r.pathname=null,r.path=null),m(r.pathname)&&m(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=y.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{punycode:433,querystring:436}],442:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],443:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],444:[function(e,t,r){(function(t,i){(function(){function a(e,t){var i={seen:[],stylize:o};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),b(t)?i.showHidden=t:t&&r._extend(i,t),f(i.showHidden)&&(i.showHidden=!1),f(i.depth)&&(i.depth=2),f(i.colors)&&(i.colors=!1),f(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=s),u(i,e,i.depth)}function s(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function o(e,t){return e}function n(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,i){if(e.customInspect&&t&&A(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var a=t.inspect(i,e);return N(a)||(a=u(e,a,i)),a}var s=p(e,t);if(s)return s;var o=Object.keys(t),b=n(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),R(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return m(t);if(0===o.length){if(A(t)){var S=t.name?": "+t.name:"";return e.stylize("[Function"+S+"]","special")}if(T(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(k(t))return e.stylize(Date.prototype.toString.call(t),"date");if(R(t))return m(t)}var g="",h=!1,I=["{","}"];if(y(t)&&(h=!0,I=["[","]"]),A(t)){g=" [Function"+(t.name?": "+t.name:"")+"]"}if(T(t)&&(g=" "+RegExp.prototype.toString.call(t)),k(t)&&(g=" "+Date.prototype.toUTCString.call(t)),R(t)&&(g=" "+m(t)),0===o.length&&(!h||0==t.length))return I[0]+g+I[1];if(i<0)return T(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var f;return f=h?c(e,t,i,b,o):o.map(function(r){return l(e,t,i,b,r,h)}),e.seen.pop(),d(f,g,I)}function p(e,t){if(f(t))return e.stylize("undefined","undefined");if(N(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return h(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):S(t)?e.stylize("null","null"):void 0}function m(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,i,a){for(var s=[],o=0,n=t.length;o-1&&(n=s?n.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+n.split("\n").map(function(e){return" "+e}).join("\n"))):n=e.stylize("[Circular]","special")),f(o)){if(s&&a.match(/^\d+$/))return n;o=JSON.stringify(""+a),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+n}function d(e,t,r){var i=0;return e.reduce(function(e,t){return i++,t.indexOf("\n")>=0&&i++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function y(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function S(e){return null===e}function g(e){return null==e}function h(e){return"number"==typeof e}function N(e){return"string"==typeof e}function I(e){return"symbol"==typeof e}function f(e){return void 0===e}function T(e){return C(e)&&"[object RegExp]"===D(e)}function C(e){return"object"==typeof e&&null!==e}function k(e){return C(e)&&"[object Date]"===D(e)}function R(e){return C(e)&&("[object Error]"===D(e)||e instanceof Error)}function A(e){return"function"==typeof e}function v(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function D(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}function x(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),G[e.getMonth()],t].join(" ")}function q(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=/%[sdj%]/g;r.format=function(e){if(!N(e)){for(var t=[],r=0;r=s)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}}),n=i[r];r>>((3&t)<<3)&255;return s}}},{}],448:[function(e,t,r){function i(e,t,r){var i=t&&r||0,m=t||[];e=e||{};var c=e.node||a,l=void 0!==e.clockseq?e.clockseq:s;if(null==c||null==l){var d=o();null==c&&(c=a=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=s=16383&(d[6]<<8|d[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),b=void 0!==e.nsecs?e.nsecs:p+1,S=y-u+(b-p)/1e4;if(S<0&&void 0===e.clockseq&&(l=l+1&16383),(S<0||y>u)&&void 0===e.nsecs&&(b=0),b>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");u=y,p=b,s=l,y+=122192928e5;var g=(1e4*(268435455&y)+b)%4294967296;m[i++]=g>>>24&255,m[i++]=g>>>16&255,m[i++]=g>>>8&255,m[i++]=255&g;var h=y/4294967296*1e4&268435455;m[i++]=h>>>8&255,m[i++]=255&h,m[i++]=h>>>24&15|16,m[i++]=h>>>16&255,m[i++]=l>>>8|128,m[i++]=255&l;for(var N=0;N<6;++N)m[i+N]=c[N];return t||n(m)}var a,s,o=e("./lib/rng"),n=e("./lib/bytesToUuid"),u=0,p=0;t.exports=i},{"./lib/bytesToUuid":446,"./lib/rng":447}],449:[function(e,t,r){function i(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var o=e.random||(e.rng||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var n=0;n<16;++n)t[i+n]=o[n];return t||s(o)}var a=e("./lib/rng"),s=e("./lib/bytesToUuid");t.exports=i},{"./lib/bytesToUuid":446,"./lib/rng":447}],450:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils/LRU"),a=1e3,s=function(){function e(e){void 0===e&&(e=a),this.maxSize=e,this.cache=new i.LRUCache(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var i="string"!=typeof t?e.getKeyString(t):t,a=this.populateValue(r);this.cache.put(i,a)},e.prototype.get=function(t){var r="string"!=typeof t?e.getKeyString(t):t,i=Date.now(),a=this.cache.get(r);if(a){for(var s=a.length-1;s>=0;s--){a[s].Expire
Date: Mon, 20 Dec 2021 19:58:22 +1100
Subject: [PATCH 5/8] show recovery info for historical
---
js/tracker.js | 100 +++++++++++++++++++++++++++++++++++++-------------
1 file changed, 74 insertions(+), 26 deletions(-)
diff --git a/js/tracker.js b/js/tracker.js
index cb82dbc..705cfa4 100644
--- a/js/tracker.js
+++ b/js/tracker.js
@@ -845,6 +845,15 @@ function drawHistorical (data, station) {
var normalisedTime = ((actualTime-minTime)/(maxTime-minTime));
var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo'));
+ // Check if we have recovery data for it
+ var recovered = false;
+ if (historicalPlots[station].data.hasOwnProperty("recovered")) {
+ if (historicalPlots[station].data.recovered.hasOwnProperty(serial)) {
+ var recovery_info = historicalPlots[station].data.recovered[serial];
+ recovered = true;
+ }
+ }
+
var popup = L.popup();
html = "";
@@ -864,7 +873,16 @@ function drawHistorical (data, station) {
};
html += "
";
- html += "
"
+
+ if (recovered) {
+ html += "
Recovered: "+recovery_info.recovered+"
";
+ html += "
Recovered by: "+recovery_info.recovered_by+"
";
+ html += "
Recovery time: "+recovery_info.datetime+"
";
+ html += "
Recovery location: "+recovery_info.position[1]+","+recovery_info.position[0] + "
";
+ html += "
Recovery notes: "+recovery_info.description+"
";
+
+ html += "
";
+ }
html += "
";
html += "
";
@@ -878,7 +896,11 @@ function drawHistorical (data, station) {
popup.setContent(html);
- var marker = L.circleMarker([landing.lat, landing.lon], {color: iconColour, radius: 5, fillOpacity:0.9});
+ if (!recovered) {
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "white", color: iconColour, weight: 2, radius: 5, fillOpacity:1});
+ } else {
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "grey", color: iconColour, weight: 2, radius: 5, fillOpacity:1});
+ }
marker.bindPopup(popup);
@@ -949,36 +971,62 @@ function showHistorical (station, marker) {
historicalPlots[station].data.maxTime = dateNow.getTime();
}
- for (let i = 0; i < sondes.length; i++) {
- downloadHistorical(sondes[i]).done(handleData).fail(handleError);;
- }
+ // Get station location to fetch recoveries
+ if (!historicalPlots[station].data.hasOwnProperty("recovered")) {
+ historicalPlots[station].data.recovered = {};
- var completed = 0;
+ var station_position = sites[station].position;
+ var data_str = "lat=" + station_position[0] + "&lon=" + station_position[1] + "&distance=400000&last=0";
- function handleData(data) {
- completed += 1;
- drawHistorical(data, station);
- if (completed == sondes.length) {
- submit.show();
- submitLoading.hide();
- deleteHistorical.show();
- // If modal is closed the contents needs to be forced updated
- if (!realpopup.isOpen()) {
- realpopup.setContent("");
+ $.ajax({
+ type: "GET",
+ url: recovered_sondes_url,
+ data: data_str,
+ dataType: "json",
+ success: function(json) {
+ for (var i = 0; i < json.length; i++) {
+ historicalPlots[station].data.recovered[json[i].serial] = json[i];
+ }
+ processHistorical()
+ },
+ error: function() {
+ processHistorical();
}
- }
+ });
}
- function handleError(error) {
- completed += 1;
- if (completed == sondes.length) {
- submit.show();
- submitLoading.hide();
- deleteHistorical.show();
+ function processHistorical() {
+ for (let i = 0; i < sondes.length; i++) {
+ downloadHistorical(sondes[i]).done(handleData).fail(handleError);;
}
- // If modal is closed the contents needs to be forced updated
- if (!realpopup.isOpen()) {
- realpopup.setContent("");
+
+ var completed = 0;
+
+ function handleData(data) {
+ completed += 1;
+ drawHistorical(data, station);
+ if (completed == sondes.length) {
+ submit.show();
+ submitLoading.hide();
+ deleteHistorical.show();
+ // If modal is closed the contents needs to be forced updated
+ if (!realpopup.isOpen()) {
+ realpopup.setContent("");
+ }
+ }
+ }
+
+ function handleError(error) {
+ completed += 1;
+ if (completed == sondes.length) {
+ submit.show();
+ submitLoading.hide();
+ deleteHistorical.show();
+ }
+ // If modal is closed the contents needs to be forced updated
+ if (!realpopup.isOpen()) {
+ realpopup.setContent("");
+ }
}
}
}
From 77414754d299164605f9c12de76f981f7174b364 Mon Sep 17 00:00:00 2001
From: Uskompuf <22492406+Uskompuf@users.noreply.github.com>
Date: Mon, 20 Dec 2021 21:11:57 +1100
Subject: [PATCH 6/8] various fixes
---
js/tracker.js | 67 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 57 insertions(+), 10 deletions(-)
diff --git a/js/tracker.js b/js/tracker.js
index 705cfa4..283f234 100644
--- a/js/tracker.js
+++ b/js/tracker.js
@@ -875,23 +875,22 @@ function drawHistorical (data, station) {
html += "
";
if (recovered) {
- html += "
Recovered: "+recovery_info.recovered+"
";
- html += "
Recovered by: "+recovery_info.recovered_by+"
";
- html += "
Recovery time: "+recovery_info.datetime+"
";
- html += "
Recovery location: "+recovery_info.position[1]+","+recovery_info.position[0] + "
";
+ html += "
"+(recovery_info.recovered ? "Recovered by " : "Not Recovered by ")+recovery_info.recovered_by+"
";
+ html += "
Recovery time: "+formatDate(stringToDateUTC(recovery_info.datetime))+"
";
+ html += "
Recovery location: "+recovery_info.position[1]+", "+recovery_info.position[0] + "
";
html += "
Recovery notes: "+recovery_info.description+"
";
html += "
";
}
- html += "
";
- html += "
";
+ html += "
";
+ html += "
";
html += "
";
html += "
"
if (landing.hasOwnProperty("uploader_callsign")) {
- html += "
" + landing.uploader_callsign + "
";
+ html += "
Last received by: " + landing.uploader_callsign.toLowerCase() + "
";
};
popup.setContent(html);
@@ -1053,6 +1052,15 @@ function historicalLaunchViewer(station, marker) {
return;
}
+ // Find latest year
+ var latestYear = "0";
+ var latestYears = Object.keys(data);
+ for (var i=0; i < latestYears.length; i++) {
+ if (parseInt(latestYears[i]) > parseInt(latestYear)) {
+ latestYear = latestYears[i];
+ }
+ }
+
// Generate year drop down
var yearList = document.createElement("select");
yearList.name = "year"
@@ -1066,10 +1074,43 @@ function historicalLaunchViewer(station, marker) {
var option = document.createElement("option");
option.value = year;
option.text = year;
+ if (year == latestYear) {
+ option.setAttribute("selected", "selected");
+ }
yearList.appendChild(option);
}
}
+ // Find latest month
+ var latestMonth = "0";
+ var latestMonths = Object.keys(data[latestYear]);
+ for (var i=0; i < latestMonths.length; i++) {
+ if (parseInt(latestMonths[i]) > parseInt(latestMonth)) {
+ latestMonth = latestMonths[i];
+ }
+ }
+
+ // Generate month drop down
+ var monthList = document.createElement("select");
+ monthList.name = "month"
+ monthList.id = "monthList";
+ var option = document.createElement("option");
+ option.value = "all";
+ option.text = "All";
+ monthList.appendChild(option);
+ var months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
+ var monthsText = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
+ for (var i=0; i < months.length; i++) {
+ var option = document.createElement("option");
+ option.value = months[i];
+ option.text = monthsText[i];
+ if (months[i] == latestMonth) {
+ option.setAttribute("selected", "selected");
+ }
+ monthList.appendChild(option);
+ }
+
+
// Calculate total launches
var totalLaunches = 0;
for (let year in data) {
@@ -1085,7 +1126,7 @@ function historicalLaunchViewer(station, marker) {
// Generate HTML
var popupContent = "
Launches Selected:
" + totalLaunches + "";
popupContent += "
";
+ popupContent += "
" + monthList.outerHTML + "";
popupContent += "

";
historical.html(popupContent);
historical.show();
@@ -1095,6 +1136,7 @@ function historicalLaunchViewer(station, marker) {
if (!realpopup.isOpen()) {
realpopup.setContent("");
}
+ getSelectedNumber(station);
}
if (historical.is(":visible")) {
// Don't regenerate if already in memory
@@ -2976,9 +3018,14 @@ function addPosition(position) {
iconAnchor: [23,90],
});
+ var tempTitle = vcallsign;
+ if (typeof position.type !== 'undefined') {
+ var tempTitle = position.type + ' ' + vcallsign;
+ }
+
marker = new L.Marker(point, {
icon: balloonIcon,
- title: position.type + ' ' + vcallsign,
+ title: tempTitle,
zIndexOffset: Z_PAYLOAD,
}).addTo(map).on('click', onClick);
@@ -3149,7 +3196,7 @@ function addPosition(position) {
if (vehicle_type == "car") {
title = marker.bindTooltip(vcallsign, {direction: 'center', permanent: 'true', className: 'serialtooltip'});
} else {
- title = marker.bindTooltip((position.type + ' ' + vcallsign), {direction: 'center', permanent: 'true', className: 'serialtooltip'});
+ title = marker.bindTooltip((tempTitle), {direction: 'center', permanent: 'true', className: 'serialtooltip'});
}
} else {
title = null;
From 99981c4ca72cde0a5e8239eaa1d3f81a6776f99c Mon Sep 17 00:00:00 2001
From: Uskompuf <22492406+Uskompuf@users.noreply.github.com>
Date: Mon, 20 Dec 2021 21:27:28 +1100
Subject: [PATCH 7/8] more changes
---
js/tracker.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/js/tracker.js b/js/tracker.js
index 283f234..88cc1ba 100644
--- a/js/tracker.js
+++ b/js/tracker.js
@@ -832,6 +832,8 @@ function drawHistorical (data, station) {
var time = landing.datetime;
if (!historicalPlots[station].sondes.hasOwnProperty(serial)) {
+ // Using age to detmine colour
+ /*
const date = new Date(time);
var minTime = historicalPlots[station].data.minTime;
var actualTime = date.getTime();
@@ -841,9 +843,23 @@ function drawHistorical (data, station) {
historicalPlots[station].sondes[serial].time = actualTime
- // Calculate normalised time between 0 and 1
var normalisedTime = ((actualTime-minTime)/(maxTime-minTime));
var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo'));
+ */
+
+ // Using last known alt to detmine colour
+ var minAlt = 0;
+ var actualAlt = landing.alt;
+ var maxAlt = 10000;
+
+ if (actualAlt > maxAlt) {
+ actualAlt = maxAlt;
+ } else if (actualAlt < minAlt) {
+ actualAlt = minAlt;
+ }
+
+ var normalisedAlt = ((actualAlt-minAlt)/(maxAlt-minAlt));
+ var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedAlt, 'turbo'));
// Check if we have recovery data for it
var recovered = false;
From c30eeff9ecdbad10cc13fa7db61c0d6fab785e8b Mon Sep 17 00:00:00 2001
From: Uskompuf <22492406+Uskompuf@users.noreply.github.com>
Date: Tue, 21 Dec 2021 15:56:35 +1100
Subject: [PATCH 8/8] Universal historical delete button
---
js/tracker.js | 112 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 87 insertions(+), 25 deletions(-)
diff --git a/js/tracker.js b/js/tracker.js
index 88cc1ba..15c450a 100644
--- a/js/tracker.js
+++ b/js/tracker.js
@@ -34,6 +34,7 @@ var launchPredictions = {};
var stationHistoricalData = {};
var historicalPlots = {};
+var historicalAjax = [];
var sites = null;
var launches = new L.LayerGroup();
@@ -579,6 +580,28 @@ function load() {
L.control.periodcontrol({ position: 'topleft' }).addTo(map);
+ L.Control.HistoricalControl = L.Control.extend({
+ onAdd: function(map) {
+ var div = L.DomUtil.create('div');
+
+ div.innerHTML = '
';
+ div.id = "historicalControlButton";
+ div.style.display = "none";
+
+ return div;
+ },
+
+ onRemove: function(map) {
+ // Nothing to do here
+ }
+ });
+
+ L.control.historicalontrol = function(opts) {
+ return new L.Control.HistoricalControl(opts);
+ }
+
+ L.control.historicalontrol({ position: 'topleft' }).addTo(map);
+
// update current position if we geolocation is available
if(currentPosition) updateCurrentPosition(currentPosition.lat, currentPosition.lon);
@@ -805,7 +828,7 @@ function getSelectedNumber (station) {
// Download summary data from AWS S3
function downloadHistorical (suffix) {
var url = "https://sondehub-history.s3.amazonaws.com/" + suffix;
- return $.ajax({
+ var ajaxReq = $.ajax({
type: "GET",
url: url,
dataType: "json",
@@ -823,6 +846,8 @@ function downloadHistorical (suffix) {
}
}
});
+ historicalAjax.push(ajaxReq);
+ return ajaxReq;
}
// Draw historic summaries to map
@@ -832,21 +857,9 @@ function drawHistorical (data, station) {
var time = landing.datetime;
if (!historicalPlots[station].sondes.hasOwnProperty(serial)) {
- // Using age to detmine colour
- /*
- const date = new Date(time);
- var minTime = historicalPlots[station].data.minTime;
- var actualTime = date.getTime();
- var maxTime = historicalPlots[station].data.maxTime;
historicalPlots[station].sondes[serial] = {};
- historicalPlots[station].sondes[serial].time = actualTime
-
- var normalisedTime = ((actualTime-minTime)/(maxTime-minTime));
- var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo'));
- */
-
// Using last known alt to detmine colour
var minAlt = 0;
var actualAlt = landing.alt;
@@ -912,9 +925,9 @@ function drawHistorical (data, station) {
popup.setContent(html);
if (!recovered) {
- var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "white", color: iconColour, weight: 2, radius: 5, fillOpacity:1});
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "white", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
} else {
- var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "grey", color: iconColour, weight: 2, radius: 5, fillOpacity:1});
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "grey", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
}
marker.bindPopup(popup);
@@ -929,6 +942,7 @@ function drawHistorical (data, station) {
function deleteHistorical (station) {
var popup = $("#popup" + station);
var deleteHistorical = popup.find("#deleteHistorical");
+ var historicalDelete = $("#historicalControlButton");
deleteHistorical.hide();
@@ -939,6 +953,45 @@ function deleteHistorical (station) {
}
delete historicalPlots[station];
+
+ var otherSondes = false;
+
+ for (station in historicalPlots) {
+ if (historicalPlots.hasOwnProperty(station)) {
+ if (Object.keys(historicalPlots[station].sondes).length > 1) {
+ otherSondes = true;
+ }
+ }
+ }
+
+ if (!otherSondes) historicalDelete.hide();
+}
+
+function deleteHistoricalButton() {
+ var historicalDelete = $("#historicalControlButton");
+
+ for (station in historicalPlots) {
+ if (historicalPlots.hasOwnProperty(station)) {
+ historicalPlots[station].data.drawing = false;
+ for (let serial in historicalPlots[station].sondes) {
+ map.removeLayer(historicalPlots[station].sondes[serial].marker);
+ }
+ var popup = $("#popup" + station);
+ var deleteHistorical = popup.find("#deleteHistorical");
+ deleteHistorical.hide();
+ }
+ }
+
+ for (i=0; i < historicalAjax.length; i++) {
+ historicalAjax[i].abort();
+ }
+
+ historicalAjax = [];
+
+ historicalPlots = {};
+
+ historicalDelete.hide();
+
}
// Master function to display historic summaries
@@ -982,8 +1035,6 @@ function showHistorical (station, marker) {
historicalPlots[station] = {};
historicalPlots[station].sondes = {};
historicalPlots[station].data = {};
- historicalPlots[station].data.minTime = 1511960400000;
- historicalPlots[station].data.maxTime = dateNow.getTime();
}
// Get station location to fetch recoveries
@@ -1008,26 +1059,36 @@ function showHistorical (station, marker) {
processHistorical();
}
});
+ } else {
+ processHistorical();
}
function processHistorical() {
+ var historicalDelete = $("#historicalControlButton");
+ historicalDelete.show();
+
+ historicalPlots[station].data.drawing = true;
+
for (let i = 0; i < sondes.length; i++) {
- downloadHistorical(sondes[i]).done(handleData).fail(handleError);;
+ downloadHistorical(sondes[i]).done(handleData).fail(handleError);
}
var completed = 0;
function handleData(data) {
completed += 1;
- drawHistorical(data, station);
+ try {
+ drawHistorical(data, station);
+ } catch(e) {};
if (completed == sondes.length) {
submit.show();
submitLoading.hide();
- deleteHistorical.show();
+ if (historicalPlots[station].data.drawing) deleteHistorical.show();
// If modal is closed the contents needs to be forced updated
if (!realpopup.isOpen()) {
realpopup.setContent("");
}
+ historicalPlots[station].data.drawing = false;
}
}
@@ -1036,11 +1097,12 @@ function showHistorical (station, marker) {
if (completed == sondes.length) {
submit.show();
submitLoading.hide();
- deleteHistorical.show();
- }
- // If modal is closed the contents needs to be forced updated
- if (!realpopup.isOpen()) {
- realpopup.setContent("");
+ if (historicalPlots[station].data.drawing) deleteHistorical.show();
+ // If modal is closed the contents needs to be forced updated
+ if (!realpopup.isOpen()) {
+ realpopup.setContent("");
+ }
+ historicalPlots[station].data.drawing = false;
}
}
}