Update directory.js

This is what i have as of today - i will keep working at it. i've realised it wont be as big as originally thought. it actually could be quite simple.