mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 16:55:24 +03:00
migrate privacy policy and changelog to a tab
This commit is contained in:
parent
5eedc3b507
commit
6fe3cb1500
11 changed files with 82 additions and 204 deletions
|
@ -16,7 +16,9 @@ var GUI_control = function () {
|
|||
|
||||
this.defaultAllowedTabsWhenDisconnected = [
|
||||
'landing',
|
||||
'changelog',
|
||||
'firmware_flasher',
|
||||
'privacy_policy',
|
||||
'help'
|
||||
];
|
||||
this.defaultAllowedFCTabsWhenConnected = [
|
||||
|
@ -243,7 +245,7 @@ GUI_control.prototype.tab_switch_cleanup = function (callback) {
|
|||
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
|
||||
GUI.interval_kill_all(); // all intervals (mostly data pulling) needs to be removed on tab switch
|
||||
|
||||
if (this.active_tab) {
|
||||
if (this.active_tab && TABS[this.active_tab]) {
|
||||
TABS[this.active_tab].cleanup(callback);
|
||||
} else {
|
||||
callback();
|
||||
|
|
|
@ -222,6 +222,12 @@ function startProcess() {
|
|||
case 'landing':
|
||||
TABS.landing.initialize(content_ready);
|
||||
break;
|
||||
case 'changelog':
|
||||
TABS.staticTab.initialize('changelog', content_ready);
|
||||
break;
|
||||
case 'privacy_policy':
|
||||
TABS.staticTab.initialize('privacy_policy', content_ready);
|
||||
break;
|
||||
case 'firmware_flasher':
|
||||
TABS.firmware_flasher.initialize(content_ready);
|
||||
break;
|
||||
|
|
|
@ -12,46 +12,6 @@ TABS.landing.initialize = function (callback) {
|
|||
// translate to user-selected language
|
||||
i18n.localizePage();
|
||||
|
||||
// load changelog content
|
||||
$('#changelog .log').load('./changelog.html');
|
||||
|
||||
/** changelog trigger **/
|
||||
$("#changelog_toggle").on('click', function() {
|
||||
var state = $(this).data('state2');
|
||||
if (state) {
|
||||
$("#changelog").animate({right: -245}, 200, function () {
|
||||
$("#content").removeClass('log_open');
|
||||
});
|
||||
state = false;
|
||||
} else {
|
||||
$("#changelog").animate({right: 0}, 200);
|
||||
$("#content").addClass('log_open');
|
||||
state = true;
|
||||
}
|
||||
$(this).text(state ? i18n.getMessage('close') : i18n.getMessage('defaultChangelogAction'));
|
||||
$(this).data('state2', state);
|
||||
});
|
||||
|
||||
// load privacy policy content
|
||||
$('#privacy_policy .policy').load('./tabs/privacy_policy.html');
|
||||
|
||||
/** changelog trigger **/
|
||||
$("#privacy_policy_toggle").on('click', function() {
|
||||
var state = $(this).data('state2');
|
||||
if (state) {
|
||||
$("#privacy_policy").animate({right: -495}, 200, function () {
|
||||
$("#content").removeClass('policy_open');
|
||||
});
|
||||
state = false;
|
||||
} else {
|
||||
$("#privacy_policy").animate({right: 0}, 200);
|
||||
$("#content").addClass('policy_open');
|
||||
state = true;
|
||||
}
|
||||
$(this).text(state ? i18n.getMessage('close') : i18n.getMessage('defaultPrivacyPolicyAction'));
|
||||
$(this).data('state2', state);
|
||||
});
|
||||
|
||||
GUI.content_ready(callback);
|
||||
});
|
||||
|
||||
|
|
21
src/js/tabs/static_tab.js
Normal file
21
src/js/tabs/static_tab.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
TABS.staticTab = {};
|
||||
TABS.staticTab.initialize = function (staticTabName, callback) {
|
||||
var self = this;
|
||||
|
||||
if (GUI.active_tab != staticTabName) {
|
||||
GUI.active_tab = staticTabName;
|
||||
}
|
||||
var tabFile = "./tabs/" + staticTabName + ".html";
|
||||
|
||||
$('#content').html('<div id="tab-static"><div id="tab-static-contents"></div>');
|
||||
$('#tab-static-contents').load(tabFile, function () {
|
||||
// translate to user-selected language
|
||||
i18n.localizePage();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
});
|
||||
|
||||
};
|
||||
// Just noting that other tabs have cleanup functions.
|
Loading…
Add table
Add a link
Reference in a new issue