<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learning the World &#187; hCard</title>
	<atom:link href="http://learningtheworld.eu/tag/hcard/feed/" rel="self" type="application/rss+xml" />
	<link>http://learningtheworld.eu</link>
	<description></description>
	<lastBuildDate>Tue, 06 Nov 2012 00:17:33 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Enhanced Keyboard-accessible Google Maps</title>
		<link>http://learningtheworld.eu/2009/keyboard-accessible-google-maps/</link>
		<comments>http://learningtheworld.eu/2009/keyboard-accessible-google-maps/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 19:00:28 +0000</pubDate>
		<dc:creator><![CDATA[Martin Kliehm]]></dc:creator>
				<category><![CDATA[accessibility]]></category>
		<category><![CDATA[downloads]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[hCard]]></category>
		<category><![CDATA[keyboard access]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[Patrick H. Lauke]]></category>
		<category><![CDATA[vcard]]></category>

		<guid isPermaLink="false">http://learningtheworld.eu/?p=517</guid>
		<description><![CDATA[<strong>Patrick H. Lauke</strong> wrote an excellent article about <strong>keyboard-accessible Google Maps</strong> on the Opera Developer website. Still I was able to improve it slightly when I implemented an accessible map myself. I would like to share these modifications with you.]]></description>
				<content:encoded><![CDATA[<p><a href="http://twitter.com/patrick_h_lauke">Patrick H. Lauke</a> wrote an excellent article about <a href="http://dev.opera.com/articles/view/keyboard-accessible-google-maps/">keyboard-accessible Google Maps</a> on the Opera Developer website. Still I was able to improve it slightly when I implemented an <a href="http://eafra.eu/2009/venue/">accessible map</a> myself. I would like to share these modifications with you:</p>

<ul>
<li>A <strong>link to Google Maps</strong> when JavaScript is disabled.</li>
<li>Support for the <strong><a href="http://code.google.com/apis/ajax/documentation/">Google <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> <acronym title="Application Programming Interface">API</acronym> Loader</a></strong>.</li><li>Using the <strong>small map control</strong>.</li>
<li>Keyboard accessibility for <strong><em>all</em> control elements</strong> within the map.</li>
</ul>

<p>As a fallback without JavaScript&nbsp;&mdash; because people disable it, because their mobile device doesn&rsquo;t support it, or because it gets filtered by corporate proxies&nbsp;&mdash; Patrick used the little known <a href="http://code.google.com/intl/en-US/apis/maps/documentation/staticmaps/">Google Static Maps <acronym>API</acronym></a>, but for some reason he missed adding the link to Google. Here is the fix:</p>

<ol class="code" title="HTML code">
<li><code>&lt;div id=&quot;map&quot;&gt;</code></li>
<li class="indent"><code><strong>&lt;a href=&quot;http://maps.google.com/maps<span class="codeSpace">&nbsp;</span><span class="nowrap">?f=q&amp;amp;output=html</span><span class="codeSpace">&nbsp;</span><span class="nowrap">&amp;amp;q=50.110950+8.684666&quot;</span> title=&quot;Google Maps&quot;&gt;</strong></code></li>
<li class="double">&lt;img src=&quot;http://maps.google.com/staticmap?hl=en<span class="codeSpace">&nbsp;</span><span class="nowrap">&amp;amp;center=50.112267,8.678384</span><span class="codeSpace">&nbsp;</span><span class="nowrap">&amp;amp;markers=50.110950,8.684666,red</span><span class="codeSpace">&nbsp;</span><span class="nowrap">&amp;amp;zoom=15&amp;amp;size=500&#x78;300</span><span class="codeSpace">&nbsp;</span><span class="nowrap">&amp;amp;key=[Your API Key]&quot;</span> alt=&quot;City map of Frankfurt&quot; width=&quot;500&quot; height=&quot;300&quot; /&gt;</li>
<li class="indent"><code><strong>&lt;/a&gt;</strong></code></li>
<li><code>&lt;/div&gt;</code></li>
</ol>

<div>
<p><a href="http://maps.google.com/maps?f=q&amp;output=html&amp;q=50.110950757575814+8.684666901826859" title="Google Maps" id="maps-static-without-js"><img src="http://maps.google.com/staticmap?hl=de&amp;center=50.112267,8.678384&amp;markers=50.110950757575814,8.684666901826859,red&amp;zoom=15&amp;size=500x300&amp;key=ABQIAAAAiX9IUvugciHL2lvi9eAyFBSMjuiRZEUjgLWr4CdH8vZ2LQfPbhTYj1_FZwtIQquykkDMnYbZpMJHXQ" alt="City Map of Frankfurt" width="510" height="300" /></a></p>
</div>

<p>Then I changed how the map is embedded. As it seems that the <a href="http://code.google.com/apis/ajax/documentation/"><acronym>API</acronym> loader</a> is more current, I preferred that way:</p>

<ol class="code" title="HTML code">
<li><code>&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi?key=[Your API Key]&quot;&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type=&quot;text/javascript&quot; src="/js/accgmap.js&quot;&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type=&quot;text/javascript&quot;&gt;</code></li>
<li class="indent"><code>google.load( &#x27;maps&#x27;, &#x27;2&#x27;, { &#x27;language&#x27; : &#x27;en&#x27; } );</code></li>
<li class="indent"><code>google.setOnLoadCallback( GMAP.initMap );</code></li>
<li><code>&lt;/script&gt;</code></li>
</ol>

<p>Using the small control elements is trivial: <code>SmallMapControl()</code>. The next thing I wanted to change was <strong>keyboard access to <em>all</em> controls</strong>, in particular for the map type, <abbr title="that is">i.e.</abbr> <code>Map&nbsp;| Satellite&nbsp;| Hybrid</code>. Patrick refers to an <code>id</code>, but I found that all relevant controls have a <code>title</code>, so I just checked for that attribute. I also dropped setting the <code>style</code> attribute in JavaScript as that belongs in the <acronym title="Cascading Style Sheets">CSS</acronym> file. His original function <code>GKeyboardPatch()</code> now looks like this (note the <code>while</code> loop for a slightly better performance):</p>

<ol class="code" title="JavaScript code">
<li><code>GKeyboardPatch: <strong>function</strong>( map ) {</code></li>
<li class="indent"><code>var</code> button, divs = map.getContainer().getElementsByTagName( &#x27;div&#x27; );</li>
<li class="indent"><code>var</code> i = 0;</li>
<li class="indent"><code>while</code> ( divs[i] ) {</li>
<li class="double"><code>if ( divs[i].getAttribute( &#x27;log&#x27; ) || ( <em>divs[i].getAttribute( &#x27;title&#x27; ) &amp;&amp; divs[i].getAttribute( &#x27;title&#x27; ) != &#x27;&#x27;</em> ) ) {</code></li>
<li class="double"><span class="indent">button = document.createElement( &#x27;button&#x27; );</span></li>
<li class="double"><span class="indent">button.setAttribute( &#x27;value&#x27;, divs[i].getAttribute( &#x27;title&#x27; ));</span></li>
<li class="double"><span class="indent">divs[i].appendChild( button );</span></li>
<li class="double"><span class="indent">if ( divs[i].getAttribute( &#x27;log&#x27; )) { <code>// only control buttons</code></span></li>
<li class="double"><code class="double">// override the IE opacity filter that Google annoyingly sets</code></li>
<li class="double"><span class="double">divs[i].style.filter = &#x27;&#x27;;</span></li>
<li class="double"><code class="double">// should really set to &#x27;transparent&#x27;</code></li>
<li class="double"><span class="double">divs[i].style.background = <span class="nowrap">&#x27;url( http://www.google.com/</span><span class="codeSpace">&nbsp;</span>intl/en_ALL/mapfiles/transparent.png )&#x27;;</span></li>
<li class="double"><span class="indent">}</span></li>
<li class="double">}</li>
<li class="double">i++;</li>
<li class="indent">}</li>
<li>}</li>
</ol>

<p>Now remember I said I&rsquo;d rather separate style and behaviour, so here are a some lines of <acronym>CSS</acronym> with the setting of <code>width</code> and <code>height</code> for the <code>#map</code> being most relevant, otherwise it will collapse:</p>

<ol class="code" title="CSS code">
<li><code>#map {</code></li>
<li class="indent">height: 300px;</li>
<li class="indent">overflow: hidden;</li>
<li class="indent">position: relative;</li>
<li class="indent">width: 500px;</li>
<li><code>}</code></li>
<li><code>#maps-static, #maps-static img {</code></li>
<li class="indent">display: block;</li>
<li><code>}</code></li>
<li><code>#map span.note {</code></li>
<li class="indent">display: none;</li>
<li><code>}</code></li>
<li><code>#map button {</code></li>
<li class="indent">background: transparent;</li>
<li class="indent">border-style: solid;</li>
<li class="indent">border-width: 0;</li>
<li class="indent">cursor: pointer;</li>
<li class="indent">height: 100%;</li>
<li class="indent">left: -2px;</li>
<li class="indent">margin: 2px;</li>
<li class="indent">overflow: hidden;</li>
<li class="indent">padding: 2px;</li>
<li class="indent">position: absolute;</li>
<li class="indent">text-indent: -100em;</li>
<li class="indent">top: -2px;</li>
<li class="indent">width: 100%;</li>
<li><code>}</code></li>
<li><code>#map a:focus, #map a:active, #map button:focus, #map button:active {</code></li>
<li class="indent">outline: 2px dashed #61bf1a;</li>
<li><code>}</code></li>
</ol>

<p>And that&rsquo;s it, thanks again to Patrick for the solid foundation I built upon. Now <a href="/examples/js/accgmap.js">download the JavaScript code</a> and try to tab through the map below.</p>

<p>Actually on the other website I extracted <strong>hCard microformats</strong> from the page as well and displayed the addresses on the map, but I was lazy and used jQuery. I thought it doesn&rsquo;t look well here mixed with Patrick&rsquo;s clean <acronym title="Document Object Model">DOM</acronym> scripting, but feel free to <a href="http://eafra.eu/2009/venue/">take it from the original website</a>.</p>

<div id="map">
<p><a href="http://maps.google.com/maps?f=q&amp;output=html&amp;q=50.110950757575814+8.684666901826859" title="Google Maps" id="maps-static"><img src="http://maps.google.com/staticmap?hl=de&amp;center=50.112267,8.678384&amp;markers=50.110950757575814,8.684666901826859,red&amp;zoom=15&amp;size=500x300&amp;key=ABQIAAAAiX9IUvugciHL2lvi9eAyFBSMjuiRZEUjgLWr4CdH8vZ2LQfPbhTYj1_FZwtIQquykkDMnYbZpMJHXQ" alt="City Map of Frankfurt" width="510" height="300" /></a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://learningtheworld.eu/2009/keyboard-accessible-google-maps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
