From 38b0e22049346ad8955bdbb5b1927d1253dab273 Mon Sep 17 00:00:00 2001 From: "smain@google.com" Date: Wed, 16 Mar 2016 11:30:53 -0700 Subject: [PATCH] new search results layout. no more custom suggestions; just API matches and organic results. Change-Id: I6324aa6fb289f5d93aa701aecbd7fad64711d35f --- .../templates-sdk-dev/assets/css/default.css | 28 ++++++++++++++++++- .../templates-sdk-dev/assets/js/docs.js | 20 ++++--------- .../templates-sdk-dev/customizations.cs | 13 ++------- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/tools/droiddoc/templates-sdk-dev/assets/css/default.css b/tools/droiddoc/templates-sdk-dev/assets/css/default.css index 93172fe31d..04f4b90172 100644 --- a/tools/droiddoc/templates-sdk-dev/assets/css/default.css +++ b/tools/droiddoc/templates-sdk-dev/assets/css/default.css @@ -8601,11 +8601,26 @@ div.jd-descr > .resource-widget[data-section=distribute\/tools] .dac-custom-search-entry { margin-bottom: 36px; margin-top: 24px; + margin-left:10px; +} + +.dac-custom-search-entry.cols:after { + clear: none; } + +.dac-custom-search-image-wrapper { + float: left; + position: relative; } .dac-custom-search-image { background-size: cover; height: 112px; + width:150px; + margin-right:15px; +} + +.dac-custom-search-text-wrapper { + position: relative; } .dac-custom-search-title { @@ -8614,6 +8629,7 @@ div.jd-descr > .resource-widget[data-section=distribute\/tools] font-weight: 700; line-height: 24px; padding: 0; + clear:none; } .dac-custom-search-title a { @@ -8732,11 +8748,21 @@ div.jd-descr > .resource-widget[data-section=distribute\/tools] padding-bottom: 40px; } +#dac-search-results-reference { + float:right; + z-index:999; +} + +@media (max-width: 719px) { + #dac-search-results-reference { + float:none; + } +} + .dac-search-results-reference { background: white; box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.21); margin: 0 0 20px 0; - height: 340px; overflow: hidden; padding: 6px 0 4px; } diff --git a/tools/droiddoc/templates-sdk-dev/assets/js/docs.js b/tools/droiddoc/templates-sdk-dev/assets/js/docs.js index 4141433399..f64b41e16f 100644 --- a/tools/droiddoc/templates-sdk-dev/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk-dev/assets/js/docs.js @@ -5336,7 +5336,7 @@ window.metadata.search = (function() { key: 'AIzaSyCFhbGnjW06dYwvRCU8h_zjdpS4PYYbEe8', q: query, start: start || 1, - num: 6, + num: 9, hl: getSearchLang(), fields: 'queries,items(pagemap,link,title,htmlSnippet,formattedUrl)' }; @@ -5360,11 +5360,11 @@ window.metadata.search = (function() { if (hasImage) { var image = item.pagemap.cse_thumbnail[0]; - entry.append($('
').addClass('col-1of6') + entry.append($('
').addClass('dac-custom-search-image-wrapper') .append($('
').addClass('dac-custom-search-image').css('background-image', 'url(' + image.src + ')'))); } - entry.append($('
').addClass(hasImage ? 'col-5of6' : 'col-6of6') + entry.append($('
').addClass('dac-custom-search-text-wrapper') .append($('

').addClass('dac-custom-search-section').text(section)) .append( $('').text(item.title).attr('href', item.link).wrap('

').parent().addClass('dac-custom-search-title') @@ -5437,8 +5437,8 @@ window.metadata.search = (function() { renderResults(referenceCard, results, query, false); }; - var ROW_COUNT_COLLAPSED = 10; - var ROW_COUNT_EXPANDED = 33; + var ROW_COUNT_COLLAPSED = 20; + var ROW_COUNT_EXPANDED = 40; var ROW_COUNT_GOOGLE_COLLAPSED = 1; var ROW_COUNT_GOOGLE_EXPANDED = 8; @@ -5463,9 +5463,7 @@ window.metadata.search = (function() { var link = $('').attr('href', window.toRoot + match.link); var label = match.label; - console.log("labeld:" +classNameStart); var classNameStart = label.match(/[A-Z]/) ? label.search(/[A-Z]/) : label.lastIndexOf('.') + 1; - console.log("label:" +label.substr(0, classNameStart)); var newLink = '' + label.substr(0, classNameStart) + '' + @@ -5540,10 +5538,6 @@ window.metadata.search = (function() { // Reserve space for "No reference results" googleCount--; } - var nn = results.android.length; - var showing = androidCount; - console.log('ac ' + androidCount); - console.log('res ' + results.android.length); renderAndroidResults(list, results.android.slice(0, androidCount), query); renderGoogleDocsResults(list, results.docs.slice(0, googleCount - 1), query); @@ -5555,13 +5549,11 @@ window.metadata.search = (function() { // Tweak see more logic to account for references. var hasMore = totalResults > ROW_COUNT_COLLAPSED && !util.matchesMedia('mobile'); - if (hasMore) { // We can't actually show all matches, only as many as the expanded list // will fit, so we actually lie if the total results count is more var moreCount = Math.min(totalResults, ROW_COUNT_EXPANDED + ROW_COUNT_GOOGLE_EXPANDED); - var $moreLink = $('
  • and ' - + moreCount +' more matches
  • '); + var $moreLink = $('
  • see more matches
  • '); list.append($moreLink.on('click', onToggleMore)); } var searchEl = $('#search-resources'); diff --git a/tools/droiddoc/templates-sdk-dev/customizations.cs b/tools/droiddoc/templates-sdk-dev/customizations.cs index 5fe579cc1f..d5a6960dcc 100644 --- a/tools/droiddoc/templates-sdk-dev/customizations.cs +++ b/tools/droiddoc/templates-sdk-dev/customizations.cs @@ -136,23 +136,16 @@ elif:samples ?>

    +