Fix working with Tampermonkey

Tampermonkey and greasemonkey don't put functions you define into the
document, so clicking the button gave a function not found error.