()
| 3 | var valueList = {} //defined for graphs to fetch data |
| 4 | window.temperature = "27" |
| 5 | export const siteControl = () => { |
| 6 | |
| 7 | //generate data |
| 8 | function randomVa(max, min) { |
| 9 | return Math.random() * (max - min) + min |
| 10 | } |
| 11 | window.dataRandom = setInterval(function() { |
| 12 | valueList = { |
| 13 | "Reactor Core (°C)": randomVa(870, 800), |
| 14 | "Signal (dBm)": randomVa(-30, -67), |
| 15 | "Radiation Level (μSv/h)": randomVa(0.15, 0.1), |
| 16 | "Temperature": randomVa(temperature, temperature - 2), |
| 17 | "Stability": randomVa(100, 90) |
| 18 | } |
| 19 | }, 1000); |
| 20 | |
| 21 | //append modules |
| 22 | jQuery.get("/src/ex_file/html/controldash.html", function(va) { //get control html code |
| 23 | if (htmlLoaded == false) { |
| 24 | htmlLoaded = true |
| 25 | $("head").append(` |
| 26 | <link rel="stylesheet" href="/src/css/controlStyle.min.css"> |
| 27 | <script src="/src/ex_file/scripts/chart.js"></script> |
| 28 | <script src="/src/ex_file/scripts/luxon.js"></script> |
| 29 | <script src="/src/ex_file/scripts/chartjs-adapter-luxon.js"></script> |
| 30 | <script src="/src/ex_file/scripts/chartjs-plugin-streaming.js"></script>`) |
| 31 | $.getScript("https://cdnjs.cloudflare.com/ajax/libs/three.js/109/three.min.js", function () { |
| 32 | $.getScript("https://unpkg.com/three@0.85.0/examples/js/controls/OrbitControls.js", function () { |
| 33 | popUp(`${displayTitle} Main Site Control Unit`, va) |
| 34 | $("head").append('<script src="/src/ex_file/scripts/dna.min.js"></script>') |
| 35 | runDNA() |
| 36 | mainHTMLFun() |
| 37 | }) |
| 38 | }) |
| 39 | } |
| 40 | else { |
| 41 | popUp(`${displayTitle} Main Site Control Unit`, va) |
| 42 | runDNA() |
| 43 | mainHTMLFun() |
| 44 | } |
| 45 | }) |
| 46 | function mainHTMLFun() { |
| 47 | playSound('/src/ex_file/audio/dashEntrance.mp3') |
| 48 | playSound('/src/ex_file/audio/dashNormal.mp3') |
| 49 | //get local temperature if location masking is disabled |
| 50 | if (loaded == false && locationGet != false) { |
| 51 | $.getJSON("https://api.openweathermap.org/data/2.5/weather", { |
| 52 | lat: countrylat, |
| 53 | lon: countrylong, |
| 54 | units: 'metric', |
| 55 | APPID: config.WEATHER_KEY |
| 56 | }).done(function(weather) { |
| 57 | loaded = true //log for second time loading |
| 58 | temperature = weather.main.temp || "27" |
| 59 | $('#feedTemp').text(`${temperature} °C`) |
| 60 | }) |
| 61 | } else { |
| 62 | if (locationGet == false) { |
nothing calls this directly
no test coverage detected