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

Side by Side Diff: chrome/common/extensions/docs/server2/static/js/sidebar.js

Issue 10826132: Firefox compatibility changes: Sidebar and Searchbar. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced Created 8 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/static/css/site.css ('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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 /** 6 /**
7 * Toggles the display of nodes given the status of their associated controls. 7 * Toggles the display of nodes given the status of their associated controls.
8 * 8 *
9 * For each node passed to this function, check to see if a toggle has been 9 * For each node passed to this function, check to see if a toggle has been
10 * inserted into the node's parent. If yes, change the state of the toggle 10 * inserted into the node's parent. If yes, change the state of the toggle
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 var toc = document.getElementById('gc-toc'); 58 var toc = document.getElementById('gc-toc');
59 if (!toc) 59 if (!toc)
60 return; 60 return;
61 var items = toc.getElementsByTagName('li'); 61 var items = toc.getElementsByTagName('li');
62 var selectedNode = null; 62 var selectedNode = null;
63 for (var i = 0; i < items.length; i++) { 63 for (var i = 0; i < items.length; i++) {
64 var item = items[i]; 64 var item = items[i];
65 if (item.className == 'leftNavSelected') { 65 if (item.className == 'leftNavSelected') {
66 selectedNode = item; 66 selectedNode = item;
67 } else if (item.firstChild && 67 } else if (item.firstChild &&
68 item.firstChild instanceof HTMLSpanElement) { 68 item.firstChild.tagName == 'SPAN') {
69 // Only assign toggles to text nodes in the sidebar. 69 // Only assign toggles to text nodes in the sidebar.
70 var a = document.createElement('a'); 70 var a = document.createElement('a');
71 a.className = 'toggle selected'; 71 a.className = 'toggle selected';
72 a.appendChild(document.createTextNode(' ')); 72 a.appendChild(document.createTextNode(' '));
73 a.onclick = function() { 73 a.onclick = function() {
74 toggleList(this.parentNode.getElementsByTagName('ul')); 74 toggleList(this.parentNode.getElementsByTagName('ul'));
75 }; 75 };
76 item.firstChild.onclick = function() { 76 item.firstChild.onclick = function() {
77 toggleList(this.parentNode.getElementsByTagName('ul')); 77 toggleList(this.parentNode.getElementsByTagName('ul'));
78 }; 78 };
79 item.insertBefore(a, item.firstChild); 79 item.insertBefore(a, item.firstChild);
80 toggleList(item.getElementsByTagName('ul')); 80 toggleList(item.getElementsByTagName('ul'));
81 } 81 }
82 } 82 }
83 if (selectedNode) { 83 if (selectedNode) {
84 revealAncestor(selectedNode); 84 revealAncestor(selectedNode);
85 } 85 }
86 }; 86 };
87 87
88 initSidebar(); 88 initSidebar();
89 })() 89 })()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/static/css/site.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698