]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Move inline JS outside of HTML. (#25140)
authorXhmikosR <xhmikosr@gmail.com>
Sun, 31 Dec 2017 00:11:59 +0000 (02:11 +0200)
committerGitHub <noreply@github.com>
Sun, 31 Dec 2017 00:11:59 +0000 (02:11 +0200)
_includes/scripts.html
assets/js/src/application.js
docs/4.0/examples/album/index.html

index 261ca9a17648823973291cee9fae7846c106daf6..ee598dcc4d5ca8bfed29c217168892275d156082 100644 (file)
@@ -9,6 +9,10 @@
   <script src="{{ site.baseurl }}/dist/js/bootstrap.js"></script>
 {%- endif -%}
 
+{%- if page.layout == "docs" -%}
+<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
+{%- endif -%}
+
 {%- if site.github -%}
   <script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
 {%- else -%}
   <script src="{{ site.baseurl }}/assets/js/src/ie-emulation-modes-warning.js"></script>
   <script src="{{ site.baseurl }}/assets/js/src/pwa.js"></script>
 {%- endif -%}
-
-{%- if page.layout == "docs" -%}
-<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
-<script>
-  docsearch({
-    apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
-    indexName: 'bootstrap-v4',
-    inputSelector: '#search-input',
-    handleSelected: function (input, event, suggestion) {
-      var url = suggestion.url;
-      url = suggestion.isLvl1 ? url.split('#')[0]: url;
-      // If it's a title we remove the anchor so it does not jump.
-      window.location.href = url;
-    },
-    transformData: function (hits) {
-      return hits.map(function (hit) {
-        hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '/docs/4.0');
-        return hit;
-      });
-    },
-    debug: false // Set debug to true if you want to inspect the dropdown
-  });
-</script>
-{%- endif -%}
-
-<script>
-  Holder.addTheme('gray', {
-    bg: '#777',
-    fg: 'rgba(255,255,255,.75)',
-    font: 'Helvetica',
-    fontweight: 'normal'
-  });
-</script>
index eb52848756674da6e62f8af044a4a9c13a34aceb..d5ee22ebc3f6450efe8bc699ba3b27d6419f43f5 100644 (file)
@@ -10,7 +10,7 @@
  * details, see https://creativecommons.org/licenses/by/3.0/.
  */
 
-/* global Clipboard, anchors */
+/* global Clipboard: false, anchors: false, Holder: false */
 
 (function ($) {
   'use strict'
     }
     anchors.add('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')
     $('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5').wrapInner('<div></div>')
+
+    // Search
+    if (window.docsearch) {
+      window.docsearch({
+        apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
+        indexName: 'bootstrap-v4',
+        inputSelector: '#search-input',
+        handleSelected: function (input, event, suggestion) {
+          var url = suggestion.url
+          url = suggestion.isLvl1 ? url.split('#')[0] : url
+          // If it's a title we remove the anchor so it does not jump.
+          window.location.href = url
+        },
+        transformData: function (hits) {
+          return hits.map(function (hit) {
+            hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '/docs/4.0')
+            return hit
+          })
+        },
+        debug: false // Set debug to true if you want to inspect the dropdown
+      })
+    }
+
+    // Holder
+    Holder.addTheme('gray', {
+      bg: '#777',
+      fg: 'rgba(255,255,255,.75)',
+      font: 'Helvetica',
+      fontweight: 'normal'
+    })
   })
 }(jQuery))
index de6ff5e8da401a1dd74dcc78089a4c1d58968134..6e5fc61731c5244f427758a3b30e3b3805b17469 100644 (file)
 
           <div class="row">
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
 
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
 
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
             <div class="card">
-              <img data-src="holder.js/100px280?theme=thumb" alt="Card image cap">
+              <img data-src="holder.js/100px280?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Card image cap">
               <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
             </div>
           </div>
     <script src="../../../../assets/js/vendor/popper.min.js"></script>
     <script src="../../../../dist/js/bootstrap.min.js"></script>
     <script src="../../../../assets/js/vendor/holder.min.js"></script>
-    <script>
-      Holder.addTheme('thumb', {
-        bg: '#55595c',
-        fg: '#eceeef',
-        text: 'Thumbnail'
-      });
-    </script>
   </body>
 </html>