Refactor itext.class.js