}}}1 Event handlers {{{1
function removed() {  // {{{2
  if (O.ui.dialogs[O.ui.dialogs.length - 1] === this) {
    O.ui.dialogs.pop();

    if (this.lastHistory === O.ui.lastHistory) {
      history.back();
    }

    if (! O.ui.dialogs.length) {
      delete O.ui.dialogs;
    }
  }
}