bit of reformatting of js code and clarifying of inline variable declarations
added a barebones text input directive