Batch editing for scene and layouts

Is there a faster way to do this?

If not, there should be, like checking what scenes and layouts I want this script to work and apply it to all of them. This may looks like its not much work, but the site its planned to grow into 10 more scenes, and adding a new javascript or any new “on layout load” function on each one of the upcoming 60 layouts… i don’t want to think about it, but so far seems like its the only way its one by one.

We feel your pain David! Thanks for the feature request.

If you have a series of functions you need to run on each layout load, you can combine them into a single JavaScript function instead of nesting the same four functions as actions.

If you need to conditionally run certain functions in that master ‘sceneload’ function, you could use this syntax for individual layout sizes:

if (screen.width > 1300 && screen.width < 1900 ) {
// insert function here for the 1300 to 1900 sized layout here 

If you were to duplicate the scene you have with those ‘on layout load’ functions all setup, all the actions will carry over to your duplicated scene so you can avoid that tedium.

Hope that helps!

1 Like

Thanks, that’s really helpful, but I hope that a more visual way to do it will ever come to Hype, since many like me are not really good with code, for javascript functions I can understand how to work with your solution, but for other things it may not be as obvious for me.

A tab for “global” functions come to mind, since the code im inserting on all those layouts its the same one. Maybe Im not understanding how JS handle its functions, but Im have the feeling its not needed to be inserted on all those pages, but I may be wrong.

combine the scriptcalls in a custombehaviour, so you only have to do it once per scene layout … and changes would also be global

1 Like