Performance issue of custom javascript on master and layout slides

I discovered a strange behavior with the storyline output. I have a master-slide with a customized menu with 16 sub items. The menu uses a custom javascript for the navigation. The javascript of each sub item will be written in its own javascript function. So far so good. 

The master slide is used on every slide/page of my output. I have around 60 slides/pages so far in this projects. If I export my projects storyline creates for each slides which uses this master slide a new function for each sub item of the menu. 

Instead of having 16 sub functions I have 960 functions with exact the same code. This blows up my user.js file. The user.js file has 63125 lines if code. The file size is now already 2 mb. But I have to add several chapters which will have a similar amount of sub items. So at the end I have to expect a huge file size of 10 to 20 mb having a very repetitive code. 

The same problem exist with all my other custom javascript code on the master slide.

Is there a way to fix that? Any ideas for fixes/workarounds?

PS: I already put my code in a function, so that 960 storyline functions just have one line of code, calling my function.

3 Replies