Carey Metcalfe | ed3a552 | 2016-03-12 14:14:30 -0500 | [diff] [blame] | 1 | // Unmangle email addresses on page load |
| 2 | |
| 3 | function unmangleEmail(){ |
| 4 | var e = document.querySelectorAll(".email"); |
| 5 | for (var i = 0; i < e.length; i++) { |
| 6 | var email = e[i].getAttribute("data-email") |
| 7 | var title = e[i].getAttribute("data-title") |
| 8 | if (email){ |
| 9 | e[i].href = email.split("").reverse().join(""); |
| 10 | e[i].removeAttribute("data-email"); |
| 11 | e[i].removeAttribute("data-title"); |
| 12 | e[i].removeAttribute("class"); |
| 13 | if (title){ |
| 14 | e[i].setAttribute("title", title); |
| 15 | } |
| 16 | else{ |
| 17 | e[i].removeAttribute("title"); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | } |