- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 12 Aug 2010 19:55:40 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/markup/js In directory hutz:/tmp/cvs-serv18720/js Modified Files: dfn.js jump-indexes.js Log Message: 色々 Index: jump-indexes.js =================================================================== RCS file: /sources/public/html5/markup/js/jump-indexes.js,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- jump-indexes.js 10 Aug 2010 13:51:11 -0000 1.11 +++ jump-indexes.js 12 Aug 2010 19:55:38 -0000 1.12 @@ -2,6 +2,14 @@ var jumpIndexA; document.addEventListener('click', showjumpIndexA, false); +document.addEventListener("keyup", function(e) { + if(!e) e=window.event; + var key = e.keyCode ? e.keyCode : e.which; + if ( key == 27 && jumpIndexA) { + jumpIndexA.parentNode.removeChild(jumpIndexA); + jumpIndexA = null; + } +}, true); var itemList = [ @@ -84,7 +92,7 @@ p.setAttribute("class", "jumpIndexA-other"); } if (itemName == 'index-of-terms') { - itemName = 'index of terms'; + itemName = 'terms'; } a.textContent = itemName; p.appendChild(a); Index: dfn.js =================================================================== RCS file: /sources/public/html5/markup/js/dfn.js,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dfn.js 10 Aug 2010 13:51:10 -0000 1.10 +++ dfn.js 12 Aug 2010 19:55:38 -0000 1.11 @@ -1,5 +1,5 @@ // dfn.js - makes <dfn> elements link back to all uses of the term. -// No copyright is asserted on that file nor on this modified version. +// No copyright is asserted on this file. var dfnLinks; var dfnLinksFile = 'index-of-terms.xhtml'; @@ -11,8 +11,13 @@ dfnLinks = request.responseXML; } }; - request.open('GET', dfnLinksFile, true); - request.send(null); + try { + request.open('GET', dfnLinksFile, true); + request.send(null); + } catch (e) { + console.log(e); + return -1; + } } else { dfnLinks = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); var index = dfnLinks.importNode(document.getElementById("index-of-terms"), true); @@ -20,9 +25,16 @@ } document.body.className += " dfnEnabled"; } - var dfnPanel; document.addEventListener('click', dfnShow, false); +document.addEventListener("keyup", function(e) { + if(!e) e=window.event; + var key = e.keyCode ? e.keyCode : e.which; + if ( key == 27 && dfnPanel) { + dfnPanel.parentNode.removeChild(dfnPanel); + dfnPanel = null; + } +}, true); function dfnShow(event) { if (dfnPanel) { dfnPanel.parentNode.removeChild(dfnPanel); @@ -41,9 +53,11 @@ permalinkP.appendChild(permalinkA); panel.appendChild(permalinkP); panelDiv = document.createElement('div'); - if (node.id) { + if (node.id && dfnLinks) { panelDiv.innerHTML = dfnLinks.getElementById(node.id+"_index_items").innerHTML; panel.appendChild(panelDiv); + } else { + return -1; } node.appendChild(panel); dfnPanel = panel;
Received on Thursday, 12 August 2010 19:55:41 UTC