Refactor webmentions JS