Refactor basic PubSubHub JavaScript code