mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-17 05:15:20 +03:00
Tab loading was relying on replacing the contents of '#content' with the loading indicator, then replacing it with the loading tab content and blocking rendering until the tab was ready by not yielding. This is problematic for tabs that load some data asynchronously, like PID and OSD. Instead, put the loading indicator in front of everything else and load new content inside '#content' next to the loading indicator (but without showing it). Once the content and data are fully loaded we fade out the loading indicator with a 0.4s long animation and then we remove. This works for both synchronous and asynchonous loading of tabs.
26 lines
597 B
JavaScript
26 lines
597 B
JavaScript
'use strict';
|
|
/*global $,TABS,GUI,googleAnalytics*/
|
|
|
|
TABS.landing = {};
|
|
TABS.landing.initialize = function (callback) {
|
|
|
|
if (GUI.active_tab != 'landing') {
|
|
GUI.active_tab = 'landing';
|
|
googleAnalytics.sendAppView('Landing');
|
|
}
|
|
|
|
GUI.load("./tabs/landing.html", function () {
|
|
localize();
|
|
|
|
$('.tab-landing a').click(function () {
|
|
googleAnalytics.sendEvent('ExternalUrls', 'Click', $(this).prop('href'));
|
|
});
|
|
|
|
GUI.content_ready(callback);
|
|
});
|
|
|
|
};
|
|
|
|
TABS.landing.cleanup = function (callback) {
|
|
if (callback) callback();
|
|
};
|