42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
|
- var lang = current.path[1]
|
||
|
|
||
|
nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav
|
||
|
|
||
|
// SEARCH BAR
|
||
|
header.side-nav-search.st-input-wrapper
|
||
|
form.st-input-inner
|
||
|
label(for="search-io" class="is-hidden") Search Docs
|
||
|
input(type="search" id="search-io" placeholder="SEARCH DOCS...")
|
||
|
button(class="mobile-trigger button" aria-label="View Docs Menu" ng-click="appCtrl.toggleDocsMenu($event)" md-button) Docs <span class="icon icon-arrow-drop-down"></span>
|
||
|
|
||
|
div(class="side-nav-secondary" ng-class="appCtrl.showDocsNav ? 'is-visible' : ''")
|
||
|
!= partial("../" + lang + "/latest/_nav")
|
||
|
|
||
|
|
||
|
script.
|
||
|
// Could put in appCtrl but only needed here and clear here
|
||
|
(function highlightSelectedLink() {
|
||
|
var leftNav = document.getElementsByClassName('side-nav-secondary')[0];
|
||
|
if (!leftNav) {return;}
|
||
|
var links = leftNav.getElementsByTagName('a');
|
||
|
var path = location.toString();
|
||
|
// remove trailing '/'
|
||
|
if (path[path.length-1] === '/') {path = path.slice(0, path.length-1);}
|
||
|
// remove trailing '/index.html' (11 chars) for matching purposes.
|
||
|
if (path.lastIndexOf('/index.html') === path.length-11) {
|
||
|
path = path.slice(0, -11);
|
||
|
}
|
||
|
for (var i=0; i < links.length; i++){
|
||
|
// assumes fresh page each time so no need to clear class
|
||
|
if (path === links[i].href) {
|
||
|
var parent = links[i].parentElement;
|
||
|
parent.classList.add('is-selected');
|
||
|
|
||
|
if(parent.offsetTop > window.innerHeight && parent.scrollIntoView){
|
||
|
parent.scrollIntoView(false);
|
||
|
// parent.scrollTop();
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
})()
|