From 675629dc14a1dd86d0e1897b9acdce929b024cef Mon Sep 17 00:00:00 2001 From: Taka Date: Sat, 20 Oct 2018 06:24:18 +0000 Subject: [PATCH] Changed when the default scenario is loaded during startup. --- vasl_templates/webapp/static/main.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 7dbd352..cdd4ec9 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -258,7 +258,6 @@ $(document).ready( function () { } } install_template_pack( data ) ; - do_on_new_scenario() ; gDefaultNationalities = $.extend( true, {}, data.nationalities ) ; // NOTE: If we are loading a user-defined template pack, then what we think // is the set of valid template ID's will depend on what's in it :-/ @@ -409,6 +408,14 @@ function update_page_load_status( id ) if ( id === "template-pack" ) $("fieldset[name='scenario']").fadeIn( 2*1000 ) ; + // check if the vehicle/ordnance listings have finished loading + if ( gPageLoadStatus.indexOf( "vehicle-listings" ) === -1 && gPageLoadStatus.indexOf( "ordnance-listings" ) === -1 ) { + // NOTE: If the default scanerio contains any vehicles or ordnance, it will look up the V/O listings, + // so we need to wait until those have arrived. Note that while the default scenario will normally + // be empty, having stuff in it is very useful during development. + do_on_new_scenario() ; + } + // check if the page has finished loading if ( gPageLoadStatus.length === 0 ) { // yup - update the UI