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

Unified 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 side-by-side diff with in-line comments
Download patch
« chromeos/docs/OWNERS ('K') | « chromeos/docs/onc_spec.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/docs/onc_spec.js
diff --git a/chromeos/docs/onc_spec.js b/chromeos/docs/onc_spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..057577ce62fd355f7ae4e52a4dc4b8f02a39d8ba
--- /dev/null
+++ b/chromeos/docs/onc_spec.js
@@ -0,0 +1,51 @@
+var outline_root = null;
+var root = null;
+var outline_ptr = null;
+
+function onEnter(node) {
+ var li = document.createElement('li');
+ outline_ptr.appendChild(li);
+
+ var header = node.querySelector('h1');
+ header.id = 'sec_' + header.textContent.replace(/ /g, '_');
+ var link = document.createElement('a');
+ link.href = '#' + header.id;
+ link.textContent = header.textContent;
+ li.appendChild(link);
+ var ul = document.createElement('ul');
+ li.appendChild(ul);
+ outline_ptr = ul;
+}
+
+function onExit(node) {
+ outline_ptr = outline_ptr.parentNode.parentNode;
+}
+
+function outline(node) {
+ var in_toc = !node.classList.contains('not_in_toc');
+ if (in_toc) {
+ onEnter(node);
+ }
+ var child = node.firstChild;
+ while (child) {
+ if (child.tagName === 'SECTION') {
+ outline(child);
+ }
+ child = child.nextSibling;
+ }
+ if (in_toc) {
+ onExit(node);
+ }
+}
+
+
+window.onload = function () {
+ outline_root = document.getElementById('outline');
+ root = document.getElementById('root');
+
+ var ul = document.createElement('ul');
+ outline_root.appendChild(ul);
+ outline_ptr = ul;
+
+ outline(root);
+};
« 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