am a9d796a4: docs: Add navigation heading for Develop > Preview

* commit 'a9d796a4f9e198f17de6f1a27264b1b4fc9a778a':
  docs: Add navigation heading for Develop > Preview
This commit is contained in:
Joe Fernandez 2015-05-07 06:29:59 +00:00 committed by Android Git Automerger
commit c4ef9bb08f
4 changed files with 123 additions and 124 deletions

View File

@ -192,6 +192,8 @@ $(document).ready(function() {
subNavEl.find("li.google > a").addClass("selected"); subNavEl.find("li.google > a").addClass("selected");
} else if ($("body").hasClass("samples")) { } else if ($("body").hasClass("samples")) {
subNavEl.find("li.samples > a").addClass("selected"); subNavEl.find("li.samples > a").addClass("selected");
} else if ($("body").hasClass("preview")) {
subNavEl.find("li.preview > a").addClass("selected");
} else { } else {
parentNavEl.removeClass('has-subnav').addClass("selected"); parentNavEl.removeClass('has-subnav').addClass("selected");
} }
@ -2357,6 +2359,37 @@ function search_changed(e, kd, toroot)
} }
} }
// Search for Preview Guides
for (var i=0; i<PREVIEW_RESOURCES.length; i++) {
// current search comparison, with counters for tag and title,
// used later to improve ranking
var s = PREVIEW_RESOURCES[i];
s.matched_tag = 0;
s.matched_title = 0;
var matched = false;
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
if (s.keywords[j].toLowerCase().match(textRegex)) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
}
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
if (s.title.toLowerCase().match(textRegex)) {
matched = true;
s.matched_title = 1;
}
}
if (matched) {
gDocsMatches[matchedCountDocs] = s;
matchedCountDocs++;
}
}
// Rank/sort all the matched pages // Rank/sort all the matched pages
rank_autocomplete_doc_results(text, gDocsMatches); rank_autocomplete_doc_results(text, gDocsMatches);
} }

View File

@ -1,7 +1,4 @@
<?cs def:custom_masthead() ?> <?cs def:custom_masthead() ?>
<?cs if:preview ?>
<?cs call:preview_masthead() ?>
<?cs else ?>
<a name="top"></a> <a name="top"></a>
<!-- dialog to prompt lang pref change when loaded from hardcoded URL <!-- dialog to prompt lang pref change when loaded from hardcoded URL
@ -180,6 +177,9 @@
<a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a> <a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a>
</li> </li>
<?cs /if ?> <?cs /if ?>
<li class="dac-nav-item preview">
<a class="dac-nav-link" href="<?cs var:toroot ?>preview/index.html">M Preview</a>
</li>
</ul> </ul>
</li> </li>
<li class="dac-nav-item distribute"> <li class="dac-nav-item distribute">
@ -217,41 +217,9 @@
</nav> </nav>
<!-- end navigation--> <!-- end navigation-->
<?cs /if ?><?cs # end if/else !devsite ?> <?cs /if ?><?cs # end if/else !devsite ?>
<?cs /if ?><?cs # end if/else preview ?><?cs
/def ?>
<?cs def:preview_masthead() ?> <?cs
<a name="top"></a> /def ?><?cs # end custom_masthead() ?>
<!-- Header -->
<div id="header-wrapper">
<div id="header"><?cs call:butter_bar() ?>
<div class="wrap" id="header-wrap">
<div class="col_3 logo landing-logo" style="width:240px">
<a href="<?cs var:toroot ?>preview/index.html">
<img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android"
style="margin:-3px 0 0" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div>
<?cs # ADD SEARCH AND MENU ?>
<?cs call:header_search_widget() ?>
</div><!-- end header-wrap -->
</div><!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
</div> <!--end header-wrapper -->
<?cs
/def ?>
<?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?> <?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?>

View File

@ -72,6 +72,20 @@ def:googleplay_nav() ?>
</script> </script>
<?cs /def ?><?cs <?cs /def ?><?cs
def:preview_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<?cs /def ?><?cs
def:essentials_nav() ?> def:essentials_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols"> <div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@ -306,22 +320,6 @@ def:wear_nav() ?>
</script> </script>
<?cs /def ?> <?cs /def ?>
<?cs
def:preview_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<?cs
include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<?cs /def ?>
<?cs # The default side navigation for the reference docs ?><?cs <?cs # The default side navigation for the reference docs ?><?cs
def:default_left_nav() ?> def:default_left_nav() ?>
<?cs if:reference.gcm || reference.gms ?> <?cs if:reference.gcm || reference.gms ?>
@ -495,6 +493,8 @@ def:custom_left_nav() ?><?cs
call:google_nav() ?><?cs call:google_nav() ?><?cs
elif:samples ?><?cs elif:samples ?><?cs
call:samples_nav() ?><?cs call:samples_nav() ?><?cs
elif:preview ?><?cs
call:preview_nav() ?><?cs
elif:distribute ?><?cs elif:distribute ?><?cs
if:googleplay ?><?cs if:googleplay ?><?cs
call:googleplay_nav() ?><?cs call:googleplay_nav() ?><?cs
@ -519,8 +519,6 @@ def:custom_left_nav() ?><?cs
call:distribute_nav() ?><?cs call:distribute_nav() ?><?cs
elif:wear ?><?cs elif:wear ?><?cs
call:wear_nav() ?><?cs call:wear_nav() ?><?cs
elif:preview ?><?cs
call:preview_nav() ?><?cs
else ?><?cs else ?><?cs
call:default_left_nav() ?> <?cs call:default_left_nav() ?> <?cs
/if ?><?cs /if ?><?cs

View File

@ -4,22 +4,25 @@
<?cs include:"head_tag.cs" ?> <?cs include:"head_tag.cs" ?>
<body class="gc-documentation <body class="gc-documentation
<?cs # add document classes for navigation header selection (and other stuff) ?>
<?cs <?cs
if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs if:(google || reference.gms || reference.gcm) ?>google<?cs
if:(guide||develop||training||reference||tools||google||sdk||samples) ?>develop<?cs /if ?><?cs
if:guide ?> guide<?cs /if ?><?cs if:(guide||develop||training||reference||tools||sdk||google||samples||preview) ?>develop<?cs
if:samples ?> samples<?cs /if ?><?cs if:guide ?> guide<?cs /if ?><?cs
elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories) if:samples ?> samples<?cs /if ?><?cs
?>distribute<?cs if:preview ?> preview<?cs /if ?><?cs
if:googleplay ?> googleplay<?cs /if ?><?cs elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories)
if:essentials ?> essentials<?cs /if ?><?cs ?>distribute<?cs
if:users ?> users<?cs /if ?><?cs if:googleplay ?> googleplay<?cs /if ?><?cs
if:engage ?> engage<?cs /if ?><?cs if:essentials ?> essentials<?cs /if ?><?cs
if:monetize ?> monetize<?cs /if ?><?cs if:users ?> users<?cs /if ?><?cs
if:disttools ?> disttools<?cs /if ?><?cs if:engage ?> engage<?cs /if ?><?cs
if:stories ?> stories<?cs /if ?><?cs if:monetize ?> monetize<?cs /if ?><?cs
elif:(about||wear||tv||auto) ?>about<?cs if:disttools ?> disttools<?cs /if ?><?cs
elif:design ?>design<?cs if:stories ?> stories<?cs /if ?><?cs
elif:(about||wear||tv||auto) ?>about<?cs
elif:design ?>design<?cs
/if ?><?cs /if ?><?cs
if:page.trainingcourse ?> trainingcourse<?cs if:page.trainingcourse ?> trainingcourse<?cs
/if ?>" itemscope itemtype="http://schema.org/Article"><?cs /if ?>" itemscope itemtype="http://schema.org/Article"><?cs
@ -193,6 +196,3 @@ include:"header.cs" ?>
</body> </body>
</html> </html>