refactored to OOP

rewrote most of notepad.js to fit a more object-oriented (i.e.
extensible) model. everything seems to work nonetheless