GlobalOption "Hide aircraft not on map" does not work

Are you having problems with using or developing a plugin? Let me know here.
Post Reply
rdjsb
Posts: 11
Joined: Mon Nov 25, 2013 11:16 am

GlobalOption "Hide aircraft not on map" does not work

Post by rdjsb » Sat Dec 16, 2017 11:11 pm

Hello,

I want to do 2 things via a Script and it does not work :
1) I am trying to enable te checkbox "Hide aircraft not on map" by default in the configuration menu.
2) I also want to hide this checkbox in the configuration menu, so this checkbox can not be unchecked.

The following script is running, but the checkbox is still visible in the configuration menu and the Aircraft not on the map are still shown in the list. The checkbox "Hide aircraft not on map" is not checked by the script.
What am I doing wrong? Or what's wrong in my script?

Code: Select all

<script type="text/javascript">
    if(VRS && VRS.globalDispatch && VRS.serverConfig) {
        VRS.globalDispatch.hook(VRS.globalEvent.bootstrapCreated, function(bootStrap) {
            // This will run once, just after the server configuration has been loaded
            // but before any of the JavaScript objects are initialised.
            // ADD YOUR CONTENT AFTER THIS LINE
            VRS.globalOptions.aircraftListHideAircraftNotOnMap = true;
        });
    }
</script>
My plugin is configured the right way, because when I replace
VRS.globalOptions.aircraftListHideAircraftNotOnMap = true;
with
alert('It worked!');
The script displays the alert box with the text 'It worked!'

So it looks like the global option "aircraftListHideAircraftNotOnMap" does not what it supposed to do.
I hope someone can help.

PS: I have the latest preview version installed.

Regards,
Roland

agw
Posts: 1970
Joined: Fri Feb 17, 2012 3:20 am

Re: GlobalOption "Hide aircraft not on map" does not work

Post by agw » Fri Jan 19, 2018 11:31 pm

Sorry for the delay in replying.

Looking at the source I think the option is only used to supply the default setting for the checkbox. Once you've viewed the site and saved your own settings it'll be ignored, it'll use whatever settings were saved. I think this predates the addition of the Initial Settings feature, nowadays I wouldn't have global options to set initial states.

I think the way it's working at the moment is misleading. Initial Settings is a better way of doing what this flag is trying to do and it doesn't require custom scripts, and the hideAircraftOnMap global option does give the impression that it'll do what you thought it would do... so I think it's probably best if I just change the code so that if you set the flag to true then it'll hide aircraft that aren't on the map and remove the GUI for it. I'll add it to the list.

Post Reply