PageSourceSearch

https://www.pioneerdriverseducation.com/clibs/js/email_obfuscate.js

js pioneerdriverseducation.com collected 2026-10-04 17:47:59 UTC 2,831 bytes, 113 lines download raw bytes

1//****************************************
2// Email Obfuscator
3// <a href="/" data-mail="box | domain | tld | subject | body"></a>
4//****************************************
5
6(function()
7{
8  var _mail_links = document.querySelectorAll('a[data-mail]') || false;
9
10  if(_mail_links)
11  {
12    _mail_links.forEach(function(link)
13    {
14      // Don't set address if link content is not empty
15      if(link.innerHTML === '')
16      {
17        Mail_Set_Link_Content(link);
18      }
19      else if(/{mail}/.test(link.innerHTML))
20      {
21        Mail_Set_Link_Placeholder(link);
22      }
23
24      // Listen for link mouseover
25      link.addEventListener('mouseover', function(e)
26      {
27        e.preventDefault();
28        Mail_Set_HREF(this);
29      }, {once: true});
30
31      // Listen for link focus
32      link.addEventListener('focus', function(e)
33      {
34        e.preventDefault();
35        Mail_Set_HREF(this);
36      }, {once: true});
37    });
38  }
39
40  //****************************************
41  // Set link content
42  //****************************************
43
44  function Mail_Set_Link_Content(link)
45  {
46    var mail = Mail_Format_String(link);
47
48    if(mail.box && mail.dom && mail.tld)
49    {
50      link.innerHTML = mail.box + '@' + mail.dom + '.' + mail.tld;
51    }
52  }
53
54  //****************************************
55  // Set link placeholder
56  //****************************************
57
58  function Mail_Set_Link_Placeholder(link)
59  {
60    var mail = Mail_Format_String(link);
61
62    if(mail.box && mail.dom && mail.tld)
63    {
64      link.innerHTML = link.innerHTML.replace(/{mail}/, mail.box + '@' + mail.dom + '.' + mail.tld);
65    }
66  }
67
68  //****************************************
69  // Set email href
70  //****************************************
71
72  function Mail_Set_HREF(link)
73  {
74    var mail = Mail_Format_String(link);
75
76    if(mail.box && mail.dom && mail.tld)
77    {
78      link.href = 'mailto:' + mail.box + '@' + mail.dom + '.' + mail.tld;
79
80      // Add subject if available
81      if(mail.sbj)
82      {
83        link.href += '?subject=' + mail.sbj;
84      }
85
86      // Add body if available
87      if(mail.bod)
88      {
89        link.href += '&body=' + mail.bod;
90      }
91    }
92  }
93
94  //****************************************
95  // Format mail string
96  //****************************************
97
98  function Mail_Format_String(link)
99  {
100    var mail = link.dataset.mail.split('|');
101
102    var formatted_mail = {
103      'box': ((mail.length > 0) ? mail[0].trim() : ''),
104      'dom': ((mail.length > 1) ? mail[1].trim() : ''),
105      'tld': ((mail.length > 2) ? mail[2].trim() : ''),
106      'sbj': ((mail.length > 3) ? mail[3].trim() : ''),
107      'bod': ((mail.length > 4) ? mail[4].trim() : '')
108    };
109
110    return formatted_mail;
111  }
112
113})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.