Skip to content

Commit 48ba07d

Browse files
authored
Update page-mailto-generator.php
Wrap output in a IIFE to avoid redecleration of the UnCryptMailto function.
1 parent 6e247b1 commit 48ba07d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/templates/page-mailto-generator.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@
4545
addressOutput = addressOutput.slice(0, -1);
4646

4747
output.value = `\<script\>
48-
let UnCryptMailto = (s) => s.split(';').map((c) => String.fromCharCode(parseInt(c))).join('');
49-
document.write('<a href="mailto:' + UnCryptMailto('${addressOutput}') + '">' + UnCryptMailto('${addressOutput}') + '</a>')
50-
\<\/script\>`;
48+
(function() {
49+
let UnCryptMailto = (s) => s.split(';').map((c) => String.fromCharCode(parseInt(c))).join('');
50+
document.write('<a href="mailto:' + UnCryptMailto('${addressOutput}') + '">' + UnCryptMailto('${addressOutput}') + '</a>')
51+
\<\/script\>
52+
})();`;
53+
5154
});
5255
</script>
5356

0 commit comments

Comments
 (0)