
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
    module.exports = ltriToUrl;
}

/**
 * Translate an LTRI to a URL
 *
 * @param {string} url  LTRI or URL
 * @return {string}
 */
function ltriToUrl(url) {
    if (url.match(/^https?:\/\//)) return url;

    var baseElement = document.querySelector('head base');
    var base = baseElement ? baseElement.getAttribute('href') : null;
    base = base || '/';

    var scheme = window.location.protocol + '//';
    var host = window.location.host;

    base = base.replace(/service\/[a-z]+\//, 'service/');

    if (!base.match(/^(https?:)?\/\//)) {
        base = host + '/' + base.replace(/^\//, '');
    }

    url = url.replace('lt:', '');
    var auth = url.match(/^[^:\/@]+:[^:\/@]+@/);
    if (auth) {
        url = url.replace(auth[0], '');
        base = auth[0] + base;
    }

    url = url.replace(/^([a-z]+):(\/)?/, function(match, resource) {
        var start = resource === 'external' ? host : base.replace(/\/$/, '');

        return scheme + start + '/' + resource + '/';
    });

    return url;
}

@@ -689,37 +689,215 @@
     
-url = url.replace('lt:', '');
+if (url.match('lt:')) %7B%0A        url = url.replace('lt:', '');%0A        %0A        if (typeof legalforms !== 'undefined') %7B%0A            host = legalforms.base_url.replace(/https?:%5C/%5C//, '');%0A        %7D%0A    %7D%0A    
 %0A   

Replace wordpress host with base_url from config