From dde407471e79ff71b18b46ac690641cc25b8b923 Mon Sep 17 00:00:00 2001 From: xssfox Date: Sat, 12 Apr 2025 20:37:55 +1000 Subject: [PATCH 01/10] set recovery warning to be the same offset as the realtime warning. They shouldn't be up at the same time anyway --- index.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.template.html b/index.template.html index 22c8048..287cc94 100644 --- a/index.template.html +++ b/index.template.html @@ -408,7 +408,7 @@

Chase Mode

Zoom in for realtime data!
- From 6ee7514a5fddac3a0a3cf2ff262002f57453eee1 Mon Sep 17 00:00:00 2001 From: smithse Date: Sat, 26 Apr 2025 17:10:16 +0800 Subject: [PATCH 02/10] Prediction map link and planned recovery icon (#402) Co-authored-by: Mark Jessop Co-authored-by: xssfox --- img/markers/payload-recovery-planned.png | Bin 0 -> 2353 bytes js/sondehub.js | 7 +++++++ js/station.js | 12 +++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 img/markers/payload-recovery-planned.png diff --git a/img/markers/payload-recovery-planned.png b/img/markers/payload-recovery-planned.png new file mode 100644 index 0000000000000000000000000000000000000000..e3147149c979449d7987a2f96fd431cb8006e78c GIT binary patch literal 2353 zcmV-13C{M3P)BE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096103x6R00aO4 z0096103rYY001GfgKhu-1e!@iK~z`??O01lqgNC@(L{|J-xL+C(m0NcA}A;XEY@w& zMP*zRq^p)X1-nxhqnmNMwL8bwwjzk4ExHi3)PjYIK@?FTND7Yc@l`b#AJO>e`A)q* zjiX7%>7=vhfiL&}@9TX3z2}^JZgk{Z%-kiLk;%aGyNu-A+}z~Z+1YpaSre|?;<^`H z0W34-8GkTrSI=DBEV`Sksfg=8V7$+;6ciMg($dl>Jw2Vi>d5CR-}1O}iWV0aX=!PR zCMG7FJi^NOo$(uEl;I)QiIj8eL&isym6c%@i-n4ciYO{7N*k1H!F;~uh1H^U+TY)& z(a}+|TCLR4(c$8TKE_XsUe!qvxz80}Fdj8FHX6#y%PBlOT=nrN??U9C6C52KQEzWA zH8eE1x&9fWnPCs&ACP!jU0wa9-EKGVO593<`@Oc{1EB-Dppz$j%D5lQKebg=RiD+= z)KG9RUcHOy`&I89u3DX+rh4rMUD*1QlamLNlaohSk=nAdGOvT)WaE|YS`c|FM2PhF z_y1>Plx`t1Gc!X?O-*!qdKxf7&;^}cU0tG6h}75D)AI5%<>chR&j~K}rUY|CM^;vr zkVr^K5LJjHmkSFE^3v1OLjwZ?G(J8~6%`d?)&F)t>+I~L*w|PJk_eP%XJ=%y*~o*4 zT7{935s8ExnrVK1p0cyE>2*T<^z^hSj*N_y60rmX6mBJ=2pu0E)7;z~@j)hpR#sN% z7yIX`*=zYAqJfM?qXfr@hzJS|4HX-NZMfZTjf7eez1P{e(QGzTN=ga>54l`?OnmaE zuOZT2TwF}}5R8Ljz?-~Xal{+bK(+n9BG*@1RwO1S=6Zd=-c{125eYOIqyad2+uPga zqc!&hk&BB9Iy^k2^YimtS7h*+QCt$P33pa5iui!Ba8q&flbff|>-AJvSV$!$B~)5k zs&&$cpe8OZPJkQ}X95WM@_%h6FApIhA(WAkL7ADEl%Jn3M6P%DAfg(vZ))%Gl}@Kq zfM-NVykA~kN_5oebOhi_O(qis1qBflV?0(lDJe;^|I}3P8JnCnnABf6P5S%T_SHXR z{bOHUw03-m80*f?j#e4yhrT}CEQn-l4h{~)P>~yeT_6Ou*VfiX-QC?#=LQi6uSg8G z2OfZv5_{`UMt>K=@Tj4oAsQYYrm?Xxl@+=`#WoRv}P|hT7=E9s?TU$u9Jg%JTY6rLZnPKBJ@uIo8`5xPi9{U*|A20TT;D+T)@AEIQ z9=P{h`ePhE0?JocSCOB(_V)IEWL-}fUo*sI)r#=Dhj{!gk(ZZeLSRZvOq9eIb`usB zCff*d_)^#vE0FC(I8e{9IbQx({#(L>&DD#U%a{JB;X2#{aBLeHkYk2}fn4&H|ET#3 X9CBOMfvHt100000NkvXXu0mjfVb*CU literal 0 HcmV?d00001 diff --git a/js/sondehub.js b/js/sondehub.js index 6e2f0d2..6449673 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -4765,6 +4765,13 @@ function updateRecoveryMarker(recovery) { _recovery_icon = host_url + markers_url + "payload-not-recovered.png"; } + // Override icon if 'is planned' field exists and is true + if(recovery.hasOwnProperty('planned')){ + if(recovery.planned == true){ + _recovery_icon = host_url + markers_url + "payload-recovery-planned.png"; + } + } + recoveryIcon = new L.icon({ iconUrl: _recovery_icon, iconSize: [17, 19], diff --git a/js/station.js b/js/station.js index df1ce29..76da9fa 100644 --- a/js/station.js +++ b/js/station.js @@ -705,6 +705,7 @@ function launchSitePredictions(times, station, properties, marker, id) { } } +//VK6DI Changes function plotPrediction (data, dates, marker, properties) { if (!launchPredictions.hasOwnProperty(marker)) { launchPredictions[marker] = {}; @@ -768,15 +769,24 @@ function plotPrediction (data, dates, marker, properties) { icon: new L.NumberedDivIcon({number: dates.indexOf(data.request.launch_datetime)+1}) }).addTo(map); + var coords_text = format_coordinates(landingPoint.latitude, landingLongitude, "Prediction"); + var landingTime = new Date(landingPoint.datetime); if (properties[3] != "" && properties[4] != "") { var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset + + "
Prediction: " + coords_text + "
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude (" + properties[3] + " samples)
- " + data.request.descent_rate + "m/s descent (" + properties[4] + " samples)"; } else { var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset + + "
Prediction:" + coords_text + "
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude
- " + data.request.descent_rate + "m/s descent"; } - plot.landingMarker.bindTooltip(landingTooltip, {offset: [13,-28]}); + + plot.landingMarker.bindPopup(landingTooltip, { autoClose: false, closeOnClick: false }) + .on('click', function (e) { + this.openPopup(); + }); + } function showPrediction(url) { From f127d15cb51a444bd80c0076e8a7f3762396a32b Mon Sep 17 00:00:00 2001 From: xssfox Date: Sun, 27 Apr 2025 10:35:26 +1000 Subject: [PATCH 03/10] upper case fixes for #404 --- js/app.js | 5 ++++- js/station.js | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 7ab00d6..5ed6e87 100644 --- a/js/app.js +++ b/js/app.js @@ -128,6 +128,7 @@ function load_hash(no_refresh) { } break; case "f": + v = v.toUpperCase(); refocus = (follow_vehicle != v); follow_vehicle = v; def.focus = v; @@ -137,6 +138,7 @@ function load_hash(no_refresh) { if(modeList.indexOf(def.mode) == -1) def.mode = (is_mobile) ? modeDefaultMobile : modeDefault; break; case "q": + v = v.toUpperCase(); def.query = v; $("header .search input[type='text']").val(v); break; @@ -1074,7 +1076,8 @@ $(window).ready(function() { $("header .search form").on('submit', function(e) { e.preventDefault(); - var text = $("header .search input[type='text']").val(); + var text = $("header .search input[type='text']").val().toUpperCase(); + $("header .search input[type='text']")[0].value = text; // update field in case it wasn't already uppercase if(text === wvar.query) return; diff --git a/js/station.js b/js/station.js index 76da9fa..07a8b6f 100644 --- a/js/station.js +++ b/js/station.js @@ -705,7 +705,6 @@ function launchSitePredictions(times, station, properties, marker, id) { } } -//VK6DI Changes function plotPrediction (data, dates, marker, properties) { if (!launchPredictions.hasOwnProperty(marker)) { launchPredictions[marker] = {}; From ac7e6c674694fbb562810812b24c1c8adef4149b Mon Sep 17 00:00:00 2001 From: xssfox Date: Sun, 27 Apr 2025 10:50:44 +1000 Subject: [PATCH 04/10] fix for #398 imperial units on leaflet --- js/app.js | 12 ++++++++++++ js/sondehub.js | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 5ed6e87..498eefa 100644 --- a/js/app.js +++ b/js/app.js @@ -850,6 +850,18 @@ $(window).ready(function() { else focusVehicle(null, true); break; case "opt_imperial": + if (map_scale){ + map_scale.remove() + } + // we need to remove and add the zoom controls so they end up in the same position + zoom_controls.remove() + if (on) { + map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map); + } else { + map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map); + } + zoom_controls.addTo(map); + case "opt_haxis_hours": refreshUI(); break; diff --git a/js/sondehub.js b/js/sondehub.js index 6449673..29a8f81 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -868,10 +868,15 @@ function load() { L.control.status({ position: 'bottomright' }).addTo(map); // scale (would be better if integrated into attirbution bar) - L.control.scale({position:'bottomright', imperial:false}).addTo(map); + if (offline.get('opt_imperial')){ + map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map); + } else { + map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map); + } + // zoom controls - new L.Control.Zoom({ position: 'bottomright' }).addTo(map); + zoom_controls = new L.Control.Zoom({ position: 'bottomright' }).addTo(map); // map selector layers = L.control.layers(baseMaps, null, {position: "topleft"}).addTo(map); From 0669e7882407262675196a9f046d6928ced5ee07 Mon Sep 17 00:00:00 2001 From: xssfox Date: Sun, 27 Apr 2025 11:19:08 +1000 Subject: [PATCH 05/10] blueman group (update position even if chase car mode not active #396) --- js/app.js | 161 +++++++++++++++++++++++-------------------------- js/sondehub.js | 6 +- 2 files changed, 79 insertions(+), 88 deletions(-) diff --git a/js/app.js b/js/app.js index 498eefa..b3a4b69 100644 --- a/js/app.js +++ b/js/app.js @@ -355,89 +355,83 @@ var positionUpdateHandle = function(position) { } } - //navigator.geolocation.getCurrentPosition(function(position) { - var lat = position.coords.latitude; - var lon = position.coords.longitude; - var alt = (position.coords.altitude) ? position.coords.altitude : 0; - var accuracy = (position.coords.accuracy) ? position.coords.accuracy : 0; - var speed = (position.coords.speed) ? position.coords.speed : 0; - - // constantly update 'last updated' field, and display friendly time since last update - if(!GPS_ts) { - GPS_ts = parseInt(position.timestamp/1000); - - setInterval(function() { - var delta_ts = parseInt(Date.now()/1000) - GPS_ts; - - // generate friendly timestamp - var hours = Math.floor(delta_ts / 3600); - var minutes = Math.floor(delta_ts / 60) % 60; - var ts_str = (delta_ts >= 60) ? - ((hours)?hours+'h ':'') + - ((minutes)?minutes+'m':'') + - ' ago' - : 'just now'; - $('#cc_timestamp').text(ts_str); - }, 30000); - - $('#cc_timestamp').text('just now'); - } + var lat = position.coords.latitude; + var lon = position.coords.longitude; + var alt = (position.coords.altitude) ? position.coords.altitude : 0; + var accuracy = (position.coords.accuracy) ? position.coords.accuracy : 0; + var speed = (position.coords.speed) ? position.coords.speed : 0; + + // constantly update 'last updated' field, and display friendly time since last update + if(!GPS_ts) { + GPS_ts = parseInt(position.timestamp/1000); + + setInterval(function() { + var delta_ts = parseInt(Date.now()/1000) - GPS_ts; + + // generate friendly timestamp + var hours = Math.floor(delta_ts / 3600); + var minutes = Math.floor(delta_ts / 60) % 60; + var ts_str = (delta_ts >= 60) ? + ((hours)?hours+'h ':'') + + ((minutes)?minutes+'m':'') + + ' ago' + : 'just now'; + $('#cc_timestamp').text(ts_str); + }, 30000); + + $('#cc_timestamp').text('just now'); + } - // save position and update only if different is available - if(CHASE_timer < (new Date()).getTime() && - ( - GPS_lat != lat || - GPS_lon != lon || - GPS_alt != alt || - GPS_speed != speed - ) + // save position and update only if different is available + if(CHASE_timer < (new Date()).getTime() && + ( + GPS_lat != lat || + GPS_lon != lon || + GPS_alt != alt || + GPS_speed != speed ) - { - GPS_lat = lat; - GPS_lon = lon; - GPS_alt = alt; - GPS_speed = speed; - GPS_ts = parseInt(position.timestamp/1000); - $('#cc_timestamp').text('just now'); - - // update look angles once we get position - if(follow_vehicle !== null && vehicles[follow_vehicle] !== undefined) { - update_lookangles(follow_vehicle); - } + ) + { + GPS_lat = lat; + GPS_lon = lon; + GPS_alt = alt; + GPS_speed = speed; + GPS_ts = parseInt(position.timestamp/1000); + $('#cc_timestamp').text('just now'); + + // update look angles once we get position + if(follow_vehicle !== null && vehicles[follow_vehicle] !== undefined) { + update_lookangles(follow_vehicle); + } - if(CHASE_enabled) { - ChaseCar.updatePosition(callsign, position); - CHASE_timer = (new Date()).getTime() + 15000; - } + if(CHASE_enabled) { + ChaseCar.updatePosition(callsign, position); + CHASE_timer = (new Date()).getTime() + 15000; } - else { return; } - - // add/update marker on the map (sondehub.js) - updateCurrentPosition(lat, lon); - - // round the coordinates - lat = parseInt(lat * 10000)/10000; // 4 decimal places (11m accuracy at equator) - lon = parseInt(lon * 10000)/10000; // 4 decimal places - speed = parseInt(speed * 10)/10; // 1 decimal place - accuracy = parseInt(accuracy); - alt = parseInt(alt); - - // dispaly them in the top right corner - $('#app_name b').html(lat + '
' + lon); - - // update chase car interface - $('#cc_lat').text(lat); - $('#cc_lon').text(lon); - $('#cc_alt').text(alt + " m"); - $('#cc_accuracy').text(accuracy + " m"); - $('#cc_speed').text(speed + " m/s"); - /* - }, - function() { - // when there is no location - $('#app_name b').html('mobile
tracker'); - }); - */ + } + + + // add/update marker on the map (sondehub.js) + updateCurrentPosition(lat, lon); + + // round the coordinates + lat = parseInt(lat * 10000)/10000; // 4 decimal places (11m accuracy at equator) + lon = parseInt(lon * 10000)/10000; // 4 decimal places + speed = parseInt(speed * 10)/10; // 1 decimal place + accuracy = parseInt(accuracy); + alt = parseInt(alt); + + // dispaly them in the top right corner + $('#app_name b').html(lat + '
' + lon); + + // update chase car interface + $('#cc_lat').text(lat); + $('#cc_lon').text(lon); + $('#cc_alt').text(alt + " m"); + $('#cc_accuracy').text(accuracy + " m"); + $('#cc_speed').text(speed + " m/s"); + + }; var twoZeroPad = function(n) { @@ -703,7 +697,6 @@ $(window).ready(function() { field.removeAttr('disabled'); e.removeClass('on').addClass('off'); - if(navigator.geolocation) navigator.geolocation.clearWatch(CHASE_enabled); CHASE_enabled = null; //CHASE_enabled = false; @@ -731,8 +724,7 @@ $(window).ready(function() { ChaseCar.updatePosition(callsign, { coords: { latitude: GPS_lat, longitude: GPS_lon, altitude: GPS_alt, speed: GPS_speed }}); } - if(navigator.geolocation) CHASE_enabled = navigator.geolocation.watchPosition(positionUpdateHandle, positionUpdateError); - //CHASE_enabled = true; + CHASE_enabled = true; // hide the blue man if(currentPosition && currentPosition.marker) map.removeLayer(currentPosition.marker); @@ -986,10 +978,7 @@ $(window).ready(function() { }); navigator.geolocation.getCurrentPosition(positionUpdateHandle); - // check for location update every 30sec - //setInterval(positionUpdateHandle, 30000); - // immediatelly check for position - //positionUpdateHandle(); + if(navigator.geolocation) navigator.geolocation.watchPosition(positionUpdateHandle, positionUpdateError); } // weather feature diff --git a/js/sondehub.js b/js/sondehub.js index 29a8f81..83f246c 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -4519,8 +4519,10 @@ function updateCurrentPosition(lat, lon) { } else { currentPosition.lat = lat; currentPosition.lon = lon; - currentPosition.marker.addTo(map); - currentPosition.marker.setLatLng(latlng); + if (!CHASE_enabled){ + currentPosition.marker.addTo(map); + currentPosition.marker.setLatLng(latlng); + } } } From 32d4c56e8ce3bc1d634548e1c3aa0100ec3d5982 Mon Sep 17 00:00:00 2001 From: xssfox Date: Sat, 31 May 2025 09:16:47 +1000 Subject: [PATCH 06/10] fix bug where up location permission tries to turn on chase car! --- index.template.html | 1 + js/app.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.template.html b/index.template.html index 287cc94..8d3f3b0 100644 --- a/index.template.html +++ b/index.template.html @@ -9,6 +9,7 @@ + diff --git a/js/app.js b/js/app.js index b3a4b69..8a2454f 100644 --- a/js/app.js +++ b/js/app.js @@ -339,8 +339,7 @@ function positionUpdateError(error) { switch(error.code) { case error.PERMISSION_DENIED: - alert("no permission to use your location"); - $('#sw_chasecar').click(); // turn off chase car + $('#sw_chasecar').removeClass('on').addClass('off'); break; default: break; From 553a867e8d4fa0e71a22b29aab75a14b737ed093 Mon Sep 17 00:00:00 2001 From: xssfox Date: Wed, 27 Aug 2025 08:57:09 +1000 Subject: [PATCH 07/10] might fix #414 - not sure --- js/station.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/station.js b/js/station.js index 07a8b6f..6ad8857 100644 --- a/js/station.js +++ b/js/station.js @@ -632,26 +632,26 @@ function launchSitePredictions(times, station, properties, marker, id) { var date = new Date(); var time = times[i].split(":"); if (time[0] != 0) { - date.setDate(date.getDate() + (7 + time[0] - date.getDay()) % 7); + date.setUTCDate(date.getUTCDate() + (7 + time[0] - date.getUTCDay()) % 7); } date.setUTCHours(time[1]); date.setUTCMinutes(time[2]); - date.setSeconds(0); - date.setMilliseconds(0); + date.setUTCSeconds(0); + date.setUTCMilliseconds(0); // launch time 45 minutes before target time - date.setMinutes( date.getMinutes() - 45 ); + date.setUTCMinutes( date.getUTCMinutes() - 45 ); while (date < now) { if (time[0] == 0) { - date.setDate(date.getDate() + 1); + date.setUTCDate(date.getUTCDate() + 1); } else { - date.setDate(date.getDate() + 7); + date.setUTCDate(date.getUTCDate() + 7); } } if (day > 0) { if (time[0] == 0) { - date.setDate(date.getDate() + day); + date.setUTCDate(date.getUTCDate() + day); } else { - date.setDate(date.getDate() + (7*day)); + date.setUTCDate(date.getUTCDate() + (7*day)); } } if (count < maxCount) { From 48c94da9ef0fad043246484a9ff12fef851040de Mon Sep 17 00:00:00 2001 From: xssfox Date: Fri, 19 Sep 2025 23:36:51 +1000 Subject: [PATCH 08/10] realtime only at more zoomed in to save mqtt servers --- js/sondehub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/sondehub.js b/js/sondehub.js index 83f246c..d29944f 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -681,7 +681,7 @@ function throttle_events(event) { function sub_to_nearby_sondes(){ let bounds = map.getBounds().pad(1); // expand by one viewport - let zoomed_out = map.getZoom() <= 6; + let zoomed_out = map.getZoom() <= 8; const sub_logging = false; if (zoomed_out){ // If we are fairly zooomed out - only give the slow feed From c0e4ca9be28c5e84a30a17a84d0dc4a3a1d67d1f Mon Sep 17 00:00:00 2001 From: danieldegroot2 <67521919+danieldegroot2@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:08:41 +0200 Subject: [PATCH 09/10] Update sondehub.js - Use preferred tile.openstreetmap.org URL See https://github.com/openstreetmap/operations/issues/737 --- js/sondehub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/sondehub.js b/js/sondehub.js index d29944f..1296cc4 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -570,7 +570,7 @@ function makeQuad(x, y, zoom) { // map type list -var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { +var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '© OpenStreetMap contributors' }); From d9ef24ecdc075cc8bb12701f8b8cb7a2187d2ea6 Mon Sep 17 00:00:00 2001 From: xssfox Date: Wed, 24 Dec 2025 16:15:37 +1100 Subject: [PATCH 10/10] Add banner --- css/layout.css | 16 ++++++++++++++++ index.template.html | 1 + js/app.js | 14 ++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/css/layout.css b/css/layout.css index 2b915f2..8ebfd8f 100644 --- a/css/layout.css +++ b/css/layout.css @@ -179,4 +179,20 @@ header h1{ padding: 10px; border-width: 1px; display: none; +} + +#banner { + display: none +} +@media only screen and (min-width: 768px){ + #banner { + line-height: 1.1; + font-size: small; + display: block; + margin-left: 300px; + text-align: center; + overflow-y: auto; + font-weight: bold; + height: 100%; + } } \ No newline at end of file diff --git a/index.template.html b/index.template.html index 8d3f3b0..964bc91 100644 --- a/index.template.html +++ b/index.template.html @@ -84,6 +84,7 @@ no
location
+ diff --git a/js/app.js b/js/app.js index 8a2454f..2731e23 100644 --- a/js/app.js +++ b/js/app.js @@ -1126,6 +1126,19 @@ function update_site(){ window.location.reload(true) } +function check_banner(){ + const bannerRequest = new Request("https://api.v2.sondehub.org/banner"); + fetch(bannerRequest) + .then(function(response){ return response.json()}) + .then(function(response){ + if (response['banner']) { + document.getElementsByTagName("header")[0].style.backgroundColor = "#ff6259" + document.getElementsByTagName("header")[0].style.borderColor = "#eb3d34" + document.getElementById("banner").innerText = response['banner'] + } + }) +} + function update_countdown(){ var date = new Date(0); time_remaining = (reload_end_time - new Date().getTime())/1000 @@ -1135,6 +1148,7 @@ function update_countdown(){ } check_version() +check_banner() update_check = setInterval(check_version, 15 * 60 * 1000) load_hash(); startAjax();