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

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: Moved to chromeos/docs. 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
« chromeos/docs/OWNERS ('K') | « 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 var outline_root = null;
2 var root = null;
3 var outline_ptr = null;
4
5 function onEnter(node) {
6 var li = document.createElement('li');
7 outline_ptr.appendChild(li);
8
9 var header = node.querySelector('h1');
10 header.id = 'sec_' + header.textContent.replace(/ /g, '_');
11 var link = document.createElement('a');
12 link.href = '#' + header.id;
13 link.textContent = header.textContent;
14 li.appendChild(link);
15 var ul = document.createElement('ul');
16 li.appendChild(ul);
17 outline_ptr = ul;
18 }
19
20 function onExit(node) {
21 outline_ptr = outline_ptr.parentNode.parentNode;
22 }
23
24 function outline(node) {
25 var in_toc = !node.classList.contains('not_in_toc');
26 if (in_toc) {
27 onEnter(node);
28 }
29 var child = node.firstChild;
30 while (child) {
31 if (child.tagName === 'SECTION') {
32 outline(child);
33 }
34 child = child.nextSibling;
35 }
36 if (in_toc) {
37 onExit(node);
38 }
39 }
40
41
42 window.onload = function () {
43 outline_root = document.getElementById('outline');
44 root = document.getElementById('root');
45
46 var ul = document.createElement('ul');
47 outline_root.appendChild(ul);
48 outline_ptr = ul;
49
50 outline(root);
51 };
OLDNEW
« chromeos/docs/OWNERS ('K') | « chromeos/docs/onc_spec.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698