File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 1- function jep_link ( domain , user ) {
2- const email = `${ user } @${ domain } ` ;
3- const mailto = `mailto:${ email } ` ;
4-
5- const encode = str => [ ...str ] . map ( c => `&#${ c . charCodeAt ( 0 ) } ;` ) . join ( '' ) ;
1+ /* jep.js - JavaScript Email Protection (JEP) */
62
7- const a = document . createElement ( "a" ) ;
8- a . setAttribute ( "href" , encode ( mailto ) ) ;
9- a . innerHTML = encode ( email ) ;
3+ function jep_link ( domain , user ) {
4+ // Create email string
5+ let email = `${ user } @${ domain } ` ;
6+
7+ // Obfuscate each character using HTML entity codes
8+ let encodedEmail = "" ;
9+ let encode = str => [ ...str ] . map ( c => `&#${ c . charCodeAt ( 0 ) } ;` ) . join ( '' ) ;
1010
11- // Append to a target container (like the calling script's parent)
12- const scriptEl = document . currentScript ;
13- scriptEl . parentNode . insertBefore ( a , scriptEl . nextSibling ) ;
11+ // Insert the obfuscated email link into the DOM
12+ document . write ( `<a href="${ encode ( mailto ) } ">${ encode ( email ) } </a>` ) ;
1413}
You can’t perform that action at this time.
0 commit comments