Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38b0e220 authored by smain@google.com's avatar smain@google.com
Browse files

new search results layout.

no more custom suggestions; just API matches and organic results.

Change-Id: I6324aa6fb289f5d93aa701aecbd7fad64711d35f
parent 1c8d4a49
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -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;
}
+6 −14
Original line number Diff line number Diff line
@@ -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($('<div>').addClass('col-1of6')
        entry.append($('<div>').addClass('dac-custom-search-image-wrapper')
          .append($('<div>').addClass('dac-custom-search-image').css('background-image', 'url(' + image.src + ')')));
      }

      entry.append($('<div>').addClass(hasImage ? 'col-5of6' : 'col-6of6')
      entry.append($('<div>').addClass('dac-custom-search-text-wrapper')
        .append($('<p>').addClass('dac-custom-search-section').text(section))
        .append(
          $('<a>').text(item.title).attr('href', item.link).wrap('<h2>').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 = $('<a>').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 = '<span class="namespace">' +
      label.substr(0, classNameStart) +
      '</span>' +
@@ -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 = $('<li class="dac-search-results-reference-entry-empty " data-toggle="show-more">and '
        + moreCount +' more matches</li>');
      var $moreLink = $('<li class="dac-search-results-reference-entry-empty " data-toggle="show-more">see more matches</li>');
      list.append($moreLink.on('click', onToggleMore));
    }
    var searchEl = $('#search-resources');
+3 −10
Original line number Diff line number Diff line
@@ -136,25 +136,18 @@ elif:samples ?><?cs include:"../../../../frameworks/base/docs/html/ndk/samples/s
        <div id="dac-search-results-hero"></div>

        <div class="dac-search-results-hero cols">
          <div id="dac-search-results-reference" class="col-2of6 col-tablet-1of2 col-mobile-1of1">
          <div id="dac-search-results-reference" class="col-3of6 col-tablet-1of2 col-mobile-1of1">
            <div class="suggest-card reference no-display">
              <ul class="dac-search-results-reference">
              </ul>
            </div>
          </div>

          <div id="dac-custom-search" class="dac-custom-search">
            <div class="wrap dac-offset-parent">
              <a class="dac-fab dac-scroll-button" data-scroll-button="" data-scroll-container="#search-results" href="#dac-custom-search">
                <i class="dac-sprite dac-arrow-down-gray"></i>
              </a>
          <div id="dac-custom-search-results"></div>
        </div>
      </div>

    </div>
  </div>
    </div>
  </div>
<?cs /def ?>

<?cs def:custom_left_nav() ?>