added getopt.js, and migrate wrwd class to wrwd.js