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

Side by Side Diff: chromeos/docs/onc_spec.js

Issue 11602010: Initial commit of the ONC spec in HTML. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added license headers. Created 8 years 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 unified diff | Download patch
« no previous file with comments | « chromeos/docs/onc_spec.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var outline_root = null;
6 var root = null;
7 var outline_ptr = null;
8
9 function onEnter(node) {
10 var li = document.createElement('li');
11 outline_ptr.appendChild(li);
12
13 var header = node.querySelector('h1');
14 header.id = 'sec_' + header.textContent.replace(/ /g, '_');
15 var link = document.createElement('a');
16 link.href = '#' + header.id;
17 link.textContent = header.textContent;
18 li.appendChild(link);
19 var ul = document.createElement('ul');
20 li.appendChild(ul);
21 outline_ptr = ul;
22 }
23
24 function onExit(node) {
25 outline_ptr = outline_ptr.parentNode.parentNode;
26 }
27
28 function outline(node) {
29 var in_toc = !node.classList.contains('not_in_toc');
30 if (in_toc) {
31 onEnter(node);
32 }
33 var child = node.firstChild;
34 while (child) {
35 if (child.tagName === 'SECTION') {
36 outline(child);
37 }
38 child = child.nextSibling;
39 }
40 if (in_toc) {
41 onExit(node);
42 }
43 }
44
45
46 window.onload = function () {
47 outline_root = document.getElementById('outline');
48 root = document.getElementById('root');
49
50 var ul = document.createElement('ul');
51 outline_root.appendChild(ul);
52 outline_ptr = ul;
53
54 outline(root);
55 };
OLDNEW
« no previous file with comments | « chromeos/docs/onc_spec.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698