“E”-ddress encoder


 



 

 

This page contains JavaScript that emulates an early version of the Hiveware/Hivelogic “Enkoder” program, one that ran on platforms other than Mac (current official — now server based — version here). This version emulates the simple XOR masking of the original; but I have modified the scripting so that it uses DOM manipulation, rather than document.write(), which makes it suitable for use in XHTML pages.

Enter your details in the text fields, and then hit “Go!” —

This generates a simple HTML page with scripting which can be used as a skeleton for your pages, like this (generated with the placeholder values actually as input):

<html><head>
<title>"E"-ddress encoder framework page</title>
</head><body>
<p id="mailtag">email &lt;at&gt; nowhere &lt;dot&gt; nil</p>
</body>
<script type="text/javascript">//<![CDATA[
/*jslint browser: true, bitwise: true, plusplus: true, indent: 2 */
(function() {
  "use strict";
  var data = [
      575, 563, 571, 574, 550, 573, 616, 567,
      575, 563, 571, 574, 530, 572, 573, 549,
      570, 567, 544, 567, 636, 572, 571, 574,
      621, 545, 551, 560, 568, 567, 561, 550,
      623, 518, 570, 571, 545, 631, 608, 610,
      575, 563, 571, 574, 631, 608, 610, 571,
      545, 631, 608, 610, 563, 560, 573, 551,
      550, 616, 594, 535, 575, 563, 571, 574,
      626, 575, 567, 627, 594, 567, 575, 563,
      571, 574, 622, 563, 550, 620, 572, 573,
      549, 570, 567, 544, 567, 622, 566, 573,
      550, 620, 572, 571, 574, 594
    ],
    idx = 0,
    a = document.createElement('a'),
    n = data[data.length - 1],
    mailtext = '',
    m = document.getElementById('mailtag');
  while (m.firstChild) { m.removeChild(m.firstChild); }
  while (data[idx] !== n) {mailtext += String.fromCharCode(data[idx++] ^ n); }
  idx++;
  a.setAttribute('href', mailtext);
  mailtext = '';
  while (data[idx] !== n) {mailtext += String.fromCharCode(data[idx++] ^ n); }
  idx++;
  a.setAttribute('title', mailtext);
  mailtext = '';
  while (data[idx] !== n) {mailtext += String.fromCharCode(data[idx++] ^ n); }
  idx++;
  a.appendChild(document.createTextNode(mailtext));
  m.appendChild(a);
}());
//]]></script></html>

The paragraph with the id attribute of mailtag is modified during the page load, to become:

<p id="mailtag">

    <a title="Email me!" href="mailto:email@nowhere.nil?subject=This+mail+is+about%3A"> email&lt;at&gt;nowhere&lt;dot&gt;nil </a>

</p>

The script section in the head should be lifted out into a separate .js file so that it can be referred to from every page, rather than bulking every page up.

The subject is optional and can be left blank, which than omits the “?subject=” clause from the mailto: URL.

The source for the script is here. You can save the page as “Web Page, complete” and run it in a browser locally.

[There's a somewhat modified version of the script actually in use in the site today.]