diff --git a/assets/css/openfusion.css b/assets/css/openfusion.css index 430057b..ace7d1a 100644 --- a/assets/css/openfusion.css +++ b/assets/css/openfusion.css @@ -65,6 +65,12 @@ body { right: 8px; } +#of-about-flash-div { + position: fixed; + bottom: 4px; + right: 8px; +} + #of-config-button-div { position: fixed; bottom: 4px; @@ -91,6 +97,18 @@ body { background-repeat: repeat; } +.form-check-input { + width: 25px; + height: 25px; +} + +.form-check-label { + height: 25px; + margin-top: 5px; + margin-left: 10px; + font-size: 1rem; +} + #of-aboutmodal > .modal-dialog > .modal-content { background-color: #093363; border-color: #6699ff; @@ -192,3 +210,19 @@ button > i { background: #000; clear: both; } + +@keyframes pulse { + 0% { + opacity: 1; + } + 50% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.pulsing { + animation: pulse 2s infinite; +} diff --git a/assets/js/server-selector.js b/assets/js/server-selector.js index 4fde0a6..effac46 100644 --- a/assets/js/server-selector.js +++ b/assets/js/server-selector.js @@ -80,6 +80,36 @@ function setAppVersionText() { $("#of-aboutversionnumber").text("Version " + getAppVersion()); } +function checkForNewAppVersion() { + $("#of-about-button").removeClass("pulsing"); + setAppVersionText(); + if (config["autoupdate-check"] === true) { + $.getJSON( + "https://api.github.com/repos/OpenFusionProject/OpenFusionClient/releases/latest", + {}, + function (data) { + $.each(data, function (index, element) { + if (index === "tag_name" && element > getAppVersion()) { + console.log("New version available: " + element); + var downloadPage = + "https://github.com/OpenFusionProject/OpenFusionClient/releases/latest"; + $("#of-aboutversionnumber").html( + "Version " + + getAppVersion() + + `
A new version is available! ` + + `Click here to download.` + ); + $("#of-about-button").addClass("pulsing"); + return false; // break out of loop early + } + }); + } + ); + } +} + function validateServerSave(modalName) { // works everytime a key is entered into the server save form var descInput = document.getElementById(modalName + "server-descinput"); @@ -382,6 +412,7 @@ function loadConfig() { offlineRoot = config["offline-cache-location"] || offlineRootDefault; $("#editconfig-offlinecachelocation:text").val(offlineRoot); + checkForNewAppVersion(); validateCacheLocation(); } diff --git a/index.html b/index.html index c568848..b86f87e 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + @@ -490,40 +490,63 @@