From 1c6abab9a8b0b12a2a380de7f67075a8cd11d3fd Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 12 Mar 2014 18:28:47 +0000 Subject: [PATCH] Fix link activation to be able to handle the same link (or email address) multiple times in the content --- etemplate/js/et2_core_common.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_core_common.js b/etemplate/js/et2_core_common.js index 1bffe9b871..1aa84864de 100644 --- a/etemplate/js/et2_core_common.js +++ b/etemplate/js/et2_core_common.js @@ -490,14 +490,15 @@ function et2_activateLinks(_content) } } - // Split the content string at the given position - var splitted = _content.split(_matches[0], 2); + // Split the content string at the given position(s) + // but we only handle the first occurence + var splitted = _content.split(_matches[0]); // Push the not-matched part if (splitted[0]) { // activate the links of the left string - arr = arr.concat(et2_activateLinks(splitted[0])); + arr = arr.concat(et2_activateLinks(splitted.shift())); } // Call the callback function which converts the matches into an object @@ -505,7 +506,7 @@ function et2_activateLinks(_content) _proc(_matches); // Set the new working string to the right part - _content = splitted[1]; + _content = splitted.join(_matches[0]); } }