email: Update script to HTML5.
3 files changed, 16 insertions(+), 47 deletions(-)

M contributing/index.php
M index.php
M js/email.js
M contributing/index.php +5 -5
@@ 1,12 1,12 @@ 
 <?php include $_SERVER['DOCUMENT_ROOT'].'/scripts/functions.php'; addHTTPHeader(); ?>
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.grauw.nl/g" xml:lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
   <title>Contributing to the MAP - MSX Assembly Page</title>
   <?php addStyles(); ?>
-  <script type="text/javascript" src="/js/email.js"></script>
+  <script type="module" src="/js/email.js"></script>
 </head>
-<body onload="putEmail();">
+<body>
 <?php addHeader(); ?>
 
 <h1>Contributing to the MAP</h1>

          
@@ 16,8 16,8 @@ comments about the content, feel free to
 mistakes, and we don’t always know what’s best either, so any feedback is
 appreciated. If you want to submit something for publication on this
 site, you can email it to us as well. Our contact address is
-<g:insertMail domain="grauw.nl" local-part="map">(enable JavaScript for email
-link)</g:insertMail>.</p>
+<span class="email" data-domain="grauw.nl" data-local-part="map">(enable
+JavaScript for email link)</span>.</p>
 
 <p>If you want to contribute more directly to the MAP like write articles about
 a certain subject, or digitize some documents, or making editorial changes

          
M index.php +5 -5
@@ 1,14 1,14 @@ 
 <?php include $_SERVER['DOCUMENT_ROOT'].'/scripts/functions.php'; addHTTPHeader(); ?>
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.grauw.nl/g" xml:lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
   <title>MSX Assembly Page</title>
   <meta name="description" content="The MSX Assembly Page is a central source for MSX programming information in various languages, though mainly assembly. It contains articles on several topics, programming resources, sources, software downloads and links to some other good MSX programming sites." />
   <meta name="keywords" content="MSX, Assembly, Basic, programming, byte, bit, word, ld, jp, fast loop, keyboard, samples, multiplication, division, RAM, ROM, BIOS, SUBROM, MSX-DOS, I/O, Port, Z80, R800, VDP, TMS9918, V9938, V9958, V9990, Graphics9000, Gfx9000, PSG, AY-3-8910, SCC, MSX-Music, FM-PAC, OPLL, YM2413, MSX-Audio, Music Module, OPL1, Y8950, Moonsound, OPL4, MSX Engine, S3527, S1985, S1990, Sunrise, IDE, Novaxis, SCSI, PPI, RTC, MemMan" />
   <?php addStyles(); ?>
-  <script type="text/javascript" src="/js/email.js"></script>
+  <script type="module" src="/js/email.js"></script>
 </head>
-<body onload="putEmail();">
+<body>
 <?php addHeader(); ?>
 
 <h1>Introduction</h1>

          
@@ 60,8 60,8 @@ comments about the content, feel free to
 mistakes, and we don’t always know what’s best either, so any feedback is
 appreciated. If you want to submit something for publication on this
 site, you can email it to us as well. Our contact address is
-<g:insertMail domain="grauw.nl" local-part="map">(enable JavaScript for email
-link)</g:insertMail>.</p>
+<span class="email" data-domain="grauw.nl" data-local-part="map">(enable
+JavaScript for email link)</span>.</p>
 
 <p>If you want to contribute more directly to the map, like write articles about
 a certain subject, or digitize some documents, or making editorial changes

          
M js/email.js +6 -37
@@ 1,38 1,7 @@ 
-/**
- * Email address link javascript     (by Grauw)
- * =============================
- * Using standard DOM methods working in an XHTML environment.
- *
- * Usage:
- * - Fill in your email address in the variable 'eml' below
- * - Put a tag with class="myemail" where you want the link
- * - Add onload="putEmail(['<mailbox>','<domain>']);" to your &lt;body&gt; tag
- */
-
-/**
- * Replaces all spans with class 'myemail' with an email address constructed from the provided array.
- * @param email An array with two elements, corresponding to the part before and after the @ in an email-address.
- */
-function putEmail() {
-	var aNodes = document_getElementsByTagNameNS('http://www.grauw.nl/g', 'insertMail', 'g');
-	for (var i=0; i < aNodes.length; i++) {
-		var oNode = aNodes[i];
-		var sEmail = oNode.getAttribute('local-part') + '@' + oNode.getAttribute('domain');
-		var oAnchor = document.createElement('a');
-		oAnchor.setAttribute('href', 'mailto:' + sEmail);
-		oAnchor.appendChild(document.createTextNode(sEmail));
-		oNode.parentNode.replaceChild(oAnchor, oNode);
-	}
+for (const node of document.getElementsByClassName("email")) {
+	var email = `${node.dataset.localPart}@${node.dataset.domain}`;
+	var anchor = document.createElement('a');
+	anchor.href = `mailto:${email}`;
+	anchor.textContent = email;
+	node.parentNode.replaceChild(anchor, node);
 }
-
-/**
- * Ugly cross-browser getElementsByTagNameNS wrapper
- */
-function document_getElementsByTagNameNS(sNamespace, sLocalName, sPrefix) {
-	if (document.getElementsByTagNameNS)
-		return document.getElementsByTagNameNS(sNamespace, sLocalName);
-	else if (window.ActiveXObject)
-		return document.getElementsByTagName(sLocalName);
-	else
-		return document.getElementsByTagName(sPrefix + ':' + sLocalName);
-}
  No newline at end of file