admin
4 days ago
check-email-front.js
4 days ago
check-email-front.min.js
4 days ago
network-admin.js
4 days ago
network-admin.min.js
4 days ago
check-email-front.js
59 lines
| 1 | function check_email_rot47(str) { |
| 2 | let rotated = ''; |
| 3 | for (let i = 0; i < str.length; i++) { |
| 4 | const charCode = str.charCodeAt(i); |
| 5 | if (charCode >= 33 && charCode <= 126) { |
| 6 | rotated += String.fromCharCode(33 + ((charCode + 14) % 94)); |
| 7 | } else { |
| 8 | rotated += str[i]; // Non-ROT47 characters remain unchanged |
| 9 | } |
| 10 | } |
| 11 | return rotated; |
| 12 | } |
| 13 | document.addEventListener("DOMContentLoaded", function() { |
| 14 | // functionality for rot13 |
| 15 | // this code for non-anchor email |
| 16 | if (checkemail_encoder_data.is_enable && checkemail_encoder_data.email_technique == 'rot_13') { |
| 17 | var emailLinks = document.querySelectorAll('.check-email-encoded-email'); |
| 18 | emailLinks.forEach(function(emailElement) { |
| 19 | var encodedEmail = emailElement.textContent; |
| 20 | var decodedEmail = encodedEmail.replace(/[a-zA-Z]/g, function(c) { |
| 21 | return String.fromCharCode( |
| 22 | (c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26 |
| 23 | ); |
| 24 | }); |
| 25 | emailElement.textContent = decodedEmail; |
| 26 | }); |
| 27 | // this code for anchor tag |
| 28 | document.querySelectorAll('a[href^="mailto:"]').forEach(function(emailElement) { |
| 29 | var encodedEmail = emailElement.getAttribute('href').replace('mailto:', ''); |
| 30 | var decodedEmail = encodedEmail.replace(/[a-zA-Z]/g, function(c) { |
| 31 | return String.fromCharCode( |
| 32 | (c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26 |
| 33 | ); |
| 34 | }); |
| 35 | // emailElement.textContent = decodedEmail; |
| 36 | emailElement.setAttribute('href', 'mailto:' + decodedEmail); |
| 37 | }); |
| 38 | } |
| 39 | if (checkemail_encoder_data.is_enable && checkemail_encoder_data.email_technique == 'rot_47') { |
| 40 | var emailLinks = document.querySelectorAll('.check-email-rot47-email'); |
| 41 | emailLinks.forEach(function(emailElement) { |
| 42 | var encodedEmail = emailElement.textContent; |
| 43 | const decodedEmail = check_email_rot47(encodedEmail); |
| 44 | emailElement.textContent = decodedEmail; |
| 45 | }); |
| 46 | |
| 47 | document.querySelectorAll('a[href^="mailto:"]').forEach(function(emailElement) { |
| 48 | var encodedEmail = emailElement.getAttribute('href').replace('mailto:', ''); |
| 49 | const decodedEmail = check_email_rot47(encodedEmail); |
| 50 | emailElement.setAttribute('href', 'mailto:' + decodedEmail); |
| 51 | }); |
| 52 | } |
| 53 | if (checkemail_encoder_data.is_enable && checkemail_encoder_data.email_technique == 'css_direction') { |
| 54 | // this code for anchor tag |
| 55 | document.querySelectorAll('a[href^="mailto:"]').forEach(function(encodedEmail) { |
| 56 | encodedEmail.setAttribute("style", "direction: ltr;"); |
| 57 | }); |
| 58 | } |
| 59 | }); |