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

Commit 1c8d4a49 authored by smain@google.com's avatar smain@google.com
Browse files

remove dev guide search suggestions, move organic search results up.

tweak the search suggest for reference pages

Change-Id: I14e48fdac3f103dd998591886b91e5f6040b0f7a
parent e4a8ab1a
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -8771,12 +8771,24 @@ div.jd-descr > .resource-widget[data-section=distribute\/tools]
  color: #333;
  display: block;
  font-size: 0.81em;
  line-height: 1.2em;
  line-height: 1.5em;
  padding: 0 12px 5px 12px;
  width: 100%;
  white-space: nowrap;
}

ul.dac-search-results-reference {
list-style: none;
}

ul.dac-search-results-reference li[data-toggle="show-more"] {
  cursor:pointer;
}

ul.dac-search-results-reference.is-expanded li[data-toggle="show-more"] {
  display:none;
}

.dac-search-results-reference-entry a:hover {
  background-color: #eceff1;
}
+19 −6
Original line number Diff line number Diff line
@@ -3370,7 +3370,7 @@ window.changeLangPref = changeLangPref;
   * Current locale.
   */
  var locale = (function() {
    var lang = window.devsite ? window.devsiteLang : window.readCookie('pref_lang');
    var lang = window.readCookie('pref_lang');
    if (lang === 0 || LANGUAGES.indexOf(lang) === -1) {
      lang = 'en';
    }
@@ -5437,7 +5437,7 @@ window.metadata.search = (function() {
    renderResults(referenceCard, results, query, false);
  };

  var ROW_COUNT_COLLAPSED = 7;
  var ROW_COUNT_COLLAPSED = 10;
  var ROW_COUNT_EXPANDED = 33;
  var ROW_COUNT_GOOGLE_COLLAPSED = 1;
  var ROW_COUNT_GOOGLE_EXPANDED = 8;
@@ -5463,11 +5463,12 @@ 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><br />' +
      '</span>' +
      label.substr(classNameStart, label.length);

    link.html(newLink);
@@ -5492,7 +5493,7 @@ window.metadata.search = (function() {
  function renderAndroidResults(list, gMatches, query) {
    list.empty();

    var header = $('<li class="dac-search-results-reference-header">Reference</li>');
    var header = $('<li class="dac-search-results-reference-header">android</li>');
    list.append(header);

    if (gMatches.length > 0) {
@@ -5500,7 +5501,6 @@ window.metadata.search = (function() {

      var resources = buildResults(gMatches, query);
      list.append(resources);

      return true;
    } else {
      list.append('<li class="dac-search-results-reference-entry-empty">No results</li>');
@@ -5540,6 +5540,10 @@ 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);
@@ -5551,6 +5555,15 @@ 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>');
      list.append($moreLink.on('click', onToggleMore));
    }
    var searchEl = $('#search-resources');
    searchEl.toggleClass('dac-has-more', searchEl.hasClass('dac-has-more') || (hasMore && !expanded));
    searchEl.toggleClass('dac-has-less', searchEl.hasClass('dac-has-less') || (hasMore && expanded));
+7 −16
Original line number Diff line number Diff line
@@ -142,13 +142,6 @@ elif:samples ?><?cs include:"../../../../frameworks/base/docs/html/ndk/samples/s
              </ul>
            </div>
          </div>
          <div id="search-resources"
            class="dac-search-results-resources resource-flow-layout"
            data-maxresults="10"
            data-cardsizes="6x2">
          </div>
        </div>
      </div>

          <div id="dac-custom-search" class="dac-custom-search">
            <div class="wrap dac-offset-parent">
@@ -156,10 +149,8 @@ elif:samples ?><?cs include:"../../../../frameworks/base/docs/html/ndk/samples/s
                <i class="dac-sprite dac-arrow-down-gray"></i>
              </a>
            </div>
          </div>

        <div class="wrap">
          <h2 class="dac-custom-search-section-title">More results</h2>
          <div id="dac-custom-search-results"></div>
        </div>
      </div>
    </div>