Reimplement warning message as a page

This commit is contained in:
DeionSi 2023-01-13 19:42:13 +01:00
parent 5559f81f2f
commit c710b5c27b
4 changed files with 45 additions and 69 deletions

View File

@ -217,4 +217,18 @@
uploadFW();
});
$(document).on('click', '#btnDownloadBasetune', function(event) {
event.preventDefault();
$("[href='#basetunewarning']").trigger('click');
var select = document.getElementById('basetunesSelect');
let selectedTune = select.options[select.selectedIndex];
document.getElementById("tuneBoard").innerHTML = selectedTune.dataset.board;
});
$(document).on('click', '#btnDownloadCancel', function(event) {
event.preventDefault();
$("[href='#basetunes']").trigger('click');
});
})(jQuery);

View File

@ -25,6 +25,7 @@
<li><a href="#port">Choose Port</a></li>
<li><a href="#progress">Progress</a></li>
<li><a href="#basetunes">Base Tunes</a></li>
<li style="display: none;"><a href="#basetunewarning">Base Tunes</a></li>
</ul>
</nav>
</div>
@ -144,14 +145,39 @@
<div id="tuneDetailsText" style="padding-left: 0.9em; padding-right: 0.9em; padding-top: 0.1em; overflow-y: auto; height: 17vh; font-size: 14px;"></div>
</div>
<ul class="actions">
<li><input type='button' id="btnDownloadBasetune" value="Download tune" onclick="showBasetuneWarning();" /></li>
<li><input type='button' id="btnDownloadBasetune" value="Download tune" /></li>
<li><input type='button' value="Exit" id="btnExit" onclick="quit();" /></li>
</ul>
</p>
</div>
</section>
</div>
<!-- Base tune warning -->
<section id="basetunewarning" class="wrapper style5" style="height: 100vh;">
<div class="inner">
<h1 style="text-align: center; width: 100%;">WARNING</h1>
<div class="features major">
<p style="text-align: center; width: 100%;">Base tunes are intended as a starting point ONLY. They will require changes in order to work correctly with your engine!</p>
<center><span class="icon fa-exclamation major" id="warningIcon"></span></center>
<p style="text-align: center; width: 100%;">Take note of the board that has been used in this tune. If you are not using this board you need to change this setting immediately:</p>
<p style="text-align: center; width: 100%;">
<span class="icon fa-arrow-right" id="emphasisIcon"></span>
<span style="font-weight: bold;" id="tuneBoard"></span>
<span class="icon fa-arrow-left" id="emphasisIcon"></span>
</p>
</div>
<ul class="actions modal">
<li><input type='button' id="btnDownloadConfirm" value="Download" onclick="downloadBasetune();" /></li>
<li><input type='button' id="btnDownloadCancel" value="Cancel" /></li>
</ul>
</div>
</section>
<!-- Footer -->
<footer id="footer" class="wrapper style1-alt">

View File

@ -434,38 +434,6 @@ function downloadIni()
}
function showBasetuneWarning()
{
let mainWindow = remote.BrowserWindow.getFocusedWindow();
warningWindow = new remote.BrowserWindow({ width: 550, height: 380, modal: true, parent: mainWindow, show: false })
var select = document.getElementById('basetunesSelect');
selectedTune = select.options[select.selectedIndex];
// auto hide menu bar (Win, Linux)
warningWindow.setMenuBarVisibility(false);
warningWindow.setAutoHideMenuBar(true);
// remove completely when app is packaged (Win, Linux)
if (remote.app.isPackaged) {
warningWindow.removeMenu();
}
board = selectedTune.dataset.board
warningWindow.loadURL(`file://${__dirname}/warning.html?board=` + board);
warningWindow.once('ready-to-show', () => {
warningWindow.show();
})
warningWindow.on('close', () => {
warningWindow = null;
downloadBasetune();
});
}
function downloadBasetune()
{
console.log("downloading");
@ -482,6 +450,9 @@ function downloadBasetune()
url: DLurl,
properties: {directory: "downloads"}
});
const baseTuneLink = document.querySelectorAll('a[href="#basetunes"]');
baseTuneLink[0].click();
}
//Installing the Windows drivers

View File

@ -1,35 +0,0 @@
<html>
<link rel="stylesheet" href="assets/css/main.css" />
<script>
function updateBoard()
{
board = (location.search.split('board=')[1]||'').split('&')[0]
document.getElementById("tuneBoard").innerHTML = decodeURI(board);
}
</script>
<body onload="updateBoard()">
<!-- Choose Version -->
<section id="loader" class="wrapper style5 fullscreen fade-up" style="padding: 0; margin: 0;">
<!--<h1>Firmware Loader</h1>-->
<div class="inner" style="padding: 0; margin: 0;">
<p><h1 class="modal" style="margin: 0;">WARNING</h1></p>
</div>
<div class="features major modal" style="margin-left: 15px; margin-right: 15px; padding-top: 1; padding-bottom: 1; margin-bottom: 8px;">
<div style="padding-left: .9em; padding-right: 0.9em; overflow-y: auto; ">
<p style="margin-bottom: 5;">Base tunes are intended as a starting point ONLY. They will require changes in order to work correctly with your engine</p>
<center><span class="icon fa-exclamation major" style="margin: 0; justify-content: center;" id="warningIcon"></span></center>
<p >Take note of the board that has been used in this tune. If you are not using this board you will to change this setting immediately: <br /><span class="icon fa-arrow-right" style="margin: 0; justify-content: center;" id="emphasisIcon"></span> <span style="font-weight: bold;" id="tuneBoard"></span> <span class="icon fa-arrow-left" style="margin: 0; justify-content: center;" id="emphasisIcon"></span></p>
</div>
</div>
<ul class="actions modal">
<li><input type='button' id="btnDownloadConfirm" value="Download" onclick="window.close();" /></li>
</ul>
</section>
</body>
</html>