am 40e30da7
: am ac2aef5b
: docs: switch templates to dynamic tab highlighting; prep for devsite template migration
# Via Android Git Automerger (1) and Scott Main (1) * commit '40e30da78a7551b91674cc41ac134146b85daa22': docs: switch templates to dynamic tab highlighting; prep for devsite template migration
This commit is contained in:
commit
d48506da27
2 changed files with 46 additions and 20 deletions
|
@ -112,7 +112,7 @@ $(document).ready(function() {
|
|||
if (pagePath.indexOf("/intl/") == 0) {
|
||||
pagePath = pagePath.substr(pagePath.indexOf("/",6)); // start after intl/ to get last /
|
||||
}
|
||||
|
||||
|
||||
if (pagePath.indexOf(SITE_ROOT) == 0) {
|
||||
if (pagePath == '' || pagePath.charAt(pagePath.length - 1) == '/') {
|
||||
pagePath += 'index.html';
|
||||
|
@ -138,12 +138,47 @@ $(document).ready(function() {
|
|||
// Otherwise the page path is already an absolute URL
|
||||
}
|
||||
|
||||
// select current page in sidenav and set up prev/next links if they exist
|
||||
// Highlight the header tabs...
|
||||
// highlight Design tab
|
||||
if ($("body").hasClass("design")) {
|
||||
$("#header li.design a").addClass("selected");
|
||||
|
||||
// highlight Develop tab
|
||||
} else if ($("body").hasClass("develop") || $("body").hasClass("google")) {
|
||||
$("#header li.develop a").addClass("selected");
|
||||
|
||||
// In Develop docs, also highlight appropriate sub-tab
|
||||
var rootDir = pagePath.substring(1,pagePath.indexOf('/', 1));
|
||||
if (rootDir == "training") {
|
||||
$("#nav-x li.training a").addClass("selected");
|
||||
} else if (rootDir == "guide") {
|
||||
$("#nav-x li.guide a").addClass("selected");
|
||||
} else if (rootDir == "reference") {
|
||||
// If the root is reference, but page is also part of Google Services, select Google
|
||||
if ($("body").hasClass("google")) {
|
||||
$("#nav-x li.google a").addClass("selected");
|
||||
} else {
|
||||
$("#nav-x li.reference a").addClass("selected");
|
||||
}
|
||||
} else if ((rootDir == "tools") || (rootDir == "sdk")) {
|
||||
$("#nav-x li.tools a").addClass("selected");
|
||||
} else if ($("body").hasClass("google")) {
|
||||
$("#nav-x li.google a").addClass("selected");
|
||||
}
|
||||
|
||||
// highlight Distribute tab
|
||||
} else if ($("body").hasClass("distribute")) {
|
||||
$("#header li.distribute a").addClass("selected");
|
||||
}
|
||||
|
||||
|
||||
// select current page in sidenav and header, and set up prev/next links if they exist
|
||||
var $selNavLink = $('#nav').find('a[href="' + pagePath + '"]');
|
||||
var $selListItem;
|
||||
if ($selNavLink.length) {
|
||||
$selListItem = $selNavLink.closest('li');
|
||||
|
||||
// Find this page's <li> in sidenav and set selected
|
||||
$selListItem = $selNavLink.closest('li');
|
||||
$selListItem.addClass('selected');
|
||||
|
||||
// Traverse up the tree and expand all parent nav-sections
|
||||
|
@ -151,7 +186,6 @@ $(document).ready(function() {
|
|||
$(this).addClass('expanded');
|
||||
$(this).children('ul').show();
|
||||
});
|
||||
|
||||
|
||||
// set up prev links
|
||||
var $prevLink = [];
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
</div>
|
||||
<ul class="nav-x col-9">
|
||||
<li class="design">
|
||||
<a href="<?cs var:toroot ?>design/index.html" <?cs
|
||||
if:design ?>class="selected"<?cs /if ?>
|
||||
<a href="<?cs var:toroot ?>design/index.html"
|
||||
zh-TW-lang="設計"
|
||||
zh-CN-lang="设计"
|
||||
ru-lang="Проектирование"
|
||||
|
@ -22,8 +21,7 @@
|
|||
ja-lang="設計"
|
||||
es-lang="Diseñar"
|
||||
>Design</a></li>
|
||||
<li class="develop"><a href="<?cs var:toroot ?>develop/index.html" <?cs
|
||||
if:training || guide || reference || tools || develop || google ?>class="selected"<?cs /if ?>
|
||||
<li class="develop"><a href="<?cs var:toroot ?>develop/index.html"
|
||||
zh-TW-lang="開發"
|
||||
zh-CN-lang="开发"
|
||||
ru-lang="Разработка"
|
||||
|
@ -31,8 +29,7 @@
|
|||
ja-lang="開発"
|
||||
es-lang="Desarrollar"
|
||||
>Develop</a></li>
|
||||
<li class="distribute last"><a href="<?cs var:toroot ?>distribute/index.html" <?cs
|
||||
if:distribute ?>class="selected"<?cs /if ?>
|
||||
<li class="distribute last"><a href="<?cs var:toroot ?>distribute/index.html"
|
||||
zh-TW-lang="發佈"
|
||||
zh-CN-lang="分发"
|
||||
ru-lang="Распространение"
|
||||
|
@ -203,8 +200,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
<div id="nav-x">
|
||||
<div class="wrap">
|
||||
<ul class="nav-x col-9 develop" style="width:100%">
|
||||
<li><a href="<?cs var:toroot ?>training/index.html" <?cs
|
||||
if:training ?>class="selected"<?cs /if ?>
|
||||
<li class="training"><a href="<?cs var:toroot ?>training/index.html"
|
||||
zh-TW-lang="訓練課程"
|
||||
zh-CN-lang="培训"
|
||||
ru-lang="Курсы"
|
||||
|
@ -212,8 +208,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
ja-lang="トレーニング"
|
||||
es-lang="Capacitación"
|
||||
>Training</a></li>
|
||||
<li><a href="<?cs var:toroot ?>guide/components/index.html" <?cs
|
||||
if:guide ?>class="selected"<?cs /if ?>
|
||||
<li class="guide"><a href="<?cs var:toroot ?>guide/components/index.html"
|
||||
zh-TW-lang="API 指南"
|
||||
zh-CN-lang="API 指南"
|
||||
ru-lang="Руководства по API"
|
||||
|
@ -221,8 +216,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
ja-lang="API ガイド"
|
||||
es-lang="Guías de la API"
|
||||
>API Guides</a></li>
|
||||
<li><a href="<?cs var:toroot ?>reference/packages.html" <?cs
|
||||
if:reference && !(reference.gcm || reference.gms) ?>class="selected"<?cs /if ?>
|
||||
<li class="reference"><a href="<?cs var:toroot ?>reference/packages.html"
|
||||
zh-TW-lang="參考資源"
|
||||
zh-CN-lang="参考"
|
||||
ru-lang="Справочник"
|
||||
|
@ -230,8 +224,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
ja-lang="リファレンス"
|
||||
es-lang="Referencia"
|
||||
>Reference</a></li>
|
||||
<li><a href="<?cs var:toroot ?>tools/index.html" <?cs
|
||||
if:tools ?>class="selected"<?cs /if ?>
|
||||
<li class="tools"><a href="<?cs var:toroot ?>tools/index.html"
|
||||
zh-TW-lang="相關工具"
|
||||
zh-CN-lang="工具"
|
||||
ru-lang="Инструменты"
|
||||
|
@ -239,8 +232,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
ja-lang="ツール"
|
||||
es-lang="Herramientas"
|
||||
>Tools</a></li>
|
||||
<li><a href="<?cs var:toroot ?>google/index.html" <?cs
|
||||
if:google || reference.gcm || reference.gms?>class="selected"<?cs /if ?>
|
||||
<li class="google"><a href="<?cs var:toroot ?>google/index.html"
|
||||
>Google Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue