A father did not commit either criminal contempt or stalking when he wrote disparagingly about the mother of his two children on Facebook, a judge has ruled.