Compatibility fixes for Greasemonkey v2.

- add `@grant`
- export function which is referred from page context