Deeper integration of undoTypes-"condition"-function

Instead of getting called from within the "on"-function, the
"condition"-function now gets called by the addToStack function. That
way its better suitable for custom undoTypes or changed undoTypes, as
the authors of these undoTypes don't have to manually integrate it into
their implementation.