]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
stub out docsearch additions
authorMark Otto <markdotto@gmail.com>
Tue, 4 Jul 2017 20:24:51 +0000 (13:24 -0700)
committerMark Otto <markdotto@gmail.com>
Tue, 4 Jul 2017 20:24:51 +0000 (13:24 -0700)
docs/_includes/footer.html
docs/_includes/header.html
docs/_layouts/default.html
docs/assets/less/algolia.less [new file with mode: 0644]
docs/assets/less/docs.less
docs/assets/less/sidebar.less

index fe19b6a70302450080744a240deaaf0810ce8489..b0f9b786c291fe3e9379fc8514d2d82a107e726a 100644 (file)
   {% endfor %}
 {% endif %}
 
+{% if page.slug == "getting-started" or page.slug == "css" or page.slug == "components" or page.slug == "js" %}
+<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
+<script type="text/javascript">
+  var docsearch = docsearch({
+    apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
+    indexName: 'bootstrap-v3',
+    inputSelector: '#search-input',
+    transformData: function (hits) {
+      return hits.map(function (hit) {
+        hit.url = hit.url.replace('https://getbootstrap.com/docs/3.4/', '');
+        return hit;
+      });
+    },
+    debug: false // Set debug to true if you want to inspect the dropdown
+  });
+</script>
+{% endif %}
+
 {% if page.slug == "customize" %}
   <script>var __configBridge = {{ site.data.configBridge.config | jsonify }}</script>
   {% if site.github %}
index bf90dc408d22404af1e546d55eff5af0185d6ea3..d7077f9a09651abb110002a1062e321cad926fe9 100644 (file)
   {% endif %}
 {% endif %}
 
+{% if page.slug == "getting-started" or page.slug == "css" or page.slug == "components" or page.slug == "js" %}
+  <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css">
+{% endif %}
+
 <!-- Documentation extras -->
 {% if site.github %}
 <link href="{{ site.baseurl }}/assets/css/docs.min.css" rel="stylesheet">
index dd2b850db47b00ba9308e271646af0f35cdb6c0a..948ea389f4b84546e2d625de80d4a76069e97067 100644 (file)
         {% unless page.fullwidth == true %}
         <div class="col-md-3" role="complementary">
           <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm">
+            <form class="bs-docs-search">
+              <input type="search" class="form-control" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
+            </form>
+
             <ul class="nav bs-docs-sidenav">
               {% if page.slug == "getting-started" %}
                 {% include nav/getting-started.html %}
diff --git a/docs/assets/less/algolia.less b/docs/assets/less/algolia.less
new file mode 100644 (file)
index 0000000..8ab9785
--- /dev/null
@@ -0,0 +1,139 @@
+// Docsearch overrides
+//
+// `!important` indicates overridden properties.
+.algolia-autocomplete {
+  display: block !important;
+  flex: 1;
+
+  // Menu container
+  .ds-dropdown-menu {
+    width: 100%;
+    min-width: 0 !important;
+    max-width: none !important;
+    padding: .75rem 0 !important;
+    background-color: #fff;
+    background-clip: padding-box;
+    border: 1px solid rgba(0,0,0,.1);
+    box-shadow: 0 .5rem 1rem rgba(0,0,0,.175);
+
+    @media min-width(@screen-sm-min) {
+      width: 175%;
+    }
+
+    // Caret
+    &::before {
+      display: none !important;
+    }
+
+    [class^=ds-dataset-] {
+      padding: 0 !important;
+      overflow: visible !important;
+      background-color: transparent !important;
+      border: 0 !important;
+    }
+
+    .ds-suggestions {
+      margin-top: 0 !important;
+    }
+  }
+
+  .algolia-docsearch-suggestion {
+    padding: 0 !important;
+    overflow: visible !important;
+  }
+
+  .algolia-docsearch-suggestion--category-header {
+    padding: .125rem 1rem !important;
+    margin-top: 0 !important;
+    font-size: .875rem !important;
+    font-weight: 500 !important;
+    color: #7952b3 !important;
+    border-bottom: 0 !important;
+  }
+
+  .algolia-docsearch-suggestion--wrapper {
+    float: none !important;
+    padding-top: 0 !important;
+  }
+
+  // Section header
+  .algolia-docsearch-suggestion--subcategory-column {
+    float: none !important;
+    width: auto !important;
+    padding: 0 !important;
+    text-align: left !important;
+  }
+
+  .algolia-docsearch-suggestion--content {
+    float: none !important;
+    width: auto !important;
+    padding: 0 !important;
+
+    // Vertical divider between column header and content
+    &::before {
+      display: none !important;
+    }
+  }
+
+  .ds-suggestion {
+    &:not(:first-child) {
+      .algolia-docsearch-suggestion--category-header {
+        padding-top: .75rem !important;
+        margin-top: .75rem !important;
+        border-top: 1px solid rgba(0,0,0,.1);
+      }
+    }
+
+    .algolia-docsearch-suggestion--subcategory-column {
+      display: none !important;
+    }
+  }
+
+  .algolia-docsearch-suggestion--title {
+    display: block;
+    padding: .25rem 1rem !important;
+    margin-bottom: 0 !important;
+    font-size: .875rem !important;
+    font-weight: 400 !important;
+  }
+
+  .algolia-docsearch-suggestion--text {
+    padding: 0 1rem .5rem !important;
+    margin-top: -.25rem;
+    font-size: .875rem !important;
+    font-weight: normal;
+    line-height: 1.25 !important;
+  }
+
+  .algolia-docsearch-footer {
+    float: none !important;
+    width: auto !important;
+    height: auto !important;
+    padding: .75rem 1rem 0;
+    font-size: .75rem !important;
+    line-height: 1 !important;
+    color: #767676 !important;
+    border-top: 1px solid rgba(0,0,0,.1);
+  }
+
+  .algolia-docsearch-footer--logo {
+    display: inline !important;
+    overflow: visible !important;
+    color: inherit !important;
+    text-indent: 0 !important;
+    background: none !important;
+  }
+
+  .algolia-docsearch-suggestion--highlight {
+    color: #5f2dab;
+    background-color: rgba(154, 132, 187, .12);
+  }
+
+  .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight {
+    box-shadow: inset 0 -2px 0 0 rgba(95,45,171,.5) !important;
+  }
+
+  .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content {
+    background-color: rgba(208,189,236,.15) !important;
+  }
+}
index 8a4e5dd72027c5880016d220f69cd34cf953ab05..8bf588ade867bc923ceb04c0fb44f553b072dc8c 100644 (file)
@@ -36,6 +36,7 @@
 @import "brand.less";
 @import "zero-clipboard.less";
 @import "anchor.less";
+@import "algolia.less";
 
 
 //
index 93932128b2e5a386a0d776299fe9faf8f95b5fd3..28ce22ff594d3d61d03f64d2c142ccc0f21c3821 100644 (file)
@@ -8,6 +8,10 @@
   }
 }
 
+.bs-docs-search {
+  margin-bottom: 20px;
+}
+
 // First level of nav
 .bs-docs-sidenav {
   margin-top: 20px;