Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/webgl/resources/generateTOC.js

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/webgl/resources/default.css ('k') | third_party/webgl/resources/jquery-1.3.2.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/webgl/resources/generateTOC.js
===================================================================
--- third_party/webgl/resources/generateTOC.js (revision 121077)
+++ third_party/webgl/resources/generateTOC.js (working copy)
@@ -1,53 +0,0 @@
-function nextLevel(nodeList, startIndex, hlevel, prefix, tocString)
-{
- var hIndex = 1;
- var i = startIndex;
-
- while (i < nodeList.length) {
- var currentNode = nodeList[i];
-
- if (currentNode.tagName != "H"+hlevel)
- break;
-
- if (currentNode.className == "no-toc") {
- ++i;
- continue;
- }
-
- var sectionString = prefix+hIndex;
-
- // Update the TOC
- var text = currentNode.innerHTML;
- // Strip off names specified via <a name="..."></a>
- var tocText = text.replace(/<a name=[\'\"][^\'\"]*[\'\"]>([^<]*)<\/a>/g, "$1");
- tocString.s += "<li class='toc-h"+hlevel+"'><a href='#"+sectionString+"'><span class='secno'>"+sectionString+"</span>"+tocText+"</a></li>\n";
-
- // Modify the header
- currentNode.innerHTML = "<span class=secno>"+sectionString+"</span> "+text;
- currentNode.id = sectionString;
-
- // traverse children
- i = nextLevel(nodeList, i+1, hlevel+1, sectionString+".", tocString);
- hIndex++;
- }
-
- return i;
-}
-
-function generateTOC(toc)
-{
- var nodeList = $("h2,h3,h4,h5,h6");
- var tocString = { s:"<ul class='toc'>\n" };
- nextLevel(nodeList, 0, 2, "", tocString);
- toc.innerHTML = tocString.s;
-
- // Now position the document, in case a #xxx directive was given
- var id = window.location.hash.substring(1);
- if (id.length > 0) {
- var target = document.getElementById(id);
- if (target) {
- var rect = target.getBoundingClientRect();
- setTimeout(function() { window.scrollTo(0, rect.top) }, 0);
- }
- }
-}
« no previous file with comments | « third_party/webgl/resources/default.css ('k') | third_party/webgl/resources/jquery-1.3.2.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698