614 lines
24 KiB
HTML
614 lines
24 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<title>One Sky IT</title>
|
|
|
|
<link rel="shortcut icon" type="image/png" href="img/favicon.ico">
|
|
|
|
<!-- Cascading Style Sheets (CSS) start -->
|
|
<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/materia/bootstrap.min.css" rel="stylesheet" integrity="sha384-1tymk6x9Y5K+OF0tlmG2fDRcn67QGzBkiM3IgtJ3VrtGrIi5ryhHjKjeeS60f1FA" crossorigin="anonymous">
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.10.2/css/all.css">
|
|
|
|
<!-- One Sky IT default custom Cascading Style Sheets (CSS) -->
|
|
|
|
<!-- One Sky IT site custom Cascading Style Sheets (CSS) -->
|
|
<link rel="stylesheet" href="css/starter-template.css">
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<link rel="stylesheet" href="css/native_app.css">
|
|
|
|
<style>
|
|
</style>
|
|
<!-- Cascading Style Sheets (CSS) end -->
|
|
|
|
<!-- JavaScript (JS) start -->
|
|
|
|
<!-- JavaScript (JS) end -->
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!--<main id="main_content" role="main" class="container">-->
|
|
<div id="main_content" class="container w-100">
|
|
|
|
<!--
|
|
<div class="row no-gutters">
|
|
<div id="launcher_title" class="launcher_title border-bottom">Please wait while the data is checked and files are cached.</div>
|
|
</div>
|
|
-->
|
|
|
|
<div class="row no-gutters">
|
|
<div id="launcher_menu" class="launcher_menu col-3 border-right">
|
|
<div id="event_files_menu" class="event_files_menu d-none">
|
|
<h2>Event Files</h2>
|
|
<ul class="list-group list-group-flush event_files_list" role=""></ul>
|
|
</div>
|
|
<div id="location_files_menu" class="location_files_menu d-none">
|
|
<h2>Location Files</h2>
|
|
<ul class="list-group list-group-flush location_files_list event_files_list" role=""></ul>
|
|
</div>
|
|
<div id="sessions_menu" class="sessions_menu d-none">
|
|
<h2>Sessions</h2>
|
|
<ul class="list-group list-group-flush" role=""></ul>
|
|
</div>
|
|
<!--<div id="location_name" class="location_name"></div>-->
|
|
<div id="launcher_location_name" class="launcher_location_name">
|
|
<span id="location_name"></span><span id="event_name"></span>
|
|
</div>
|
|
<div id="reset1" class="btn btn-warning app_reset" data-spy="affix" data-offset-top="200" onclick="location.reload();">
|
|
<span class="fas fa-sync"></span> Reset Launcher
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="launcher_sessions" class="launcher_sessions col"></div> <!-- end location details div -->
|
|
</div> <!-- end row div -->
|
|
|
|
</div>
|
|
<!--</main>--> <!-- /.container -->
|
|
|
|
<div id="app_status_bar" class="app_status_bar">
|
|
<span id="app_network_status" class="app_network_status">
|
|
<span class="fas fa-globe"></span> Network Status
|
|
</span>
|
|
<span id="app_datetime" class="app_datetime">datetime</span>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- JavaScript (JS) start -->
|
|
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js" integrity="sha256-wCBClaCr6pJ7sGU5kfb3gQMOOcIZNzaWpWcj/lD9Vfk=" crossorigin="anonymous"></script>
|
|
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.15.3/axios.min.js" crossorigin></script>
|
|
|
|
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js" crossorigin></script>
|
|
|
|
<!--<script src="https://cdn.jsdelivr.net/npm/idb-keyval@3/dist/idb-keyval-iife.min.js"></script>-->
|
|
<!--<script src="https://unpkg.com/dexie@latest/dist/dexie.js"></script>-->
|
|
<script src="https://cdn.rawgit.com/mozilla/localForage/master/dist/localforage.js"></script>
|
|
|
|
<!--
|
|
Using node.js may require this: npm install jquery, add script below.
|
|
https://stackoverflow.com/questions/22658015/bootstrap-throws-uncaught-error-bootstraps-javascript-requires-jquery
|
|
-->
|
|
<!--
|
|
<script>
|
|
window.jQuery = window.$ = require('jquery');
|
|
</script>
|
|
-->
|
|
|
|
<!-- One Sky IT default custom JavaScript (JS) -->
|
|
|
|
<!-- One Sky IT site custom JavaScript (JS) -->
|
|
<script>const app = require('./js/module_app');</script>
|
|
<!--<script>const api = require('./js/module_api');</script>-->
|
|
<!--<script>const idb = require('./js/module_app_idb');</script>-->
|
|
<!--<script src="js/api.js"></script>-->
|
|
<script src="js/app_api.js"></script>
|
|
<script src="js/app_ui_misc.js"></script>
|
|
<script src="js/app_ui_sessions.js"></script>
|
|
<script src="js/app_ui_presentations.js"></script>
|
|
<script src="js/app_ui_presenters.js"></script>
|
|
<script src="js/app_ui_files.js"></script>
|
|
<!--<script src="js/testing.js"></script>-->
|
|
|
|
<script>
|
|
let app_config = app.load_config();
|
|
let account_id = app_config.account_id;
|
|
let event_id = app_config.event_id;
|
|
let event_location_id = app_config.event_location_id;
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
// Start of set display options
|
|
|
|
|
|
const display_session_codes = app_config.display_session_codes;
|
|
const display_session_badges = app_config.display_session_badges;
|
|
const display_presentation_codes = app_config.display_presentation_codes; // NOTE: not currently used
|
|
const display_presentation_badges = app_config.display_presentation_badges;
|
|
const display_presenter_codes = app_config.display_presenter_codes; // NOTE: not currently used
|
|
const display_presenter_badges = app_config.display_presenter_badges; // NOTE: not currently used
|
|
|
|
|
|
// End of set display options
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
// Start of API section
|
|
|
|
|
|
const api_token_loop_interval = app_config.api_token_loop_interval;
|
|
let api_update_period = app_config.idb_event_location_check_period;
|
|
let api_update_datetime = Date.now();
|
|
let waiting_on_api_token = false;
|
|
|
|
const secret_key = app_config.api_secret_key;
|
|
let api_temporary_token = null;
|
|
|
|
let api_base_url = null; // 'http://api.localhost:5001' 'https://api.oneskyit.com'
|
|
|
|
if (app_config.use_local_api) {
|
|
api_base_url = app_config.api_local_base_url; // 'http://api.localhost:5001'
|
|
} else {
|
|
api_base_url = app_config.api_remote_base_url; // 'https://api.oneskyit.com'
|
|
}
|
|
|
|
axios.defaults.baseURL = api_base_url;
|
|
axios.defaults.headers.post['Access-Control-Allow-Origin'] = app_config.access_control_allow_origin; // '*';
|
|
|
|
// Axios needs to authenticate first
|
|
let axios_headers_set = false;
|
|
|
|
let app_online = false;
|
|
let app_use_cached_data = true;
|
|
window.addEventListener('online', app.currently_online);
|
|
window.addEventListener('offline', app.currently_offline);
|
|
|
|
let update_event_ui = false;
|
|
let update_event_location_ui = false;
|
|
let update_event_session_ui = false;
|
|
let update_event_presentation_ui = false;
|
|
let update_event_presenter_ui = false;
|
|
let update_event_file_ui = false;
|
|
|
|
if (navigator.onLine) {
|
|
app.currently_online();
|
|
} else {
|
|
app.currently_offline();
|
|
|
|
console.log('Using cached IDB data.');
|
|
update_event_ui = true;
|
|
update_event_location_ui = true;
|
|
update_event_session_ui = true;
|
|
update_event_presentation_ui = true;
|
|
update_event_presenter_ui = true;
|
|
update_event_file_ui = true;
|
|
}
|
|
|
|
var api_token_loop = setInterval(async function() {
|
|
if (app_online && api_update_datetime < Date.now()) {
|
|
//let api_temporary_token_result = api_token_request_async(axios, secret_key)
|
|
api_temporary_token = await api_token_request_async(axios, secret_key)
|
|
.then(function (result) {
|
|
if (result) {
|
|
console.log('Setting temporary API token to axios Authorization header: '+result);
|
|
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
|
//api_temporary_token = result;
|
|
|
|
console.log('Axios headers have been set.');
|
|
axios_headers_set = true;
|
|
api_update_datetime = Date.now() + api_update_period;
|
|
return result;
|
|
} else {
|
|
console.log('The temporary API token appears to have failed. Are we actually online? Setting the app to offline mode.');
|
|
console.log(navigator.onLine);
|
|
app.currently_offline();
|
|
return false;
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
console.log('Something went wrong while trying to request a temporary API token.');
|
|
console.log(error);
|
|
return false;
|
|
});
|
|
} else if (app_online) {
|
|
//console.log('Currently online, but not asking for a new temporary token yet.');
|
|
} else {
|
|
console.log('Currently offline. Can not request a new temporary API token.');
|
|
}
|
|
}, api_token_loop_interval);
|
|
|
|
|
|
// End of API section
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
// Start of IDB section
|
|
|
|
|
|
let idb_name = app_config.idb_name;
|
|
|
|
if (window.indexedDB) {
|
|
console.log('IndexedDB is supported');
|
|
} else {
|
|
console.log('IndexedDB is NOT supported');
|
|
close();
|
|
}
|
|
|
|
var tbl_event = null;
|
|
var tbl_event_location = null;
|
|
var tbl_event_session = null;
|
|
var tbl_event_presentation = null;
|
|
var tbl_event_presenter = null;
|
|
var tbl_event_file = null;
|
|
var tbl_hosted_file = null;
|
|
|
|
var tbl_event_key_count = null;
|
|
var tbl_event_location_key_count = null;
|
|
var tbl_event_session_key_count = null;
|
|
var tbl_event_presentation_key_count = null;
|
|
var tbl_event_presenter_key_count = null;
|
|
var tbl_event_file_key_count = null;
|
|
var tbl_hosted_file_key_count = null;
|
|
|
|
localforage.config({
|
|
driver: localforage.INDEXEDDB,
|
|
version: 1,
|
|
name: idb_name
|
|
});
|
|
|
|
var tbl_event = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event',
|
|
});
|
|
tbl_event.length().then(function(key_count) {
|
|
console.log('tbl_event count: '+key_count);
|
|
tbl_event_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
var tbl_event_location = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event_location',
|
|
});
|
|
tbl_event_location.length().then(function(key_count) {
|
|
console.log('tbl_event_location count: '+key_count);
|
|
tbl_event_location_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
var tbl_event_session = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event_session',
|
|
});
|
|
tbl_event_session.length().then(function(key_count) {
|
|
console.log('tbl_event_session count: '+key_count);
|
|
tbl_event_session_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
var tbl_event_presentation = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event_presentation',
|
|
});
|
|
tbl_event_presentation.length().then(function(key_count) {
|
|
console.log('tbl_event_presentation_key_count count: '+key_count);
|
|
tbl_event_presentation_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
var tbl_event_presenter = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event_presenter',
|
|
});
|
|
tbl_event_presenter.length().then(function(key_count) {
|
|
console.log('tbl_event_presenter count: '+key_count);
|
|
tbl_event_presenter_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
var tbl_event_file = localforage.createInstance({
|
|
name: idb_name,
|
|
storeName: 'event_file',
|
|
});
|
|
tbl_event_file.length().then(function(key_count) {
|
|
console.log('tbl_event_file count: '+key_count);
|
|
tbl_event_file_key_count = key_count;
|
|
}).catch(function(err) {
|
|
console.log(err);
|
|
});
|
|
|
|
const open_tables_loop_interval = 10; // only runs briefly on start up
|
|
|
|
const update_idb_loop_interval = app_config.update_idb_loop_interval; // loop forever
|
|
//const update_render_loop_interval = 10000; // loop forever; only run when the launcher object is safe
|
|
|
|
// IDB tables need to be opened
|
|
let idb_tables_opened = false;
|
|
|
|
// check periods and datetimes for update_idb_loop
|
|
let idb_event_check_period = app_config.idb_event_check_period;
|
|
let idb_event_check_datetime = Date.now();
|
|
let idb_event_location_check_period = app_config.idb_event_location_check_period;
|
|
let idb_event_location_check_datetime = Date.now();
|
|
let idb_event_session_check_period = app_config.idb_event_session_check_period;
|
|
let idb_event_session_check_datetime = Date.now();
|
|
let idb_event_presentation_check_period = app_config.idb_event_presentation_check_period;
|
|
let idb_event_presentation_check_datetime = Date.now();
|
|
let idb_event_presenter_check_period = app_config.idb_event_presenter_check_period;
|
|
let idb_event_presenter_check_datetime = Date.now();
|
|
|
|
let idb_event_file_check_period = app_config.idb_event_file_check_period;
|
|
let idb_event_file_check_datetime = Date.now();
|
|
|
|
|
|
let run_update_idb = false;
|
|
let run_check_file_cache = false;
|
|
|
|
let looping_tbl_event = false;
|
|
let looping_tbl_event_location = false;
|
|
let looping_tbl_event_session = false;
|
|
let looping_tbl_event_presentation = false;
|
|
let looping_tbl_event_presenter = false;
|
|
let looping_tbl_event_file = false;
|
|
|
|
let idb_tables_have_records = false;
|
|
|
|
var open_tables_loop = setInterval(async function() {
|
|
if (tbl_event && tbl_event_location && tbl_event_session
|
|
&& tbl_event_presentation && tbl_event_presenter
|
|
&& tbl_event_file) {
|
|
console.log('IDB tables have now been opened.');
|
|
idb_tables_opened = true;
|
|
|
|
clearInterval(open_tables_loop);
|
|
|
|
console.log('Attempting to use cached IDB data...');
|
|
|
|
console.log('table record counts: '+tbl_event_key_count+' | '+tbl_event_location_key_count+' | '+tbl_event_session_key_count
|
|
+' | '+tbl_event_presentation_key_count+' | '+tbl_event_presenter_key_count
|
|
+' | '+tbl_event_file_key_count);
|
|
|
|
if (tbl_event_key_count
|
|
&& tbl_event_location_key_count
|
|
&& tbl_event_session_key_count
|
|
&& tbl_event_presentation_key_count
|
|
&& tbl_event_presenter_key_count
|
|
&& tbl_event_file_key_count) {
|
|
|
|
|
|
|
|
let render_event_records_result = render_event_records();
|
|
//setTimeout(async function(){ let render_event_records_result = await render_event_records(); }, 500);
|
|
let render_event_location_records_result = render_event_location_records();
|
|
//setTimeout(async function(){ let render_event_location_records_result = await render_event_location_records(); }, 1000);
|
|
let render_event_session_records_result = render_event_session_records()
|
|
.then(async function (result) {
|
|
console.log('Rendering session records has finished. Moving to other records.');
|
|
console.log(result);
|
|
let render_event_presentation_records_result = await render_event_presentation_records();
|
|
let render_event_presenter_records_result = await render_event_presenter_records();
|
|
let render_event_file_records_result = await render_event_file_records();
|
|
})
|
|
.catch(function (error) {
|
|
console.log('Something went wrong rendering session records.');
|
|
console.log(error);
|
|
});
|
|
} else {
|
|
console.log('One or more of the IDB tables has 0 records.');
|
|
}
|
|
} else {
|
|
console.log('IDB tables have not yet been created or opened.');
|
|
|
|
idb_tables_opened = false;
|
|
}
|
|
}, open_tables_loop_interval);
|
|
|
|
var update_idb_loop = setInterval(async function() {
|
|
//console.log('FLAG: axios_headers_set='+axios_headers_set);
|
|
//console.log('FLAG: idb_tables_opened='+idb_tables_opened);
|
|
|
|
if (app_online && axios_headers_set && idb_tables_opened) {
|
|
if (idb_event_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check events * ** *** ****');
|
|
let v2_account_events = await v2_get_account_events(axios, account_id)
|
|
.then(function (response) {
|
|
for (var i in response) {
|
|
tbl_event.setItem(response[i].id.toString(), response[i]);
|
|
}
|
|
idb_event_check_datetime = Date.now() + idb_event_check_period;
|
|
let render_event_records_result = render_event_records(); // NOTE: v2 idb to ui
|
|
//update_event_ui = true;
|
|
})
|
|
.catch(function (error) {
|
|
console.log('Trying to check events. Something went wrong. Expired token?');
|
|
console.log(error);
|
|
});
|
|
|
|
}
|
|
|
|
if (idb_event_location_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check event locations * ** *** ****');
|
|
let v2_event_locations = await v2_get_event_locations(axios, event_id);
|
|
for (var i in v2_event_locations) {
|
|
tbl_event_location.setItem(v2_event_locations[i].id.toString(), v2_event_locations[i]);
|
|
}
|
|
idb_event_location_check_datetime = Date.now() + idb_event_location_check_period;
|
|
let render_event_location_records_result = render_event_location_records(); // NOTE: v2 idb to ui
|
|
//update_event_location_ui = true;
|
|
}
|
|
|
|
if (idb_event_session_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check event sessions * ** *** ****'); // All event sessions, not just location specific.
|
|
let v2_event_sessions = await v2_get_event_sessions(axios, event_id); // Was v2_get_event_location_sessions
|
|
//tbl_event_session.clear();
|
|
for (var i in v2_event_sessions) {
|
|
tbl_event_session.setItem(v2_event_sessions[i].id.toString(), v2_event_sessions[i]);
|
|
}
|
|
idb_event_session_check_datetime = Date.now() + idb_event_session_check_period;
|
|
let render_event_session_records_result = render_event_session_records(); // NOTE: v2 idb to ui
|
|
//update_event_session_ui = true;
|
|
}
|
|
|
|
if (idb_event_presentation_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check event location presentations * ** *** ****');
|
|
let v2_event_presentations = await v2_get_event_location_presentations(axios, event_location_id);
|
|
for (var i in v2_event_presentations) {
|
|
tbl_event_presentation.setItem(v2_event_presentations[i].id.toString(), v2_event_presentations[i]);
|
|
}
|
|
idb_event_presentation_check_datetime = Date.now() + idb_event_presentation_check_period;
|
|
let render_event_presentation_records_result = await render_event_presentation_records(); // NOTE: v2 idb to ui
|
|
//update_event_presentation_ui = true;
|
|
}
|
|
|
|
if (idb_event_presenter_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check event location presenters * ** *** ****');
|
|
let v2_event_presenters = await v2_get_event_location_presenters(axios, event_location_id);
|
|
for (var i in v2_event_presenters) {
|
|
tbl_event_presenter.setItem(v2_event_presenters[i].id.toString(), v2_event_presenters[i]);
|
|
}
|
|
idb_event_presenter_check_datetime = Date.now() + idb_event_presenter_check_period;
|
|
|
|
let render_event_presenter_records_result = await render_event_presenter_records(); // NOTE: v2 idb to ui
|
|
//update_event_presenter_ui = true;
|
|
}
|
|
|
|
if (idb_event_file_check_datetime < Date.now()) {
|
|
console.log('**** *** ** * Time to check event location files * ** *** ****');
|
|
|
|
let v2_event_files = await v2_get_event_files(axios, event_id);
|
|
for (var i in v2_event_files) {
|
|
tbl_event_file.setItem(v2_event_files[i].id.toString(), v2_event_files[i]);
|
|
}
|
|
|
|
let v2_event_location_files = await v2_get_event_location_files(axios, event_location_id);
|
|
for (var i in v2_event_location_files) {
|
|
tbl_event_file.setItem(v2_event_location_files[i].id.toString(), v2_event_location_files[i]);
|
|
}
|
|
|
|
let v2_event_location_files_sessions = await v2_get_event_location_files_sessions(axios, event_location_id);
|
|
for (var i in v2_event_location_files_sessions) {
|
|
tbl_event_file.setItem(v2_event_location_files_sessions[i].id.toString(), v2_event_location_files_sessions[i]);
|
|
}
|
|
|
|
let v2_event_location_files_presentations = await v2_get_event_location_files_presentations(axios, event_location_id);
|
|
for (var i in v2_event_location_files_presentations) {
|
|
tbl_event_file.setItem(v2_event_location_files_presentations[i].id.toString(), v2_event_location_files_presentations[i]);
|
|
}
|
|
|
|
let v2_event_location_files_presenters = await v2_get_event_location_files_presenters(axios, event_location_id);
|
|
for (var i in v2_event_location_files_presenters) {
|
|
tbl_event_file.setItem(v2_event_location_files_presenters[i].id.toString(), v2_event_location_files_presenters[i]);
|
|
}
|
|
|
|
//run_check_file_cache = true; // Set to true so that the local file cache will be checked against the updated event files
|
|
idb_event_file_check_datetime = Date.now() + idb_event_file_check_period;
|
|
|
|
let render_event_file_records_result = await render_event_file_records(); // NOTE: v2 idb to ui
|
|
|
|
let check_file_cache_result = app.check_file_cache()
|
|
.then(function (result) {
|
|
if (result) {
|
|
console.log('Cached files have now been updated.');
|
|
} else {
|
|
console.log('Cached files were not updated.');
|
|
}
|
|
|
|
});
|
|
|
|
|
|
//update_event_file_ui = true;
|
|
}
|
|
|
|
} else if (app_online && idb_tables_opened && !axios_headers_set) {
|
|
console.log('Online and waiting for the Axios headers to be set.');
|
|
} else if (app_online && axios_headers_set && !idb_tables_opened) {
|
|
console.log('Online and Axios headers are set. Waiting for the IDB tables to be opened');
|
|
} else if (!app_online) {
|
|
console.log('Waiting to update IDB once online.');
|
|
} else {
|
|
console.log('This should not happen.');
|
|
}
|
|
}, update_idb_loop_interval);
|
|
|
|
|
|
// End of IDB section
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
// Start of cached file section
|
|
|
|
|
|
const check_file_cache_loop_interval = app_config.check_file_cache_loop_interval; // loop forever; only run after the event_file table has updated
|
|
const update_render_loop_interval = app_config.update_render_loop_interval; // loop forever
|
|
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/'
|
|
|
|
var check_file_cache_loop = setInterval(async function() {
|
|
if (run_check_file_cache) {
|
|
console.log('FLAG: check_file_cache='+run_check_file_cache);
|
|
check_file_cache_result = app.check_file_cache();
|
|
|
|
check_file_cache_result.then(function (response) {
|
|
console.log('Cached files have now been updated.');
|
|
});
|
|
run_check_file_cache = false;
|
|
} else {
|
|
//console.log('Flag to run check_file_cache is set to false');
|
|
}
|
|
}, check_file_cache_loop_interval);
|
|
|
|
|
|
// End of cached file section
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
var check_initial_online_status = setInterval(async function() {
|
|
console.log('check_initial_online_status online check?');
|
|
console.log(navigator.onLine);
|
|
if (navigator.onLine) {
|
|
app.currently_online();
|
|
|
|
} else {
|
|
app.currently_offline();
|
|
|
|
console.log('Using cached IDB data.');
|
|
|
|
update_event_ui = true;
|
|
update_event_location_ui = true;
|
|
update_event_session_ui = true;
|
|
update_event_presentation_ui = true;
|
|
update_event_presenter_ui = true;
|
|
update_event_file_ui = true;
|
|
|
|
}
|
|
clearInterval(check_initial_online_status);
|
|
}, 500);
|
|
|
|
|
|
|
|
let status_clock = setInterval(function() {
|
|
//https://date-fns.org/v1.30.1/docs/format
|
|
let datetime_string = dateFns.format(new Date(), 'dddd, Do h:mm:ss A'); //dddd, Do hh:mm:ss A
|
|
document.getElementById('app_datetime').innerHTML = datetime_string;
|
|
}, 1000);
|
|
|
|
|
|
</script>
|
|
|
|
<!-- <script src="js/launcher.js"></script>-->
|
|
<!-- JavaScript (JS) end -->
|
|
|
|
</body>
|
|
</html>
|