On application of a party or on the court's own motion, the court may restrain or otherwise control the conduct of a person if a petition has been filed under the Nebraska Juvenile Code and the court finds that such conduct is or may be detrimental or harmful to the juvenile. Notice of the application or motion and an opportunity to be heard thereon shall be given to the person against whom such application or motion is directed, except that the court may enter a temporary order restraining or otherwise controlling the conduct of a person for the protection of a juvenile without prior notice if it appears to the court that it is necessary to issue such order forthwith. Such temporary order shall be effective not to exceed ten days and shall not be binding against any person unless he or she has received a copy of such order. Any individual who violates an order restraining or otherwise controlling his or her conduct under this section shall be guilty of a Class II misdemeanor and may be proceeded against as described in sections 42-928 and 42-929.