summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorScott Main <smain@google.com>2009-06-04 11:10:17 -0700
committerScott Main <smain@google.com>2009-06-05 13:54:06 -0700
commit5b53cd78cd7ac1469b4e2985098bd04dca00a296 (patch)
tree5c66f32d0646f6a7d5c8883ae3e0f1445baeaff9 /tools
parent39528d6bace1457d21e76824fe94d85c880fe4be (diff)
downloadbuild-5b53cd78cd7ac1469b4e2985098bd04dca00a296.zip
build-5b53cd78cd7ac1469b4e2985098bd04dca00a296.tar.gz
build-5b53cd78cd7ac1469b4e2985098bd04dca00a296.tar.bz2
page load perfomance improvements...
remove the lists.js file from the <head>, which slows down page load a lot (over 300K), and instead load it dynamically on page load. also remove navtree_data.js from the <head>, which also slows the load and is only used in the reference when in tree view. This file is now loaded during the initialization of the nav tree.
Diffstat (limited to 'tools')
-rw-r--r--tools/droiddoc/templates-sdk/customization.cs5
-rw-r--r--tools/droiddoc/templates/assets/android-developer-docs.js11
-rw-r--r--tools/droiddoc/templates/assets/navtree.js14
-rw-r--r--tools/droiddoc/templates/head_tag.cs2
4 files changed, 26 insertions, 6 deletions
diff --git a/tools/droiddoc/templates-sdk/customization.cs b/tools/droiddoc/templates-sdk/customization.cs
index 0cb85e8..9ec1f44 100644
--- a/tools/droiddoc/templates-sdk/customization.cs
+++ b/tools/droiddoc/templates-sdk/customization.cs
@@ -151,8 +151,9 @@ def:default_left_nav() ?>
if (!isMobile) {
$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
chooseDefaultNav();
- if ($("#nav-tree").is(':visible')) init_navtree("nav-tree", "<?cs var:toroot ?>", NAVTREE_DATA);
- else {
+ if ($("#nav-tree").is(':visible')) {
+ init_default_navtree("<?cs var:toroot ?>");
+ } else {
addLoadEvent(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js
index 016fa4e..160e492 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates/assets/android-developer-docs.js
@@ -31,6 +31,15 @@ if ((agent.indexOf("Mobile") != -1) ||
addLoadEvent(mobileSetup);
}
+/* loads the lists.js file to the page.
+Loading this in the head was slowing page load time */
+addLoadEvent( function() {
+ var lists = document.createElement("script");
+ lists.setAttribute("type","text/javascript");
+ lists.setAttribute("src", toRoot+"reference/lists.js");
+ $("head").append($(lists));
+} );
+
window.onresize = resizeAll;
function mobileSetup() {
@@ -282,7 +291,7 @@ function swapNav() {
nav_pref = NAV_PREF_PANELS;
} else {
nav_pref = NAV_PREF_TREE;
- init_navtree("nav-tree", toRoot, NAVTREE_DATA);
+ init_default_navtree(toRoot);
}
var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
diff --git a/tools/droiddoc/templates/assets/navtree.js b/tools/droiddoc/templates/assets/navtree.js
index f48e1dc..8e7a91c 100644
--- a/tools/droiddoc/templates/assets/navtree.js
+++ b/tools/droiddoc/templates/assets/navtree.js
@@ -144,8 +144,20 @@ function find_page(url, data)
return null;
}
+function load_navtree_data(toroot) {
+ var navtreeData = document.createElement("script");
+ navtreeData.setAttribute("type","text/javascript");
+ navtreeData.setAttribute("src", toroot+"navtree_data.js");
+ $("head").append($(navtreeData));
+}
+
+function init_default_navtree(toroot) {
+ load_navtree_data(toroot);
+ init_navtree("nav-tree", toroot, NAVTREE_DATA);
+}
+
function init_navtree(navtree_id, toroot, root_nodes)
-{
+{
var me = new Object();
me.toroot = toroot;
me.node = new Object();
diff --git a/tools/droiddoc/templates/head_tag.cs b/tools/droiddoc/templates/head_tag.cs
index 61559e1..f721403 100644
--- a/tools/droiddoc/templates/head_tag.cs
+++ b/tools/droiddoc/templates/head_tag.cs
@@ -11,14 +11,12 @@ else ?>
<link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" /><?cs
/if ?>
<script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script>
-<script src="<?cs var:toroot ?>reference/lists.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script>
<script type="text/javascript">
setToRoot("<?cs var:toroot ?>");
</script><?cs
if:reference ?>
-<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/navtree.js" type="text/javascript"></script><?cs
/if ?>
<noscript>