Update weather script.

Rename `element Id` and `elem` to `parentId` and `parent`.
Checked for parent existence before widget creation.
Update code style.