a javascript for the use with [jsui] in MAX

prko's icon

Dear users,

I have a algorithm for a hierarchal menu in max.
It is, however, very clumsy.
I think it would be better with a javascript.
However, I have no idea to program for the javascript.
Can anyone convert the following function for javascript for [jsui]?
It would be ok if the basic code is presented.

Max Patch
Copy patch and select New From Clipboard in Max.

Sincerely,
prko