Skip to content

Commit c2fff5b

Browse files
committed
Replaced jbox dialogues.
1 parent 357b6c0 commit c2fff5b

File tree

6 files changed

+82
-15
lines changed

6 files changed

+82
-15
lines changed

_locales/en/messages.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"autoConnect": {
2424
"message": "Auto-Connect"
2525
},
26+
"close": {
27+
"message": "Close"
28+
},
2629
"autoConnectEnabled": {
2730
"message": "Auto-Connect: Enabled - Configurator automatically tries to connect when new port is detected"
2831
},
@@ -41,6 +44,9 @@
4144
"configuratorUpdateNotice": {
4245
"message": "You are using an outdated version of the <b>Betaflight Configurator</b>.<br>Version <b>$1</b> is available online, please visit <a href=\"$2\" target=\"_blank\">the release page</a> to download and install the latest version with fixes and improvements.<br>Please close the configurator window before updating."
4346
},
47+
"configuratorUpdateWebsite": {
48+
"message": "Go to Release Website"
49+
},
4450
"deviceRebooting": {
4551
"message": "Device - <span style=\"color: red\">Rebooting</span>"
4652
},

js/gui.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,5 @@ GUI_control.prototype.content_ready = function (callback) {
321321
if (callback) callback();
322322
}
323323

324-
GUI_control.prototype.show_modal = function (title, message) {
325-
var popup = new jBox('Modal', {
326-
title: title,
327-
content: message,
328-
closeButton: 'title'
329-
});
330-
331-
popup.open();
332-
}
333-
334324
// initialize object into GUI variable
335325
var GUI = new GUI_control();

js/serial_backend.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,29 @@ function onOpen(openInfo) {
238238
});
239239
});
240240
} else {
241-
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
242-
chrome.i18n.getMessage('firmwareTypeNotSupported'));
241+
var dialog = $('.dialogConnectWarning')[0];
242+
243+
$('.dialogConnectWarning-content').html(chrome.i18n.getMessage('firmwareTypeNotSupported'));
244+
245+
$('.dialogConnectWarning-closebtn').click(function() {
246+
dialog.close();
247+
});
248+
249+
dialog.showModal();
243250

244251
connectCli();
245252
}
246253
});
247254
} else {
248-
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
249-
chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
255+
var dialog = $('.dialogConnectWarning')[0];
256+
257+
$('.dialogConnectWarning-content').html(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
258+
259+
$('.dialogConnectWarning-closebtn').click(function() {
260+
dialog.close();
261+
});
262+
263+
dialog.showModal();
250264

251265
connectCli();
252266
}

main.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,26 @@ dialog {
13021302
box-shadow: inset 0px 1px 5px rgba(0, 0, 0, 0.35);
13031303
}
13041304

1305+
.regular-button {
1306+
margin-top: 8px;
1307+
margin-bottom: 8px;
1308+
margin-right: 10px;
1309+
background-color: #ffbb00;
1310+
border-radius: 3px;
1311+
border: 1px solid #dba718;
1312+
color: #000;
1313+
font-family: 'open_sansbold', Arial;
1314+
font-size: 12px;
1315+
text-shadow: 0px 1px rgba(255, 255, 255, 0.25);
1316+
display: inline-block;
1317+
cursor: pointer;
1318+
transition: all ease 0.2s;
1319+
padding: 0px;
1320+
padding-left: 9px;
1321+
padding-right: 9px;
1322+
line-height: 28px;
1323+
}
1324+
13051325
.small {
13061326
width: auto;
13071327
position: relative;

main.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,27 @@
294294
</div>
295295
</div>
296296
</div>
297+
298+
<dialog class="dialogConfiguratorUpdate">
299+
<h3 i18n="noticeTitle"></h3>
300+
<div class="content">
301+
<div class="dialogConfiguratorUpdate-content" style="margin-top: 10px"></div>
302+
</div>
303+
<div class="buttons">
304+
<a href="#" class="dialogConfiguratorUpdate-websitebtn regular-button" i18n="configuratorUpdateWebsite"></a>
305+
<a href="#" class="dialogConfiguratorUpdate-closebtn regular-button" i18n="close"></a>
306+
</div>
307+
</dialog>
308+
309+
<dialog class="dialogConnectWarning">
310+
<h3 i18n="warningTitle"></h3>
311+
<div class="content">
312+
<div class="dialogConnectWarning-content" style="margin-top: 10px"></div>
313+
</div>
314+
<div class="buttons">
315+
<a href="#" class="dialogConnectWarning-closebtn regular-button" i18n="close"></a>
316+
</div>
317+
</dialog>
318+
297319
</body>
298320
</html>

main.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,23 @@ function notifyOutdatedVersion(releaseData) {
377377
});
378378

379379
if (versions.length > 0 && semver.lt(getManifestVersion(), versions[0].tag_name)) {
380-
GUI.show_modal(chrome.i18n.getMessage('noticeTitle'), chrome.i18n.getMessage('configuratorUpdateNotice', [versions[0].tag_name, versions[0].html_url]));
381380
GUI.log(chrome.i18n.getMessage('configuratorUpdateNotice', [versions[0].tag_name, versions[0].html_url]));
381+
382+
var dialog = $('.dialogConfiguratorUpdate')[0];
383+
384+
$('.dialogConfiguratorUpdate-content').html(chrome.i18n.getMessage('configuratorUpdateNotice', [versions[0].tag_name, versions[0].html_url]));
385+
386+
$('.dialogConfiguratorUpdate-closebtn').click(function() {
387+
dialog.close();
388+
});
389+
390+
$('.dialogConfiguratorUpdate-websitebtn').click(function() {
391+
dialog.close();
392+
393+
window.open(versions[0].html_url);
394+
});
395+
396+
dialog.showModal();
382397
}
383398
});
384399
}

0 commit comments

Comments
 (0)