так явно короче:
```js
function openPopupFromLink(link) { 
    document.getElementsByClassName('content')[0].appendChild(
        createPopup(
            link.getAttribute('data-title'),
            link.getAttribute('data-message').replace(/%s/, link),
            function() { document.location.href = link; }
        )
    );
}
```