am a4d57eab: am 38f19c21: Merge "docs: fix search suggestions and other script bugs for offline docs" into jb-dev

* commit 'a4d57eab27139af93ecdb4b0eb8ec8c5193b7c80':
  docs: fix search suggestions and other script bugs for offline docs
This commit is contained in:
Scott Main 2012-07-03 14:18:10 -07:00 committed by Android Git Automerger
commit 37a21f82bf
4 changed files with 12 additions and 17 deletions

View file

@ -5,9 +5,11 @@ var cookie_namespace = 'android_developer';
var NAV_PREF_TREE = "tree";
var NAV_PREF_PANELS = "panels";
var nav_pref;
var toRoot;
var isMobile = false; // true if mobile, so we can adjust some layout
var basePath = getBaseUri(location.pathname);
var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));
/****** ON LOAD SET UP STUFF *********/
@ -30,7 +32,7 @@ $(document).ready(function() {
// set search's onkeyup handler here so we can show suggestions
// even while search results are visible
$("#search_autocomplete").keyup(function() {return search_changed(event, false, '/')});
$("#search_autocomplete").keyup(function() {return search_changed(event, false, toRoot)});
// set up the search close button
$('.search .close').click(function() {
@ -526,11 +528,6 @@ addLoadEvent( function() {
prettyPrint();
} );
function setToRoot(root) {
toRoot = root;
// note: toRoot also used by carousel.js
}
function init() {
//resizeNav();

View file

@ -473,7 +473,7 @@ function hideResults() {
// forcefully regain key-up event control (previously jacked by search api)
$("#search_autocomplete").keyup(function(event) {
return search_changed(event, false, '/');
return search_changed(event, false, toRoot);
});
// add event listeners to each tab so we can track the browser history

View file

@ -66,8 +66,8 @@
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')" onkeyup="return search_changed(event, false,
'/')" />
onkeydown="return search_changed(event, true, '<?cs var:toroot ?>')"
onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>

View file

@ -11,7 +11,7 @@
<!-- BASIC STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
href="<?cs if:android.whichdoc != 'online' ?>http:<?cs /if ?>//fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="<?cs var:toroot ?>assets/css/default.css" rel="stylesheet" type="text/css">
<?cs if:reference ?>
@ -28,6 +28,9 @@ type="text/css">
<!-- BASIC JAVASCRIPT -->
<script src="<?cs var:toroot ?>assets/js/global-libraries-combined.js"
type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "<?cs var:toroot ?>";
</script>
<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
<?cs if:carousel ?>
@ -36,7 +39,7 @@ type="text/css">
<?cs /if ?>
<!-- search -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="<?cs if:android.whichdoc != 'online' ?>http:<?cs /if ?>//www.google.com/jsapi" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/js/search_autocomplete.js" type="text/javascript"></script>
<?cs if:tabbedList ?>
@ -48,10 +51,5 @@ type="text/css">
<script src="<?cs var:toroot ?>assets/js/droiddoc.js" type="text/javascript"></script>
<?cs /if ?>
<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script>
<script type="text/javascript">
setToRoot("<?cs var:toroot ?>");
var basePath = getBaseUri(location.pathname);
var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));
</script>
</head>