I can do with pure js. Do you want?
Something very simple , 100% compatible with any browser.
var number = getDocumentById("input")
var folder = ////slice number
Then some function calling https//...../folder/number
I know nothing about this, so I can't really judge if this is good or not.
I Will make it and I will post the link here in the next few days.
I think it will do what you are expecting