modgui.js refactor from mod-manager