A general approach to D-optimal designs for weighted univariate polynomial regression models