@@ -5,11 +5,11 @@ wmsx.Configurator = {
55 applyConfig : function ( then ) {
66 this . backupOriginalConfig ( ) ;
77
8- // Read URL parameters
9- if ( WMSX . ALLOW_URL_PARAMETERS ) this . parseURLParams ( ) ;
8+ // Process parameter overrides (including URL parameters)
9+ this . parseParams ( ) ;
1010
1111 // Process Config file if asked
12- if ( this . parameters . CONFIG_URL ) this . applyParam ( "CONFIG_URL" , this . parameters . CONFIG_URL ) ;
12+ if ( WMSX . params . CONFIG_URL ) this . applyParam ( "CONFIG_URL" , WMSX . params . CONFIG_URL ) ;
1313 if ( WMSX . CONFIG_URL ) this . readThenApplyConfigFile ( then ) ;
1414 else this . applyConfigDetails ( then ) ;
1515 } ,
@@ -32,11 +32,11 @@ wmsx.Configurator = {
3232 this . applyPresetsConfigModifications ( ) ;
3333
3434 // Define Machine
35- if ( this . parameters . MACHINE ) this . applyParam ( "MACHINE" , this . parameters . MACHINE ) ;
35+ if ( WMSX . params . MACHINE ) this . applyParam ( "MACHINE" , WMSX . params . MACHINE ) ;
3636 WMSX . MACHINE = WMSX . MACHINE . trim ( ) . toUpperCase ( ) ;
3737 if ( WMSX . MACHINE && ! WMSX . MACHINES_CONFIG [ WMSX . MACHINE ] ) return wmsx . Util . message ( "Invalid Machine: " + WMSX . MACHINE ) ;
3838 if ( ! WMSX . MACHINES_CONFIG [ WMSX . MACHINE ] || WMSX . MACHINES_CONFIG [ WMSX . MACHINE ] . AUTO_TYPE ) WMSX . MACHINE = this . detectDefaultMachine ( ) ;
39- delete this . parameters . MACHINE ;
39+ delete WMSX . params . MACHINE ;
4040
4141 // Apply all parameters from Machine, Presets and Single Parameters from URL
4242 this . applyFinalConfig ( ) ;
@@ -58,8 +58,8 @@ wmsx.Configurator = {
5858 this . applyPresets ( WMSX . MACHINES_CONFIG [ WMSX . MACHINE ] . PRESETS ) ;
5959 // Apply additional Presets over Machine configuration
6060 this . applyPresets ( WMSX . PRESETS ) ;
61- // Apply additional Single Parameters from URL
62- for ( var par in this . parameters ) this . applyParam ( par , this . parameters [ par ] ) ;
61+ // Apply additional Single Parameters overrides (including URL parameters)
62+ for ( var par in WMSX . params ) this . applyParam ( par , WMSX . params [ par ] ) ;
6363 // Ensure the correct types of the parameters after all settings applied
6464 this . normalizeParameterTypes ( ) ;
6565 } ,
@@ -97,11 +97,11 @@ wmsx.Configurator = {
9797 } ,
9898
9999 applyPresetsConfigModifications : function ( ) {
100- if ( this . parameters . PRESETS ) this . applyParam ( "PRESETS" , this . parameters . PRESETS ) ;
101- delete this . parameters . PRESETS ;
100+ if ( WMSX . params . PRESETS ) this . applyParam ( "PRESETS" , WMSX . params . PRESETS ) ;
101+ delete WMSX . params . PRESETS ;
102102
103103 // Apply Presets modifications
104- for ( var p in this . parameters ) if ( wmsx . Util . stringStartsWith ( p , "PRESETS_CONFIG" ) ) this . applyParam ( p , this . parameters [ p ] ) ;
104+ for ( var p in WMSX . params ) if ( wmsx . Util . stringStartsWith ( p , "PRESETS_CONFIG" ) ) this . applyParam ( p , WMSX . params [ p ] ) ;
105105
106106 // Apply Alternate Slot Config Preset if asked (special case, also modifies other presets)
107107 if ( ( WMSX . PRESETS || "" ) . toUpperCase ( ) . indexOf ( "ALTSLOTCONFIG" ) < 0 ) return ;
@@ -121,14 +121,21 @@ wmsx.Configurator = {
121121 this . applyConfigDetails ( then ) ;
122122 } ,
123123
124- parseURLParams : function ( ) {
125- var search = ( window . location . search || "" ) . split ( '+' ) . join ( ' ' ) ;
126- var reg = / [ ? & ] ? ( [ ^ = ] + ) = ( [ ^ & ] * ) / g;
127- var tokens ;
128- while ( tokens = reg . exec ( search ) ) {
129- var parName = decodeURIComponent ( tokens [ 1 ] ) . trim ( ) . toUpperCase ( ) ;
130- parName = wmsx . Configurator . abbreviations [ parName ] || parName ;
131- this . parameters [ parName ] = decodeURIComponent ( tokens [ 2 ] ) . trim ( ) ;
124+ parseParams : function ( ) {
125+ if ( WMSX . ALLOW_URL_PARAMETERS ) {
126+ var search = ( window . location . search || "" ) . split ( '+' ) . join ( ' ' ) ;
127+ var reg = / [ ? & ] ? ( [ ^ = ] + ) = ( [ ^ & ] * ) / g;
128+ var tokens ;
129+ while ( tokens = reg . exec ( search ) )
130+ WMSX . params [ decodeURIComponent ( tokens [ 1 ] ) . trim ( ) . toUpperCase ( ) ] = decodeURIComponent ( tokens [ 2 ] ) . trim ( ) ;
131+ }
132+ // Replace abbreviations
133+ for ( var parName in WMSX . params ) {
134+ var newName = wmsx . Configurator . abbreviations [ parName ] ;
135+ if ( newName ) {
136+ WMSX . params [ newName ] = WMSX . params [ parName ] ;
137+ delete WMSX . params [ parName ] ;
138+ }
132139 }
133140 } ,
134141
@@ -385,8 +392,6 @@ wmsx.Configurator = {
385392
386393 originalConfig : { } ,
387394
388- parameters : { } ,
389-
390395 abbreviations : {
391396 E : "ENVIRONMENT" ,
392397 ENV : "ENVIRONMENT" ,
0 commit comments