Fixed #364, #410.

#### Tasks

* `xxx.length === 0` to `!xxx.length`, `xxx.length > 0` to `xxx.length`
* Fixed #364 Extract commands from handler.
* Extract variables($window, $scrollbar) from local.
* Rename handler to sEvent.
* Fixed losing focus when dialog open and close. (Tested on Chrome, FF)
* Fixed #410. Create a new link when there is no anchor on range.