am 972c3798: am 28ca0f32: am 25e7300c: load the navtree javascript on demand; don\'t try setting up the tree until it\'s loaded

* commit '972c3798890f8b0e20005eece62ee88f508dd761':
  load the navtree javascript on demand; don't try setting up the tree until it's loaded
This commit is contained in:
Scott Main 2013-03-27 16:07:57 -07:00 committed by Android Git Automerger
commit a6188a56ea
2 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,10 @@ var basePath = getBaseUri(location.pathname);
var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));
var GOOGLE_DATA; // combined data for google service apis, used for search suggest
// Ensure that all ajax getScript() requests allow caching
$.ajaxSetup({
cache: true
});
/****** ON LOAD SET UP STUFF *********/
@ -2319,7 +2323,13 @@ function find_page(url, data)
}
function init_default_navtree(toroot) {
init_navtree("tree-list", toroot, NAVTREE_DATA);
// load json file for navtree data
$.getScript(toRoot + 'navtree_data.js', function(data, textStatus, jqxhr) {
// when the file is loaded, initialize the tree
if(jqxhr.status === 200) {
init_navtree("tree-list", toroot, NAVTREE_DATA);
}
});
// perform api level toggling because because the whole tree is new to the DOM
var selectedLevel = $("#apiLevelSelector option:selected").val();

View File

@ -50,8 +50,6 @@ else
<?cs if:reference.gms || reference.gcm || google?>
<script src="<?cs var:toroot ?>gms_navtree_data.js" async type="text/javascript"></script>
<script src="<?cs var:toroot ?>gcm_navtree_data.js" async type="text/javascript"></script>
<?cs elif:reference ?>
<script src="<?cs var:toroot ?>navtree_data.js" async type="text/javascript"></script>
<?cs /if ?>
<script type="text/javascript">