Javascript for bookmarklet