Turning Bookmarklet into a function

… so it can be included and reused in other contexts (eg: extensions as
part of the registered background process)