Off- and online detection of dynamical phases in time series