Merge branch 'ent-7035-enlace-modulos-rotos-module-library' into 'develop'

Fixed module library download links

See merge request artica/pandorafms!3834
This commit is contained in:
Daniel Rodriguez 2021-04-06 16:56:37 +00:00
commit 6adc987f72

View File

@ -409,7 +409,7 @@ function print_excerpt(id_div, response) {
category_names(elem.categories) +
"</span></p>" +
updated +
elem.content.rendered +
format_download_link(elem.content.rendered) +
'<div class="view_web"><a href="' +
elem.link +
'" target="_blank"><button class="sub next">' +
@ -516,3 +516,14 @@ function show_error_msg(selector, message_error) {
$(selector).append("<div id='empty_result'>" + message_error + "</div>");
}
}
function format_download_link(html) {
const regex = /href="(?!\bhttps?:\/\/\b)(?!pandorafms.com)(.*)"/gm;
var str = html;
const subst = `href="https://pandorafms.com$1"`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
return result;
}