mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-02 04:43:46 +01:00
20 lines
456 B
JavaScript
20 lines
456 B
JavaScript
|
/**
|
||
|
* @typedef {object} Replacement
|
||
|
* @property {string | RegExp} pattern
|
||
|
* @property {string} replacement
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @typedef {Array<Replacement>} Replacements
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @param {Document} content
|
||
|
* @param {Replacements} replacements
|
||
|
*/
|
||
|
module.exports = function (content, replacements) {
|
||
|
replacements.forEach(replacement => {
|
||
|
content.body.innerHTML = content.body.innerHTML.replaceAll(replacement.pattern, replacement.replacement);
|
||
|
});
|
||
|
};
|