- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 05 Aug 2010 05:40:30 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/markup/js In directory hutz:/tmp/cvs-serv7990/js Modified Files: jump-indexes.js Log Message: build tweak (moved IDs to html element (document element) in multipage output) Index: jump-indexes.js =================================================================== RCS file: /sources/public/html5/markup/js/jump-indexes.js,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- jump-indexes.js 4 Aug 2010 17:17:59 -0000 1.5 +++ jump-indexes.js 5 Aug 2010 05:40:28 -0000 1.6 @@ -3,7 +3,7 @@ var jumpIndexA; document.addEventListener('click', showjumpIndexA, false); -var elementList = +var itemList = [ ["a", "abbr", "address", "area", "article", "aside", "audio"], ["b", "base", "bdo", "blockquote", "body", "br", "button"], @@ -30,39 +30,49 @@ jumpIndexA = null; } else if (node.id == 'jumpIndexA-button') { var indexDiv = document.createElement('div'); - var elements; + var items; indexDiv.className = 'jumpIndexA'; - for (var i=0, len=elementList.length; i<len; ++i) { + for (var i=0, len=itemList.length; i<len; ++i) { var p = document.createElement('p'); - var elements = elementList[i]; - for (var j=0, jlen=elements.length; j<jlen; ++j) { + var items = itemList[i]; + for (var j=0, jlen=items.length; j<jlen; ++j) { var a = document.createElement('a'); var separator = document.createTextNode(" "); - var elementName = elements[j]; + var itemName = items[j]; if (document.body.className.indexOf("chunk") != -1) { - if (elementName == 'toc') { + if (itemName == 'toc') { a.setAttribute("href", "Overview.html#unexpanded-toc"); - } else if (elementName == 'toggle') { - a.setAttribute("href", "spec.html"); - elementName = "single"; + } else if (itemName == 'toggle') { + if (document.documentElement.id) { + itemName = "#" + document.documentElement.id; + } else { + itemName = ""; + } + a.setAttribute("href", "spec.html" + itemName); + itemName = "single"; } else { - a.setAttribute("href", elementName + ".html"); + a.setAttribute("href", itemName + ".html"); } } else { - if (elementName == 'toc') { + if (itemName == 'toc') { a.setAttribute("href", "#unexpanded-toc"); - } else if (elementName == 'toggle') { - a.setAttribute("href", "Overview.html"); - elementName = "multi"; + } else if (itemName == 'toggle') { + if (window.location.hash) { + itemName = window.location.hash.substring(1,window.location.hash.length) + ".html"; + } else { + itemName = "Overview.html"; + } + a.setAttribute("href", itemName); + itemName = "multi"; } else { - a.setAttribute("href", "#" + elementName); + a.setAttribute("href", "#" + itemName); } } - if (elementName == 'global-attributes') { - elementName = 'global attributes'; + if (itemName == 'global-attributes') { + itemName = 'global attributes'; p.setAttribute("class", "jumpIndexA-other"); } - a.textContent = elementName; + a.textContent = itemName; p.appendChild(a); p.appendChild(separator); }
Received on Thursday, 5 August 2010 05:40:31 UTC