From ac71b2b59bae525502ae0b7af93b5f3a9f569b47 Mon Sep 17 00:00:00 2001 From: Scott Main Date: Fri, 30 Nov 2012 14:40:58 -0800 Subject: [PATCH] docs: revisions for google reference nav Change-Id: I9befa502a3ce30ab6cca7d45ce1bb469930c14ed --- .../droiddoc/templates-sdk/assets/css/default.css | 26 ++++++++++- tools/droiddoc/templates-sdk/assets/js/docs.js | 52 +++------------------- 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css index 5867bec30..d143a69b4 100644 --- a/tools/droiddoc/templates-sdk/assets/css/default.css +++ b/tools/droiddoc/templates-sdk/assets/css/default.css @@ -277,8 +277,6 @@ video.with-shadow { position: relative; margin-bottom: 1px; padding: 0 30px 0 0; } - #nav .nav-section-header-ref { - padding: 10px 0; } #nav li.selected a, #nav li.selected > .nav-section-header > a { color: #09C; } @@ -335,6 +333,25 @@ video.with-shadow { background: transparent url(../images/styles/disclosure_up.png) no-repeat scroll 50% 50%; width: 34px; height: 34px; } + #nav li.expanded li ul.tree-list-children { + padding:0; + } + #nav li.expanded li ul.tree-list-children .tree-list-children { + padding:0 0 0 10px; + } + #nav li span.tree-list-subtitle { + display:inline-block; + padding:5px 0 0 10px; + color:#555; + text-transform:uppercase; + font-size:12px; + } + #nav li span.tree-list-subtitle:before { + content: '—'; + } + #nav li span.tree-list-subtitle:after { + content: '—'; + } #nav li ul { display:none; overflow: hidden; @@ -359,11 +376,16 @@ video.with-shadow { #nav li ul > li:last-child { padding-bottom:5px; } + #nav li ul.tree-list-children > li:last-child { + padding-bottom:0; + } #nav li.expanded ul > li { background:#efefef; background: rgba(0, 0, 0, 0.03); } #nav li.expanded ul > li li { background:inherit; } + #nav li ul.tree-list-children ul { + display:block; } .new, .new-child { diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js index 9a57b2930..59ddb2908 100644 --- a/tools/droiddoc/templates-sdk/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk/assets/js/docs.js @@ -139,7 +139,6 @@ $(document).ready(function() { if ($selNavLink.length) { $selListItem = $selNavLink.closest('li'); - var depth = $selListItem.parents().length; $selListItem.addClass('selected'); // Traverse up the tree and expand all parent nav-sections @@ -147,39 +146,7 @@ $(document).ready(function() { $(this).addClass('expanded'); $(this).children('ul').show(); }); - //expand current item if user clicked on reference or package name - if(depth == 10 || depth == 12){ - $selListItem.closest('li.nav-section').addClass('expanded'); - $selListItem.closest('li.nav-section').children('ul').show(); - //if the user clicked on a package name (which has a depth of 12), we know it has children, so expand them - if(depth == 12){ - //expand all of the items under the titles "interfaces", "classes", and "exceptions". - $selListItem.children('ul').children('li').children('ul').addClass('expanded'); - $selListItem.children('ul').children('li').children('ul').show(); - //also expand all subclasses, subinterfaces, and subexceptions under a particular class, interface, or exception. - $selListItem.children('ul').children('li').children('ul').children('li').children('ul').addClass('expanded'); - $selListItem.children('ul').children('li').children('ul').children('li').children('ul').show(); - } - } - //else if the user clicked on a class, interface, or exception, which has a depth of 16 or 18 for a subclass - else if(depth == 16 || depth == 18){ - //expand the classes in the package - $selListItem.closest('li.nav-section').parent().children('li').children('ul').children('li').children('ul').addClass('expanded'); - $selListItem.closest('li.nav-section').parent().children('li').children('ul').children('li').children('ul').show(); - //expand the level immediately above the class or subclass. This expands all of the interfaces, classes, and exceptions within a package. - $selListItem.closest('li.nav-section').parent().parent().children('ul').children('li').children('ul').addClass('expanded'); - $selListItem.closest('li.nav-section').parent().parent().children('ul').children('li').children('ul').show(); - - //if this is the lowest depth (subclass) or container of a subclass expand the uls above the previously expanded uls as well. - //this is true when the closest li nav-section has a parents() length of 16. - if($selListItem.closest('li.nav-section').parents().length == 16){ - $selListItem.closest('li.nav-section').parent().parent().parent().children('li').children('ul').addClass('expanded'); - $selListItem.closest('li.nav-section').parent().parent().parent().children('li').children('ul').show(); - } - } - // $selListItem.closest('li.nav-section').closest('li.nav-section').addClass('expanded'); - // $selListItem.closest('li.nav-section').closest('li.nav-section').children('ul').show(); // set up prev links var $prevLink = []; @@ -1881,8 +1848,9 @@ function escapeHTML(string) { /* ######################################################## */ /* Initialize some droiddoc stuff, but only if we're in the reference */ -if (location.pathname.indexOf("/reference" && - !location.pathname.indexOf("/reference/google-packages.html") && +if ((location.pathname.indexOf("/reference") && + !location.pathname.indexOf("/reference-gms/packages.html") && + !location.pathname.indexOf("/reference-gcm/packages.html") && !location.pathname.indexOf("/reference/com/google")) == 0) { $(document).ready(function() { // init available apis based on user pref @@ -2179,15 +2147,6 @@ 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+"google_navtree_data.js"); - - console.log(navtreeData.src); - $("head").append($(navtreeData)); -} - function init_default_navtree(toroot) { init_navtree("tree-list", toroot, NAVTREE_DATA); @@ -2258,7 +2217,8 @@ function new_google_node(me, mom, text, link, children_data, api_level) node.depth = mom.depth + 1; node.get_children_ul = function() { if (!node.children_ul) { - node.children_ul = document.createElement("ul"); + node.children_ul = document.createElement("ul"); + node.children_ul.className = "tree-list-children"; node.li.appendChild(node.children_ul); } return node.children_ul; @@ -2274,7 +2234,7 @@ function new_google_node(me, mom, text, link, children_data, api_level) } else { child = document.createElement("span"); - child.setAttribute("style", "padding-left:10px; color:#555; text-transform:uppercase; font-size:12px"); + child.className = "tree-list-subtitle"; } if (children_data != null) { -- 2.11.0