|
73 | 73 |
|
74 | 74 |
|
75 | 75 | <div class="span2 offset1 docs-sidebar hoop"> |
76 | | - {%- include "searchbox.html" %} |
77 | 76 | {{ toctree(collapse=False, maxdepth=3) }} |
78 | 77 | </div> |
79 | 78 |
|
|
138 | 137 | $('.docs-sidebar').height(maxHeight - 145); |
139 | 138 |
|
140 | 139 | //remove the margin from the tallest column if it exists |
141 | | - tallest.height(maxHeight - tallestMargin); |
| 140 | + //tallest.height(maxHeight - tallestMargin); |
142 | 141 |
|
143 | 142 | //Set the margin above the social buttons in the left-hand menu |
144 | 143 | if (maxHeight > 800) { |
|
148 | 147 | $('.social-menu').css({'margin-top': 309}) |
149 | 148 | } |
150 | 149 |
|
| 150 | + //Check URL |
| 151 | + // var path = window.location.pathname; |
| 152 | + // var pathName = path.split('/'); |
| 153 | + // var num = pathName.length - 2; |
| 154 | + |
| 155 | + var path = window.location.href; |
| 156 | + var pathName = path.split('/'); |
| 157 | + var num = pathName.length - 3; |
| 158 | + console.log(pathName[num]); |
| 159 | + var gettingstarted, terms, client, server, contributing; |
| 160 | + |
| 161 | + switch(pathName[num]) { |
| 162 | + case 'gettingstarted': |
| 163 | + console.log('case at Getting Started'); |
| 164 | + $('.toctree-l1 > a').each(function(){ |
| 165 | + if($(this).html() == "Getting Started") { |
| 166 | + $(this).parent().attr('state', 'open'); |
| 167 | + $(this).attr('state', 'open'); |
| 168 | + } |
| 169 | + }); |
| 170 | + break; |
| 171 | + case 'terms': |
| 172 | + console.log('case at Terms'); |
| 173 | + $('.toctree-l1 > a').each(function(){ |
| 174 | + if($(this).html() == "Terms") { |
| 175 | + $(this).parent().attr('state', 'open'); |
| 176 | + $(this).attr('state', 'open'); |
| 177 | + } |
| 178 | + }); |
| 179 | + break; |
| 180 | + case 'client': |
| 181 | + console.log('case at Client Reference'); |
| 182 | + $('.toctree-l1 > a').each(function(){ |
| 183 | + if($(this).html() == "Client Reference") { |
| 184 | + $(this).parent().attr('state', 'open'); |
| 185 | + $(this).attr('state', 'open'); |
| 186 | + } |
| 187 | + }); |
| 188 | + break; |
| 189 | + case 'server': |
| 190 | + console.log('case at Server Reference'); |
| 191 | + $('.toctree-l1 > a').each(function(){ |
| 192 | + if($(this).html() == "Server Reference") { |
| 193 | + $(this).parent().attr('state', 'open'); |
| 194 | + $(this).attr('state', 'open'); |
| 195 | + } |
| 196 | + }); |
| 197 | + break; |
| 198 | + case 'contributing': |
| 199 | + console.log('case at Contributing'); |
| 200 | + $('.toctree-l1 > a').each(function(){ |
| 201 | + if($(this).html() == "Contributing") { |
| 202 | + $(this).parent().attr('state', 'open'); |
| 203 | + $(this).attr('state', 'open'); |
| 204 | + } |
| 205 | + }); |
| 206 | + break; |
| 207 | + case 'releases': |
| 208 | + //code this out when releases gets filled out |
| 209 | + break; |
| 210 | + default: |
| 211 | + console.log('failure.'); |
| 212 | + |
| 213 | + } |
| 214 | + |
| 215 | + |
| 216 | + // switch(pathName[num]) { |
| 217 | + // case gettingstarted: |
| 218 | + // $('Getting Started').parent().attr('state', 'open'); |
| 219 | + // $('Getting Started').attr('state', 'open'); |
| 220 | + // break; |
| 221 | + // } |
| 222 | + |
| 223 | + //Check for match between path name and menu titles |
| 224 | + //$('.toctree-l2 > a').each(function(){ |
| 225 | + // if($(this).html().toLowerCase() == pathName[num]) { |
| 226 | + // var parents = $(this).parents(); |
| 227 | + // $(parents[2]).attr('state', 'open'); |
| 228 | + // } |
| 229 | + //}); |
| 230 | + |
151 | 231 | //Doc Sidebar: Create accordion |
152 | 232 | var allPanels = $('.toctree-l1 > ul'); |
153 | 233 | allPanels.hide(); |
154 | 234 |
|
155 | | - $('.toctree-l1 > a').click(function() { |
156 | | - if($(this).siblings().size() > 0) { |
| 235 | + $('.toctree-l1 > a').each(function(){ |
| 236 | + if($(this).parent().attr('state') == 'open') { |
| 237 | + $(this).attr('state', 'open'); |
| 238 | + $(this).next().show(); |
| 239 | + } |
| 240 | + }); |
| 241 | + |
| 242 | + $('.toctree-l1 > a:first-child').click(function() { |
| 243 | + if($(this).siblings().size() > 0 && $(this).attr('state') != 'open') { |
157 | 244 | allPanels.slideUp(); |
158 | 245 | $(this).next().slideDown(); |
| 246 | + $('.toctree-l1 > a').attr('state', 'closed'); |
| 247 | + $(this).attr('state', 'open'); |
| 248 | + return false; |
| 249 | + } |
| 250 | + if ($(this).attr('state') == 'open') { |
159 | 251 | return false; |
160 | 252 | } |
161 | 253 | }); |
|
0 commit comments